public function get($condition = null): Router
    {
        if (!$condition) {
            return $this->getDefault();
        }

        // alias of getByName()
        if (\is_string($condition)) {
            return $this->getByName($condition);
        }

        $useName = self::DEFAULT_ROUTER;

        foreach ($this->conditions as $name => $cond) {
            if ($this->compareArray($cond, $condition)) {
                $useName = $name;
                break;
            }
        }

        return $this->getByName($useName);
    }
public function get($condition = null): Router
    {
        if (!$condition) {
            return $this->getDefault();
        }

        // alias of getByName()
        if (\is_string($condition)) {
            return $this->getByName($condition);
        }

        $useName = self::DEFAULT_ROUTER;

        foreach ($this->conditions as $name => $cond) {
            if ($this->compareArray($cond, $condition)) {
                $useName = $name;
                break;
            }
        }

        return $this->getByName($useName);
    }
public function get ( $ condition = null ) : Router { if ( ! $ condition ) { return $ this -> getDefault ( ) ; } // alias of getByName() if ( \ is_string ( $ condition ) ) { return $ this -> getByName ( $ condition ) ; } $ useName = self :: DEFAULT_ROUTER ; foreach ( $ this -> conditions as $ name => $ cond ) { if ( $ this -> compareArray ( $ cond , $ condition ) ) { $ useName = $ name ; break ; } } return $ this -> getByName ( $ useName ) ; }
get router by condition
@param array|string $condition
array:
[
'domain' => 'abc.com',
'scheme' => 'https',
]
string:
get by name. same of call getByName()
@return Router |RouterInterface
@throws \InvalidArgumentException
get router by condition