| @@ -24,56 +24,56 @@ discard block | ||
| 24 | 24 | */ | 
| 25 | 25 | class PaginationHelper | 
| 26 | 26 |  { | 
| 27 | - /** | |
| 28 | - * @var int | |
| 29 | - */ | |
| 27 | + /** | |
| 28 | + * @var int | |
| 29 | + */ | |
| 30 | 30 | protected $total; | 
| 31 | 31 | |
| 32 | - /** | |
| 33 | - * @var int | |
| 34 | - */ | |
| 32 | + /** | |
| 33 | + * @var int | |
| 34 | + */ | |
| 35 | 35 | protected $perPage; | 
| 36 | 36 | |
| 37 | - /** | |
| 38 | - * @var int | |
| 39 | - */ | |
| 37 | + /** | |
| 38 | + * @var int | |
| 39 | + */ | |
| 40 | 40 | protected $current; | 
| 41 | 41 | |
| 42 | - /** | |
| 43 | - * @var int | |
| 44 | - */ | |
| 42 | + /** | |
| 43 | + * @var int | |
| 44 | + */ | |
| 45 | 45 | protected $next = 0; | 
| 46 | 46 | |
| 47 | - /** | |
| 48 | - * @var int | |
| 49 | - */ | |
| 47 | + /** | |
| 48 | + * @var int | |
| 49 | + */ | |
| 50 | 50 | protected $prev = 0; | 
| 51 | 51 | |
| 52 | - /** | |
| 53 | - * @var int | |
| 54 | - */ | |
| 52 | + /** | |
| 53 | + * @var int | |
| 54 | + */ | |
| 55 | 55 | protected $last = 0; | 
| 56 | 56 | |
| 57 | - /** | |
| 58 | - * @var int | |
| 59 | - */ | |
| 57 | + /** | |
| 58 | + * @var int | |
| 59 | + */ | |
| 60 | 60 | protected $adjacentPages = 3; | 
| 61 | 61 | |
| 62 | - /** | |
| 63 | - * @var int | |
| 64 | - */ | |
| 62 | + /** | |
| 63 | + * @var int | |
| 64 | + */ | |
| 65 | 65 | protected $offsetEnd = 0; | 
| 66 | 66 | |
| 67 | - /** | |
| 68 | - * @var int | |
| 69 | - */ | |
| 67 | + /** | |
| 68 | + * @var int | |
| 69 | + */ | |
| 70 | 70 | protected $offsetStart = 0; | 
| 71 | 71 | |
| 72 | - /** | |
| 73 | - * @param int $totalItems The total amount of items available. | |
| 74 | - * @param int $itemsPerPage How many items to display per page. | |
| 75 | - * @param int $currentPage The current page number (1-based) | |
| 76 | - */ | |
| 72 | + /** | |
| 73 | + * @param int $totalItems The total amount of items available. | |
| 74 | + * @param int $itemsPerPage How many items to display per page. | |
| 75 | + * @param int $currentPage The current page number (1-based) | |
| 76 | + */ | |
| 77 | 77 | public function __construct(int $totalItems, int $itemsPerPage, int $currentPage) | 
| 78 | 78 |      { | 
| 79 | 79 | $this->total = $totalItems; | 
| @@ -83,34 +83,34 @@ discard block | ||
| 83 | 83 | $this->calculate(); | 
| 84 | 84 | } | 
| 85 | 85 | |
| 86 | - /** | |
| 87 | - * Sets the amount of adjacent pages to display next to the | |
| 88 | - * current one when using the pages list. | |
| 89 | - * | |
| 90 | - * @param int $amount | |
| 91 | - * @return PaginationHelper | |
| 92 | - */ | |
| 86 | + /** | |
| 87 | + * Sets the amount of adjacent pages to display next to the | |
| 88 | + * current one when using the pages list. | |
| 89 | + * | |
| 90 | + * @param int $amount | |
| 91 | + * @return PaginationHelper | |
| 92 | + */ | |
| 93 | 93 | public function setAdjacentPages(int $amount) : PaginationHelper | 
| 94 | 94 |      { | 
| 95 | 95 | $this->adjacentPages = $amount; | 
| 96 | 96 | return $this; | 
| 97 | 97 | } | 
| 98 | 98 | |
| 99 | - /** | |
| 100 | - * Whether there is a next page after the current page. | |
| 101 | - * @return bool | |
| 102 | - */ | |
| 99 | + /** | |
| 100 | + * Whether there is a next page after the current page. | |
| 101 | + * @return bool | |
| 102 | + */ | |
| 103 | 103 | public function hasNextPage() : bool | 
| 104 | 104 |      { | 
| 105 | 105 | return $this->next > 0; | 
| 106 | 106 | } | 
| 107 | 107 | |
| 108 | - /** | |
| 109 | - * The next page number. Returns the last page | |
| 110 | - * number if there is no next page. | |
| 111 | - * | |
| 112 | - * @return int | |
| 113 | - */ | |
| 108 | + /** | |
| 109 | + * The next page number. Returns the last page | |
| 110 | + * number if there is no next page. | |
| 111 | + * | |
| 112 | + * @return int | |
| 113 | + */ | |
| 114 | 114 | public function getNextPage() : int | 
| 115 | 115 |      { | 
| 116 | 116 |          if($this->next === 0) { | 
| @@ -120,21 +120,21 @@ discard block | ||
| 120 | 120 | return $this->next; | 
| 121 | 121 | } | 
| 122 | 122 | |
| 123 | - /** | |
| 124 | - * Whether there is a previous page before the current page. | |
| 125 | - * @return bool | |
| 126 | - */ | |
| 123 | + /** | |
| 124 | + * Whether there is a previous page before the current page. | |
| 125 | + * @return bool | |
| 126 | + */ | |
| 127 | 127 | public function hasPreviousPage() : bool | 
| 128 | 128 |      { | 
| 129 | 129 | return $this->prev > 0; | 
| 130 | 130 | } | 
| 131 | 131 | |
| 132 | - /** | |
| 133 | - * The previous page number. Returns the first page | |
| 134 | - * number if there is no previous page. | |
| 135 | - * | |
| 136 | - * @return int | |
| 137 | - */ | |
| 132 | + /** | |
| 133 | + * The previous page number. Returns the first page | |
| 134 | + * number if there is no previous page. | |
| 135 | + * | |
| 136 | + * @return int | |
| 137 | + */ | |
| 138 | 138 | public function getPreviousPage() : int | 
| 139 | 139 |      { | 
| 140 | 140 |          if($this->prev === 0) { | 
| @@ -144,21 +144,21 @@ discard block | ||
| 144 | 144 | return $this->prev; | 
| 145 | 145 | } | 
| 146 | 146 | |
| 147 | - /** | |
| 148 | - * Retrieves the last page number. | |
| 149 | - * @return int | |
| 150 | - */ | |
| 147 | + /** | |
| 148 | + * Retrieves the last page number. | |
| 149 | + * @return int | |
| 150 | + */ | |
| 151 | 151 | public function getLastPage() : int | 
| 152 | 152 |      { | 
| 153 | 153 | return $this->last; | 
| 154 | 154 | } | 
| 155 | 155 | |
| 156 | - /** | |
| 157 | - * Whether there is more than one page, i.e. whether | |
| 158 | - * pagination is required at all. | |
| 159 | - * | |
| 160 | - * @return bool | |
| 161 | - */ | |
| 156 | + /** | |
| 157 | + * Whether there is more than one page, i.e. whether | |
| 158 | + * pagination is required at all. | |
| 159 | + * | |
| 160 | + * @return bool | |
| 161 | + */ | |
| 162 | 162 | public function hasPages() : bool | 
| 163 | 163 |      { | 
| 164 | 164 | return $this->last > 1; | 
| @@ -169,12 +169,12 @@ discard block | ||
| 169 | 169 | return $this->current; | 
| 170 | 170 | } | 
| 171 | 171 | |
| 172 | - /** | |
| 173 | - * Retrieves a list of page numbers for a page | |
| 174 | - * navigator, to quickly jump between pages. | |
| 175 | - * | |
| 176 | - * @return int[] | |
| 177 | - */ | |
| 172 | + /** | |
| 173 | + * Retrieves a list of page numbers for a page | |
| 174 | + * navigator, to quickly jump between pages. | |
| 175 | + * | |
| 176 | + * @return int[] | |
| 177 | + */ | |
| 178 | 178 | public function getPageNumbers() : array | 
| 179 | 179 |      { | 
| 180 | 180 | $adjacent = $this->adjacentPages; | 
| @@ -250,66 +250,66 @@ discard block | ||
| 250 | 250 | return $numbers; | 
| 251 | 251 | } | 
| 252 | 252 | |
| 253 | - /** | |
| 254 | - * Whether the specified page number is the current page. | |
| 255 | - * | |
| 256 | - * @param int $pageNumber | |
| 257 | - * @return bool | |
| 258 | - */ | |
| 253 | + /** | |
| 254 | + * Whether the specified page number is the current page. | |
| 255 | + * | |
| 256 | + * @param int $pageNumber | |
| 257 | + * @return bool | |
| 258 | + */ | |
| 259 | 259 | public function isCurrentPage(int $pageNumber) : bool | 
| 260 | 260 |      { | 
| 261 | 261 | return $pageNumber === $this->current; | 
| 262 | 262 | } | 
| 263 | 263 | |
| 264 | - /** | |
| 265 | - * Retrieves the 1-based starting offset of | |
| 266 | - * items currently displayed in the page. | |
| 267 | - * | |
| 268 | - * Note: Use this to create a text like | |
| 269 | - * "showing entries x to y". | |
| 270 | - * | |
| 271 | - * @return int | |
| 272 | - * @see PaginationHelper::getOffsetEnd() | |
| 273 | - */ | |
| 264 | + /** | |
| 265 | + * Retrieves the 1-based starting offset of | |
| 266 | + * items currently displayed in the page. | |
| 267 | + * | |
| 268 | + * Note: Use this to create a text like | |
| 269 | + * "showing entries x to y". | |
| 270 | + * | |
| 271 | + * @return int | |
| 272 | + * @see PaginationHelper::getOffsetEnd() | |
| 273 | + */ | |
| 274 | 274 | public function getItemsStart() : int | 
| 275 | 275 |      { | 
| 276 | 276 | return $this->getOffsetStart() + 1; | 
| 277 | 277 | } | 
| 278 | 278 | |
| 279 | - /** | |
| 280 | - * Retrieves the 1-based ending offset of | |
| 281 | - * items currently displayed in the page. | |
| 282 | - * | |
| 283 | - * Note: Use this to create a text like | |
| 284 | - * "showing entries x to y". | |
| 285 | - * | |
| 286 | - * @return int | |
| 287 | - * @see PaginationHelper::getOffsetStart() | |
| 288 | - */ | |
| 279 | + /** | |
| 280 | + * Retrieves the 1-based ending offset of | |
| 281 | + * items currently displayed in the page. | |
| 282 | + * | |
| 283 | + * Note: Use this to create a text like | |
| 284 | + * "showing entries x to y". | |
| 285 | + * | |
| 286 | + * @return int | |
| 287 | + * @see PaginationHelper::getOffsetStart() | |
| 288 | + */ | |
| 289 | 289 | public function getItemsEnd() : int | 
| 290 | 290 |      { | 
| 291 | 291 | return $this->getOffsetEnd() + 1; | 
| 292 | 292 | } | 
| 293 | 293 | |
| 294 | - /** | |
| 295 | - * Retrieves the 0-based starting offset of | |
| 296 | - * items currently displayed in the page. | |
| 297 | - * | |
| 298 | - * @return int | |
| 299 | - * @see PaginationHelper::getItemsStart() | |
| 300 | - */ | |
| 294 | + /** | |
| 295 | + * Retrieves the 0-based starting offset of | |
| 296 | + * items currently displayed in the page. | |
| 297 | + * | |
| 298 | + * @return int | |
| 299 | + * @see PaginationHelper::getItemsStart() | |
| 300 | + */ | |
| 301 | 301 | public function getOffsetStart() : int | 
| 302 | 302 |      { | 
| 303 | 303 | return $this->offsetStart; | 
| 304 | 304 | } | 
| 305 | 305 | |
| 306 | - /** | |
| 307 | - * Retrieves the 0-based ending offset of | |
| 308 | - * items currently displayed in the page. | |
| 309 | - * | |
| 310 | - * @return int | |
| 311 | - * @see PaginationHelper::getItemsEnd() | |
| 312 | - */ | |
| 306 | + /** | |
| 307 | + * Retrieves the 0-based ending offset of | |
| 308 | + * items currently displayed in the page. | |
| 309 | + * | |
| 310 | + * @return int | |
| 311 | + * @see PaginationHelper::getItemsEnd() | |
| 312 | + */ | |
| 313 | 313 | public function getOffsetEnd() : int | 
| 314 | 314 |      { | 
| 315 | 315 | return $this->offsetEnd; | 
| @@ -113,7 +113,7 @@ discard block | ||
| 113 | 113 | */ | 
| 114 | 114 | public function getNextPage() : int | 
| 115 | 115 |      { | 
| 116 | -        if($this->next === 0) { | |
| 116 | +        if ($this->next === 0) { | |
| 117 | 117 | return $this->last; | 
| 118 | 118 | } | 
| 119 | 119 | |
| @@ -137,7 +137,7 @@ discard block | ||
| 137 | 137 | */ | 
| 138 | 138 | public function getPreviousPage() : int | 
| 139 | 139 |      { | 
| 140 | -        if($this->prev === 0) { | |
| 140 | +        if ($this->prev === 0) { | |
| 141 | 141 | return 1; | 
| 142 | 142 | } | 
| 143 | 143 | |
| @@ -182,7 +182,7 @@ discard block | ||
| 182 | 182 | // adjust the adjacent value if it exceeds the | 
| 183 | 183 | // total amount of pages | 
| 184 | 184 | $adjacentTotal = ($adjacent * 2) + 1; | 
| 185 | - if($adjacentTotal > $this->last) | |
| 185 | + if ($adjacentTotal > $this->last) | |
| 186 | 186 |          { | 
| 187 | 187 | $adjacent = (int)floor($this->last / 2); | 
| 188 | 188 | } | 
| @@ -195,13 +195,13 @@ discard block | ||
| 195 | 195 | $back = 0; | 
| 196 | 196 | $fwd = 0; | 
| 197 | 197 | |
| 198 | -        if($maxBack >= $adjacent) { | |
| 198 | +        if ($maxBack >= $adjacent) { | |
| 199 | 199 | $back = $adjacent; | 
| 200 | 200 |          } else { | 
| 201 | 201 | $back = $maxBack; | 
| 202 | 202 | } | 
| 203 | 203 | |
| 204 | -        if($maxFwd >= $adjacent)  { | |
| 204 | +        if ($maxFwd >= $adjacent) { | |
| 205 | 205 | $fwd = $adjacent; | 
| 206 | 206 |          } else { | 
| 207 | 207 | $fwd = $maxFwd; | 
| @@ -217,16 +217,16 @@ discard block | ||
| 217 | 217 | $fwd += $backDiff; | 
| 218 | 218 | $back += $fwdDiff; | 
| 219 | 219 | |
| 220 | -        if($fwd > $maxFwd) { $fwd = $maxFwd; } | |
| 221 | -        if($back > $maxBack) { $back = $maxBack; } | |
| 220 | +        if ($fwd > $maxFwd) { $fwd = $maxFwd; } | |
| 221 | +        if ($back > $maxBack) { $back = $maxBack; } | |
| 222 | 222 | |
| 223 | 223 | // calculate the first and last page in the list | 
| 224 | 224 | $prev = $this->current - $back; | 
| 225 | 225 | $next = $this->current + $fwd; | 
| 226 | 226 | |
| 227 | 227 | // failsafe so we stay within the bounds | 
| 228 | -        if($prev < 1) { $prev = 1; } | |
| 229 | -        if($next > $this->last) { $next = $this->last; } | |
| 228 | +        if ($prev < 1) { $prev = 1; } | |
| 229 | +        if ($next > $this->last) { $next = $this->last; } | |
| 230 | 230 | |
| 231 | 231 | // create and return the page numbers list | 
| 232 | 232 | $numbers = range($prev, $next); | 
| @@ -319,11 +319,11 @@ discard block | ||
| 319 | 319 |      { | 
| 320 | 320 | $pages = (int)ceil($this->total / $this->perPage); | 
| 321 | 321 | |
| 322 | - if($this->current < 1) | |
| 322 | + if ($this->current < 1) | |
| 323 | 323 |          { | 
| 324 | 324 | $this->current = 1; | 
| 325 | 325 | } | 
| 326 | - else if($this->current > $pages) | |
| 326 | + else if ($this->current > $pages) | |
| 327 | 327 |          { | 
| 328 | 328 | $this->current = $pages; | 
| 329 | 329 | } | 
| @@ -331,19 +331,19 @@ discard block | ||
| 331 | 331 | $this->last = $pages; | 
| 332 | 332 | |
| 333 | 333 | $nextPage = $this->current + 1; | 
| 334 | -        if($nextPage <= $pages) { | |
| 334 | +        if ($nextPage <= $pages) { | |
| 335 | 335 | $this->next = $nextPage; | 
| 336 | 336 | } | 
| 337 | 337 | |
| 338 | 338 | $prevPage = $this->current - 1; | 
| 339 | -        if($prevPage > 0) { | |
| 339 | +        if ($prevPage > 0) { | |
| 340 | 340 | $this->prev = $prevPage; | 
| 341 | 341 | } | 
| 342 | 342 | |
| 343 | 343 | $this->offsetStart = ($this->current - 1) * $this->perPage; | 
| 344 | 344 | |
| 345 | 345 | $this->offsetEnd = $this->offsetStart + $this->perPage; | 
| 346 | -        if($this->offsetEnd > ($this->total - 1)) { | |
| 346 | +        if ($this->offsetEnd > ($this->total - 1)) { | |
| 347 | 347 | $this->offsetEnd = ($this->total - 1); | 
| 348 | 348 | } | 
| 349 | 349 | } | 
| @@ -65,7 +65,7 @@ discard block | ||
| 65 | 65 |      { | 
| 66 | 66 | $this->isWindows = substr(PHP_OS, 0, 3) == 'WIN'; | 
| 67 | 67 | |
| 68 | -        if($this->isWindows) { | |
| 68 | +        if ($this->isWindows) { | |
| 69 | 69 | $this->normalize['from'] = '/'; | 
| 70 | 70 | $this->normalize['to'] = '\\'; | 
| 71 | 71 | } | 
| @@ -80,7 +80,7 @@ discard block | ||
| 80 | 80 | // | 
| 81 | 81 | // NOTE: In case of symlinks, this resolves the symlink to its source (WIN/NIX) | 
| 82 | 82 | $realPath = realpath($this->sourcePath); | 
| 83 | -        if(!is_dir($realPath)) { | |
| 83 | +        if (!is_dir($realPath)) { | |
| 84 | 84 | throw new SVNHelper_Exception( | 
| 85 | 85 | 'Local repository path does not exist', | 
| 86 | 86 | sprintf( | 
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 | $result = array(); | 
| 99 | 99 |          preg_match_all('%([^:]+):(.+)@(https|http|svn)://(.+)%sm', $repURL, $result, PREG_PATTERN_ORDER); | 
| 100 | 100 | |
| 101 | -        if(!isset($result[1]) || !isset($result[1][0])) { | |
| 101 | +        if (!isset($result[1]) || !isset($result[1][0])) { | |
| 102 | 102 | throw new SVNHelper_Exception( | 
| 103 | 103 | 'Invalid SVN repository URL', | 
| 104 | 104 | 'The SVN URL must have the following format: [username:password@http://domain.com/path/to/rep].', | 
| @@ -131,18 +131,18 @@ discard block | ||
| 131 | 131 | * @throws SVNHelper_Exception | 
| 132 | 132 | * @return string | 
| 133 | 133 | */ | 
| 134 | - public function normalizePath($path, $relativize=false) | |
| 134 | + public function normalizePath($path, $relativize = false) | |
| 135 | 135 |      { | 
| 136 | -        if(empty($path)) { | |
| 136 | +        if (empty($path)) { | |
| 137 | 137 | return ''; | 
| 138 | 138 | } | 
| 139 | 139 | |
| 140 | - if($relativize) | |
| 140 | + if ($relativize) | |
| 141 | 141 |          { | 
| 142 | 142 | $path = $this->normalizePath($path); | 
| 143 | 143 | |
| 144 | 144 | // path is absolute, and does not match the realpath or the source path? | 
| 145 | -            if(strstr($path, ':'.$this->getSlash()) && (!stristr($path, $this->path) && !stristr($path, $this->sourcePath))) { | |
| 145 | +            if (strstr($path, ':'.$this->getSlash()) && (!stristr($path, $this->path) && !stristr($path, $this->sourcePath))) { | |
| 146 | 146 | throw new SVNHelper_Exception( | 
| 147 | 147 | 'Cannot relativize path outside of repository', | 
| 148 | 148 | sprintf( | 
| @@ -223,14 +223,14 @@ discard block | ||
| 223 | 223 | */ | 
| 224 | 224 | protected function filterPath($path) | 
| 225 | 225 |      { | 
| 226 | -        if(empty($path)) { | |
| 226 | +        if (empty($path)) { | |
| 227 | 227 | return ''; | 
| 228 | 228 | } | 
| 229 | 229 | |
| 230 | 230 | $path = $this->getPath().'/'.$this->relativizePath($path); | 
| 231 | 231 | |
| 232 | 232 | $real = realpath($path); | 
| 233 | -        if($real !== false) { | |
| 233 | +        if ($real !== false) { | |
| 234 | 234 | return $real; | 
| 235 | 235 | } | 
| 236 | 236 | |
| @@ -257,13 +257,13 @@ discard block | ||
| 257 | 257 | $key = $type.':'.$relativePath; | 
| 258 | 258 | |
| 259 | 259 | $relativePath = $this->normalizePath($relativePath, true); | 
| 260 | -        if(isset($this->targets[$key])) { | |
| 260 | +        if (isset($this->targets[$key])) { | |
| 261 | 261 | return $this->targets[$key]; | 
| 262 | 262 | } | 
| 263 | 263 | |
| 264 | 264 | $target = null; | 
| 265 | 265 | |
| 266 | - switch($type) | |
| 266 | + switch ($type) | |
| 267 | 267 |          { | 
| 268 | 268 | case 'File': | 
| 269 | 269 | $target = new SVNHelper_Target_File($this, $relativePath); | 
| @@ -396,7 +396,7 @@ discard block | ||
| 396 | 396 | */ | 
| 397 | 397 | public function addFolder($path) | 
| 398 | 398 |      { | 
| 399 | -        if(is_dir($path)) { | |
| 399 | +        if (is_dir($path)) { | |
| 400 | 400 | return $this->getFolder($path); | 
| 401 | 401 | } | 
| 402 | 402 | |
| @@ -404,12 +404,12 @@ discard block | ||
| 404 | 404 | $tokens = explode($this->getSlash(), $path); | 
| 405 | 405 | |
| 406 | 406 | $target = $this->path; | 
| 407 | - foreach($tokens as $folder) | |
| 407 | + foreach ($tokens as $folder) | |
| 408 | 408 |          { | 
| 409 | 409 | $target .= $this->getSlash().$folder; | 
| 410 | - if(file_exists($target)) | |
| 410 | + if (file_exists($target)) | |
| 411 | 411 |              { | 
| 412 | -                if(!is_dir($target)) { | |
| 412 | +                if (!is_dir($target)) { | |
| 413 | 413 | throw new SVNHelper_Exception( | 
| 414 | 414 | 'Target folder is a file', | 
| 415 | 415 | sprintf( | 
| @@ -423,7 +423,7 @@ discard block | ||
| 423 | 423 | continue; | 
| 424 | 424 | } | 
| 425 | 425 | |
| 426 | -            if(!mkdir($target, 0777)) { | |
| 426 | +            if (!mkdir($target, 0777)) { | |
| 427 | 427 | throw new SVNHelper_Exception( | 
| 428 | 428 | 'Cannot create folder', | 
| 429 | 429 | sprintf( | 
| @@ -453,7 +453,7 @@ discard block | ||
| 453 | 453 | */ | 
| 454 | 454 | public static function setLogCallback($callback) | 
| 455 | 455 |      { | 
| 456 | -        if(!is_callable($callback)) { | |
| 456 | +        if (!is_callable($callback)) { | |
| 457 | 457 | throw new SVNHelper_Exception( | 
| 458 | 458 | 'Not a valid logging callback', | 
| 459 | 459 | 'The specified argument is not callable.', | 
| @@ -466,7 +466,7 @@ discard block | ||
| 466 | 466 | |
| 467 | 467 | public static function log($message) | 
| 468 | 468 |      { | 
| 469 | -        if(isset(self::$logCallback)) { | |
| 469 | +        if (isset(self::$logCallback)) { | |
| 470 | 470 | call_user_func(self::$logCallback, 'SVNHelper | '.$message); | 
| 471 | 471 | } | 
| 472 | 472 | } | 
| @@ -23,101 +23,101 @@ discard block | ||
| 23 | 23 | */ | 
| 24 | 24 | class SVNHelper | 
| 25 | 25 |  { | 
| 26 | - /** | |
| 27 | - * @var integer | |
| 28 | - */ | |
| 26 | + /** | |
| 27 | + * @var integer | |
| 28 | + */ | |
| 29 | 29 | public const ERROR_LOCAL_PATH_DOES_NOT_EXIST = 22401; | 
| 30 | 30 | |
| 31 | - /** | |
| 32 | - * @var integer | |
| 33 | - */ | |
| 31 | + /** | |
| 32 | + * @var integer | |
| 33 | + */ | |
| 34 | 34 | public const ERROR_INVALID_REP_URL = 22402; | 
| 35 | 35 | |
| 36 | - /** | |
| 37 | - * @var integer | |
| 38 | - */ | |
| 36 | + /** | |
| 37 | + * @var integer | |
| 38 | + */ | |
| 39 | 39 | public const ERROR_PATH_IS_OUTSIDE_REPOSITORY = 22403; | 
| 40 | 40 | |
| 41 | - /** | |
| 42 | - * @var integer | |
| 43 | - */ | |
| 41 | + /** | |
| 42 | + * @var integer | |
| 43 | + */ | |
| 44 | 44 | public const ERROR_TARGET_FOLDER_IS_A_FILE = 22404; | 
| 45 | 45 | |
| 46 | - /** | |
| 47 | - * @var integer | |
| 48 | - */ | |
| 46 | + /** | |
| 47 | + * @var integer | |
| 48 | + */ | |
| 49 | 49 | public const ERROR_CANNOT_ADD_INEXISTENT_FILE = 22405; | 
| 50 | 50 | |
| 51 | - /** | |
| 52 | - * @var integer | |
| 53 | - */ | |
| 51 | + /** | |
| 52 | + * @var integer | |
| 53 | + */ | |
| 54 | 54 | public const ERROR_TARGET_PATH_NOT_FOUND = 22406; | 
| 55 | 55 | |
| 56 | - /** | |
| 57 | - * @var integer | |
| 58 | - */ | |
| 56 | + /** | |
| 57 | + * @var integer | |
| 58 | + */ | |
| 59 | 59 | public const ERROR_INVALID_TARGET_TYPE = 22407; | 
| 60 | 60 | |
| 61 | - /** | |
| 62 | - * @var integer | |
| 63 | - */ | |
| 61 | + /** | |
| 62 | + * @var integer | |
| 63 | + */ | |
| 64 | 64 | public const ERROR_INVALID_LOG_CALLBACK = 22408; | 
| 65 | 65 | |
| 66 | - /** | |
| 67 | - * @var SVNHelper_Target_Folder | |
| 68 | - */ | |
| 66 | + /** | |
| 67 | + * @var SVNHelper_Target_Folder | |
| 68 | + */ | |
| 69 | 69 | protected $target; | 
| 70 | 70 | |
| 71 | - /** | |
| 72 | - * @var string | |
| 73 | - */ | |
| 71 | + /** | |
| 72 | + * @var string | |
| 73 | + */ | |
| 74 | 74 | protected $path; | 
| 75 | 75 | |
| 76 | - /** | |
| 77 | - * @var string | |
| 78 | - */ | |
| 76 | + /** | |
| 77 | + * @var string | |
| 78 | + */ | |
| 79 | 79 | protected $url; | 
| 80 | 80 | |
| 81 | - /** | |
| 82 | - * @var string | |
| 83 | - */ | |
| 81 | + /** | |
| 82 | + * @var string | |
| 83 | + */ | |
| 84 | 84 | protected $user; | 
| 85 | 85 | |
| 86 | - /** | |
| 87 | - * @var string | |
| 88 | - */ | |
| 86 | + /** | |
| 87 | + * @var string | |
| 88 | + */ | |
| 89 | 89 | protected $pass; | 
| 90 | 90 | |
| 91 | - /** | |
| 92 | - * @var array | |
| 93 | - */ | |
| 91 | + /** | |
| 92 | + * @var array | |
| 93 | + */ | |
| 94 | 94 | protected $options = array( | 
| 95 | 95 | 'binaries-path' => '' | 
| 96 | 96 | ); | 
| 97 | 97 | |
| 98 | - /** | |
| 99 | - * @var boolean | |
| 100 | - */ | |
| 98 | + /** | |
| 99 | + * @var boolean | |
| 100 | + */ | |
| 101 | 101 | protected $isWindows = false; | 
| 102 | 102 | |
| 103 | - /** | |
| 104 | - * @var array | |
| 105 | - */ | |
| 103 | + /** | |
| 104 | + * @var array | |
| 105 | + */ | |
| 106 | 106 | protected $normalize = array( | 
| 107 | 107 | 'from' => '\\', | 
| 108 | 108 | 'to' => '/' | 
| 109 | 109 | ); | 
| 110 | 110 | |
| 111 | - /** | |
| 112 | - * @var string | |
| 113 | - */ | |
| 111 | + /** | |
| 112 | + * @var string | |
| 113 | + */ | |
| 114 | 114 | protected $sourcePath; | 
| 115 | 115 | |
| 116 | - /** | |
| 117 | - * @param string $repPath The path to the repository | |
| 118 | - * @param string $repURL The SVN URL to the repository | |
| 119 | - * @throws SVNHelper_Exception | |
| 120 | - */ | |
| 116 | + /** | |
| 117 | + * @param string $repPath The path to the repository | |
| 118 | + * @param string $repURL The SVN URL to the repository | |
| 119 | + * @throws SVNHelper_Exception | |
| 120 | + */ | |
| 121 | 121 | public function __construct(string $repPath, string $repURL) | 
| 122 | 122 |      { | 
| 123 | 123 | $this->isWindows = substr(PHP_OS, 0, 3) == 'WIN'; | 
| @@ -178,16 +178,16 @@ discard block | ||
| 178 | 178 | return $this->pass; | 
| 179 | 179 | } | 
| 180 | 180 | |
| 181 | - /** | |
| 182 | - * Normalizes slashes in the path according to the | |
| 183 | - * operating system, i.e. forward slashes for NIX-systems | |
| 184 | - * and backward slashes for Windows. | |
| 185 | - * | |
| 186 | - * @param string $path An absolute path to normalize | |
| 187 | - * @param bool $relativize Whether to return a path relative to the repository | |
| 188 | - * @throws SVNHelper_Exception | |
| 189 | - * @return string | |
| 190 | - */ | |
| 181 | + /** | |
| 182 | + * Normalizes slashes in the path according to the | |
| 183 | + * operating system, i.e. forward slashes for NIX-systems | |
| 184 | + * and backward slashes for Windows. | |
| 185 | + * | |
| 186 | + * @param string $path An absolute path to normalize | |
| 187 | + * @param bool $relativize Whether to return a path relative to the repository | |
| 188 | + * @throws SVNHelper_Exception | |
| 189 | + * @return string | |
| 190 | + */ | |
| 191 | 191 | public function normalizePath($path, $relativize=false) | 
| 192 | 192 |      { | 
| 193 | 193 |          if(empty($path)) { | 
| @@ -222,32 +222,32 @@ discard block | ||
| 222 | 222 | ); | 
| 223 | 223 | } | 
| 224 | 224 | |
| 225 | - /** | |
| 226 | - * Retrieves the path slash style according to the | |
| 227 | - * current operating system. | |
| 228 | - * | |
| 229 | - * @return string | |
| 230 | - */ | |
| 225 | + /** | |
| 226 | + * Retrieves the path slash style according to the | |
| 227 | + * current operating system. | |
| 228 | + * | |
| 229 | + * @return string | |
| 230 | + */ | |
| 231 | 231 | public function getSlash() | 
| 232 | 232 |      { | 
| 233 | 233 | return $this->normalize['to']; | 
| 234 | 234 | } | 
| 235 | 235 | |
| 236 | - /** | |
| 237 | - * Keeps instances of files. | |
| 238 | - * @var SVNHelper_Target[] | |
| 239 | - */ | |
| 236 | + /** | |
| 237 | + * Keeps instances of files. | |
| 238 | + * @var SVNHelper_Target[] | |
| 239 | + */ | |
| 240 | 240 | protected $targets = array(); | 
| 241 | 241 | |
| 242 | - /** | |
| 243 | - * Retrieves a file instance from the SVN repository: | |
| 244 | - * this allows all possible operations on the file as | |
| 245 | - * well as accessing more information on it. | |
| 246 | - * | |
| 247 | - * @param string $path A path to the file, relative to the repository path or absolute. | |
| 248 | - * @return SVNHelper_Target_File | |
| 249 | - * @throws SVNHelper_Exception | |
| 250 | - */ | |
| 242 | + /** | |
| 243 | + * Retrieves a file instance from the SVN repository: | |
| 244 | + * this allows all possible operations on the file as | |
| 245 | + * well as accessing more information on it. | |
| 246 | + * | |
| 247 | + * @param string $path A path to the file, relative to the repository path or absolute. | |
| 248 | + * @return SVNHelper_Target_File | |
| 249 | + * @throws SVNHelper_Exception | |
| 250 | + */ | |
| 251 | 251 | public function getFile(string $path) : SVNHelper_Target_File | 
| 252 | 252 |      { | 
| 253 | 253 | $path = $this->filterPath($path); | 
| @@ -256,15 +256,15 @@ discard block | ||
| 256 | 256 | ->requireIsFile(); | 
| 257 | 257 | } | 
| 258 | 258 | |
| 259 | - /** | |
| 260 | - * Retrieves a folder instance from the SVN repository: | |
| 261 | - * This allows all possible operations on the folder as | |
| 262 | - * well as accessing more information on it. | |
| 263 | - * | |
| 264 | - * @param string $path | |
| 265 | - * @return SVNHelper_Target_Folder | |
| 266 | - * @throws SVNHelper_Exception | |
| 267 | - */ | |
| 259 | + /** | |
| 260 | + * Retrieves a folder instance from the SVN repository: | |
| 261 | + * This allows all possible operations on the folder as | |
| 262 | + * well as accessing more information on it. | |
| 263 | + * | |
| 264 | + * @param string $path | |
| 265 | + * @return SVNHelper_Target_Folder | |
| 266 | + * @throws SVNHelper_Exception | |
| 267 | + */ | |
| 268 | 268 | public function getFolder(string $path) : SVNHelper_Target_Folder | 
| 269 | 269 |      { | 
| 270 | 270 | $path = $this->filterPath($path); | 
| @@ -273,13 +273,13 @@ discard block | ||
| 273 | 273 | ->requireIsFolder(); | 
| 274 | 274 | } | 
| 275 | 275 | |
| 276 | - /** | |
| 277 | - * Passes the path through realpath and ensures it exists. | |
| 278 | - * | |
| 279 | - * @param string $path | |
| 280 | - * @throws SVNHelper_Exception | |
| 281 | - * @return string | |
| 282 | - */ | |
| 276 | + /** | |
| 277 | + * Passes the path through realpath and ensures it exists. | |
| 278 | + * | |
| 279 | + * @param string $path | |
| 280 | + * @throws SVNHelper_Exception | |
| 281 | + * @return string | |
| 282 | + */ | |
| 283 | 283 | protected function filterPath($path) | 
| 284 | 284 |      { | 
| 285 | 285 |          if(empty($path)) { | 
| @@ -304,13 +304,13 @@ discard block | ||
| 304 | 304 | ); | 
| 305 | 305 | } | 
| 306 | 306 | |
| 307 | - /** | |
| 308 | - * Retrieves a target file or folder within the repository. | |
| 309 | - * | |
| 310 | - * @param string $type The target type, "File" or "Folder". | |
| 311 | - * @param string $relativePath A path relative to the root folder. | |
| 312 | - * @return SVNHelper_Target | |
| 313 | - */ | |
| 307 | + /** | |
| 308 | + * Retrieves a target file or folder within the repository. | |
| 309 | + * | |
| 310 | + * @param string $type The target type, "File" or "Folder". | |
| 311 | + * @param string $relativePath A path relative to the root folder. | |
| 312 | + * @return SVNHelper_Target | |
| 313 | + */ | |
| 314 | 314 | protected function getTarget(string $type, string $relativePath) : SVNHelper_Target | 
| 315 | 315 |      { | 
| 316 | 316 | $key = $type.':'.$relativePath; | 
| @@ -358,33 +358,33 @@ discard block | ||
| 358 | 358 | return $this->url; | 
| 359 | 359 | } | 
| 360 | 360 | |
| 361 | - /** | |
| 362 | - * Updates the whole SVN repository from the root folder. | |
| 363 | - * @return SVNHelper_CommandResult | |
| 364 | - */ | |
| 361 | + /** | |
| 362 | + * Updates the whole SVN repository from the root folder. | |
| 363 | + * @return SVNHelper_CommandResult | |
| 364 | + */ | |
| 365 | 365 | public function runUpdate() | 
| 366 | 366 |      { | 
| 367 | 367 | return $this->createUpdate($this->target)->execute(); | 
| 368 | 368 | } | 
| 369 | 369 | |
| 370 | - /** | |
| 371 | - * Creates an update command for the target file or folder. | |
| 372 | - * This can be configured further before it is executed. | |
| 373 | - * | |
| 374 | - * @param SVNHelper_Target $target | |
| 375 | - * @return SVNHelper_Command_Update | |
| 376 | - */ | |
| 370 | + /** | |
| 371 | + * Creates an update command for the target file or folder. | |
| 372 | + * This can be configured further before it is executed. | |
| 373 | + * | |
| 374 | + * @param SVNHelper_Target $target | |
| 375 | + * @return SVNHelper_Command_Update | |
| 376 | + */ | |
| 377 | 377 | public function createUpdate(SVNHelper_Target $target) | 
| 378 | 378 |      { | 
| 379 | 379 |          return $this->createCommand('Update', $target); | 
| 380 | 380 | } | 
| 381 | 381 | |
| 382 | - /** | |
| 383 | - * Creates an add command for the targt file or folder. | |
| 384 | - * | |
| 385 | - * @param SVNHelper_Target $target | |
| 386 | - * @return SVNHelper_Command_Add | |
| 387 | - */ | |
| 382 | + /** | |
| 383 | + * Creates an add command for the targt file or folder. | |
| 384 | + * | |
| 385 | + * @param SVNHelper_Target $target | |
| 386 | + * @return SVNHelper_Command_Add | |
| 387 | + */ | |
| 388 | 388 | public function createAdd(SVNHelper_Target $target) | 
| 389 | 389 |      { | 
| 390 | 390 |          return $this->createCommand('Add', $target); | 
| @@ -401,12 +401,12 @@ discard block | ||
| 401 | 401 |          return $this->createCommand('Info', $target); | 
| 402 | 402 | } | 
| 403 | 403 | |
| 404 | - /** | |
| 405 | - * Creates a status command for the target file or folder. | |
| 406 | - * | |
| 407 | - * @param SVNHelper_Target $target | |
| 408 | - * @return SVNHelper_Command_Status | |
| 409 | - */ | |
| 404 | + /** | |
| 405 | + * Creates a status command for the target file or folder. | |
| 406 | + * | |
| 407 | + * @param SVNHelper_Target $target | |
| 408 | + * @return SVNHelper_Command_Status | |
| 409 | + */ | |
| 410 | 410 | public function createStatus(SVNHelper_Target $target) | 
| 411 | 411 |      { | 
| 412 | 412 |          return $this->createCommand('Status', $target); | 
| @@ -431,28 +431,28 @@ discard block | ||
| 431 | 431 | return $cmd; | 
| 432 | 432 | } | 
| 433 | 433 | |
| 434 | - /** | |
| 435 | - * Creates a path relative to the repository for the target | |
| 436 | - * file or folder, from an absolute path. | |
| 437 | - * | |
| 438 | - * @param string $path An absolute path. | |
| 439 | - * @return string | |
| 440 | - */ | |
| 434 | + /** | |
| 435 | + * Creates a path relative to the repository for the target | |
| 436 | + * file or folder, from an absolute path. | |
| 437 | + * | |
| 438 | + * @param string $path An absolute path. | |
| 439 | + * @return string | |
| 440 | + */ | |
| 441 | 441 | public function relativizePath($path) | 
| 442 | 442 |      { | 
| 443 | 443 | return $this->normalizePath($path, true); | 
| 444 | 444 | } | 
| 445 | 445 | |
| 446 | - /** | |
| 447 | - * Adds a folder: creates it as necessary (recursive), | |
| 448 | - * and adds it to be committed if it is not versioned yet. | |
| 449 | -    * Use this instead of {@link getFolder()} when you are | |
| 450 | - * not sure that it exists yet, and will need it. | |
| 451 | - * | |
| 452 | - * @param string $path Absolute or relative path to the folder | |
| 453 | - * @throws SVNHelper_Exception | |
| 454 | - * @return SVNHelper_Target_Folder | |
| 455 | - */ | |
| 446 | + /** | |
| 447 | + * Adds a folder: creates it as necessary (recursive), | |
| 448 | + * and adds it to be committed if it is not versioned yet. | |
| 449 | +     * Use this instead of {@link getFolder()} when you are | |
| 450 | + * not sure that it exists yet, and will need it. | |
| 451 | + * | |
| 452 | + * @param string $path Absolute or relative path to the folder | |
| 453 | + * @throws SVNHelper_Exception | |
| 454 | + * @return SVNHelper_Target_Folder | |
| 455 | + */ | |
| 456 | 456 | public function addFolder($path) | 
| 457 | 457 |      { | 
| 458 | 458 |          if(is_dir($path)) { | 
| @@ -502,14 +502,14 @@ discard block | ||
| 502 | 502 | |
| 503 | 503 | protected static $logCallback; | 
| 504 | 504 | |
| 505 | - /** | |
| 506 | - * Sets the callback function/method to use for | |
| 507 | - * SVH helper log messages. This gets the message | |
| 508 | - * and the SVNHelper instance as parameters. | |
| 509 | - * | |
| 510 | - * @param callable $callback | |
| 511 | - * @throws SVNHelper_Exception | |
| 512 | - */ | |
| 505 | + /** | |
| 506 | + * Sets the callback function/method to use for | |
| 507 | + * SVH helper log messages. This gets the message | |
| 508 | + * and the SVNHelper instance as parameters. | |
| 509 | + * | |
| 510 | + * @param callable $callback | |
| 511 | + * @throws SVNHelper_Exception | |
| 512 | + */ | |
| 513 | 513 | public static function setLogCallback($callback) | 
| 514 | 514 |      { | 
| 515 | 515 |          if(!is_callable($callback)) { | 
| @@ -530,22 +530,22 @@ discard block | ||
| 530 | 530 | } | 
| 531 | 531 | } | 
| 532 | 532 | |
| 533 | - /** | |
| 534 | - * Retrieves information about the file, and adds it | |
| 535 | - * to be committed later if it not versioned yet. | |
| 536 | - * | |
| 537 | - * @param string $path | |
| 538 | - * @return SVNHelper_Target_File | |
| 539 | - */ | |
| 533 | + /** | |
| 534 | + * Retrieves information about the file, and adds it | |
| 535 | + * to be committed later if it not versioned yet. | |
| 536 | + * | |
| 537 | + * @param string $path | |
| 538 | + * @return SVNHelper_Target_File | |
| 539 | + */ | |
| 540 | 540 | public function addFile($path) | 
| 541 | 541 |      { | 
| 542 | 542 | return $this->getFile($path)->runAdd(); | 
| 543 | 543 | } | 
| 544 | 544 | |
| 545 | - /** | |
| 546 | - * Commits all changes in the repository. | |
| 547 | - * @param string $message The commit message to log. | |
| 548 | - */ | |
| 545 | + /** | |
| 546 | + * Commits all changes in the repository. | |
| 547 | + * @param string $message The commit message to log. | |
| 548 | + */ | |
| 549 | 549 | public function runCommit($message) | 
| 550 | 550 |      { | 
| 551 | 551 | $this->createCommit($this->getFolder($this->path), $message)->execute(); | 
| @@ -17,7 +17,7 @@ discard block | ||
| 17 | 17 | |
| 18 | 18 | protected $logging = true; | 
| 19 | 19 | |
| 20 | - public function __construct($message, $details=null, $code=null, $previous=null) | |
| 20 | + public function __construct($message, $details = null, $code = null, $previous = null) | |
| 21 | 21 |      { | 
| 22 | 22 | parent::__construct($message, $details, $code, $previous); | 
| 23 | 23 | |
| @@ -31,17 +31,17 @@ discard block | ||
| 31 | 31 | |
| 32 | 32 | public function __destruct() | 
| 33 | 33 |      { | 
| 34 | -        if(!$this->logging) { | |
| 34 | +        if (!$this->logging) { | |
| 35 | 35 | return; | 
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 | $loggers = SVNHelper::getExceptionLoggers(); | 
| 39 | 39 | |
| 40 | -        if(empty($loggers)) { | |
| 40 | +        if (empty($loggers)) { | |
| 41 | 41 | return; | 
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | -        foreach($loggers as $callback) { | |
| 44 | +        foreach ($loggers as $callback) { | |
| 45 | 45 | call_user_func($callback, $this); | 
| 46 | 46 | } | 
| 47 | 47 | } | 
| @@ -76,10 +76,10 @@ discard block | ||
| 76 | 76 | return $this instanceof SVNHelper_Target_Folder; | 
| 77 | 77 | } | 
| 78 | 78 | |
| 79 | - /** | |
| 80 | - * Runs an update of the file or folder. | |
| 81 | - * @return SVNHelper_Command_Update | |
| 82 | - */ | |
| 79 | + /** | |
| 80 | + * Runs an update of the file or folder. | |
| 81 | + * @return SVNHelper_Command_Update | |
| 82 | + */ | |
| 83 | 83 | public function runUpdate() | 
| 84 | 84 |      { | 
| 85 | 85 | $cmd = $this->createUpdate(); | 
| @@ -88,55 +88,55 @@ discard block | ||
| 88 | 88 | return $cmd; | 
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | - /** | |
| 92 | - * Creates an update command instance for the target file or folder. | |
| 93 | - * @return SVNHelper_Command_Update | |
| 94 | - */ | |
| 91 | + /** | |
| 92 | + * Creates an update command instance for the target file or folder. | |
| 93 | + * @return SVNHelper_Command_Update | |
| 94 | + */ | |
| 95 | 95 | public function createUpdate() | 
| 96 | 96 |      { | 
| 97 | 97 | return $this->helper->createUpdate($this); | 
| 98 | 98 | } | 
| 99 | 99 | |
| 100 | - /** | |
| 101 | - * Creates a status command instance for the target file or folder. | |
| 102 | - * @return SVNHelper_Command_Status | |
| 103 | - */ | |
| 100 | + /** | |
| 101 | + * Creates a status command instance for the target file or folder. | |
| 102 | + * @return SVNHelper_Command_Status | |
| 103 | + */ | |
| 104 | 104 | public function createStatus() | 
| 105 | 105 |      { | 
| 106 | 106 | return $this->helper->createStatus($this); | 
| 107 | 107 | } | 
| 108 | 108 | |
| 109 | - /** | |
| 110 | - * Creates an info command instance for the target file or folder. | |
| 111 | - * @return SVNHelper_Command_Info | |
| 112 | - */ | |
| 109 | + /** | |
| 110 | + * Creates an info command instance for the target file or folder. | |
| 111 | + * @return SVNHelper_Command_Info | |
| 112 | + */ | |
| 113 | 113 | public function createInfo() | 
| 114 | 114 |      { | 
| 115 | 115 | return $this->helper->createInfo($this); | 
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | - /** | |
| 119 | - * Creates a commit command instance for the target file or folder. | |
| 120 | - * @param string $message | |
| 121 | - * @return SVNHelper_Command_Commit | |
| 122 | - */ | |
| 118 | + /** | |
| 119 | + * Creates a commit command instance for the target file or folder. | |
| 120 | + * @param string $message | |
| 121 | + * @return SVNHelper_Command_Commit | |
| 122 | + */ | |
| 123 | 123 | public function createCommit($message) | 
| 124 | 124 |      { | 
| 125 | 125 | return $this->helper->createCommit($this, $message); | 
| 126 | 126 | } | 
| 127 | 127 | |
| 128 | - /** | |
| 129 | - * Creates an add command instance for the target file or folder. | |
| 130 | - * @return SVNHelper_Command_Add | |
| 131 | - */ | |
| 128 | + /** | |
| 129 | + * Creates an add command instance for the target file or folder. | |
| 130 | + * @return SVNHelper_Command_Add | |
| 131 | + */ | |
| 132 | 132 | public function createAdd() | 
| 133 | 133 |      { | 
| 134 | 134 | return $this->helper->createAdd($this); | 
| 135 | 135 | } | 
| 136 | 136 | |
| 137 | - /** | |
| 138 | - * @return SVNHelper_Command_Status | |
| 139 | - */ | |
| 137 | + /** | |
| 138 | + * @return SVNHelper_Command_Status | |
| 139 | + */ | |
| 140 | 140 | public function getStatus() | 
| 141 | 141 |      { | 
| 142 | 142 | $cmd = $this->createStatus(); | 
| @@ -154,10 +154,10 @@ discard block | ||
| 154 | 154 | return $this; | 
| 155 | 155 | } | 
| 156 | 156 | |
| 157 | - /** | |
| 158 | - * Whether the target is versioned or needs to be added. | |
| 159 | - * @return boolean | |
| 160 | - */ | |
| 157 | + /** | |
| 158 | + * Whether the target is versioned or needs to be added. | |
| 159 | + * @return boolean | |
| 160 | + */ | |
| 161 | 161 | public function isVersioned() | 
| 162 | 162 |      { | 
| 163 | 163 | return $this->getInfo()->isVersioned(); | 
| @@ -170,10 +170,10 @@ discard block | ||
| 170 | 170 | $this->cache = array(); | 
| 171 | 171 | } | 
| 172 | 172 | |
| 173 | - /** | |
| 174 | - * Retrieves information on the target. | |
| 175 | - * @return SVNHelper_Command_Info | |
| 176 | - */ | |
| 173 | + /** | |
| 174 | + * Retrieves information on the target. | |
| 175 | + * @return SVNHelper_Command_Info | |
| 176 | + */ | |
| 177 | 177 | public function getInfo() | 
| 178 | 178 |      { | 
| 179 | 179 |          if(!isset($this->cache['info'])) { | 
| @@ -183,15 +183,15 @@ discard block | ||
| 183 | 183 | return $this->cache['info']; | 
| 184 | 184 | } | 
| 185 | 185 | |
| 186 | - /** | |
| 187 | - * Commits the target file or folder. If it has | |
| 188 | - * not been added to the repository yet, it is | |
| 189 | - * added automatically beforehand. If it does | |
| 190 | - * not need to be committed, no changes are made. | |
| 191 | - * | |
| 192 | - * @param string $message | |
| 193 | - * @return SVNHelper_Target | |
| 194 | - */ | |
| 186 | + /** | |
| 187 | + * Commits the target file or folder. If it has | |
| 188 | + * not been added to the repository yet, it is | |
| 189 | + * added automatically beforehand. If it does | |
| 190 | + * not need to be committed, no changes are made. | |
| 191 | + * | |
| 192 | + * @param string $message | |
| 193 | + * @return SVNHelper_Target | |
| 194 | + */ | |
| 195 | 195 | public function runCommit($message) | 
| 196 | 196 |      { | 
| 197 | 197 |          if(!$this->isVersioned()) { | 
| @@ -20,7 +20,7 @@ discard block | ||
| 20 | 20 | $this->url = $this->helper->getURL().'/'.$this->relativePath; | 
| 21 | 21 | |
| 22 | 22 | $path = $this->helper->getPath(); | 
| 23 | -        if(!empty($relativePath)) { | |
| 23 | +        if (!empty($relativePath)) { | |
| 24 | 24 | $path .= $this->helper->getSlash().$this->relativePath; | 
| 25 | 25 | } | 
| 26 | 26 | |
| @@ -30,7 +30,7 @@ discard block | ||
| 30 | 30 | // this is relevant). | 
| 31 | 31 | $this->path = realpath($path); | 
| 32 | 32 | |
| 33 | -        if(!$this->path || !file_exists($this->path)) { | |
| 33 | +        if (!$this->path || !file_exists($this->path)) { | |
| 34 | 34 | throw new SVNHelper_Exception( | 
| 35 | 35 | 'File not found', | 
| 36 | 36 | sprintf( | 
| @@ -138,7 +138,7 @@ discard block | ||
| 138 | 138 | |
| 139 | 139 | public function runAdd() | 
| 140 | 140 |      { | 
| 141 | -        if(!$this->isVersioned()) { | |
| 141 | +        if (!$this->isVersioned()) { | |
| 142 | 142 | $this->createAdd()->execute(); | 
| 143 | 143 | $this->clearCache(); | 
| 144 | 144 | } | 
| @@ -168,7 +168,7 @@ discard block | ||
| 168 | 168 | */ | 
| 169 | 169 | public function getInfo() | 
| 170 | 170 |      { | 
| 171 | -        if(!isset($this->cache['info'])) { | |
| 171 | +        if (!isset($this->cache['info'])) { | |
| 172 | 172 | $this->cache['info'] = $this->helper->createInfo($this); | 
| 173 | 173 | } | 
| 174 | 174 | |
| @@ -186,12 +186,12 @@ discard block | ||
| 186 | 186 | */ | 
| 187 | 187 | public function runCommit($message) | 
| 188 | 188 |      { | 
| 189 | -        if(!$this->isVersioned()) { | |
| 189 | +        if (!$this->isVersioned()) { | |
| 190 | 190 |              $this->log('Adding the unversioned file.'); | 
| 191 | 191 | $this->runAdd(); | 
| 192 | 192 | } | 
| 193 | 193 | |
| 194 | -        if(!$this->isCommitted()) { | |
| 194 | +        if (!$this->isCommitted()) { | |
| 195 | 195 | $this->createCommit($message)->execute(); | 
| 196 | 196 | $this->clearCache(); | 
| 197 | 197 | } | 
| @@ -224,7 +224,7 @@ discard block | ||
| 224 | 224 | |
| 225 | 225 | public function requireIsFile() : SVNHelper_Target_File | 
| 226 | 226 |      { | 
| 227 | - if($this instanceof SVNHelper_Target_File) | |
| 227 | + if ($this instanceof SVNHelper_Target_File) | |
| 228 | 228 |          { | 
| 229 | 229 | return $this; | 
| 230 | 230 | } | 
| @@ -238,7 +238,7 @@ discard block | ||
| 238 | 238 | |
| 239 | 239 | public function requireIsFolder() : SVNHelper_Target_Folder | 
| 240 | 240 |      { | 
| 241 | - if($this instanceof SVNHelper_Target_Folder) | |
| 241 | + if ($this instanceof SVNHelper_Target_Folder) | |
| 242 | 242 |          { | 
| 243 | 243 | return $this; | 
| 244 | 244 | } | 
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | */ | 
| 19 | 19 | protected $result; | 
| 20 | 20 | |
| 21 | - public function __construct($message, $details, $code, SVNHelper_CommandResult $result, $previous=null) | |
| 21 | + public function __construct($message, $details, $code, SVNHelper_CommandResult $result, $previous = null) | |
| 22 | 22 |      { | 
| 23 | 23 | parent::__construct($message, $details, $code, $previous); | 
| 24 | 24 | $this->result = $result; | 
| @@ -14,7 +14,7 @@ discard block | ||
| 14 | 14 |      { | 
| 15 | 15 |          $result = $this->execCommand('add', $this->target->getPath()); | 
| 16 | 16 | |
| 17 | -        if($result->isError()) { | |
| 17 | +        if ($result->isError()) { | |
| 18 | 18 | throw new SVNHelper_Exception( | 
| 19 | 19 | 'Could not add target path', | 
| 20 | 20 | sprintf( | 
| @@ -27,7 +27,7 @@ discard block | ||
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | 29 | $line = $result->getFirstLine(); | 
| 30 | -        if(substr($line, 0, 1) != 'a') { | |
| 30 | +        if (substr($line, 0, 1) != 'a') { | |
| 31 | 31 | throw new SVNHelper_Exception( | 
| 32 | 32 | 'Unexpected result for adding a path', | 
| 33 | 33 | sprintf( | 
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | ) | 
| 17 | 17 | ); | 
| 18 | 18 | |
| 19 | -        if($result->isError()) { | |
| 19 | +        if ($result->isError()) { | |
| 20 | 20 | $this->throwExceptionUnexpected($result); | 
| 21 | 21 | } | 
| 22 | 22 | |
| @@ -44,12 +44,12 @@ | ||
| 44 | 44 | return $result; | 
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | - /** | |
| 48 | - * Whether the file or folder has already been committed | |
| 49 | - * and has no pending changes. | |
| 50 | - * | |
| 51 | - * @return boolean | |
| 52 | - */ | |
| 47 | + /** | |
| 48 | + * Whether the file or folder has already been committed | |
| 49 | + * and has no pending changes. | |
| 50 | + * | |
| 51 | + * @return boolean | |
| 52 | + */ | |
| 53 | 53 | public function isCommitted() | 
| 54 | 54 |      { | 
| 55 | 55 | $status = $this->target->getStatus(); | 
| @@ -14,9 +14,9 @@ discard block | ||
| 14 | 14 | |
| 15 | 15 | $this->params = array(); | 
| 16 | 16 | |
| 17 | -        if($result->isError()) { | |
| 17 | +        if ($result->isError()) { | |
| 18 | 18 | // this error code means the target exists, but is not versioned yet | 
| 19 | -            if(!$result->hasErrorCode('200009')) { | |
| 19 | +            if (!$result->hasErrorCode('200009')) { | |
| 20 | 20 | $this->throwExceptionUnexpected($result); | 
| 21 | 21 | } | 
| 22 | 22 | |
| @@ -29,15 +29,15 @@ discard block | ||
| 29 | 29 | |
| 30 | 30 | $lines = $result->getOutput(); | 
| 31 | 31 | |
| 32 | - foreach($lines as $line) | |
| 32 | + foreach ($lines as $line) | |
| 33 | 33 |          { | 
| 34 | -            if(!strstr($line, ':')) { | |
| 34 | +            if (!strstr($line, ':')) { | |
| 35 | 35 | continue; | 
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 | $pos = strpos($line, ':'); | 
| 39 | 39 |              $name = str_replace(' ', '-', substr($line, 0, $pos)); | 
| 40 | - $value = trim(substr($line, $pos+1)); | |
| 40 | + $value = trim(substr($line, $pos + 1)); | |
| 41 | 41 | $this->params[$name] = $value; | 
| 42 | 42 | } | 
| 43 | 43 | |
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 |      { | 
| 90 | 90 | $this->execute(); | 
| 91 | 91 | |
| 92 | -        if(isset($this->params[$name])) { | |
| 92 | +        if (isset($this->params[$name])) { | |
| 93 | 93 | return $this->params[$name]; | 
| 94 | 94 | } | 
| 95 | 95 | |
| @@ -28,17 +28,17 @@ discard block | ||
| 28 | 28 | return $result; | 
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | - /** | |
| 32 | - * @var SVNHelper_Command_Update_Status[] | |
| 33 | - */ | |
| 31 | + /** | |
| 32 | + * @var SVNHelper_Command_Update_Status[] | |
| 33 | + */ | |
| 34 | 34 | protected $stati; | 
| 35 | 35 | |
| 36 | 36 | protected $revision; | 
| 37 | 37 | |
| 38 | - /** | |
| 39 | - * Parses the command output to find out which files have been modified, and how. | |
| 40 | - * @param SVNHelper_CommandResult $result | |
| 41 | - */ | |
| 38 | + /** | |
| 39 | + * Parses the command output to find out which files have been modified, and how. | |
| 40 | + * @param SVNHelper_CommandResult $result | |
| 41 | + */ | |
| 42 | 42 | protected function parseResult(SVNHelper_CommandResult $result) | 
| 43 | 43 |      { | 
| 44 | 44 | $this->stati = array(); | 
| @@ -119,11 +119,11 @@ discard block | ||
| 119 | 119 |          return $this->getByStatus('a'); | 
| 120 | 120 | } | 
| 121 | 121 | |
| 122 | - /** | |
| 123 | - * Whether there were files with the specified status code. | |
| 124 | - * @param string $status | |
| 125 | - * @return boolean | |
| 126 | - */ | |
| 122 | + /** | |
| 123 | + * Whether there were files with the specified status code. | |
| 124 | + * @param string $status | |
| 125 | + * @return boolean | |
| 126 | + */ | |
| 127 | 127 | protected function hasStatus($status) | 
| 128 | 128 |      { | 
| 129 | 129 | $this->execute(); | 
| @@ -10,13 +10,13 @@ discard block | ||
| 10 | 10 |      { | 
| 11 | 11 |          $result = $this->execCommand('update', $this->target->getPath()); | 
| 12 | 12 | |
| 13 | -        if($result->isError()) { | |
| 13 | +        if ($result->isError()) { | |
| 14 | 14 | $this->throwExceptionUnexpected($result); | 
| 15 | 15 | } | 
| 16 | 16 | |
| 17 | 17 | $this->parseResult($result); | 
| 18 | 18 | |
| 19 | -        if(!isset($this->revision)) { | |
| 19 | +        if (!isset($this->revision)) { | |
| 20 | 20 | $this->throwException( | 
| 21 | 21 | 'No update revision returned', | 
| 22 | 22 | 'The command did not return the expected last line with "at revision x".', | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | |
| 46 | 46 | $lines = $result->getLines(); | 
| 47 | 47 | |
| 48 | - foreach($lines as $line) | |
| 48 | + foreach ($lines as $line) | |
| 49 | 49 |          { | 
| 50 | 50 | $result = array(); | 
| 51 | 51 |              preg_match_all('/\A(a|c|d|u)[ ]+(.+)/si', $line, $result, PREG_PATTERN_ORDER); | 
| @@ -53,13 +53,13 @@ discard block | ||
| 53 | 53 | // is this a file update status line? It looks like this: | 
| 54 | 54 | // a c:\path\to\file.ext | 
| 55 | 55 | // ^ status code | 
| 56 | - if(isset($result[0]) && isset($result[1][0]) && !empty($result[1][0])) | |
| 56 | + if (isset($result[0]) && isset($result[1][0]) && !empty($result[1][0])) | |
| 57 | 57 |              { | 
| 58 | 58 | $status = $result[1][0]; | 
| 59 | 59 | $path = $result[2][0]; | 
| 60 | 60 | $obj = new SVNHelper_Command_Update_Status($this, $status, $path); | 
| 61 | 61 | |
| 62 | -                if(!isset($this->stati[$status])) { | |
| 62 | +                if (!isset($this->stati[$status])) { | |
| 63 | 63 | $this->stati[$status] = array(); | 
| 64 | 64 | } | 
| 65 | 65 | |
| @@ -69,9 +69,9 @@ discard block | ||
| 69 | 69 | } | 
| 70 | 70 | |
| 71 | 71 | // the revision line, "updated to revision X" or "at revision X" | 
| 72 | -            if(strstr($line, 'revision ')) { | |
| 72 | +            if (strstr($line, 'revision ')) { | |
| 73 | 73 |                  preg_match('/(at revision|to revision) ([0-9]+)/si', $line, $result); | 
| 74 | -                if(isset($result[2])) { | |
| 74 | +                if (isset($result[2])) { | |
| 75 | 75 | $this->revision = $result[2]; | 
| 76 | 76 | } | 
| 77 | 77 | continue; | 
| @@ -135,7 +135,7 @@ discard block | ||
| 135 | 135 |      { | 
| 136 | 136 | $this->execute(); | 
| 137 | 137 | |
| 138 | -        if(isset($this->stati[$status])) { | |
| 138 | +        if (isset($this->stati[$status])) { | |
| 139 | 139 | return $this->stati[$status]; | 
| 140 | 140 | } | 
| 141 | 141 | |