1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Installer;
13
14 use ICanBoogie\Errors;
15
16 17 18
19 class RepositoryRequirement extends Requirement
20 {
21 public function __construct()
22 {
23 $this->title = t('requirement.repository.title');
24 $this->description = t('requirement.repository.description', array(':action' => new TellMeMore('repository')));
25 }
26
27 public function __invoke(Errors $errors)
28 {
29 $repository = \ICanBoogie\REPOSITORY;
30 $repository_relative = \ICanBoogie\strip_root($repository);
31
32 if (file_exists($repository))
33 {
34 if (!is_writable($repository))
35 {
36 $errors['repository'] = t('requirement.repository.error.not_writable', array('dir' => $repository_relative));
37 }
38 }
39 else
40 {
41 $errors['repository'] = t('requirement.repository.error.missing', array('dir' => $repository_relative));
42 }
43 }
44 }