familytree365 /
php-gedcom
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * php-gedcom. |
||||||
| 4 | * |
||||||
| 5 | * php-gedcom is a library for parsing, manipulating, importing and exporting |
||||||
| 6 | * GEDCOM 5.5 files in PHP 5.3+. |
||||||
| 7 | * |
||||||
| 8 | * @author Kristopher Wilson <[email protected]> |
||||||
| 9 | * @copyright Copyright (c) 2010-2013, Kristopher Wilson |
||||||
| 10 | * @license MIT |
||||||
| 11 | * |
||||||
| 12 | * @link http://github.com/mrkrstphr/php-gedcom |
||||||
| 13 | */ |
||||||
| 14 | |||||||
| 15 | namespace Gedcom\Parser\ObjeRef; |
||||||
| 16 | |||||||
| 17 | class File extends \Gedcom\Parser\Component |
||||||
| 18 | { |
||||||
| 19 | public static function parse(\Gedcom\Parser $parser) |
||||||
| 20 | { |
||||||
| 21 | $file = new \Gedcom\Record\ObjeRef\File(); |
||||||
| 22 | $record = $parser->getCurrentLineRecord(); |
||||||
| 23 | $depth = (int) $record[0]; |
||||||
| 24 | if (isset($record[2])) { |
||||||
| 25 | $file->setFile($record[2]); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 26 | } else { |
||||||
| 27 | return null; |
||||||
| 28 | } |
||||||
| 29 | $parser->forward(); |
||||||
| 30 | |||||||
| 31 | while (!$parser->eof()) { |
||||||
| 32 | $record = $parser->getCurrentLineRecord(); |
||||||
| 33 | $recordType = strtoupper(trim($record[1])); |
||||||
| 34 | $currentDepth = (int) $record[0]; |
||||||
| 35 | |||||||
| 36 | if ($currentDepth <= $depth) { |
||||||
| 37 | $parser->back(); |
||||||
| 38 | break; |
||||||
| 39 | } |
||||||
| 40 | |||||||
| 41 | switch ($recordType) { |
||||||
| 42 | case 'FORM': |
||||||
| 43 | $file->setDate(\Parser\ObjeRef\File\Form::parse($parser)); |
||||||
|
0 ignored issues
–
show
The method
setDate() does not exist on Gedcom\Record\ObjeRef\File. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
The type
Parser\ObjeRef\File\Form was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 44 | break; |
||||||
| 45 | case 'TITL': |
||||||
| 46 | $file->setTitl(trim($record[2])); |
||||||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The method
setTitl() does not exist on Gedcom\Record\ObjeRef\File. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 47 | default: |
||||||
| 48 | $parser->logUnhandledRecord(self::class.' @ '.__LINE__); |
||||||
| 49 | } |
||||||
| 50 | |||||||
| 51 | $parser->forward(); |
||||||
| 52 | } |
||||||
| 53 | |||||||
| 54 | return $file; |
||||||
| 55 | } |
||||||
| 56 | } |
||||||
| 57 |