Exemplo n.º 1
0
 /**
  * Extend node that located under $path in configuration with configuration that is located under $extendSourceNode
  *
  * @param string $path
  * @param string $extendSourceNode
  * @return array
  * @throws \InvalidArgumentException
  */
 protected function _extendNode($path, $extendSourceNode)
 {
     $currentNodeData = $this->_getDataByPath($path);
     if (in_array($path, $this->_extendedNodesList)) {
         return $currentNodeData;
     }
     $extendSourcePath = $this->_pathConverter->convert($path, $extendSourceNode);
     $data = $this->_getDataByPath($extendSourcePath);
     if (!$data) {
         throw new \InvalidArgumentException(sprintf('Invalid path in extends attribute of config/system/sections/%s node', $path));
     }
     if (isset($data['extends'])) {
         $data = $this->_extendNode($extendSourcePath, $data['extends']);
     }
     $resultingData = $this->_mergeData($data, $currentNodeData);
     $this->_replaceData($path, $resultingData);
     $this->_extendedNodesList[] = $path;
     return $resultingData;
 }
 /**
  * @dataProvider testConvertDataProvider
  * @param string $nodePath
  * @param string $relativePath
  * @param string $result
  */
 public function testConvert($nodePath, $relativePath, $result)
 {
     $this->assertEquals($result, $this->_sut->convert($nodePath, $relativePath));
 }
Exemplo n.º 3
0
 /**
  * Get depend path
  *
  * @param array $field
  * @param array $config
  * @return string[]
  * @throws \InvalidArgumentException
  */
 protected function _getDependPath($field, $config)
 {
     $dependPath = $field['id'];
     $elementPath = $config['path'] . '/' . $config['id'];
     return explode('/', $this->_pathConverter->convert($elementPath, $dependPath));
 }