| @@ 546-561 (lines=16) @@ | ||
| 543 | * |
|
| 544 | * @return EditableRepository The resource repository. |
|
| 545 | */ |
|
| 546 | public function getRepository() |
|
| 547 | { |
|
| 548 | if (!$this->started) { |
|
| 549 | throw new LogicException('Puli was not started'); |
|
| 550 | } |
|
| 551 | ||
| 552 | if (!$this->context instanceof ProjectContext) { |
|
| 553 | return null; |
|
| 554 | } |
|
| 555 | ||
| 556 | if (!$this->repo) { |
|
| 557 | $this->repo = $this->getFactory()->createRepository(); |
|
| 558 | } |
|
| 559 | ||
| 560 | return $this->repo; |
|
| 561 | } |
|
| 562 | ||
| 563 | /** |
|
| 564 | * Returns the resource discovery of the project. |
|
| @@ 568-583 (lines=16) @@ | ||
| 565 | * |
|
| 566 | * @return EditableDiscovery The resource discovery. |
|
| 567 | */ |
|
| 568 | public function getDiscovery() |
|
| 569 | { |
|
| 570 | if (!$this->started) { |
|
| 571 | throw new LogicException('Puli was not started'); |
|
| 572 | } |
|
| 573 | ||
| 574 | if (!$this->context instanceof ProjectContext) { |
|
| 575 | return null; |
|
| 576 | } |
|
| 577 | ||
| 578 | if (!$this->discovery) { |
|
| 579 | $this->discovery = $this->getFactory()->createDiscovery($this->getRepository()); |
|
| 580 | } |
|
| 581 | ||
| 582 | return $this->discovery; |
|
| 583 | } |
|
| 584 | ||
| 585 | /** |
|
| 586 | * @return object |
|