Returns registered matchers.

@param  string $name   The name of the matcher.
@param  string $target An optionnal target class name.

@return array          The registered matchers or a fully-namespaced class name if $name is not null.
@throws Exception
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}`.");
    }
46755
public static function match($methods = [], $path, $name, $namespaceOrController) {
        $item = new ConfigurationItem($path, $name, $methods, $namespaceOrController);
        self::$configuration[] = $item;
        return $item;
    }
586959
protected function fixMatches(
        /*# string */ $name,
        array $matches
    )/*# : array */ {
        $res = [];
        $map = $this->maps[$name];
        foreach ($matches as $idx => $val) {
            if ($idx > 0 && '' !== $val) {
                $res[$map[$idx - 1]] = $val;
            }
        }

        // debug
        $this->debug(Message::get(
            Message::DEBUG_MATCH_REGEX,
            $this->regex[$name]
        ));

        return [ $name, $res ];
    }
1073227
public function get(string $name): array
    {
        if (isset($this->compiled[$name])) {
            $config = $this->compiled[$name];
        } else {
            $this->compiled[$name] = $this->createServiceConfig($name);
            $config = $this->compiled[$name];
        }

        if (!isset($config['use'])) {
            $config['use'] = $name;
        }

        return $config;
    }
205892
protected function extractComponentBuilder($name) {
		$componentBuilder = $this->components[$name];

		if (!$componentBuilder) {
			return [$name, false];
		}

		return [$componentBuilder['builder'], $componentBuilder['singleton']];
	}
647330
public function findByName($name)
    {
        return Arr::first($this->items, function ($key, Contract $skill) use ($name) {
            return $skill->getName() === strtolower($name);
        }, null);
    }
588532
public function get($name)
    {
        $names = explode(self::SEPARATOR, $name);
        $method = array_pop($names);
        if ($names) {
            $class_name = 'Task\\' . join('\\', array_map('ucfirst', $names)) . 'TaskList';
        } else {
            $class_name = 'Task\\TaskList';
        }
        $class_path = $this->loader->getPathByClass($class_name, false);
        if ($class_path === null || ! $class_path->isExists()) throw new NotFoundException("No such task. -> {$name}");

        require_once $class_path;
        $class_name = $class_path->getClassName();
        $taskList = new $class_name();
        $taskList->setOutput($this->output);
        $taskList->setContainer($this->raikiri());
        if (! $taskList->has($method)) throw new NotImplementsException("No such task. -> {$name}");

        return $taskList->get($method);
    }
653368
protected function get_target_suffix($target) {
        if (empty($target) || $target === RENDERER_TARGET_MAINTENANCE) {
            // If the target hasn't been specified we need to guess the defaults.
            // We also override the target with the default if the maintenance target has been provided.
            // This ensures we don't use the maintenance renderer if we are processing a special target.
            if (defined('PREFERRED_RENDERER_TARGET')) {
                $target = PREFERRED_RENDERER_TARGET;
            } else if (CLI_SCRIPT) {
                $target = RENDERER_TARGET_CLI;
            } else if (AJAX_SCRIPT) {
                $target = RENDERER_TARGET_AJAX;
            }
        }

        switch ($target) {
            case RENDERER_TARGET_CLI: $suffix = '_cli'; break;
            case RENDERER_TARGET_AJAX: $suffix = '_ajax'; break;
            case RENDERER_TARGET_TEXTEMAIL: $suffix = '_textemail'; break;
            case RENDERER_TARGET_HTMLEMAIL: $suffix = '_htmlemail'; break;
            case RENDERER_TARGET_MAINTENANCE: $suffix = '_maintenance'; break;
            default: $target = RENDERER_TARGET_GENERAL; $suffix = '';
        }

        return array($target, $suffix);
    }
754137
public function getParam($name)
  {
    //if (in_array($name, self::$_textParamNames)) {
    if (in_array($name, $this->_textParamNames)) {
      return $this->_textParams[$name];
    } else {
      throw new CPS_Exception(array(array('long_message' => 'Invalid response parameter', 'code' => ERROR_CODE_INVALID_PARAMETER, 'level' => 'REJECTED', 'source' => 'CPS_API')));
    }
  }
1012159
public function getTarget(string $target)
    {
        if (! empty($this->match['target'][$target])) {
            return $this->match['target'][$target];
        }
    }
1109589
protected function _getPatterned($name)
    {
        foreach ($this->_patterns as $pattern => $namespaces) {
            if (fnmatch($pattern, $name)) {
                if (is_string($namespaces)) {
                    return strpos($namespaces, '@') === false ? $namespaces . ucfirst($name) : $this->alias->resolveNS($namespaces . ucfirst($name));
                } else {
                    foreach ($namespaces as $namespace) {
                        $className = strpos($namespace, '@') === false ? $namespace . ucfirst($name) : $this->alias->resolveNS($namespace . ucfirst($name));
                        if (class_exists($className)) {
                            return $className;
                        }
                    }
                    return null;
                }
            }
        }

        return null;
    }
172935
public function addTarget(Target $target, string $name = null)
    {
        if ($name === null) {
            $this->_targets[] = $target;
        } else {
            $this->_targets[$name] = $target;
        }
    }
910686
protected function _getUsedTasks($name) {
		$plugin = $this->getConfig(static::CONFIG_PLUGIN);
		if (substr($name, -4) === 'Task') {
			$className = App::className(($plugin ? $plugin . '.' : '') . $name, 'Shell/Task');
		} else {
			$className = App::className(($plugin ? $plugin . '.' : '') . $name, 'Shell');
		}
		if (!$className) {
			throw new Exception($name);
		}

		$reflection = new ReflectionClass($className);
		if ($reflection->isAbstract()) {
			return [];
		}

		try {
			/** @var \Cake\Console\Shell $object */
			$object = new $className();
			$object->loadTasks();
		} catch (Exception $e) {
			if ($this->getConfig(static::CONFIG_VERBOSE)) {
				$this->_io->warn('   Skipping shell task annotations: ' . $e->getMessage());
			}
			return [];
		} catch (\Throwable $e) {
			if ($this->getConfig(static::CONFIG_VERBOSE)) {
				$this->_io->warn('   Skipping shell task annotations: ' . $e->getMessage());
			}
			return [];
		}

		$map = $this->_invokeProperty($object, '_taskMap');
		if (!$map) {
			return [];
		}
		foreach ($map as $alias => $row) {
			$fullClass = App::className($row['class'], 'Shell/Task', 'Task');
			if (!$fullClass) {
				$this->_io->warn('   Skipping invalid task ' . $alias . ': ' . $row['class']);
				unset($map[$alias]);
				continue;
			}
			$map[$alias]['fullClass'] = $fullClass;
		}

		return $map;
	}
1055027
private function getClassFor($name)
    {
        $test = strtolower($name);
        foreach ($this->types as $class => $matchers) {
            foreach ($matchers as $matcher) {
                if ($test === $matcher) {
                    return $class;
                }
            }
        }
        return $this->genericType;
    }
744026
private function extractName($name) {
		if (is_string($name)) {
			return [$name, null];
		}

		if (is_array($name)) {
			return [key($name), current($name)];
		}

		throw new ComponentRegisterException('The services\'s name must be a string or an array, ' . gettype($name) . ' given.');
	}
1223682
public function _matcher($matcherName, $actual)
    {
        if (!Matcher::exists($matcherName, true)) {
            throw new Exception("Unexisting matcher attached to `'{$matcherName}'`.");
        }

        $matcher = null;

        foreach (Matcher::get($matcherName, true) as $target => $value) {
            if (!$target) {
                $matcher = $value;
                continue;
            }
            if ($actual instanceof $target) {
                $matcher = $value;
            }
        }

        if (!$matcher) {
            throw new Exception("Unexisting matcher attached to `'{$matcherName}'` for `{$target}`.");
        }

        return $matcher;
    }
955890
public function getByName($name, $throwException = true)
    {
        foreach ($this as $element) {

            if (!$element instanceof Element\NamedElement) {
                throw new Exception\CollectionException();
            }

            if ($element->getName() === $name) {
                return $element;
            }
        }

        if ($throwException) {
            throw new Exception\NotFoundException();
        }

        return null;
    }