@@ -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); |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: stwalkerster |
|
| 5 | - * Date: 26/03/2016 |
|
| 6 | - * Time: 02:55 |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: stwalkerster |
|
| 5 | + * Date: 26/03/2016 |
|
| 6 | + * Time: 02:55 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace Waca\Helpers; |
| 10 | 10 | |
@@ -451,13 +451,13 @@ |
||
| 451 | 451 | $objectDescription = self::getObjectDescription($logEntry->getObjectId(), $logEntry->getObjectType(), |
| 452 | 452 | $database, $configuration); |
| 453 | 453 | |
| 454 | - if($logEntry->getAction() === 'Renamed'){ |
|
| 454 | + if ($logEntry->getAction() === 'Renamed') { |
|
| 455 | 455 | $renameData = unserialize($logEntry->getComment()); |
| 456 | 456 | $oldName = htmlentities($renameData['old'], ENT_COMPAT, 'UTF-8'); |
| 457 | 457 | $newName = htmlentities($renameData['new'], ENT_COMPAT, 'UTF-8'); |
| 458 | 458 | $comment = 'Renamed \'' . $oldName . '\' to \'' . $newName . '\'.'; |
| 459 | 459 | } |
| 460 | - else{ |
|
| 460 | + else { |
|
| 461 | 461 | $comment = $logEntry->getComment(); |
| 462 | 462 | } |
| 463 | 463 | |
@@ -451,13 +451,13 @@ |
||
| 451 | 451 | $objectDescription = self::getObjectDescription($logEntry->getObjectId(), $logEntry->getObjectType(), |
| 452 | 452 | $database, $configuration); |
| 453 | 453 | |
| 454 | - if($logEntry->getAction() === 'Renamed'){ |
|
| 454 | + if($logEntry->getAction() === 'Renamed') { |
|
| 455 | 455 | $renameData = unserialize($logEntry->getComment()); |
| 456 | 456 | $oldName = htmlentities($renameData['old'], ENT_COMPAT, 'UTF-8'); |
| 457 | 457 | $newName = htmlentities($renameData['new'], ENT_COMPAT, 'UTF-8'); |
| 458 | 458 | $comment = 'Renamed \'' . $oldName . '\' to \'' . $newName . '\'.'; |
| 459 | 459 | } |
| 460 | - else{ |
|
| 460 | + else { |
|
| 461 | 461 | $comment = $logEntry->getComment(); |
| 462 | 462 | } |
| 463 | 463 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * |
| 43 | 43 | * @return RequestSearchHelper |
| 44 | 44 | */ |
| 45 | - public static function get(PdoDatabase $database){ |
|
| 45 | + public static function get(PdoDatabase $database) { |
|
| 46 | 46 | $helper = new RequestSearchHelper($database); |
| 47 | 47 | |
| 48 | 48 | return $helper; |
@@ -42,7 +42,8 @@ |
||
| 42 | 42 | * |
| 43 | 43 | * @return RequestSearchHelper |
| 44 | 44 | */ |
| 45 | - public static function get(PdoDatabase $database){ |
|
| 45 | + public static function get(PdoDatabase $database) |
|
| 46 | + { |
|
| 46 | 47 | $helper = new RequestSearchHelper($database); |
| 47 | 48 | |
| 48 | 49 | return $helper; |