Wait fork by names or all (without parameters)
@param string|string[]|null $names
@return array
971014
public function wait($names = null) {
        $namesArr = !isset($names) ? array_keys($this->pids) : (array) $names;
        foreach ($namesArr as $name) {
            if (!isset($this->pids[$name])) {
                continue;
            }
            pcntl_waitpid($this->pids[$name], $status);
            unset($this->pids[$name]);
        }
        $result = $this->Storage->get($this->key, $namesArr);
        $this->Storage->del($this->key, $namesArr);
        return is_string($names) ? $result[$names] : $result;
    }
817967
public function only($keys = [])
    {
        $keys = is_array($keys) ? $keys : func_get_args();

        $all = $this->all();

        $result = [];

        // now we will register keys to result variable,
        // each of variables must be exists, if they are not exists
        // null will be add to result
        foreach ($keys as $key) {
            $result[$key] = isset($all[$key]) ? $all[$key] : null;
        }

        return $result;

    }
296355
public function items(array $keys = null): array
    {
        if ($keys != null) {
            $return = [];
            foreach ($keys as $key) {
                $return[$key] = $this->get($key);
            }
        } else {
            $return = $this->data;
        }

        return $return;
    }
706875
public static function get(string $name, ...$params) {
        if (AppContainer::isAutoLoad()) return self::getAutoLoad($name, $params);

        $map = self::getInstance();
        if (!$map->containsKey($name)) {
            return null;
        }
        /** @var Node $node */
        $node = $map->getNodeByKey($name);
        if (null === $node) {
            return null;
        }
        return $node->getValue()($params);
    }
1043740
public static function sequenceNextVal($name)
    {
        $sql = null;

        switch (Driver::$name) {
        case "oracle":
            $sql = "select $name.nextval from dual";
            break;
        case "postgresql":
            $sql = "select nextval('$name') as nextval";
            break;
        }

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

        $stmt = self::executePrepared($sql);
        $data = $stmt->fetch(\PDO::FETCH_ASSOC);
        $rtn  = null;

        if (!$data) {
            return null;
        }

        $seq_keys = array("nextval", "NEXTVAL");
        foreach ($seq_keys as $seq_key) {
            if (array_key_exists($seq_key, $data)) {
                $rtn = $data[$seq_key];
                break;
            }
        }
        return $rtn;
    }
129117
public function get($name): ?Lock
    {
        if (isset($this->list[$name])) {
            return $this->list[$name];
        } else {
            return null;
        }
    }
406317
public static function nulls(array $data, $keys = null)
    {
        if ($keys === null) {
            $keys = array_keys($data);
        }

        if (!Arrays::isArray($keys)) {
            $keys = array($keys);
        }

        foreach ($keys as $key) {
            if (array_key_exists($key, $data) && empty($data[$key])) {
                $data[$key] = null;
            }
        }

        return $data;
    }
1058609
public function exclude(array $names)
    {
        $filtered = clone $this;
        foreach ($names as $name) {
            unset($filtered[$name]);
        }
        return $filtered;
    }
1160710
public function getHeaderValues($names) {
        if (is_string($names))
            $names = array($names);
        elseif (is_array($names)) {
            foreach ($names as $name)
                if (!is_string($name)) throw new IllegalTypeException('Illegal argument type in argument $names: '.gettype($name));
        }
        else                         throw new IllegalTypeException('Illegal type of parameter $names: '.gettype($names));

        $headers = $this->getHeaders($names);
        if ($headers)
            return \array_map('trim', explode(',', join(',', $headers)));

        return $headers; // empty array;
    }
315092
private static function queue(string $name = null) : Queue
    {
        list($container, $config, $return) = DI::detect(__METHOD__, 'queue', $name);

        if ($return) {
            return $return;
        }

        $db = new Queue($config);

        return DI::set(__METHOD__, $container, $db);
    }
713619
public static function getCodesByNames($names=array())
	{
		if (!($gdb = self::getGeoDBO()))
		{
			return array();
		}

		$names = array_map('strtolower', $names);
		foreach ($names as $k => $name)
		{
			$names[$k] = $gdb->quote($name);
		}

		$gdb->setQuery("SELECT DISTINCT name, code FROM countries WHERE LOWER(name) IN (" . implode(",", $names) . ")");
		$values = $gdb->loadAssocList('name');
		if (!is_array($values))
		{
			$values = array();
		}
		return $values;
	}
132199
public function setNames($names)
    {
        foreach ($this->columns as $key => $column) {
            Arr::set($names, $key, $column->getSingular());
        }

        return $names;
    }
548485
public function pending($name)
    {
        $length = $this->connection()->llen('commands:'.$name);

        if ($length < 1) {
            return [];
        }

        $results = $this->connection()->pipeline(function ($pipe) use ($name, $length) {
            $pipe->lrange('commands:'.$name, 0, $length - 1);

            $pipe->ltrim('commands:'.$name, $length, -1);
        });

        return collect($results[0])->map(function ($result) {
            return (object) json_decode($result, true);
        })->all();
    }
552058
protected function getParams($name = null)
    {
        $queues = !is_null($name) ? [$name] : $this->getQueues();
        $params = [
            config('queue.default'),
        ];
        if (empty($queues)) {
            return $params;
        }
        $queue = implode(',', $queues);
        if ($this->isCli()) {
            array_push($params, '--queue ' . $queue);
        } else {
            $params['--queue'] = $queue;
        }

        unset($queues);


        return $params;
    }
299158
public function getParams(array $keys = null)
    {
        $params = $this->params;

        if ($keys) {
            $subset = [];
            foreach ($keys as $key) {
                if (array_key_exists($key, $params)) {
                    $subset[$key] = $params[$key];
                }
            }
            return $subset;
        }

        return $params;
    }
1108662
public function children($name = null)
    {
        if (!$name) {
            return $this->getStructures();
        }

        $result = [];
        foreach ($this->getStructures() as $childStructure) {
            if ($childStructure->getParentName() === $name) {
                $result[] = $childStructure;
            } else {
                $localResult = $childStructure->children($name);
                if ($localResult) {
                    $result = array_merge($result, $localResult);
                }
            }
        }

        if (!count($result)) {
            return null;
        }

        return $result;
    }
886602
protected function callUntilNotNull($args=[])
    {
        foreach ($this->extensions() as $name) {
            $result = $this->callExtension($name, $args);

            if ($result !== null) {
                return $result;
            }
        }

        return null;
    }