for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace CultuurNet\UDB3\Security;
use CultuurNet\UDB3\Offer\Commands\AuthorizableCommandInterface;
use ValueObjects\StringLiteral\StringLiteral;
class ClassNameCommandFilter implements CommandFilterInterface
{
private $classNames;
/**
* ClassNameCommandFilter constructor.
* @param StringLiteral[] $classNames
*/
public function __construct(StringLiteral ...$classNames)
$this->classNames = $classNames;
}
* @inheritdoc
public function matches(AuthorizableCommandInterface $command)
foreach ($this->classNames as $className) {
if (get_class($command) === $className->toNative()) {
toNative
$className
array<integer,object<Val...Literal\StringLiteral>>
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.
return true;
return false;
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.