JBZoo\Data\Data::set PHP Method

set() public method

Set a value in the data
public set ( string $name, mixed $value )
$name string The key used to set the value
$value mixed The value to set
    public function set($name, $value)
    {
        $this->offsetSet($name, $value);
        return $this;
    }

Usage Example

Esempio n. 1
0
File: Lang.php Progetto: jbzoo/lang
 /**
  * @param string $module
  * @param string $format
  * @return Data
  */
 protected function _listFactory($module, $format)
 {
     $key = $module . '.' . $format;
     if ($list = $this->_storage->get($key)) {
         return $list;
     }
     if ($module === self::DEFAULT_MODULE) {
         $path = $module . ':langs/' . $this->_code . '.' . $format;
     } else {
         $path = $module . ':langs/' . $this->_code . '.' . $module . '.' . $format;
     }
     $listPath = $this->_path->get($path);
     // @codeCoverageIgnoreStart
     if ('php' === $format) {
         $list = new PHPArray($listPath);
     } elseif ('json' === $format) {
         $list = new JSON($listPath);
     } elseif ('ini' === $format) {
         $list = new Ini($listPath);
     } elseif ('yml' === $format) {
         $list = new Yml($listPath);
     } else {
         $list = new Data([]);
     }
     // @codeCoverageIgnoreEnd
     $this->_storage->set($key, $list);
     return $list;
 }
All Usage Examples Of JBZoo\Data\Data::set