RequirementsLoader.php 492 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Fgm\ComposerCheck;
  3. /**
  4. * Class RequirementsLoader loads a composer.json file.
  5. */
  6. class RequirementsLoader extends LoaderBase implements LoaderInterface {
  7. /**
  8. * {@inheritdoc}
  9. */
  10. public function __construct(string $directory) {
  11. $this->file = realpath("${directory}/composer.json");
  12. }
  13. /**
  14. * {@inheritdoc}
  15. */
  16. public function parse() {
  17. $this->run = $this->contents['require'] ?? [];
  18. $this->dev = $this->contents['require-dev'] ?? [];
  19. }
  20. }