set/get path alias
@param array|string $path
@param string|null $value
@return bool|string
337979
public static function alias($path, $value = null)
    {
        // get path by alias
        if (\is_string($path) && !$value) {
            // don't use alias
            if ($path[0] !== '@') {
                return $path;
            }

            $sep = '/';
            $path = str_replace(['/', '\\'], $sep, $path);

            // only a alias. e.g. @project
            if (!strpos($path, $sep)) {
                return self::$aliases[$path] ?? $path;
            }

            // have other partial. e.g: @project/temp/logs
            $realPath = $path;
            list($alias, $other) = explode($sep, $path, 2);

            if (isset(self::$aliases[$alias])) {
                $realPath = self::$aliases[$alias] . $sep . $other;
            }

            return $realPath;
        }

        if ($path && $value && \is_string($path) && \is_string($value)) {
            $path = [$path => $value];
        }

        // custom set path's alias. e.g: Slim::alias([ 'alias' => 'path' ]);
        if (\is_array($path)) {
            /**
             * @var string $alias
             * @var string $realPath
             */
            foreach ($path as $alias => $realPath) {
                // 1th char must is '@'
                if ($alias[0] !== '@') {
                    continue;
                }

                self::$aliases[$alias] = self::alias($realPath);
            }
        }

        return true;
    }
507152
static function pathGet($values, $path, $default = NULL) {
        foreach ($path as $key) {
            if (!is_array($values) || !isset($values[$key])) {
                return $default;
            }
            $values = $values[$key];
        }
        return $values;
    }
1102254
public function set( $path, $value )
	{
		$parts = explode( '/', trim( $path, '/' ) );

		$config = $this->_config;
		$max = count( $parts ) - 1;

		for( $i = 0; $i < $max; $i++ )
		{
			$val = $config->get( $parts[$i] );

			if( $val instanceof Zend_Config ) {
				$config = $val;
			} else {
				$config = $config->{$parts[$i]} = new Zend_Config( array(), true );
			}
		}

		$config->{$parts[$max]} = $value;
	}
948878
public static function insert(array $set, $path, $value) {
        if (!$path) {
            return $set;
        }

        // Exit early for faster processing
        if (strpos($path, '.') === false) {
            $set[$path] = $value;

            return $set;
        }

        $search =& $set;
        $paths = explode('.', $path);
        $total = count($paths);

        while ($total > 0) {
            $key = $paths[0];

            // Within the last path
            if ($total === 1) {
                $search[$key] = $value;

            // Break out of non-existent paths early
            } else if (!array_key_exists($key, $search) || !is_array($search[$key])) {
                $search[$key] = array();
            }

            $search =& $search[$key];
            array_shift($paths);
            $total--;
        }

        unset($search);

        return $set;
    }
568977
public static function set($path,$key,$value=null) {

		$data = CoreManager::all($path);

		if(CoreManager::has($data,$key)) {

			Artisan::call('config:cache');

			$current_key_value = $key.'='.env($key);

			$value = str_replace(' ' , '_', $value);

			$new_key_value = $key.'='.$value;

			$result = file_put_contents($path, str_replace($current_key_value,$new_key_value,file_get_contents($path)));

			Artisan::call('config:cache');

			return true;
		
		}

		return false;
	
	}
779682
public function setField($path, $value) {
        if (is_string($path)) {
            if (strpos($path, '.') !== false && strpos($path, '/') === false) {
                trigger_error('Field selectors must be separated by "/" instead of "."', E_USER_DEPRECATED);
                $path = explode('.', $path);
            } else {
                $path = explode('/', $path);
            }
        }

        $selection = &$this->schema;
        foreach ($path as $i => $subSelector) {
            if (is_array($selection)) {
                if (!isset($selection[$subSelector])) {
                    $selection[$subSelector] = [];
                }
            } elseif ($selection instanceof Schema) {
                $selection->setField(array_slice($path, $i), $value);
                return $this;
            } else {
                $selection = [$subSelector => []];
            }
            $selection = &$selection[$subSelector];
        }

        $selection = $value;
        return $this;
    }
1368099
public function setValueByPath($path, $value)
    {
        if (is_string($path)) {
            $path = $this->parsePath($path);
        }

        $endPart = array_pop($path);
        $child = & $this->data;

        foreach ($path as $part) {
            if (isset($child[$part])) {
                $child = & $child[$part];
            } else {
                $child[$part] = [];
                $child = & $child[$part];
            }
        }

        $child[$endPart] = $value;
    }
