1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 
<?php
namespace Omeka\Permissions\Assertion;

use Zend\Permissions\Acl\Acl;
use Zend\Permissions\Acl\Assertion\AssertionInterface;
use Zend\Permissions\Acl\Resource\ResourceInterface;
use Zend\Permissions\Acl\Role\RoleInterface;

/**
 * Simple wrapper that negates an existing assertion.
 */
class AssertionNegation implements AssertionInterface
{
    /**
     * @var AssertionInterface
     */
    protected $baseAssertion;

    public function __construct(AssertionInterface $baseAssertion)
    {
        $this->baseAssertion = $baseAssertion;
    }

    public function assert(Acl $acl, RoleInterface $role = null,
        ResourceInterface $resource = null, $privilege = null
    ) {
        return !$this->baseAssertion->assert($acl, $role, $resource, $privilege);
    }
}