1 | <?php |
||
11 | class Config |
||
12 | { |
||
13 | const EXTENSION_CONFIG_KEY = 'screenshot'; |
||
14 | const CONFIG_CONTAINER_ID = 'bex.screenshot_extension.config'; |
||
15 | |||
16 | const IMAGE_DRIVER_NAMESPACE = 'Bex\\Behat\\ScreenshotExtension\\Driver'; |
||
17 | const IMAGE_DRIVER_PARENT = 'Bex\\Behat\\ScreenshotExtension\\Driver\\ImageDriverInterface'; |
||
18 | |||
19 | const CONFIG_PARAM_EXTENSTION_ENABLED = 'enabled'; |
||
20 | const CONFIG_PARAM_ACTIVE_IMAGE_DRIVERS = 'active_image_drivers'; |
||
21 | const CONFIG_PARAM_IMAGE_DRIVER_CONFIGS = 'image_drivers'; |
||
22 | const CONFIG_PARAM_SCREENSHOT_TAKING_MODE = 'screenshot_taking_mode'; |
||
23 | |||
24 | const SCREENSHOT_TAKING_MODE_FAILED_STEPS = 'failed_steps'; |
||
25 | const SCREENSHOT_TAKING_MODE_FAILED_SCENARIOS = 'failed_scenarios'; |
||
26 | const SCREENSHOT_TAKING_MODE_ALL_SCENARIOS = 'all_scenarios'; |
||
27 | |||
28 | const DEFAULT_IMAGE_DRIVER_KEY = 'local'; |
||
29 | const DEFAULT_SCREENSHOT_TAKING_MODE = self::SCREENSHOT_TAKING_MODE_FAILED_STEPS; |
||
30 | |||
31 | const ERROR_MESSAGE_IMAGICK_NOT_FOUND = 'Imagemagick PHP extension is required, but not installed.'; |
||
32 | |||
33 | /** |
||
34 | * @var boolean |
||
35 | */ |
||
36 | private $enabled; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $screenshotTakingMode; |
||
42 | |||
43 | /** |
||
44 | * @var string[] |
||
45 | */ |
||
46 | private $imageDriverKeys; |
||
47 | |||
48 | /** |
||
49 | * @var array |
||
50 | */ |
||
51 | private $imageDriverConfigs; |
||
52 | |||
53 | /** |
||
54 | * @param array $config |
||
55 | */ |
||
56 | public function __construct(array $config) |
||
64 | |||
65 | /** |
||
66 | * @return boolean |
||
67 | */ |
||
68 | public function isEnabled() |
||
72 | |||
73 | /** |
||
74 | * @return ImageDriverInterface[] |
||
75 | */ |
||
76 | public function getImageDrivers() |
||
80 | |||
81 | /** |
||
82 | * @return boolean |
||
83 | */ |
||
84 | public function shouldCombineImages() |
||
88 | |||
89 | /** |
||
90 | * @return boolean |
||
91 | */ |
||
92 | public function shouldRecordAllScenarios() |
||
96 | |||
97 | /** |
||
98 | * Init service container and load image drivers |
||
99 | * |
||
100 | * @param ContainerBuilder $container |
||
101 | */ |
||
102 | public function loadServices(ContainerBuilder $container) |
||
112 | |||
113 | /** |
||
114 | * @return string[] |
||
115 | */ |
||
116 | public static function getScreenshotTakingModes() |
||
124 | |||
125 | /** |
||
126 | * @return \Closure |
||
127 | */ |
||
128 | public static function getScreenshotTakingModeValidator() |
||
134 | } |
||
135 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: