Find nested array inside two-dimensional array

TODO: Not work with objects

@param   array|object $multi where need to make search
@param   array $target what we want to find
@return  bool|array
961597
public static function searchMd($multi, $target)
    {
        if (empty($target) || empty($multi)) {
            return false;
        }

        $output = \is_object($multi)
            ? self::searchMdObject($multi, $target)
            : self::searchMdArray($multi, $target);

        $output = array_values(array_filter($output));

        // If output is not empty, false by default
        return !empty($output) ? $output : false;
    }
120187
public function get_shared_object( $key, $target = null ) {
		! isset( $target ) and $target = $this->app->plugin_name;

		return isset( self::$_shared_object[ $target ][ $key ] ) ? self::$_shared_object[ $target ][ $key ] : null;
	}
732173
public static function searchKey($array, $needle)
    {
        $return = false;
        if (!\is_array($array)) {
            $array = array();
        }
        $arrayKeys = array();
        foreach ($array as $k => $v) {
            if ($k == $needle) {
                $return = $v;
                break;
            }
            if (\is_array($v)) {
                // don't search deeper levels until finished with this level
                $arrayKeys[] = $k;
            }
        }
        if ($return === false) {
            foreach ($arrayKeys as $k) {
                $result = self::searchKey($array[$k], $needle);
                if ($result !== false) {
                    $return = $result;
                    break;
                }
            }
        }
        return $return;
    }
399035
public function targetSerialize($target = self::SER_DEFAULT, $params = null)
    {
        return $this->format($this->format);
    }
8500
public function get($target = null)
    {
        $options = ['key' => $this->apiKey];

        if (null !== $target) {
            $this->url = sprintf('%s&target={target}', $this->url);

            $options['target'] = $target;
        }

        return $this->process($options);
    }
315146
protected static function get($target, $key, $default = null)
    {
        if (is_null($key)) {
            return $target;
        }

        $key = is_array($key) ? $key : explode('.', $key);

        while (($segment = array_shift($key)) !== null) {
            if ($segment === '*') {
                if (! is_array($target)) {
                    return $default instanceof Closure ? $default() : $default;
                }

                $result = static::pluck($target, $key);

                return in_array('*', $key) ? static::collapse($result) : $result;
            }

            if (is_array($target) && array_key_exists($segment, $target)) {
                $target = $target[$segment];
            } elseif (is_object($target) && isset($target->{$segment})) {
                $target = $target->{$segment};
            } else {
                return $default instanceof Closure ? $default() : $default;
            }
        }

        return $target;
    }
785250
public static function get(string $target)
    {
        if (!self::has($target)) {
            return null;
        }

        if (!isset(self::$unserialized[$target])) {
            self::$unserialized[$target] = unserialize(self::$annotations[$target]);
        }

        return self::$unserialized[$target];
    }
348956
public static function get($name = null, $target = '')
    {
        if (!func_num_args()) {
            return static::$_matchers;
        }
        if ($target === true) {
            return isset(static::$_matchers[$name]) ? static::$_matchers[$name] : [];
        }
        if ($target === '') {
            if (isset(static::$_matchers[$name][''])) {
                return static::$_matchers[$name][''];
            }
            throw new Exception("Unexisting default matcher attached to `'{$name}'`.");
        }
        if (isset(static::$_matchers[$name][$target])) {
            return static::$_matchers[$name][$target];
        } elseif (isset(static::$_matchers[$name][''])) {
            return static::$_matchers[$name][''];
        }
        throw new Exception("Unexisting matcher attached to `'{$name}'` for `{$target}`.");
    }
38126
public function hasKey($target)
    {
        foreach ($this->collection as $group => $hashMap) {
            if (array_key_exists($target, $hashMap)) {
                return true;
            }
        }

        // By default
        return false;
    }
942547
protected function findOneByMetaSetAndTarget(MetaSetInterface $metaSet, $target)
    {
        $metaDatas = $this->findByMetaSetAndTarget($metaSet, $target);

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

        return current($metaDatas);
    }
308360
public function has($target, $language)
    {
        $key = $target->getId().'_'.$language;

        return isset($this->items[$key]);
    }
