@@ -39,12 +39,10 @@ final public function listByProject($projectIdentifier, array $params = []): arr
3939 }
4040
4141 try {
42- $ this -> news = $ this ->retrieveData ('/projects/ ' .strval ($ projectIdentifier ).'/news.json ' , $ params );
42+ return $ this ->retrieveData ('/projects/ ' .strval ($ projectIdentifier ).'/news.json ' , $ params );
4343 } catch (SerializerException $ th ) {
4444 throw new UnexpectedResponseException ('The Redmine server responded with an unexpected body. ' , $ th ->getCode (), $ th );
4545 }
46-
47- return $ this ->news ;
4846 }
4947
5048 /**
@@ -61,12 +59,10 @@ final public function listByProject($projectIdentifier, array $params = []): arr
6159 final public function list (array $ params = []): array
6260 {
6361 try {
64- $ this -> news = $ this ->retrieveData ('/news.json ' , $ params );
62+ return $ this ->retrieveData ('/news.json ' , $ params );
6563 } catch (SerializerException $ th ) {
6664 throw new UnexpectedResponseException ('The Redmine server responded with an unexpected body. ' , $ th ->getCode (), $ th );
6765 }
68-
69- return $ this ->news ;
7066 }
7167
7268 /**
@@ -87,9 +83,9 @@ public function all($project = null, array $params = [])
8783
8884 try {
8985 if (null === $ project ) {
90- return $ this ->list ($ params );
86+ $ this -> news = $ this ->list ($ params );
9187 } else {
92- return $ this ->listByProject (strval ($ project ), $ params );
88+ $ this -> news = $ this ->listByProject (strval ($ project ), $ params );
9389 }
9490 } catch (Exception $ e ) {
9591 if ($ this ->client ->getLastResponseBody () === '' ) {
@@ -102,5 +98,7 @@ public function all($project = null, array $params = [])
10298
10399 return $ e ->getMessage ();
104100 }
101+
102+ return $ this ->news ;
105103 }
106104}
0 commit comments