1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @link http://github.com/zfcampus/zf-development-mode for the canonical source repository
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ZF\DevelopmentMode;
class Status
{
const DEVEL_CONFIG = 'config/development.config.php';
/**
* @param string
*/
private $develConfigFile;
/**
* @param string $projectDir Location to resolve project from.
*/
public function __construct($projectDir = '')
{
if ('' === $projectDir) {
$this->develConfigFile = self::DEVEL_CONFIG;
return;
}
$this->develConfigFile = sprintf('%s/%s', $projectDir, self::DEVEL_CONFIG);
}
/**
* Indicate whether or not development mode is enabled.
*
* @return int
*/
public function __invoke()
{
if (file_exists($this->develConfigFile)) {
// nothing to do
echo 'Development mode is ENABLED', PHP_EOL;
return 0;
}
echo 'Development mode is DISABLED', PHP_EOL;
return 0;
}
}