componentPaths = $componentPaths; } /** * Add a path where objects for this component can be found * * @param string $componentPath * @param int $priority */ public function addComponentPath(string $componentPath, int $priority = Priority::NORMAL) { if (!isset($this->componentPaths[$priority])) $this->componentPaths[$priority] = []; if (!in_array($componentPath, $this->componentPaths[$priority])) $this->componentPaths[$priority][] = $componentPath; } /** * Remove a path where objects for this component can be found * * @param string $componentPath * @param int $priority */ public function removeComponentPath(string $componentPath, int $priority = Priority::NORMAL) { if (!isset($this->componentPaths[$priority])) return; if (($key = array_search($componentPath, $this->componentPaths[$priority])) !== false) unset($this->componentPaths[$priority][$key]); } /** * Get a list of all current componentPaths * * @param int $priority * @return array of paths where objects for this component can be found */ public function getComponentPaths(int $priority = Priority::NORMAL): array { return $this->componentPaths[$priority] ?? []; } }