Category.php

Go to the documentation of this file.
00001 <?php
00002 
00031 class Robo47_Log_Filter_Category extends Robo47_Log_Filter_ValidateProxy
00032 {
00033 
00039     public function __construct(array $categories = array(), $not = false)
00040     {
00041         parent::__construct(
00042             new Zend_Validate_InArray($categories),
00043             'category',
00044             $not
00045         );
00046     }
00047 
00053     public function getCategories()
00054     {
00055         return $this->_validator->getHaystack();
00056     }
00057 
00064     public function setCategories(array $categories = array())
00065     {
00066         $this->_validator->setHayStack($categories);
00067         return $this;
00068     }
00069 
00074     public function getOptions()
00075     {
00076         $options = parent::getOptions();
00077         $options['categories'] = $this->getCategories();
00078         return $options;
00079     }
00080 
00087     static public function factory($config)
00088     {
00089         $config = self::_parseConfig($config);
00090         $config = array_merge(
00091             array(
00092                 'categories' => array(),
00093                 'not' => false,
00094             ),
00095             $config
00096         );
00097 
00098         $filter = new Robo47_Log_Filter_Category(
00099             $config['categories'],
00100             $config['not']
00101         );
00102 
00103         return $filter;
00104     }
00105 }