1111use Platformsh \Client \Model \Organization \Organization ;
1212use Platformsh \Client \Model \Plan ;
1313use Platformsh \Client \Model \Project ;
14+ use Platformsh \Client \Model \ProjectStub ;
1415use Platformsh \Client \Model \Region ;
1516use Platformsh \Client \Model \Catalog ;
1617use Platformsh \Client \Model \Result ;
@@ -64,13 +65,6 @@ private function apiUrl()
6465 */
6566 public function getProject ($ id , $ hostname = null , $ https = true )
6667 {
67- // Search for a project in the user's project list.
68- foreach ($ this ->getProjects () as $ project ) {
69- if ($ project ->id === $ id ) {
70- return $ project ;
71- }
72- }
73-
7468 // Look for a project directly if the hostname is known.
7569 if ($ hostname !== null ) {
7670 return $ this ->getProjectDirect ($ id , $ hostname , $ https );
@@ -101,6 +95,8 @@ public function getProject($id, $hostname = null, $https = true)
10195 /**
10296 * Get the logged-in user's projects.
10397 *
98+ * @deprecated replaced by getProjectStubs()
99+ *
104100 * @param bool $reset
105101 *
106102 * @return Project[]
@@ -123,6 +119,18 @@ public function getProjects($reset = false)
123119 return $ projects ;
124120 }
125121
122+ /**
123+ * Returns the logged-in user's project stubs.
124+ *
125+ * @param bool $reset
126+ *
127+ * @return ProjectStub[]
128+ */
129+ public function getProjectStubs ($ reset = false )
130+ {
131+ return ProjectStub::wrapCollection ($ this ->getAccountInfo ($ reset ), $ this ->apiUrl (), $ this ->connector ->getClient ());
132+ }
133+
126134 /**
127135 * Get account information for the logged-in user.
128136 *
0 commit comments