Beispiel #1
0
 /**
  * @param AdviniAdapter $adapter
  * @param string $value
  *
  * @return void
  */
 public function processValue(AdviniAdapter $adapter, &$value)
 {
     while (false !== strpos($value, static::PROCESS_TOKEN)) {
         $adapter->matchValue($value, static::PROCESS_TOKEN, static::PROCESS_PATTERN);
     }
 }
Beispiel #2
0
 /**
  * @param AdviniAdapter $adapter
  * @param string $value
  *
  * @throws Exception
  * @return void
  */
 public function processValue(AdviniAdapter $adapter, &$value)
 {
     while (false !== strpos($value, self::PROCESS_TOKEN)) {
         // You cannot define these chars: $ { } ( )
         $matches = $adapter->matchNextValue($value, self::PROCESS_TOKEN, '( *[^<>]+ *)>>');
         $parts = explode(self::TOKEN_DEFAULT_VALUE, trim($matches[1]), 2);
         $key = $parts[0];
         if (true === isset($this->constants[$key])) {
             $value = str_replace($matches[0], $this->convert($adapter, $this->constants[$key]), $value);
         } elseif (true === isset($parts[1])) {
             $value = str_replace($matches[0], $this->convert($adapter, $parts[1]), $value);
             if (null === $value) {
                 $value = '';
             }
         } else {
             throw new Exception(sprintf('Cannot found constant <%s>', $key));
         }
     }
 }
Beispiel #3
0
 /**
  * @param AdviniAdapter $adapter
  * @param string $file
  *
  * @return array
  */
 protected function importFromFile(AdviniAdapter $adapter, $file)
 {
     $importFile = sprintf('%s/%s', $adapter->getCwd(), $file);
     return $adapter->getFromFile($importFile);
 }