@@ -13,53 +13,53 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class DebugHelper |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * Internal mockable method wrapper for debug_backtrace. |
|
| 18 | - * |
|
| 19 | - * As mocking out debug_backtrace uses debug_backtrace internally, we need this in order to not cause a recursive |
|
| 20 | - * cascade until the runtime explodes. |
|
| 21 | - * |
|
| 22 | - * Instead, we mock this method, which allows debug_backtrace to still be called correctly. |
|
| 23 | - * |
|
| 24 | - * @return array |
|
| 25 | - */ |
|
| 26 | - public function get_debug_backtrace() |
|
| 27 | - { |
|
| 28 | - return debug_backtrace(); |
|
| 29 | - } |
|
| 16 | + /** |
|
| 17 | + * Internal mockable method wrapper for debug_backtrace. |
|
| 18 | + * |
|
| 19 | + * As mocking out debug_backtrace uses debug_backtrace internally, we need this in order to not cause a recursive |
|
| 20 | + * cascade until the runtime explodes. |
|
| 21 | + * |
|
| 22 | + * Instead, we mock this method, which allows debug_backtrace to still be called correctly. |
|
| 23 | + * |
|
| 24 | + * @return array |
|
| 25 | + */ |
|
| 26 | + public function get_debug_backtrace() |
|
| 27 | + { |
|
| 28 | + return debug_backtrace(); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Returns a string representation of the current backtrace for display. |
|
| 33 | - * |
|
| 34 | - * Note that this explicitly excludes the top two frames, which will be methods from this class. |
|
| 35 | - * |
|
| 36 | - * @return string |
|
| 37 | - */ |
|
| 38 | - public function getBacktrace() |
|
| 39 | - { |
|
| 40 | - $backtrace = $this->get_debug_backtrace(); |
|
| 31 | + /** |
|
| 32 | + * Returns a string representation of the current backtrace for display. |
|
| 33 | + * |
|
| 34 | + * Note that this explicitly excludes the top two frames, which will be methods from this class. |
|
| 35 | + * |
|
| 36 | + * @return string |
|
| 37 | + */ |
|
| 38 | + public function getBacktrace() |
|
| 39 | + { |
|
| 40 | + $backtrace = $this->get_debug_backtrace(); |
|
| 41 | 41 | |
| 42 | - $output = ""; |
|
| 42 | + $output = ""; |
|
| 43 | 43 | |
| 44 | - $count = 0; |
|
| 45 | - foreach ($backtrace as $line) { |
|
| 46 | - if ($count <= 1) { |
|
| 47 | - $count++; |
|
| 48 | - continue; |
|
| 49 | - } |
|
| 44 | + $count = 0; |
|
| 45 | + foreach ($backtrace as $line) { |
|
| 46 | + if ($count <= 1) { |
|
| 47 | + $count++; |
|
| 48 | + continue; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - $output .= "#{$count}: "; |
|
| 51 | + $output .= "#{$count}: "; |
|
| 52 | 52 | |
| 53 | - if (isset($line['type']) && $line['type'] != "") { |
|
| 54 | - $output .= $line['class'] . $line['type']; |
|
| 55 | - } |
|
| 53 | + if (isset($line['type']) && $line['type'] != "") { |
|
| 54 | + $output .= $line['class'] . $line['type']; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - $output .= $line['function'] . "(...)"; |
|
| 58 | - $output .= " [{$line['file']}#{$line['line']}\r\n"; |
|
| 57 | + $output .= $line['function'] . "(...)"; |
|
| 58 | + $output .= " [{$line['file']}#{$line['line']}\r\n"; |
|
| 59 | 59 | |
| 60 | - $count++; |
|
| 61 | - } |
|
| 60 | + $count++; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return $output; |
|
| 64 | - } |
|
| 63 | + return $output; |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -13,91 +13,91 @@ |
||
| 13 | 13 | |
| 14 | 14 | class BlacklistHelper implements IBlacklistHelper |
| 15 | 15 | { |
| 16 | - /** @var HttpHelper */ |
|
| 17 | - private $httpHelper; |
|
| 18 | - /** |
|
| 19 | - * Cache of previously requested usernames |
|
| 20 | - * @var array |
|
| 21 | - */ |
|
| 22 | - private $cache = array(); |
|
| 23 | - /** @var string */ |
|
| 24 | - private $mediawikiWebServiceEndpoint; |
|
| 16 | + /** @var HttpHelper */ |
|
| 17 | + private $httpHelper; |
|
| 18 | + /** |
|
| 19 | + * Cache of previously requested usernames |
|
| 20 | + * @var array |
|
| 21 | + */ |
|
| 22 | + private $cache = array(); |
|
| 23 | + /** @var string */ |
|
| 24 | + private $mediawikiWebServiceEndpoint; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * BlacklistHelper constructor. |
|
| 28 | - * |
|
| 29 | - * @param HttpHelper $httpHelper |
|
| 30 | - * @param string $mediawikiWebServiceEndpoint |
|
| 31 | - */ |
|
| 32 | - public function __construct(HttpHelper $httpHelper, $mediawikiWebServiceEndpoint) |
|
| 33 | - { |
|
| 34 | - $this->httpHelper = $httpHelper; |
|
| 35 | - $this->mediawikiWebServiceEndpoint = $mediawikiWebServiceEndpoint; |
|
| 36 | - } |
|
| 26 | + /** |
|
| 27 | + * BlacklistHelper constructor. |
|
| 28 | + * |
|
| 29 | + * @param HttpHelper $httpHelper |
|
| 30 | + * @param string $mediawikiWebServiceEndpoint |
|
| 31 | + */ |
|
| 32 | + public function __construct(HttpHelper $httpHelper, $mediawikiWebServiceEndpoint) |
|
| 33 | + { |
|
| 34 | + $this->httpHelper = $httpHelper; |
|
| 35 | + $this->mediawikiWebServiceEndpoint = $mediawikiWebServiceEndpoint; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist |
|
| 40 | - * |
|
| 41 | - * @param string $username |
|
| 42 | - * |
|
| 43 | - * @return false|string False if the username is not blacklisted, else the blacklist entry. |
|
| 44 | - */ |
|
| 45 | - public function isBlacklisted($username) |
|
| 46 | - { |
|
| 47 | - if (isset($this->cache[$username])) { |
|
| 48 | - $result = $this->cache[$username]; |
|
| 49 | - if ($result === false) { |
|
| 50 | - return false; |
|
| 51 | - } |
|
| 38 | + /** |
|
| 39 | + * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist |
|
| 40 | + * |
|
| 41 | + * @param string $username |
|
| 42 | + * |
|
| 43 | + * @return false|string False if the username is not blacklisted, else the blacklist entry. |
|
| 44 | + */ |
|
| 45 | + public function isBlacklisted($username) |
|
| 46 | + { |
|
| 47 | + if (isset($this->cache[$username])) { |
|
| 48 | + $result = $this->cache[$username]; |
|
| 49 | + if ($result === false) { |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - return $result['line']; |
|
| 54 | - } |
|
| 53 | + return $result['line']; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - try { |
|
| 57 | - $result = $this->performWikiLookup($username); |
|
| 58 | - } |
|
| 59 | - catch (CurlException $ex) { |
|
| 60 | - // LOGME log this, but fail gracefully. |
|
| 61 | - return false; |
|
| 62 | - } |
|
| 56 | + try { |
|
| 57 | + $result = $this->performWikiLookup($username); |
|
| 58 | + } |
|
| 59 | + catch (CurlException $ex) { |
|
| 60 | + // LOGME log this, but fail gracefully. |
|
| 61 | + return false; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - if ($result['result'] === 'ok') { |
|
| 65 | - // not blacklisted |
|
| 66 | - $this->cache[$username] = false; |
|
| 64 | + if ($result['result'] === 'ok') { |
|
| 65 | + // not blacklisted |
|
| 66 | + $this->cache[$username] = false; |
|
| 67 | 67 | |
| 68 | - return false; |
|
| 69 | - } |
|
| 70 | - else { |
|
| 71 | - $this->cache[$username] = $result; |
|
| 68 | + return false; |
|
| 69 | + } |
|
| 70 | + else { |
|
| 71 | + $this->cache[$username] = $result; |
|
| 72 | 72 | |
| 73 | - return $result['line']; |
|
| 74 | - } |
|
| 75 | - } |
|
| 73 | + return $result['line']; |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Performs a fetch to MediaWiki for the relevant title blacklist entry |
|
| 79 | - * |
|
| 80 | - * @param string $username The username to look up |
|
| 81 | - * |
|
| 82 | - * @return array |
|
| 83 | - * @throws CurlException |
|
| 84 | - */ |
|
| 85 | - private function performWikiLookup($username) |
|
| 86 | - { |
|
| 87 | - $endpoint = $this->mediawikiWebServiceEndpoint; |
|
| 77 | + /** |
|
| 78 | + * Performs a fetch to MediaWiki for the relevant title blacklist entry |
|
| 79 | + * |
|
| 80 | + * @param string $username The username to look up |
|
| 81 | + * |
|
| 82 | + * @return array |
|
| 83 | + * @throws CurlException |
|
| 84 | + */ |
|
| 85 | + private function performWikiLookup($username) |
|
| 86 | + { |
|
| 87 | + $endpoint = $this->mediawikiWebServiceEndpoint; |
|
| 88 | 88 | |
| 89 | - $parameters = array( |
|
| 90 | - 'action' => 'titleblacklist', |
|
| 91 | - 'format' => 'php', |
|
| 92 | - 'tbtitle' => $username, |
|
| 93 | - 'tbaction' => 'new-account', |
|
| 94 | - 'tbnooverride' => true, |
|
| 95 | - ); |
|
| 89 | + $parameters = array( |
|
| 90 | + 'action' => 'titleblacklist', |
|
| 91 | + 'format' => 'php', |
|
| 92 | + 'tbtitle' => $username, |
|
| 93 | + 'tbaction' => 'new-account', |
|
| 94 | + 'tbnooverride' => true, |
|
| 95 | + ); |
|
| 96 | 96 | |
| 97 | - $apiResult = $this->httpHelper->get($endpoint, $parameters); |
|
| 97 | + $apiResult = $this->httpHelper->get($endpoint, $parameters); |
|
| 98 | 98 | |
| 99 | - $data = unserialize($apiResult); |
|
| 99 | + $data = unserialize($apiResult); |
|
| 100 | 100 | |
| 101 | - return $data['titleblacklist']; |
|
| 102 | - } |
|
| 101 | + return $data['titleblacklist']; |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | \ No newline at end of file |
@@ -12,16 +12,16 @@ |
||
| 12 | 12 | |
| 13 | 13 | class FakeBlacklistHelper implements IBlacklistHelper |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist |
|
| 17 | - * |
|
| 18 | - * @param string $username |
|
| 19 | - * |
|
| 20 | - * @return bool |
|
| 21 | - */ |
|
| 22 | - public function isBlacklisted($username) |
|
| 23 | - { |
|
| 24 | - // Short-circuit |
|
| 25 | - return false; |
|
| 26 | - } |
|
| 15 | + /** |
|
| 16 | + * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist |
|
| 17 | + * |
|
| 18 | + * @param string $username |
|
| 19 | + * |
|
| 20 | + * @return bool |
|
| 21 | + */ |
|
| 22 | + public function isBlacklisted($username) |
|
| 23 | + { |
|
| 24 | + // Short-circuit |
|
| 25 | + return false; |
|
| 26 | + } |
|
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |
@@ -12,21 +12,21 @@ |
||
| 12 | 12 | |
| 13 | 13 | class EmailHelper implements IEmailHelper |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @param string $to |
|
| 17 | - * @param string $subject |
|
| 18 | - * @param string $content |
|
| 19 | - * @param array $headers Extra headers to include |
|
| 20 | - */ |
|
| 21 | - public function sendMail($to, $subject, $content, $headers = array()) |
|
| 22 | - { |
|
| 23 | - $headers['From'] = '[email protected]'; |
|
| 24 | - $headerString = ''; |
|
| 15 | + /** |
|
| 16 | + * @param string $to |
|
| 17 | + * @param string $subject |
|
| 18 | + * @param string $content |
|
| 19 | + * @param array $headers Extra headers to include |
|
| 20 | + */ |
|
| 21 | + public function sendMail($to, $subject, $content, $headers = array()) |
|
| 22 | + { |
|
| 23 | + $headers['From'] = '[email protected]'; |
|
| 24 | + $headerString = ''; |
|
| 25 | 25 | |
| 26 | - foreach ($headers as $header => $headerValue) { |
|
| 27 | - $headerString .= $header . ': ' . $headerValue . "\r\n"; |
|
| 28 | - } |
|
| 26 | + foreach ($headers as $header => $headerValue) { |
|
| 27 | + $headerString .= $header . ': ' . $headerValue . "\r\n"; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - mail($to, $subject, $content, $headerString); |
|
| 31 | - } |
|
| 30 | + mail($to, $subject, $content, $headerString); |
|
| 31 | + } |
|
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -12,30 +12,30 @@ |
||
| 12 | 12 | |
| 13 | 13 | interface IBanHelper |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * Summary of nameIsBanned |
|
| 17 | - * |
|
| 18 | - * @param string $name The name to test if is banned. |
|
| 19 | - * |
|
| 20 | - * @return Ban |
|
| 21 | - */ |
|
| 22 | - public function nameIsBanned($name); |
|
| 15 | + /** |
|
| 16 | + * Summary of nameIsBanned |
|
| 17 | + * |
|
| 18 | + * @param string $name The name to test if is banned. |
|
| 19 | + * |
|
| 20 | + * @return Ban |
|
| 21 | + */ |
|
| 22 | + public function nameIsBanned($name); |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Summary of emailIsBanned |
|
| 26 | - * |
|
| 27 | - * @param string $email |
|
| 28 | - * |
|
| 29 | - * @return Ban |
|
| 30 | - */ |
|
| 31 | - public function emailIsBanned($email); |
|
| 24 | + /** |
|
| 25 | + * Summary of emailIsBanned |
|
| 26 | + * |
|
| 27 | + * @param string $email |
|
| 28 | + * |
|
| 29 | + * @return Ban |
|
| 30 | + */ |
|
| 31 | + public function emailIsBanned($email); |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Summary of ipIsBanned |
|
| 35 | - * |
|
| 36 | - * @param string $ip |
|
| 37 | - * |
|
| 38 | - * @return Ban |
|
| 39 | - */ |
|
| 40 | - public function ipIsBanned($ip); |
|
| 33 | + /** |
|
| 34 | + * Summary of ipIsBanned |
|
| 35 | + * |
|
| 36 | + * @param string $ip |
|
| 37 | + * |
|
| 38 | + * @return Ban |
|
| 39 | + */ |
|
| 40 | + public function ipIsBanned($ip); |
|
| 41 | 41 | } |
@@ -17,15 +17,15 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | interface IEmailHelper |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * Sends an email to the specified email address. |
|
| 22 | - * |
|
| 23 | - * @param string $to |
|
| 24 | - * @param string $subject |
|
| 25 | - * @param string $content |
|
| 26 | - * @param array $headers Extra headers to include |
|
| 27 | - * |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public function sendMail($to, $subject, $content, $headers = array()); |
|
| 20 | + /** |
|
| 21 | + * Sends an email to the specified email address. |
|
| 22 | + * |
|
| 23 | + * @param string $to |
|
| 24 | + * @param string $subject |
|
| 25 | + * @param string $content |
|
| 26 | + * @param array $headers Extra headers to include |
|
| 27 | + * |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public function sendMail($to, $subject, $content, $headers = array()); |
|
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -10,12 +10,12 @@ |
||
| 10 | 10 | |
| 11 | 11 | interface IBlacklistHelper |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist |
|
| 15 | - * |
|
| 16 | - * @param string $username |
|
| 17 | - * |
|
| 18 | - * @return bool |
|
| 19 | - */ |
|
| 20 | - public function isBlacklisted($username); |
|
| 13 | + /** |
|
| 14 | + * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist |
|
| 15 | + * |
|
| 16 | + * @param string $username |
|
| 17 | + * |
|
| 18 | + * @return bool |
|
| 19 | + */ |
|
| 20 | + public function isBlacklisted($username); |
|
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -10,16 +10,16 @@ |
||
| 10 | 10 | |
| 11 | 11 | interface ITypeAheadHelper |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @param string $class CSS class to apply this typeahead to. |
|
| 15 | - * @param callable $generator Generator function taking no arguments to return an array of strings. |
|
| 16 | - * |
|
| 17 | - * @return void |
|
| 18 | - */ |
|
| 19 | - public function defineTypeAheadSource($class, callable $generator); |
|
| 13 | + /** |
|
| 14 | + * @param string $class CSS class to apply this typeahead to. |
|
| 15 | + * @param callable $generator Generator function taking no arguments to return an array of strings. |
|
| 16 | + * |
|
| 17 | + * @return void |
|
| 18 | + */ |
|
| 19 | + public function defineTypeAheadSource($class, callable $generator); |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @return string HTML fragment containing a JS block for typeaheads. |
|
| 23 | - */ |
|
| 24 | - public function getTypeAheadScriptBlock(); |
|
| 21 | + /** |
|
| 22 | + * @return string HTML fragment containing a JS block for typeaheads. |
|
| 23 | + */ |
|
| 24 | + public function getTypeAheadScriptBlock(); |
|
| 25 | 25 | } |
| 26 | 26 | \ No newline at end of file |
@@ -19,110 +19,110 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class RDnsCache extends DataObject |
| 21 | 21 | { |
| 22 | - private $address; |
|
| 23 | - private $data; |
|
| 24 | - private $creation; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @param string $address |
|
| 28 | - * @param PdoDatabase $database |
|
| 29 | - * |
|
| 30 | - * @return RDnsCache|false |
|
| 31 | - */ |
|
| 32 | - public static function getByAddress($address, PdoDatabase $database) |
|
| 33 | - { |
|
| 34 | - // @todo add cache invalidation (timestamp?) |
|
| 35 | - $statement = $database->prepare("SELECT * FROM rdnscache WHERE address = :id LIMIT 1;"); |
|
| 36 | - $statement->bindValue(":id", $address); |
|
| 37 | - |
|
| 38 | - $statement->execute(); |
|
| 39 | - |
|
| 40 | - $resultObject = $statement->fetchObject(get_called_class()); |
|
| 41 | - |
|
| 42 | - if ($resultObject != false) { |
|
| 43 | - $resultObject->setDatabase($database); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - return $resultObject; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - public function save() |
|
| 50 | - { |
|
| 51 | - if ($this->isNew()) { |
|
| 52 | - // insert |
|
| 53 | - $statement = $this->dbObject->prepare(<<<SQL |
|
| 22 | + private $address; |
|
| 23 | + private $data; |
|
| 24 | + private $creation; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @param string $address |
|
| 28 | + * @param PdoDatabase $database |
|
| 29 | + * |
|
| 30 | + * @return RDnsCache|false |
|
| 31 | + */ |
|
| 32 | + public static function getByAddress($address, PdoDatabase $database) |
|
| 33 | + { |
|
| 34 | + // @todo add cache invalidation (timestamp?) |
|
| 35 | + $statement = $database->prepare("SELECT * FROM rdnscache WHERE address = :id LIMIT 1;"); |
|
| 36 | + $statement->bindValue(":id", $address); |
|
| 37 | + |
|
| 38 | + $statement->execute(); |
|
| 39 | + |
|
| 40 | + $resultObject = $statement->fetchObject(get_called_class()); |
|
| 41 | + |
|
| 42 | + if ($resultObject != false) { |
|
| 43 | + $resultObject->setDatabase($database); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + return $resultObject; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + public function save() |
|
| 50 | + { |
|
| 51 | + if ($this->isNew()) { |
|
| 52 | + // insert |
|
| 53 | + $statement = $this->dbObject->prepare(<<<SQL |
|
| 54 | 54 | INSERT INTO `rdnscache` (address, data) VALUES (:address, :data); |
| 55 | 55 | SQL |
| 56 | - ); |
|
| 57 | - $statement->bindValue(":address", $this->address); |
|
| 58 | - $statement->bindValue(":data", $this->data); |
|
| 59 | - |
|
| 60 | - if ($statement->execute()) { |
|
| 61 | - $this->id = (int)$this->dbObject->lastInsertId(); |
|
| 62 | - } |
|
| 63 | - else { |
|
| 64 | - throw new Exception($statement->errorInfo()); |
|
| 65 | - } |
|
| 66 | - } |
|
| 67 | - else { |
|
| 68 | - // update |
|
| 69 | - $statement = $this->dbObject->prepare(<<<SQL |
|
| 56 | + ); |
|
| 57 | + $statement->bindValue(":address", $this->address); |
|
| 58 | + $statement->bindValue(":data", $this->data); |
|
| 59 | + |
|
| 60 | + if ($statement->execute()) { |
|
| 61 | + $this->id = (int)$this->dbObject->lastInsertId(); |
|
| 62 | + } |
|
| 63 | + else { |
|
| 64 | + throw new Exception($statement->errorInfo()); |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + else { |
|
| 68 | + // update |
|
| 69 | + $statement = $this->dbObject->prepare(<<<SQL |
|
| 70 | 70 | UPDATE `rdnscache` |
| 71 | 71 | SET address = :address, data = :data, updateversion = updateversion + 1 |
| 72 | 72 | WHERE id = :id AND updateversion = :updateversion |
| 73 | 73 | LIMIT 1; |
| 74 | 74 | SQL |
| 75 | - ); |
|
| 76 | - |
|
| 77 | - $statement->bindValue(':id', $this->id); |
|
| 78 | - $statement->bindValue(':updateversion', $this->updateversion); |
|
| 79 | - |
|
| 80 | - $statement->bindValue(':address', $this->address); |
|
| 81 | - $statement->bindValue(':data', $this->data); |
|
| 82 | - |
|
| 83 | - if (!$statement->execute()) { |
|
| 84 | - throw new Exception($statement->errorInfo()); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - if ($statement->rowCount() !== 1) { |
|
| 88 | - throw new OptimisticLockFailedException(); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - $this->updateversion++; |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - public function getAddress() |
|
| 96 | - { |
|
| 97 | - return $this->address; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @param string $address |
|
| 102 | - */ |
|
| 103 | - public function setAddress($address) |
|
| 104 | - { |
|
| 105 | - $this->address = $address; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * @return string |
|
| 110 | - */ |
|
| 111 | - public function getData() |
|
| 112 | - { |
|
| 113 | - return unserialize($this->data); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - public function setData($data) |
|
| 117 | - { |
|
| 118 | - $this->data = serialize($data); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * @return DateTimeImmutable |
|
| 123 | - */ |
|
| 124 | - public function getCreation() |
|
| 125 | - { |
|
| 126 | - return new DateTimeImmutable($this->creation); |
|
| 127 | - } |
|
| 75 | + ); |
|
| 76 | + |
|
| 77 | + $statement->bindValue(':id', $this->id); |
|
| 78 | + $statement->bindValue(':updateversion', $this->updateversion); |
|
| 79 | + |
|
| 80 | + $statement->bindValue(':address', $this->address); |
|
| 81 | + $statement->bindValue(':data', $this->data); |
|
| 82 | + |
|
| 83 | + if (!$statement->execute()) { |
|
| 84 | + throw new Exception($statement->errorInfo()); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + if ($statement->rowCount() !== 1) { |
|
| 88 | + throw new OptimisticLockFailedException(); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + $this->updateversion++; |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + public function getAddress() |
|
| 96 | + { |
|
| 97 | + return $this->address; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @param string $address |
|
| 102 | + */ |
|
| 103 | + public function setAddress($address) |
|
| 104 | + { |
|
| 105 | + $this->address = $address; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * @return string |
|
| 110 | + */ |
|
| 111 | + public function getData() |
|
| 112 | + { |
|
| 113 | + return unserialize($this->data); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + public function setData($data) |
|
| 117 | + { |
|
| 118 | + $this->data = serialize($data); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * @return DateTimeImmutable |
|
| 123 | + */ |
|
| 124 | + public function getCreation() |
|
| 125 | + { |
|
| 126 | + return new DateTimeImmutable($this->creation); |
|
| 127 | + } |
|
| 128 | 128 | } |