当前位置: 首页>>代码示例>>PHP>>正文


PHP Config::setReadOnly方法代码示例

本文整理汇总了PHP中Zend\Config\Config::setReadOnly方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::setReadOnly方法的具体用法?PHP Config::setReadOnly怎么用?PHP Config::setReadOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Config\Config的用法示例。


在下文中一共展示了Config::setReadOnly方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLayoutStructure

 /**
  *
  * @return Config
  */
 public function getLayoutStructure()
 {
     if (null === $this->layoutStructure) {
         $this->layoutStructure = new Config([], true);
         $handles = $this->getHandles();
         $event = new UpdateEvent();
         $event->setLayoutStructure($this->layoutStructure);
         $event->setHandles($handles);
         $event->setArea($this->getArea());
         $event->setName(UpdateEvent::EVENT_COLLECT);
         $event->setTarget($this);
         $results = $this->getEventManager()->triggerEventUntil(function ($result) {
             return $result instanceof Config;
         }, $event);
         if ($results->stopped()) {
             $this->layoutStructure = $results->last();
         } else {
             $this->fetchUpdates();
             $event->setName(UpdateEvent::EVENT_COLLECT_POST);
             $this->getEventManager()->triggerEvent($event);
         }
         $this->layoutStructure->setReadOnly();
     }
     return $this->layoutStructure;
 }
开发者ID:hummer2k,项目名称:conlayout,代码行数:29,代码来源:LayoutUpdater.php

示例2: getMergedConfig

 /**
  * getMergedConfig
  * Build a merged config object for all loaded modules
  * 
  * @return Zend\Config\Config
  */
 public function getMergedConfig($readOnly = true)
 {
     if (null === $this->mergedConfig) {
         $this->setMergedConfig(new Config(array(), true));
     }
     if (true === $readOnly) {
         $this->mergedConfig->setReadOnly();
     }
     return $this->mergedConfig;
 }
开发者ID:rickogden,项目名称:zf2,代码行数:16,代码来源:Manager.php

示例3: getLayoutStructure

 /**
  *
  * @return Config
  */
 public function getLayoutStructure()
 {
     if (null === $this->layoutStructure) {
         $this->layoutStructure = new Config([], true);
         $handles = $this->getHandles();
         $event = new UpdateEvent();
         $event->setLayoutStructure($this->layoutStructure);
         $event->setHandles($handles);
         $event->setArea($this->getArea());
         $results = $this->getEventManager()->trigger(__FUNCTION__ . '.pre', $this, $event, function ($result) {
             return $result instanceof Config;
         });
         if ($results->stopped()) {
             $this->layoutStructure = $results->last();
         } else {
             $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, $event);
         }
         $this->layoutStructure->setReadOnly();
     }
     return $this->layoutStructure;
 }
开发者ID:adamdyson,项目名称:ConLayout,代码行数:25,代码来源:LayoutUpdater.php

示例4: testSetReadOnlyAppliesToChildren

 /**
  * @group ZF-4728
  *
  */
 public function testSetReadOnlyAppliesToChildren()
 {
     $config = new Config($this->all, true);
     $config->setReadOnly();
     $this->assertTrue($config->isReadOnly());
     $this->assertTrue($config->one->isReadOnly(), 'First level children are writable');
     $this->assertTrue($config->one->two->isReadOnly(), 'Second level children are writable');
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:12,代码来源:ConfigTest.php

示例5: validateFields

 /**
  * Validate fields and their data
  *
  * @param Config $fields Fields
  * @return Config Validated fields
  * @throws Exception
  */
 protected function validateFields(Config $fields) : Config
 {
     $valid_field_attributes = ['name', 'required', 'form', 'multivalue'];
     /** @var Config $field */
     foreach ($fields as $field) {
         if (!$field->offsetExists('name')) {
             throw new Exception("Name is mandatory attribute for a field!");
         }
         foreach ($field as $attribute => $value) {
             if (!in_array($attribute, $valid_field_attributes)) {
                 throw new Exception(sprintf("Field base attribute %s is not valid!", $attribute));
             }
             switch ($attribute) {
                 case 'required':
                     $field->offsetSet($attribute, (int) $value);
                     if ($value !== 1) {
                         throw new Exception(sprintf("Only valid values for required is 1, value of '%s' (%s) was given.", $value, gettype($value)));
                     }
                     break;
             }
             // TODO check if attribute has a validator?
         }
     }
     $fields->setReadOnly();
     return $fields;
 }
开发者ID:back-2-95,项目名称:fields,代码行数:33,代码来源:EntityConfiguration.php


注:本文中的Zend\Config\Config::setReadOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。