php Zend-Registry类(方法)实例源码

下面列出了php Zend-Registry 类(方法)源码代码实例,从而了解它的用法。

作者:niallmccrudde    项目:zf   
/**
     * Constructor for the integer validator
     *
     * Accepts either a string locale, a Zend_Locale object, or an array or
     * Zend_Config object containing the keys "locale" and/or "format".
     *
     * @param string|Zend_Locale|array|\Zend\Config\Config $options
     * @throws \Zend\Validator\Exception On empty format
     */
    public function __construct($options = null)
    {
        if ($options instanceof \Zend\Config\Config) {
            $options = $options->toArray();
        }

        if (empty($options)) {
            if (\Zend\Registry::isRegistered('Zend_Locale')) {
                $this->setLocale(\Zend\Registry::get('Zend_Locale'));
            }
        } elseif (is_array($options)) {
            // Received
            if (array_key_exists('locale', $options)) {
                $this->setLocale($options['locale']);
            }

            if (array_key_exists('format', $options)) {
                $this->setFormat($options['format']);
            }
        } elseif ($options instanceof Locale\Locale || is_string($options)) {
            // Received Locale object or string locale
            $this->setLocale($options);
        }

        $format = $this->getFormat();
        if (empty($format)) {
            throw new Exception\InvalidArgumentException("A postcode-format string has to be given for validation");
        }
    }

作者:navti    项目:xerxes-pazpar   
public function setUp()
 {
     $this->forceAutoloader();
     $this->error = false;
     $this->manager = new SessionManager();
     Registry::_unsetInstance();
 }

作者:rafalwrzeszc    项目:zf   
/**
  * Sets validator options
  *
  * @param  null|string|Locale|array|Traversable $locale OPTIONAL
  * @return void
  */
 public function __construct($locale = null)
 {
     $options = array();
     if ($locale instanceof Traversable) {
         $locale = IteratorToArray::convert($locale);
     }
     if (is_array($locale)) {
         $options = $locale;
         if (array_key_exists('locale', $locale)) {
             $locale = $locale['locale'];
             unset($options['locale']);
         } else {
             $locale = null;
         }
     }
     if (empty($locale) && $locale !== false) {
         if (Registry::isRegistered('Zend_Locale')) {
             $locale = Registry::get('Zend_Locale');
         }
     }
     if ($locale !== null) {
         $this->setLocale($locale);
     }
     parent::__construct($options);
 }

作者:noos    项目:zf   
/**
     * Sets up the fixture, for example, open a network connection.
     * This method is called before a test is executed.
     *
     * @return void
     */
    public function setUp()
    {
        Registry::_unsetInstance();
        DojoHelper::setUseDeclarative();

        $this->view   = $this->getView();
    }

作者:rafalwrzeszc    项目:zf   
/**
  * Sets validator options
  *
  * @param  string|array|Traversable $options OPTIONAL
  * @return void
  */
 public function __construct($options = array())
 {
     if ($options instanceof Traversable) {
         $options = IteratorToArray::convert($options);
     } elseif (!is_array($options)) {
         $options = func_get_args();
         $temp['format'] = array_shift($options);
         if (!empty($options)) {
             $temp['locale'] = array_shift($options);
         }
         $options = $temp;
     }
     if (array_key_exists('format', $options)) {
         $this->setFormat($options['format']);
     }
     if (!array_key_exists('locale', $options)) {
         if (Registry::isRegistered('Zend_Locale')) {
             $options['locale'] = Registry::get('Zend_Locale');
         }
     }
     if (array_key_exists('locale', $options)) {
         $this->setLocale($options['locale']);
     }
     parent::__construct($options);
 }

作者:rmarshall-quibid    项目:zf   
/**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 public function setUp()
 {
     Registry::_unsetInstance();
     DojoHelper::setUseDeclarative();
     $this->view = $this->getView();
     $this->helper = new TextareaHelper();
     $this->helper->setView($this->view);
 }

作者:alab100110    项目:zf   
/**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 public function setUp()
 {
     Registry::_unsetInstance();
     DojoHelper::setUseDeclarative();
     $this->view = $this->getView();
     $this->helper = new AccordionContainerHelper();
     $this->helper->setView($this->view);
 }

作者:RomanShumko    项目:zf   
/**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 public function setUp()
 {
     $registry = Registry::getInstance();
     if (isset($registry['Zend\\Dojo\\View\\Helper\\Dojo'])) {
         unset($registry['Zend\\Dojo\\View\\Helper\\Dojo']);
     }
     $this->view = new View\PhpRenderer();
     \Zend\Dojo\Dojo::enableView($this->view);
 }

作者:rexma    项目:zf   
/**
  * Constructor for manually handling
  *
  * @param  \Zend\Currency\Currency $currency Instance of \Zend\Currency\Currency
  * @return void
  */
 public function __construct($currency = null)
 {
     if ($currency === null) {
         if (\Zend\Registry::isRegistered('Zend_Currency')) {
             $currency = \Zend\Registry::get('Zend_Currency');
         }
     }
     $this->setCurrency($currency);
 }

