Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
789 B
1
Indexable
<?php

declare(strict_types=1);

namespace App\Example;

use App\Example\Subnamespace\SomeOtherClass;
use ThirdParty\SomeLibrary;

class ExampleClass
{
    private const EXAMPLE_CONSTANT = 'example';

    private $exampleProperty;

    public function __construct(ExampleService $exampleService)
    {
        $this->exampleProperty = $exampleService;
    }

    public function exampleMethod(int $exampleParameter): void
    {
        $exampleLocalVariable = $this->exampleProperty->doSomething($exampleParameter);
        
        if ($exampleLocalVariable === self::EXAMPLE_CONSTANT) {
            $otherClass = new SomeOtherClass();
            $otherClass->callSomeMethod();
        } else {
            SomeLibrary::doSomethingElse();
        }
    }
}