Public Member Functions | Static Public Member Functions | Protected Attributes

Robo47_Log_Filter_Category Class Reference

Inheritance diagram for Robo47_Log_Filter_Category:
Inheritance graph
[legend]
Collaboration diagram for Robo47_Log_Filter_Category:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 __construct (array $categories=array(), $not=false)
 accept ($event)
 getCategories ()
 Get Categories.
 getKey ()
 Get Key.
 getNot ()
 Get Not.
 getOptions ()
 getValidator ()
 Get Validator.
 setCategories (array $categories=array())
 Set Categories.
 setKey ($key=null)
 Set Key.
 setNot ($not)
 Set Not.
 setValidator ($validator)
 Set Validator.

Static Public Member Functions

static factory ($config)
 Construct a Zend_Log driver.

Protected Attributes

 $_key = null
 $_not = false
 $_validator = null

Detailed Description

Definition at line 31 of file Category.php.


Constructor & Destructor Documentation

Robo47_Log_Filter_Category::__construct ( array $  categories = array(),
not = false 
)
Parameters:
array $categories
boolean $not

Definition at line 39 of file Category.php.

    {
        parent::__construct(
            new Zend_Validate_InArray($categories),
            'category',
            $not
        );
    }


Member Function Documentation

Robo47_Log_Filter_ValidateProxy::accept ( event  )  [inherited]
Parameters:
array $event
Returns:
bool

Definition at line 155 of file ValidateProxy.php.

    {
        if (null === $this->_key) {
            $validationData = $event;
        } elseif (isset($event[$this->_key])) {
            $validationData = $event[$this->_key];
        } else {
            $message = 'key "' . $this->_key . '" not found in event';
            throw new Robo47_Log_Filter_Exception($message);
        }

        if (true === $this->_not) {
            return !$this->_validator->isValid($validationData);
        } else {
            return $this->_validator->isValid($validationData);
        }
    }

static Robo47_Log_Filter_Category::factory ( config  )  [static]

Construct a Zend_Log driver.

Parameters:
array|Zend_Config $config
Returns:
Robo47_Log_Filter_Category

Reimplemented from Robo47_Log_Filter_ValidateProxy.

Definition at line 87 of file Category.php.

    {
        $config = self::_parseConfig($config);
        $config = array_merge(
            array(
                'categories' => array(),
                'not' => false,
            ),
            $config
        );

        $filter = new Robo47_Log_Filter_Category(
            $config['categories'],
            $config['not']
        );

        return $filter;
    }

Robo47_Log_Filter_Category::getCategories (  ) 

Get Categories.

Returns:
array

Definition at line 53 of file Category.php.

Referenced by getOptions().

    {
        return $this->_validator->getHaystack();
    }

Here is the caller graph for this function:

Robo47_Log_Filter_ValidateProxy::getKey (  )  [inherited]

Get Key.

Returns:
string|null

Definition at line 87 of file ValidateProxy.php.

Referenced by Robo47_Log_Filter_ValidateProxy::getOptions().

    {
        return $this->_key;
    }

Here is the caller graph for this function:

Robo47_Log_Filter_ValidateProxy::getNot (  )  [inherited]

Get Not.

Returns:
bool

Definition at line 77 of file ValidateProxy.php.

Referenced by Robo47_Log_Filter_ValidateProxy::getOptions().

    {
        return $this->_not;
    }

Here is the caller graph for this function:

Robo47_Log_Filter_Category::getOptions (  ) 
Returns:
array

Reimplemented from Robo47_Log_Filter_ValidateProxy.

Definition at line 74 of file Category.php.

References getCategories().

    {
        $options = parent::getOptions();
        $options['categories'] = $this->getCategories();
        return $options;
    }

Here is the call graph for this function:

Robo47_Log_Filter_ValidateProxy::getValidator (  )  [inherited]

Get Validator.

Returns:
Zend_Validate_Interface

Definition at line 68 of file ValidateProxy.php.

Referenced by Robo47_Log_Filter_ValidateProxy::getOptions().

    {
        return $this->_validator;
    }

Here is the caller graph for this function:

Robo47_Log_Filter_Category::setCategories ( array $  categories = array()  ) 

Set Categories.

Parameters:
array $categories
Returns:
Robo47_Log_Filter_Category *Provides Fluent Interface*

Definition at line 64 of file Category.php.

    {
        $this->_validator->setHayStack($categories);
        return $this;
    }

Robo47_Log_Filter_ValidateProxy::setKey ( key = null  )  [inherited]

Set Key.

Parameters:
string|null $key
Returns:
Robo47_Log_Filter_ValidateProxy *Provides Fluent Interface*

Definition at line 111 of file ValidateProxy.php.

Referenced by Robo47_Log_Filter_ValidateProxy::__construct().

    {
        $this->_key = $key;
        return $this;
    }

Here is the caller graph for this function:

Robo47_Log_Filter_ValidateProxy::setNot ( not  )  [inherited]

Set Not.

Parameters:
bool $not
Returns:
Robo47_Log_Filter_ValidateProxy *Provides Fluent Interface*

Definition at line 98 of file ValidateProxy.php.

Referenced by Robo47_Log_Filter_ValidateProxy::__construct().

    {
        $not = (bool) $not;
        $this->_not = $not;
        return $this;
    }

Here is the caller graph for this function:

Robo47_Log_Filter_ValidateProxy::setValidator ( validator  )  [inherited]

Set Validator.

Parameters:
Zend_Validate_Interface|string $validator
Returns:
Robo47_Log_Filter_ValidateProxy *Provides Fluent Interface*

Definition at line 123 of file ValidateProxy.php.

Referenced by Robo47_Log_Filter_ValidateProxy::__construct().

    {
        if (is_string($validator)) {
            $validator = new $validator;
        }
        if (!$validator instanceof Zend_Validate_Interface) {
            $message = 'Validator is not instance of Zend_Validate_Interface';
            throw new Robo47_Log_Filter_Exception($message);
        }
        $this->_validator = $validator;
        return $this;
    }

Here is the caller graph for this function:


Member Data Documentation

Robo47_Log_Filter_ValidateProxy::$_key = null [protected, inherited]

Definition at line 43 of file ValidateProxy.php.

Robo47_Log_Filter_ValidateProxy::$_not = false [protected, inherited]

Definition at line 48 of file ValidateProxy.php.

Robo47_Log_Filter_ValidateProxy::$_validator = null [protected, inherited]

Definition at line 38 of file ValidateProxy.php.


The documentation for this class was generated from the following file: