This repository has been archived by the owner on Jun 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Module.php
82 lines (74 loc) · 2.66 KB
/
Module.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2013 Rob Allen (http://19ft.com)
*/
namespace NFDevelopmentMode;
use Zend\Console\Adapter\AdapterInterface as Console;
class Module
{
public function getConfig()
{
return array(
'controllers' => array(
'invokables' => array(
'NFDevelopmentMode\DevelopmentModeController' => 'NFDevelopmentMode\DevelopmentModeController',
),
),
'console' => array(
'router' => array(
'routes' => array(
'development-disable' => array(
'options' => array(
'route' => 'development disable',
'defaults' => array(
'controller' => 'NFDevelopmentMode\DevelopmentModeController',
'action' => 'disable',
),
),
),
'development-enable' => array(
'options' => array(
'route' => 'development enable',
'defaults' => array(
'controller' => 'NFDevelopmentMode\DevelopmentModeController',
'action' => 'enable',
),
),
),
),
),
),
);
}
/**
* Display a console banner, if development mode is active
*
* @return string
*/
public function getConsoleBanner(Console $console)
{
if (file_exists('config/development.config.php')) {
$string = '';
$text = '* Development mode enabled';
$spaces = $console->getWidth() - strlen($text) - 1;
$return = str_repeat('*', $console->getWidth());
$return .= strtoupper($text) . str_repeat(' ', $spaces) . '*';
$return .= str_repeat('*', $console->getWidth());
return $return;
}
}
/**
* Return the console usage for this module
*
* @param Console $console
* @return array
*/
public function getConsoleUsage(Console $console)
{
return array(
'development enable' => 'Enable the development mode (do not use in production)',
'development disable' => 'Disable the development mode'
);
}
}