Just `$this->apps[$app] = $app;`, get rid of array_search.