class-filevisitorevent.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WordPress\Filesystem\Visitor; |
| 4 | |
| 5 | class FileVisitorEvent { |
| 6 | public $type; |
| 7 | /** |
| 8 | * @var string |
| 9 | */ |
| 10 | public $dir; |
| 11 | /** |
| 12 | * @var array<string> |
| 13 | */ |
| 14 | public $files; |
| 15 | |
| 16 | const EVENT_ENTER = 'entering'; |
| 17 | const EVENT_EXIT = 'exiting'; |
| 18 | |
| 19 | public function __construct( $type, $dir, $files = array() ) { |
| 20 | $this->type = $type; |
| 21 | $this->dir = $dir; |
| 22 | $this->files = $files; |
| 23 | } |
| 24 | |
| 25 | public function is_entering() { |
| 26 | return self::EVENT_ENTER === $this->type; |
| 27 | } |
| 28 | |
| 29 | public function is_exiting() { |
| 30 | return self::EVENT_EXIT === $this->type; |
| 31 | } |
| 32 | } |
| 33 |