當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。