Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Testwork / Filesystem / ConsoleFilesystemLogger.php
1 <?php
2
3 /*
4  * This file is part of the Behat Testwork.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Testwork\Filesystem;
12
13 use Symfony\Component\Console\Output\OutputInterface;
14
15 /**
16  * Logs filesystem operations to the console.
17  *
18  * @author Konstantin Kudryashov <ever.zet@gmail.com>
19  */
20 final class ConsoleFilesystemLogger implements FilesystemLogger
21 {
22     /**
23      * @var string
24      */
25     private $basePath;
26     /**
27      * @var OutputInterface
28      */
29     private $output;
30
31     /**
32      * Initializes logger.
33      *
34      * @param string          $basePath
35      * @param OutputInterface $output
36      */
37     public function __construct($basePath, OutputInterface $output)
38     {
39         $this->basePath = $basePath;
40         $this->output = $output;
41     }
42
43     /**
44      * {@inheritdoc}
45      */
46     public function directoryCreated($path, $reason)
47     {
48         $this->output->writeln(
49             sprintf(
50                 '<info>+d</info> %s - %s',
51                 str_replace($this->basePath . DIRECTORY_SEPARATOR, '', realpath($path)),
52                 $reason
53             )
54         );
55     }
56
57     /**
58      * {@inheritdoc}
59      */
60     public function fileCreated($path, $reason)
61     {
62         $this->output->writeln(
63             sprintf(
64                 '<info>+f</info> %s - %s',
65                 str_replace($this->basePath . DIRECTORY_SEPARATOR, '', realpath($path)),
66                 $reason
67             )
68         );
69     }
70
71     /**
72      * {@inheritdoc}
73      */
74     public function fileUpdated($path, $reason)
75     {
76         $this->output->writeln(
77             sprintf(
78                 '<info>u</info> %s - %s',
79                 str_replace($this->basePath . DIRECTORY_SEPARATOR, '', realpath($path)),
80                 $reason
81             )
82         );
83     }
84 }