| Conditions | 113 |
| Paths | > 20000 |
| Total Lines | 566 |
| Lines | 36 |
| Ratio | 6.36 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 142 | public function getItem($pk = null) |
||
| 143 | { |
||
| 144 | if (!isset($this->item)) |
||
| 145 | { |
||
| 146 | $conf = JFactory::getConfig(); |
||
| 147 | $caching = $conf->get('caching') >= 1; |
||
| 148 | |||
| 149 | if ($caching) |
||
| 150 | { |
||
| 151 | $keycache = $this->getState('translation.client') . '.' . $this->getState('translation.tag') . '.' . |
||
| 152 | $this->getState('translation.filename') . '.' . 'translation'; |
||
| 153 | $cache = JFactory::getCache('com_localise', ''); |
||
| 154 | $this->item = $cache->get($keycache); |
||
| 155 | |||
| 156 | if ($this->item && $this->item->reference != $this->getState('translation.reference')) |
||
| 157 | { |
||
| 158 | $this->item = null; |
||
| 159 | } |
||
| 160 | } |
||
| 161 | else |
||
| 162 | { |
||
| 163 | $this->item = null; |
||
| 164 | } |
||
| 165 | |||
| 166 | if (!$this->item) |
||
| 167 | { |
||
| 168 | $path = JFile::exists($this->getState('translation.path')) |
||
| 169 | ? $this->getState('translation.path') |
||
| 170 | : $this->getState('translation.refpath'); |
||
| 171 | |||
| 172 | $params = JComponentHelper::getParams('com_localise'); |
||
| 173 | $allow_develop = $params->get('gh_allow_develop', 0); |
||
| 174 | $gh_client = $this->getState('translation.client'); |
||
| 175 | $tag = $this->getState('translation.tag'); |
||
| 176 | $reftag = $this->getState('translation.reference'); |
||
| 177 | $refpath = $this->getState('translation.refpath'); |
||
| 178 | $istranslation = 0; |
||
| 179 | |||
| 180 | if (!empty($tag) && $tag != $reftag) |
||
| 181 | { |
||
| 182 | $istranslation = 1; |
||
| 183 | } |
||
| 184 | |||
| 185 | $this->setState('translation.translatedkeys', array()); |
||
| 186 | $this->setState('translation.untranslatedkeys', array()); |
||
| 187 | $this->setState('translation.unchangedkeys', array()); |
||
| 188 | $this->setState('translation.textchangedkeys', array()); |
||
| 189 | $this->setState('translation.revisedchanges', array()); |
||
| 190 | $this->setState('translation.developdata', array()); |
||
| 191 | |||
| 192 | $translatedkeys = $this->getState('translation.translatedkeys'); |
||
| 193 | $untranslatedkeys = $this->getState('translation.untranslatedkeys'); |
||
| 194 | $unchangedkeys = $this->getState('translation.unchangedkeys'); |
||
| 195 | $textchangedkeys = $this->getState('translation.textchangedkeys'); |
||
| 196 | $revisedchanges = $this->getState('translation.revisedchanges'); |
||
| 197 | $developdata = $this->getState('translation.developdata'); |
||
| 198 | |||
| 199 | $this->item = new JObject( |
||
| 200 | array |
||
| 201 | ( |
||
| 202 | 'reference' => $this->getState('translation.reference'), |
||
| 203 | 'bom' => 'UTF-8', |
||
| 204 | 'svn' => '', |
||
| 205 | 'version' => '', |
||
| 206 | 'description' => '', |
||
| 207 | 'creationdate' => '', |
||
| 208 | 'author' => '', |
||
| 209 | 'maincopyright' => '', |
||
| 210 | 'additionalcopyright' => array(), |
||
| 211 | 'license' => '', |
||
| 212 | 'exists' => JFile::exists($this->getState('translation.path')), |
||
| 213 | 'istranslation' => $istranslation, |
||
| 214 | 'developdata' => (array) $developdata, |
||
| 215 | 'translatedkeys' => (array) $translatedkeys, |
||
| 216 | 'untranslatedkeys' => (array) $untranslatedkeys, |
||
| 217 | 'unchangedkeys' => (array) $unchangedkeys, |
||
| 218 | 'textchangedkeys' => (array) $textchangedkeys, |
||
| 219 | 'revisedchanges' => (array) $revisedchanges, |
||
| 220 | 'unrevised' => 0, |
||
| 221 | 'translatednews' => 0, |
||
| 222 | 'unchangednews' => 0, |
||
| 223 | 'translated' => 0, |
||
| 224 | 'untranslated' => 0, |
||
| 225 | 'unchanged' => 0, |
||
| 226 | 'extra' => 0, |
||
| 227 | 'total' => 0, |
||
| 228 | 'linespath' => 0, |
||
| 229 | 'linesrefpath' => 0, |
||
| 230 | 'linesdevpath' => 0, |
||
| 231 | 'linescustompath' => 0, |
||
| 232 | 'complete' => false, |
||
| 233 | 'source' => '', |
||
| 234 | 'error' => array() |
||
| 235 | ) |
||
| 236 | ); |
||
| 237 | |||
| 238 | if (JFile::exists($path)) |
||
| 239 | { |
||
| 240 | $devpath = LocaliseHelper::searchDevpath($gh_client, $refpath); |
||
| 241 | $custompath = LocaliseHelper::searchCustompath($gh_client, $refpath); |
||
| 242 | |||
| 243 | if ($istranslation == 0 && $reftag == 'en-GB') |
||
| 244 | { |
||
| 245 | if (!empty($devpath)) |
||
| 246 | { |
||
| 247 | if (!empty($custompath)) |
||
| 248 | { |
||
| 249 | $this->item->source = LocaliseHelper::combineReferences($custompath, $devpath); |
||
| 250 | } |
||
| 251 | else |
||
| 252 | { |
||
| 253 | $this->item->source = LocaliseHelper::combineReferences($path, $devpath); |
||
| 254 | } |
||
| 255 | } |
||
| 256 | } |
||
| 257 | else |
||
| 258 | { |
||
| 259 | $this->item->source = file_get_contents($path); |
||
| 260 | } |
||
| 261 | |||
| 262 | $stream = new JStream; |
||
| 263 | $stream->open($path); |
||
| 264 | $begin = $stream->read(4); |
||
| 265 | $bom = strtolower(bin2hex($begin)); |
||
| 266 | |||
| 267 | if ($bom == '0000feff') |
||
| 268 | { |
||
| 269 | $this->item->bom = 'UTF-32 BE'; |
||
| 270 | } |
||
| 271 | else |
||
| 272 | { |
||
| 273 | if ($bom == 'feff0000') |
||
| 274 | { |
||
| 275 | $this->item->bom = 'UTF-32 LE'; |
||
| 276 | } |
||
| 277 | else |
||
| 278 | { |
||
| 279 | if (substr($bom, 0, 4) == 'feff') |
||
| 280 | { |
||
| 281 | $this->item->bom = 'UTF-16 BE'; |
||
| 282 | } |
||
| 283 | else |
||
| 284 | { |
||
| 285 | if (substr($bom, 0, 4) == 'fffe') |
||
| 286 | { |
||
| 287 | $this->item->bom = 'UTF-16 LE'; |
||
| 288 | } |
||
| 289 | } |
||
| 290 | } |
||
| 291 | } |
||
| 292 | |||
| 293 | $stream->seek(0); |
||
| 294 | $continue = true; |
||
|
|
|||
| 295 | $lineNumber = 0; |
||
| 296 | |||
| 297 | $isTranslationsView = JFactory::getApplication()->input->get('view') == 'translations'; |
||
| 298 | |||
| 299 | while (!$stream->eof()) |
||
| 300 | { |
||
| 301 | $line = $stream->gets(); |
||
| 302 | $lineNumber++; |
||
| 303 | |||
| 304 | if ($line[0] == '#') |
||
| 305 | { |
||
| 306 | $this->item->error[] = $lineNumber; |
||
| 307 | } |
||
| 308 | elseif ($line[0] == ';') |
||
| 309 | { |
||
| 310 | if (preg_match('/^(;).*(\$Id.*\$)/', $line, $matches)) |
||
| 311 | { |
||
| 312 | $this->item->svn = $matches[2]; |
||
| 313 | } |
||
| 314 | elseif (preg_match('/(;)\s*@?(\pL+):?.*/', $line, $matches)) |
||
| 315 | { |
||
| 316 | switch (strtolower($matches[2])) |
||
| 317 | { |
||
| 318 | case 'note': |
||
| 319 | preg_match('/(;)\s*@?(\pL+):?\s+(.*)/', $line, $matches2); |
||
| 320 | $this->item->complete = $this->item->complete || strtolower($matches2[3]) == 'complete'; |
||
| 321 | break; |
||
| 322 | case 'version': |
||
| 323 | preg_match('/(;)\s*@?(\pL+):?\s+(.*)/', $line, $matches2); |
||
| 324 | $this->item->version = $matches2[3]; |
||
| 325 | break; |
||
| 326 | case 'desc': |
||
| 327 | case 'description': |
||
| 328 | preg_match('/(;)\s*@?(\pL+):?\s+(.*)/', $line, $matches2); |
||
| 329 | $this->item->description = $matches2[3]; |
||
| 330 | break; |
||
| 331 | case 'date': |
||
| 332 | preg_match('/(;)\s*@?(\pL+):?\s+(.*)/', $line, $matches2); |
||
| 333 | $this->item->creationdate = $matches2[3]; |
||
| 334 | break; |
||
| 335 | View Code Duplication | case 'author': |
|
| 336 | if ($params->get('author') && !$isTranslationsView) |
||
| 337 | { |
||
| 338 | $this->item->author = $params->get('author'); |
||
| 339 | } |
||
| 340 | else |
||
| 341 | { |
||
| 342 | preg_match('/(;)\s*@?(\pL+):?\s+(.*)/', $line, $matches2); |
||
| 343 | $this->item->author = $matches2[3]; |
||
| 344 | } |
||
| 345 | break; |
||
| 346 | case 'copyright': |
||
| 347 | preg_match('/(;)\s*@?(\pL+):?\s+(.*)/', $line, $matches2); |
||
| 348 | |||
| 349 | if (empty($this->item->maincopyright)) |
||
| 350 | { |
||
| 351 | if ($params->get('copyright') && !$isTranslationsView) |
||
| 352 | { |
||
| 353 | $this->item->maincopyright = $params->get('copyright'); |
||
| 354 | } |
||
| 355 | else |
||
| 356 | { |
||
| 357 | $this->item->maincopyright = $matches2[3]; |
||
| 358 | } |
||
| 359 | } |
||
| 360 | |||
| 361 | if (empty($this->item->additionalcopyright)) |
||
| 362 | { |
||
| 363 | if ($params->get('additionalcopyright') && !$isTranslationsView) |
||
| 364 | { |
||
| 365 | $this->item->additionalcopyright[] = $params->get('additionalcopyright'); |
||
| 366 | } |
||
| 367 | else |
||
| 368 | { |
||
| 369 | $this->item->additionalcopyright[] = $matches2[3]; |
||
| 370 | } |
||
| 371 | } |
||
| 372 | break; |
||
| 373 | View Code Duplication | case 'license': |
|
| 374 | if ($params->get('license') && !$isTranslationsView) |
||
| 375 | { |
||
| 376 | $this->item->license = $params->get('license'); |
||
| 377 | } |
||
| 378 | else |
||
| 379 | { |
||
| 380 | preg_match('/(;)\s*@?(\pL+):?\s+(.*)/', $line, $matches2); |
||
| 381 | $this->item->license = $matches2[3]; |
||
| 382 | } |
||
| 383 | break; |
||
| 384 | case 'package': |
||
| 385 | preg_match('/(;)\s*@?(\pL+):?\s+(.*)/', $line, $matches2); |
||
| 386 | $this->item->package = $matches2[3]; |
||
| 387 | break; |
||
| 388 | case 'subpackage': |
||
| 389 | preg_match('/(;)\s*@?(\pL+):?\s+(.*)/', $line, $matches2); |
||
| 390 | $this->item->subpackage = $matches2[3]; |
||
| 391 | break; |
||
| 392 | case 'link': |
||
| 393 | break; |
||
| 394 | View Code Duplication | default: |
|
| 395 | if (empty($this->item->author)) |
||
| 396 | { |
||
| 397 | if ($params->get('author') && !$isTranslationsView) |
||
| 398 | { |
||
| 399 | $this->item->author = $params->get('author'); |
||
| 400 | } |
||
| 401 | else |
||
| 402 | { |
||
| 403 | preg_match('/(;)\s*(.*)/', $line, $matches2); |
||
| 404 | $this->item->author = $matches2[2]; |
||
| 405 | } |
||
| 406 | } |
||
| 407 | break; |
||
| 408 | } |
||
| 409 | } |
||
| 410 | } |
||
| 411 | else |
||
| 412 | { |
||
| 413 | break; |
||
| 414 | } |
||
| 415 | } |
||
| 416 | |||
| 417 | if (empty($this->item->author) && $params->get('author') && !$isTranslationsView) |
||
| 418 | { |
||
| 419 | $this->item->author = $params->get('author'); |
||
| 420 | } |
||
| 421 | |||
| 422 | if (empty($this->item->license) && $params->get('license') && !$isTranslationsView) |
||
| 423 | { |
||
| 424 | $this->item->license = $params->get('license'); |
||
| 425 | } |
||
| 426 | |||
| 427 | if (empty($this->item->maincopyright) && $params->get('copyright') && !$isTranslationsView) |
||
| 428 | { |
||
| 429 | $this->item->maincopyright = $params->get('copyright'); |
||
| 430 | } |
||
| 431 | |||
| 432 | if (empty($this->item->additionalcopyright) && $params->get('additionalcopyright') && !$isTranslationsView) |
||
| 433 | { |
||
| 434 | $this->item->additionalcopyright[] = $params->get('additionalcopyright'); |
||
| 435 | } |
||
| 436 | |||
| 437 | while (!$stream->eof()) |
||
| 438 | { |
||
| 439 | $line = $stream->gets(); |
||
| 440 | $lineNumber++; |
||
| 441 | $line = str_replace('\"', '"_QQ_"', $line); |
||
| 442 | |||
| 443 | if (!preg_match('/^(|(\[[^\]]*\])|([A-Z][A-Z0-9_\*\-\.]*\s*=(\s*(("[^"]*")|(_QQ_)))+))\s*(;.*)?$/', $line)) |
||
| 444 | { |
||
| 445 | $this->item->error[] = $lineNumber; |
||
| 446 | } |
||
| 447 | } |
||
| 448 | |||
| 449 | if ($tag != $reftag) |
||
| 450 | { |
||
| 451 | if (JFile::exists($custompath)) |
||
| 452 | { |
||
| 453 | $this->item->linescustompath = count(file($custompath)); |
||
| 454 | } |
||
| 455 | } |
||
| 456 | |||
| 457 | $stream->close(); |
||
| 458 | } |
||
| 459 | |||
| 460 | $this->item->additionalcopyright = implode("\n", $this->item->additionalcopyright); |
||
| 461 | |||
| 462 | if ($this->getState('translation.layout') != 'raw' && empty($this->item->error)) |
||
| 463 | { |
||
| 464 | $sections = LocaliseHelper::parseSections($this->getState('translation.path')); |
||
| 465 | |||
| 466 | if (!empty($custompath)) |
||
| 467 | { |
||
| 468 | $refsections = LocaliseHelper::parseSections($custompath); |
||
| 469 | } |
||
| 470 | else |
||
| 471 | { |
||
| 472 | $refsections = LocaliseHelper::parseSections($this->getState('translation.refpath')); |
||
| 473 | } |
||
| 474 | |||
| 475 | $develop_client_path = JPATH_ROOT |
||
| 476 | . '/media/com_localise/develop/github/joomla-cms/en-GB/' |
||
| 477 | . $gh_client; |
||
| 478 | $develop_client_path = JFolder::makeSafe($develop_client_path); |
||
| 479 | $ref_file = basename($this->getState('translation.refpath')); |
||
| 480 | $develop_file_path = "$develop_client_path/$ref_file"; |
||
| 481 | $new_keys = array(); |
||
| 482 | |||
| 483 | if (JFile::exists($develop_file_path) && $allow_develop == 1 && $reftag == 'en-GB') |
||
| 484 | { |
||
| 485 | $info = array(); |
||
| 486 | $info['client'] = $gh_client; |
||
| 487 | $info['reftag'] = 'en-GB'; |
||
| 488 | $info['tag'] = 'en-GB'; |
||
| 489 | $info['filename'] = $ref_file; |
||
| 490 | $info['istranslation'] = $istranslation; |
||
| 491 | |||
| 492 | $develop_sections = LocaliseHelper::parseSections($develop_file_path); |
||
| 493 | $developdata = LocaliseHelper::getDevelopchanges($info, $refsections, $develop_sections); |
||
| 494 | $developdata['develop_file_path'] = ''; |
||
| 495 | |||
| 496 | if ($developdata['extra_keys']['amount'] > 0 || $developdata['text_changes']['amount'] > 0) |
||
| 497 | { |
||
| 498 | if ($developdata['extra_keys']['amount'] > 0) |
||
| 499 | { |
||
| 500 | $new_keys = $developdata['extra_keys']['keys']; |
||
| 501 | } |
||
| 502 | |||
| 503 | if ($developdata['text_changes']['amount'] > 0) |
||
| 504 | { |
||
| 505 | $textchangedkeys = $developdata['text_changes']['keys']; |
||
| 506 | $this->item->textchangedkeys = $textchangedkeys; |
||
| 507 | $this->setState('translation.textchangedkeys', $textchangedkeys); |
||
| 508 | |||
| 509 | $changesdata['client'] = $gh_client; |
||
| 510 | $changesdata['reftag'] = $reftag; |
||
| 511 | |||
| 512 | if ($istranslation == 0) |
||
| 513 | { |
||
| 514 | $changesdata['tag'] = $reftag; |
||
| 515 | } |
||
| 516 | else |
||
| 517 | { |
||
| 518 | $changesdata['tag'] = $tag; |
||
| 519 | } |
||
| 520 | |||
| 521 | $changesdata['filename'] = $ref_file; |
||
| 522 | |||
| 523 | foreach ($textchangedkeys as $key_changed) |
||
| 524 | { |
||
| 525 | $target_text = $developdata['text_changes']['ref_in_dev'][$key_changed]; |
||
| 526 | $source_text = $developdata['text_changes']['ref'][$key_changed]; |
||
| 527 | |||
| 528 | $changesdata['revised'] = '0'; |
||
| 529 | $changesdata['key'] = $key_changed; |
||
| 530 | $changesdata['target_text'] = $target_text; |
||
| 531 | $changesdata['source_text'] = $source_text; |
||
| 532 | $changesdata['istranslation'] = $istranslation; |
||
| 533 | $changesdata['catch_grammar'] = '0'; |
||
| 534 | |||
| 535 | $change_status = LocaliseHelper::searchRevisedvalue($changesdata); |
||
| 536 | $revisedchanges[$key_changed] = $change_status; |
||
| 537 | |||
| 538 | if ($change_status == 1) |
||
| 539 | { |
||
| 540 | $developdata['text_changes']['revised']++; |
||
| 541 | } |
||
| 542 | else |
||
| 543 | { |
||
| 544 | $developdata['text_changes']['unrevised']++; |
||
| 545 | } |
||
| 546 | } |
||
| 547 | |||
| 548 | $this->item->revisedchanges = $revisedchanges; |
||
| 549 | $this->setState('translation.revisedchanges', $revisedchanges); |
||
| 550 | } |
||
| 551 | |||
| 552 | // When develop changes are present, replace the reference keys |
||
| 553 | $refsections = $develop_sections; |
||
| 554 | |||
| 555 | // And store the path for future calls |
||
| 556 | $developdata['develop_file_path'] = $develop_file_path; |
||
| 557 | } |
||
| 558 | } |
||
| 559 | |||
| 560 | if (!empty($refsections['keys'])) |
||
| 561 | { |
||
| 562 | foreach ($refsections['keys'] as $key => $string) |
||
| 563 | { |
||
| 564 | $this->item->total++; |
||
| 565 | |||
| 566 | if (!empty($sections['keys']) && array_key_exists($key, $sections['keys']) && $sections['keys'][$key] != '') |
||
| 567 | { |
||
| 568 | if ($sections['keys'][$key] != $string && $istranslation == 1) |
||
| 569 | { |
||
| 570 | if (array_key_exists($key, $revisedchanges) && $revisedchanges[$key] == 0) |
||
| 571 | { |
||
| 572 | $this->item->unrevised++; |
||
| 573 | $translatedkeys[] = $key; |
||
| 574 | } |
||
| 575 | elseif (in_array($key, $new_keys)) |
||
| 576 | { |
||
| 577 | $this->item->translatednews++; |
||
| 578 | $translatedkeys[] = $key; |
||
| 579 | } |
||
| 580 | else |
||
| 581 | { |
||
| 582 | $this->item->translated++; |
||
| 583 | $translatedkeys[] = $key; |
||
| 584 | } |
||
| 585 | } |
||
| 586 | elseif ($istranslation == 0) |
||
| 587 | { |
||
| 588 | if (array_key_exists($key, $revisedchanges) && $revisedchanges[$key] == 0) |
||
| 589 | { |
||
| 590 | $this->item->unrevised++; |
||
| 591 | } |
||
| 592 | elseif (in_array($key, $new_keys)) |
||
| 593 | { |
||
| 594 | $untranslatedkeys[] = $key; |
||
| 595 | } |
||
| 596 | |||
| 597 | $this->item->translated++; |
||
| 598 | } |
||
| 599 | else |
||
| 600 | { |
||
| 601 | if (in_array($key, $new_keys)) |
||
| 602 | { |
||
| 603 | $this->item->unchangednews++; |
||
| 604 | } |
||
| 605 | else |
||
| 606 | { |
||
| 607 | $this->item->unchanged++; |
||
| 608 | } |
||
| 609 | |||
| 610 | $unchangedkeys[] = $key; |
||
| 611 | } |
||
| 612 | } |
||
| 613 | elseif (!array_key_exists($key, $sections['keys'])) |
||
| 614 | { |
||
| 615 | $this->item->untranslated++; |
||
| 616 | $untranslatedkeys[] = $key; |
||
| 617 | } |
||
| 618 | } |
||
| 619 | } |
||
| 620 | |||
| 621 | $this->item->translatedkeys = $translatedkeys; |
||
| 622 | $this->item->untranslatedkeys = $untranslatedkeys; |
||
| 623 | $this->item->unchangedkeys = $unchangedkeys; |
||
| 624 | $this->item->developdata = $developdata; |
||
| 625 | |||
| 626 | $this->setState('translation.translatedkeys', $translatedkeys); |
||
| 627 | $this->setState('translation.untranslatedkeys', $untranslatedkeys); |
||
| 628 | $this->setState('translation.unchangedkeys', $unchangedkeys); |
||
| 629 | $this->setState('translation.developdata', $developdata); |
||
| 630 | |||
| 631 | if (!empty($sections['keys']) && $istranslation == 1) |
||
| 632 | { |
||
| 633 | foreach ($sections['keys'] as $key => $string) |
||
| 634 | { |
||
| 635 | if (empty($refsections['keys']) || !array_key_exists($key, $refsections['keys'])) |
||
| 636 | { |
||
| 637 | $this->item->extra++; |
||
| 638 | } |
||
| 639 | } |
||
| 640 | } |
||
| 641 | |||
| 642 | $done = $this->item->translated + $this->item->translatednews + $this->item->unchangednews; |
||
| 643 | |||
| 644 | $this->item->completed = $this->item->total |
||
| 645 | ? intval(100 * $done / $this->item->total) |
||
| 646 | : 100; |
||
| 647 | |||
| 648 | $this->item->complete = $this->item->complete == 1 && $this->item->untranslated == 0 && $this->item->unrevised == 0 |
||
| 649 | ? 1 |
||
| 650 | : ($this->item->completed == 100 |
||
| 651 | ? 1 |
||
| 652 | : 0); |
||
| 653 | } |
||
| 654 | |||
| 655 | if ($this->getState('translation.id')) |
||
| 656 | { |
||
| 657 | $table = $this->getTable(); |
||
| 658 | $table->load($this->getState('translation.id')); |
||
| 659 | $user = JFactory::getUser($table->checked_out); |
||
| 660 | $this->item->setProperties($table->getProperties()); |
||
| 661 | |||
| 662 | if ($this->item->checked_out == JFactory::getUser()->id) |
||
| 663 | { |
||
| 664 | $this->item->checked_out = 0; |
||
| 665 | } |
||
| 666 | |||
| 667 | $this->item->editor = JText::sprintf('COM_LOCALISE_TEXT_TRANSLATION_EDITOR', $user->name, $user->username); |
||
| 668 | } |
||
| 669 | |||
| 670 | if ($caching) |
||
| 671 | { |
||
| 672 | $cache->store($this->item, $keycache); |
||
| 673 | } |
||
| 674 | |||
| 675 | // Count the number of lines in the ini file to check max_input_vars |
||
| 676 | if ($tag != $reftag) |
||
| 677 | { |
||
| 678 | if (JFile::exists($path)) |
||
| 679 | { |
||
| 680 | $this->item->linespath = count(file($path)); |
||
| 681 | } |
||
| 682 | |||
| 683 | if (JFile::exists($refpath)) |
||
| 684 | { |
||
| 685 | $this->item->linesrefpath = count(file($refpath)); |
||
| 686 | } |
||
| 687 | |||
| 688 | if ($this->getState('translation.layout') != 'raw') |
||
| 689 | { |
||
| 690 | if (isset($develop_file_path) && JFile::exists($develop_file_path)) |
||
| 691 | { |
||
| 692 | $this->item->linesdevpath = count(file($develop_file_path)); |
||
| 693 | } |
||
| 694 | } |
||
| 695 | } |
||
| 696 | else |
||
| 697 | { |
||
| 698 | if (JFile::exists($path)) |
||
| 699 | { |
||
| 700 | $this->item->linespath = count(file($path)); |
||
| 701 | } |
||
| 702 | } |
||
| 703 | } |
||
| 704 | } |
||
| 705 | |||
| 706 | return $this->item; |
||
| 707 | } |
||
| 708 | |||
| 1566 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.