作者:noos    项目:zf   
/**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 public function setUp()
 {
     Registry::_unsetInstance();
     $this->view   = $this->getView();
     $this->helper = new DojoContainer();
     $this->helper->setView($this->view);
     Registry::set('Zend\Dojo\View\Helper\Dojo', $this->helper);
     DojoHelper::setUseProgrammatic();
 }

作者:alab100110    项目:zf   
public function setup()
 {
     Reader\Reader::reset();
     if (\Zend\Registry::isRegistered('Zend_Locale')) {
         $registry = \Zend\Registry::getInstance();
         unset($registry['Zend_Locale']);
     }
     $this->_feedSamplePath = dirname(__FILE__) . '/_files/Common';
 }

作者:alab100110    项目:zf   
public function testMultiplePlaceholdersUseSameRegistry()
 {
     $this->assertTrue(Registry::isRegistered(PlaceholderRegistry::REGISTRY_KEY));
     $registry = Registry::get(PlaceholderRegistry::REGISTRY_KEY);
     $this->assertSame($registry, $this->placeholder->getRegistry());
     $placeholder = new Helper\Placeholder();
     $this->assertSame($registry, $placeholder->getRegistry());
     $this->assertSame($this->placeholder->getRegistry(), $placeholder->getRegistry());
 }

作者:alab100110    项目:zf   
/**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 public function setUp()
 {
     Registry::_unsetInstance();
     DojoHelper::setUseDeclarative();
     $this->view = $this->getView();
     $this->decorator = new TabContainerDecorator();
     $this->element = $this->getElement();
     $this->element->setView($this->view);
     $this->decorator->setElement($this->element);
 }

作者:alab100110    项目:zf   
/**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     if (\Zend\Registry::isRegistered('Zend_View_Helper_Doctype')) {
         $registry = \Zend\Registry::getInstance();
         unset($registry['Zend_View_Helper_Doctype']);
     }
     $this->view = new \Zend\View\PhpRenderer();
     $this->helper = new \Zend\View\Helper\FormFile();
     $this->helper->setView($this->view);
 }

作者:alab100110    项目:zf   
public function setUp()
 {
     if (Registry::isRegistered('Zend_Locale')) {
         $registry = Registry::getInstance();
         unset($registry['Zend_Locale']);
     }
     Cldr::removeCache();
     $this->_locale = setlocale(LC_ALL, 0);
     setlocale(LC_ALL, 'de');
 }

作者:rikai    项目:zf   
/**
  * Constructor
  *
  * Map constants to doctype strings, and set default doctype
  */
 public function __construct()
 {
     if (!Registry::isRegistered($this->_regKey)) {
         $this->_registry = new ArrayObject(array('doctypes' => array(self::XHTML11 => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', self::XHTML1_RDFA1 => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">', self::XHTML1_STRICT => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', self::XHTML1_TRANSITIONAL => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', self::XHTML1_FRAMESET => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">', self::XHTML_BASIC1 => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">', self::XHTML5 => '<!DOCTYPE html>', self::HTML4_STRICT => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', self::HTML4_LOOSE => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">', self::HTML4_FRAMESET => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">', self::HTML5 => '<!DOCTYPE html>')));
         Registry::set($this->_regKey, $this->_registry);
         $this->setDoctype($this->_defaultDoctype);
     } else {
         $this->_registry = Registry::get($this->_regKey);
     }
 }

作者:stunt    项目:zf   
/**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 public function setUp()
 {
     $regKey = Registry\Registry::REGISTRY_KEY;
     if (\Zend\Registry::isRegistered($regKey)) {
         $registry = \Zend\Registry::getInstance();
         unset($registry[$regKey]);
     }
     $this->basePath = dirname(__FILE__) . '/_files/modules';
     $this->helper = new Helper\InlineScript();
 }

作者:rafalwrzeszc    项目:zf   
public function setUp()
 {
     Registry::_unsetInstance();
     Form::setDefaultTranslator(null);
     if (isset($this->error)) {
         unset($this->error);
     }
     $this->loader = new PluginLoader(array('Zend\\Form\\Decorator' => 'Zend/Form/Decorator'));
     $this->group = new DisplayGroup('test', $this->loader);
 }

作者:navti    项目:xerxes-pazpar   
/**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 public function setUp()
 {
     if (Registry::isRegistered('Zend_View_Helper_Doctype')) {
         $registry = Registry::getInstance();
         unset($registry['Zend_View_Helper_Doctype']);
     }
     $this->view = new View();
     $this->helper = new FormMultiCheckbox();
     $this->helper->setView($this->view);
 }

作者:navti    项目:xerxes-pazpar   
/**
  * Sets up the fixture, for example, open a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     if (Registry::isRegistered('Zend_View_Helper_Doctype')) {
         $registry = Registry::getInstance();
         unset($registry['Zend_View_Helper_Doctype']);
     }
     $this->view = new View();
     $this->helper = new FormTextHelper();
     $this->helper->setView($this->view);
 }


问题


面经


文章

微信
公众号

扫码关注公众号