647776
private function tryToEncodeTargetsAsSwitch(array $targets): ?array
    {
        $result = count($targets) > 1;

        $contextKey  = null;
        $valueRuleIdMap = [];

        foreach ($targets as $ruleId => $nullableTarget) {
            if ($result === true &&
                $nullableTarget !== null &&
                count($allOfs = $nullableTarget->getAnyOf()->getAllOfs()) === 1 &&
                count($pairs = reset($allOfs)->getPairs()) === 1
            ) {
                $value = reset($pairs);
                $key   = key($pairs);
                assert($key !== null);
                if ($contextKey === null) {
                    $contextKey = $key;
                }
                if ($key !== $contextKey) {
                    $result = false;
                    break;
                }
                $valueRuleIdMap[$value] = $ruleId;
            } else {
                $result = false;
                break;
            }
        }

        $result = $result === true && count($valueRuleIdMap) === count($targets);

        // if result === true we know the following
        // - we have more than one target
        // - every target is a really one key, value pair
        // - in every such pair key is identical and every value is unique
        //
        // if so
        // $contextKey - will have that identical key and $valueRuleIdMap will be an array of [unique_value => true]
        // so later we can check if target matched by simply taking value from context by $contextKey and
        // checking that value in $valueRuleIdMap (key existence).

        return $result === true ? [$contextKey, $valueRuleIdMap] : null;
    }
679391
public function find($key, $rules = [])
    {
        if (Utils\Helper::arrGet($rules, 'multiple')) {
            // check for multiple case i.e. Y-m-d.
            return Utils\HelperMultiple::prepare($key, $this->source, $rules['multiple']);
        }
        $value = Helper::arrGet($this->source, $key);
        if (is_array($value)) {
            return Utils\Helper::arrGet($rules, 'array')
                ? $value
                : '';
        }

        return (string) $value;
    }
626938
protected function findByMetaSetAndTarget(MetaSetInterface $metaSet, $target = null)
    {
        $metaDatas = array();

        foreach ($this->findMetaDataValues($metaSet, $target) as $metaDataValue) {
            $identifier = $metaDataValue->getSetId();

            if (!isset($metaDatas[$identifier])) {
                $metaData = new MetaData($metaSet);
                $metaDatas[$identifier] = $metaData;
            } else {
                $metaData = $metaDatas[$identifier];
            }

            $field = $metaSet->getFieldById($metaDataValue->getFieldId());

            if (!$field) {
                $this->logger->error(sprintf("MetaSet with id %s doesn't exist", $metaDataValue->getFieldId()));
                continue;
            }

            $metaData->set($field->getName(), $metaDataValue->getValue(), $metaDataValue->getLanguage());
        }

        return $metaDatas;
    }
704124
protected function getTarget($target, array $segments)
    {
        foreach ($segments as $segment) {
            if (!$target) {
                return;
            }

            $target = $target->{$segment};
        }

        return $target;
    }
1017293
public static function exists($name, $target = '')
    {
        if ($target === true) {
            return isset(static::$_matchers[$name]);
        }
        return isset(static::$_matchers[$name][$target]);
    }
1263668
public function find( $key, $disableLateLoading = null, $cache = true )
    {

        // $disableLateLoading default value management
        if( !is_bool( $disableLateLoading ) ) {
            $disableLateLoading = false;
        }

        // have we switched off the multiton?
        if( !$cache ) {
            return parent::find( $key, $disableLateLoading );
        }

        // determine the multitonKey
        if( is_null( $key ) ) {
            return null;
        } elseif( is_scalar( $key ) ) {
            $multitonKey = $key;
        } elseif( is_array( $key ) ) {
            $multitonKey = call_user_func( "{$this->entityClass}::keyGet", $key );
        } else {
            return null;
        }

        // do we have this?
        if( !isset( $this->instancesPersisted[$multitonKey] ) ) {

            $obj = parent::find( $key, $disableLateLoading );

            // not got anything?
            if( !$obj ) {
                return null;
            }

            $this->garbageCollect();
            $this->instancesPersisted[$multitonKey] = $obj;

        // disable late loading
        } elseif( $disableLateLoading ) {

            $this->instancesPersisted[$multitonKey]->load();

        }

        return $this->instancesPersisted[$multitonKey];

    }