@@ -17,6 +17,9 @@ |
||
| 17 | 17 | /** @var string */ |
| 18 | 18 | protected $timestamp; |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $username |
|
| 22 | + */ |
|
| 20 | 23 | public static function getByUsername($username, PdoDatabase $database) |
| 21 | 24 | { |
| 22 | 25 | $statement = $database->prepare(<<<SQL |
@@ -15,6 +15,9 @@ |
||
| 15 | 15 | private $apikey; |
| 16 | 16 | private $database; |
| 17 | 17 | |
| 18 | + /** |
|
| 19 | + * @param string $apikey |
|
| 20 | + */ |
|
| 18 | 21 | public function __construct(PdoDatabase $database, $apikey) |
| 19 | 22 | { |
| 20 | 23 | $this->database = $database; |
@@ -6,9 +6,9 @@ |
||
| 6 | 6 | use Waca\DataObjects\Ban; |
| 7 | 7 | use Waca\DataObjects\Comment; |
| 8 | 8 | use Waca\DataObjects\EmailTemplate; |
| 9 | -use Waca\DataObjects\SiteNotice; |
|
| 10 | 9 | use Waca\DataObjects\Log; |
| 11 | 10 | use Waca\DataObjects\Request; |
| 11 | +use Waca\DataObjects\SiteNotice; |
|
| 12 | 12 | use Waca\DataObjects\User; |
| 13 | 13 | use Waca\DataObjects\WelcomeTemplate; |
| 14 | 14 | use Waca\PdoDatabase; |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $objectType = get_class($object); |
| 56 | - if(strpos($objectType, 'Waca\\DataObjects\\') !== false) |
|
| 56 | + if (strpos($objectType, 'Waca\\DataObjects\\') !== false) |
|
| 57 | 57 | { |
| 58 | 58 | $objectType = str_replace('Waca\\DataObjects\\', '', $objectType); |
| 59 | 59 | } |
@@ -53,8 +53,7 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $objectType = get_class($object); |
| 56 | - if(strpos($objectType, 'Waca\\DataObjects\\') !== false) |
|
| 57 | - { |
|
| 56 | + if(strpos($objectType, 'Waca\\DataObjects\\') !== false) { |
|
| 58 | 57 | $objectType = str_replace('Waca\\DataObjects\\', '', $objectType); |
| 59 | 58 | } |
| 60 | 59 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | /** |
| 69 | 69 | * Gets search results by name |
| 70 | 70 | * |
| 71 | - * @param $searchTerm string |
|
| 71 | + * @param null|string $searchTerm string |
|
| 72 | 72 | * |
| 73 | 73 | * @returns array<Request> |
| 74 | 74 | */ |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Gets search results by email |
| 87 | 87 | * |
| 88 | - * @param $searchTerm string |
|
| 88 | + * @param null|string $searchTerm string |
|
| 89 | 89 | * |
| 90 | - * @return array <Request> |
|
| 90 | + * @return Request[] <Request> |
|
| 91 | 91 | * @throws ApplicationLogicException |
| 92 | 92 | */ |
| 93 | 93 | private function getEmailSearchResults($searchTerm) |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * Gets search results by IP address or XFF IP address |
| 109 | 109 | * |
| 110 | - * @param $searchTerm string |
|
| 110 | + * @param null|string $searchTerm string |
|
| 111 | 111 | * |
| 112 | 112 | * @returns array<Request> |
| 113 | 113 | */ |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | - * @param $searchType |
|
| 138 | - * @param $searchTerm |
|
| 137 | + * @param null|string $searchType |
|
| 138 | + * @param null|string $searchTerm |
|
| 139 | 139 | * |
| 140 | 140 | * @throws ApplicationLogicException |
| 141 | 141 | */ |
@@ -423,7 +423,7 @@ |
||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | /** |
| 426 | - * @return callable |
|
| 426 | + * @return string[] |
|
| 427 | 427 | */ |
| 428 | 428 | protected function getDefaultRoute() |
| 429 | 429 | { |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | /** |
| 132 | 132 | * @return bool |
| 133 | 133 | */ |
| 134 | - public function isNew(){ |
|
| 134 | + public function isNew() { |
|
| 135 | 135 | return $this->id === null; |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -131,7 +131,8 @@ |
||
| 131 | 131 | /** |
| 132 | 132 | * @return bool |
| 133 | 133 | */ |
| 134 | - public function isNew(){ |
|
| 134 | + public function isNew() |
|
| 135 | + { |
|
| 135 | 136 | return $this->id === null; |
| 136 | 137 | } |
| 137 | 138 | } |
@@ -163,7 +163,7 @@ |
||
| 163 | 163 | throw new Exception($statement->errorInfo()); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if($statement->rowCount() !== 1){ |
|
| 166 | + if ($statement->rowCount() !== 1) { |
|
| 167 | 167 | throw new OptimisticLockFailedException(); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -163,7 +163,7 @@ |
||
| 163 | 163 | throw new Exception($statement->errorInfo()); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if($statement->rowCount() !== 1){ |
|
| 166 | + if($statement->rowCount() !== 1) { |
|
| 167 | 167 | throw new OptimisticLockFailedException(); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | $newPasswordConfirmation = WebRequest::postString('newpasswordconfirm'); |
| 58 | 58 | |
| 59 | 59 | $user = User::getCurrent($this->getDatabase()); |
| 60 | - if(!$user instanceof User){ |
|
| 60 | + if (!$user instanceof User) { |
|
| 61 | 61 | throw new ApplicationLogicException('User not found'); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | $newPasswordConfirmation = WebRequest::postString('newpasswordconfirm'); |
| 58 | 58 | |
| 59 | 59 | $user = User::getCurrent($this->getDatabase()); |
| 60 | - if(!$user instanceof User){ |
|
| 60 | + if(!$user instanceof User) { |
|
| 61 | 61 | throw new ApplicationLogicException('User not found'); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -103,9 +103,9 @@ |
||
| 103 | 103 | $this->assign("notcreated", $usersNotCreated); |
| 104 | 104 | |
| 105 | 105 | list($logs, $logCount) = LogHelper::getLogs($database, null, null, 'User', $user->getId()); |
| 106 | - if($logs === false){ |
|
| 106 | + if ($logs === false) { |
|
| 107 | 107 | $this->assign('accountlog', array()); |
| 108 | - } else{ |
|
| 108 | + } else { |
|
| 109 | 109 | list($users, $logData) = LogHelper::prepareLogsForTemplate($logs, $database, $this->getSiteConfiguration()); |
| 110 | 110 | |
| 111 | 111 | $this->assign("accountlog", $logData); |
@@ -103,9 +103,10 @@ |
||
| 103 | 103 | $this->assign("notcreated", $usersNotCreated); |
| 104 | 104 | |
| 105 | 105 | list($logs, $logCount) = LogHelper::getLogs($database, null, null, 'User', $user->getId()); |
| 106 | - if($logs === false){ |
|
| 106 | + if($logs === false) { |
|
| 107 | 107 | $this->assign('accountlog', array()); |
| 108 | - } else{ |
|
| 108 | + } |
|
| 109 | + else { |
|
| 109 | 110 | list($users, $logData) = LogHelper::prepareLogsForTemplate($logs, $database, $this->getSiteConfiguration()); |
| 110 | 111 | |
| 111 | 112 | $this->assign("accountlog", $logData); |