318098
public static function setByPath(&$subject, array $path, $value)
    {
        $ptr = & $subject;
        foreach ($path as $key) {
            if (is_object($ptr)) {
                if (!isset($ptr->$key)) {
                    $ptr->$key = array();
                }
                $ptr = & $ptr->$key;
            } elseif (is_array($ptr)) {
                if (!isset($ptr[$key])) {
                    $ptr[$key] = array();
                }
                $ptr = & $ptr[$key];
            }
        }
        $ptr = $value;
        return $subject;
    }
738061
public function set($path, $value)
    {
        if (!empty($path)) {
            $at   = &$this->getValues();
            $keys = $this->explode($path);

            while (count($keys) > 0) {
                if (count($keys) === 1) {
                    if (is_array($at)) {
                        $at[array_shift($keys)] = $value;
                    } else {
                        throw new \RuntimeException("Can not set value at this path ($path) because is not array.");
                    }
                } else {
                    $key = array_shift($keys);
                    if (!isset($at[$key])) {
                        $at[$key] = [];
                    }
                    $at = &$at[$key];
                }
            }
        } else {
            $this->values = $value;
        }
    }
419018
public function set( $path, $value )
	{
		$path = trim( $path, '/' );

		$this->_getObject()->set( $path, $value );

		apc_store( $this->_prefix . $path, $value );
	}
922138
public static function path(&$array, $path = array(), $value = '>-null-<')
    {
        return $value !== '>-null-<'
            ? self::pathSet($array, $path, $value)
            : self::pathGet($array, $path);
    }
1261238
public function set($path, $value)
    {
        // if is readonly
        if ($this->readonly && $this->has($path)) {
            throw new \InvalidArgumentException("Config data have been setting readonly. don't allow change.");
        }

        return parent::set($path, $value);
    }
233556
public function set($path, $value)
    {
        // special case, root element.
        if ($path === '/') {
            $this->data = (array) $value;
            return $this;
        }

        $chunks = $this->splitPath($path);
        $scope  = &$this->data;
        $count  = count($chunks);

        while ($count > 1) {
            $sub   = array_shift($chunks);
            $count = count($chunks);

            if ((!(isset($scope[$sub]) && is_array($scope[$sub])))) {
                $scope[$sub] = [];
            }

            $scope = &$scope[$sub];
        }

        $sub = $chunks[0];

        if ($value === null) {
            unset($scope[$sub]);

            return $this;
        }

        $scope[$sub] = $value;

        return $this;
    }
1120481
public function set($path, $value)
  {
    $old = null;
    if ( $nodes = explode('.', $path) ){
      $node = $this->data;

      for($i=0, $n=count($nodes)-1; $i<$n; $i++){
        if ( !isset($node->{$nodes[$i]}) && ($i != $n) ){
          $node->{$nodes[$i]} = new \stdClass;
        }
        
        $node = $node->{$nodes[$i]};
      }
      
      if ( isset($node->{$nodes[$i]}) ){
        $old = $node->{$nodes[$i]};
      }
      $node->{$nodes[$i]} = $value;
    }
    return $old;
  }
674417
public function pathSet( $path, $value )
	{
		$path = $this->createPath($path);
		if( $path[0] == 1 )
		{
			$this->offsetSet($path[1], $value);
		}
		else
		{
			$array = & $this->items;
			for( $i = 1, $len = $path[0]; $i <= $len; $i++ )
			{
				$key = $path[$i];
				if( $i == $len )
				{
					$array[$key] = $value;
				}
				else
				{
					if( !isset($array[$key]) || !is_array($array[$key]) )
					{
						$array[$key] = [];
					}

					$array = & $array[$key];
				}
			}
		}
		return $this;
	}
107994
public function set($path, $value=null) {
		#to set multiple variables at once.
		if(is_array($path)) {
			foreach($path as $k=>$v)
				static::set($k, $v);
		}
		else
			ArrayUtils::set($_SESSION, $path, $value);
	}
1197702
private function getAssociationPathValue($value, array $path)
    {
        $mapping     = array_shift($path);
        $metadata    = $this->em->getClassMetadata($mapping['class']);
        $association = $metadata->getProperty($mapping['field']);
        $value       = $association->getValue($value);

        if ($value === null) {
            return null;
        }

        if (empty($path)) {
            return $value;
        }

        // Handle *-to-one associations
        if ($association instanceof ToOneAssociationMetadata) {
            return $this->getAssociationPathValue($value, $path);
        }

        $values = [];

        foreach ($value as $item) {
            $values[] = $this->getAssociationPathValue($item, $path);
        }

        return $values;
    }