| 1 | <?php |
||
| 7 | class IdentifierResolver |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * List of available Identifiers. |
||
| 11 | * |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | protected $identifiers = [ |
||
| 15 | BioArxiv::class, |
||
| 16 | Figshare::class, |
||
| 17 | Doi::class, |
||
| 18 | Arxiv::class, |
||
| 19 | Pubmed::class, |
||
| 20 | ]; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * The query string. |
||
| 24 | * |
||
| 25 | * @var string |
||
| 26 | */ |
||
| 27 | private $queryString; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Identifier constructor. |
||
| 31 | * |
||
| 32 | * @param string $queryString |
||
| 33 | */ |
||
| 34 | public function __construct(string $queryString) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Resolves the Identifier;. |
||
| 41 | * |
||
| 42 | * @return Identifier |
||
| 43 | * |
||
| 44 | * @throws UnknownIdentifierException |
||
| 45 | */ |
||
| 46 | public function handle() |
||
| 58 | |||
| 59 | } |
||
| 60 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: