Example #1
0
File: Url.php Project: aubiplus/seo
 /**
  * @param String $string
  *
  * @return String
  * @author Fabian Köstring
  */
 private function convert(string $string)
 {
     if (!$this->config->offsetExists('chars')) {
         return $string;
     }
     $chars = $this->config->get('chars')->toArray();
     $from = array_keys($chars);
     $to = array_values($chars);
     return preg_replace($from, $to, $string);
 }
Example #2
0
 /**
  * Get list items from config
  *
  * @param    String        $configKey
  * @param    Boolean        $toLower
  * @param    Boolean        $trim
  * @param    String        $delimiter
  * @return    String[]
  */
 protected function getConfigList($configKey, $trim = true, $delimiter = ',')
 {
     $data = array();
     if ($this->config->offsetExists($configKey)) {
         $configValue = $this->config->get($configKey);
         $data = explode($delimiter, $configValue);
         if ($trim) {
             $data = array_map('trim', $data);
         }
     }
     return $data;
 }
Example #3
0
 /**
  * Set options
  *
  * @param Config $options Options
  */
 protected function setOptions(Config $options)
 {
     if ($options->offsetExists('name')) {
         $this->setName($options->get('name'));
     }
     if ($options->offsetExists('description')) {
         $this->setDescription($options->get('description'));
     }
     if ($options->offsetExists('fields')) {
         $this->setFields($options->get('fields'));
     }
 }