for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ZfcUser\InputFilter;
use Zend\InputFilter\InputFilter;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\EventManager;
class ProvidesEventsInputFilter extends InputFilter
{
/**
* @var EventManagerInterface
*/
protected $events;
* Set the event manager instance used by this context
*
* @param EventManagerInterface $events
* @return mixed
public function setEventManager(EventManagerInterface $events)
$this->events = $events;
return $this;
}
* Retrieve the event manager
* Lazy-loads an EventManager instance if none registered.
* @return EventManagerInterface
public function getEventManager()
if (!$this->events instanceof EventManagerInterface) {
$identifiers = array(__CLASS__, get_called_class());
if (isset($this->eventIdentifier)) {
if ((is_string($this->eventIdentifier))
|| (is_array($this->eventIdentifier))
|| ($this->eventIdentifier instanceof \Traversable)
) {
$identifiers = array_unique($identifiers + (array) $this->eventIdentifier);
} elseif (is_object($this->eventIdentifier)) {
eventIdentifier
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$identifiers[] = $this->eventIdentifier;
// silently ignore invalid eventIdentifier types
$this->setEventManager(new EventManager(null, $identifiers));
return $this->events;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: