Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 82aca66

Browse files
committed
CS fixes for Zend_Application_Resource
1 parent eb05aa4 commit 82aca66

File tree

7 files changed

+75
-63
lines changed

7 files changed

+75
-63
lines changed

library/Zend/Application/Resource/Frontcontroller.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function init()
7272
if (is_string($value)) {
7373
$front->addModuleDirectory($value);
7474
} elseif (is_array($value)) {
75-
foreach($value as $moduleDir) {
75+
foreach ($value as $moduleDir) {
7676
$front->addModuleDirectory($moduleDir);
7777
}
7878
}
@@ -103,11 +103,10 @@ public function init()
103103
case 'plugins':
104104
foreach ((array) $value as $pluginClass) {
105105
$stackIndex = null;
106-
if(is_array($pluginClass)) {
106+
if (is_array($pluginClass)) {
107107
$pluginClass = array_change_key_case($pluginClass, CASE_LOWER);
108-
if(isset($pluginClass['class']))
109-
{
110-
if(isset($pluginClass['stackindex'])) {
108+
if (isset($pluginClass['class'])) {
109+
if (isset($pluginClass['stackindex'])) {
111110
$stackIndex = $pluginClass['stackindex'];
112111
}
113112

@@ -137,7 +136,7 @@ public function init()
137136
break;
138137

139138
case 'dispatcher':
140-
if(!isset($value['class'])) {
139+
if (!isset($value['class'])) {
141140
require_once 'Zend/Application/Exception.php';
142141
throw new Zend_Application_Exception('You must specify both ');
143142
}
@@ -146,7 +145,7 @@ public function init()
146145
}
147146

148147
$dispatchClass = $value['class'];
149-
if(!class_exists($dispatchClass)) {
148+
if (!class_exists($dispatchClass)) {
150149
require_once 'Zend/Application/Exception.php';
151150
throw new Zend_Application_Exception('Dispatcher class not found!');
152151
}

library/Zend/Application/Resource/Locale.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public function getLocale()
6868

6969
if (!isset($options['default'])) {
7070
$this->_locale = new Zend_Locale();
71-
} elseif(!isset($options['force']) ||
72-
(bool) $options['force'] == false)
73-
{
71+
} elseif (!isset($options['force'])
72+
|| (bool)$options['force'] == false
73+
) {
7474
// Don't force any locale, just go for auto detection
7575
Zend_Locale::setDefault($options['default']);
7676
$this->_locale = new Zend_Locale();

library/Zend/Application/Resource/Mail.php

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceA
4343
*/
4444
protected $_transport;
4545

46-
public function init() {
46+
public function init()
47+
{
4748
return $this->getMail();
4849
}
4950

@@ -55,21 +56,21 @@ public function getMail()
5556
{
5657
if (null === $this->_transport) {
5758
$options = $this->getOptions();
58-
foreach($options as $key => $option) {
59+
foreach ($options as $key => $option) {
5960
$options[strtolower($key)] = $option;
6061
}
6162
$this->setOptions($options);
6263

63-
if(isset($options['transport']) &&
64-
!is_numeric($options['transport']))
65-
{
64+
if (isset($options['transport'])
65+
&& !is_numeric($options['transport'])
66+
) {
6667
$this->_transport = $this->_setupTransport($options['transport']);
67-
if(!isset($options['transport']['register']) ||
68-
$options['transport']['register'] == '1' ||
69-
(isset($options['transport']['register']) &&
70-
!is_numeric($options['transport']['register']) &&
71-
(bool) $options['transport']['register'] == true))
72-
{
68+
if (!isset($options['transport']['register'])
69+
|| $options['transport']['register'] == '1'
70+
|| (isset($options['transport']['register'])
71+
&& !is_numeric($options['transport']['register'])
72+
&& (bool)$options['transport']['register'] == true)
73+
) {
7374
Zend_Mail::setDefaultTransport($this->_transport);
7475
}
7576
}
@@ -81,19 +82,23 @@ public function getMail()
8182
return $this->_transport;
8283
}
8384

84-
protected function _setDefaults($type) {
85+
protected function _setDefaults($type)
86+
{
8587
$key = strtolower('default' . $type);
8688
$options = $this->getOptions();
8789

88-
if(isset($options[$key]['email']) &&
89-
!is_numeric($options[$key]['email']))
90-
{
90+
if (isset($options[$key]['email'])
91+
&& !is_numeric($options[$key]['email'])
92+
) {
9193
$method = array('Zend_Mail', 'setDefault' . ucfirst($type));
92-
if(isset($options[$key]['name']) &&
93-
!is_numeric($options[$key]['name']))
94-
{
95-
call_user_func($method, $options[$key]['email'],
96-
$options[$key]['name']);
94+
if (isset($options[$key]['name'])
95+
&& !is_numeric(
96+
$options[$key]['name']
97+
)
98+
) {
99+
call_user_func(
100+
$method, $options[$key]['email'], $options[$key]['name']
101+
);
97102
} else {
98103
call_user_func($method, $options[$key]['email']);
99104
}
@@ -102,19 +107,17 @@ protected function _setDefaults($type) {
102107

103108
protected function _setupTransport($options)
104109
{
105-
if(!isset($options['type'])) {
110+
if (!isset($options['type'])) {
106111
$options['type'] = 'sendmail';
107112
}
108-
113+
109114
$transportName = $options['type'];
110-
if(!Zend_Loader_Autoloader::autoload($transportName))
111-
{
115+
if (!Zend_Loader_Autoloader::autoload($transportName)) {
112116
$transportName = ucfirst(strtolower($transportName));
113117

114-
if(!Zend_Loader_Autoloader::autoload($transportName))
115-
{
118+
if (!Zend_Loader_Autoloader::autoload($transportName)) {
116119
$transportName = 'Zend_Mail_Transport_' . $transportName;
117-
if(!Zend_Loader_Autoloader::autoload($transportName)) {
120+
if (!Zend_Loader_Autoloader::autoload($transportName)) {
118121
throw new Zend_Application_Resource_Exception(
119122
"Specified Mail Transport '{$transportName}'"
120123
. 'could not be found'
@@ -128,10 +131,11 @@ protected function _setupTransport($options)
128131

129132
switch($transportName) {
130133
case 'Zend_Mail_Transport_Smtp':
131-
if(!isset($options['host'])) {
134+
if (!isset($options['host'])) {
132135
throw new Zend_Application_Resource_Exception(
133136
'A host is necessary for smtp transport,'
134-
.' but none was given');
137+
. ' but none was given'
138+
);
135139
}
136140

137141
$transport = new $transportName($options['host'], $options);

library/Zend/Application/Resource/Modules.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,27 @@ public function init()
7272
foreach ($modules as $module => $moduleDirectory) {
7373
$bootstrapClass = $this->_formatModuleName($module) . '_Bootstrap';
7474
if (!class_exists($bootstrapClass, false)) {
75-
$bootstrapPath = dirname($moduleDirectory) . '/Bootstrap.php';
75+
$bootstrapPath = dirname($moduleDirectory) . '/Bootstrap.php';
7676
if (file_exists($bootstrapPath)) {
7777
$eMsgTpl = 'Bootstrap file found for module "%s" but bootstrap class "%s" not found';
7878
include_once $bootstrapPath;
7979
if (($default != $module)
8080
&& !class_exists($bootstrapClass, false)
8181
) {
82-
throw new Zend_Application_Resource_Exception(sprintf(
83-
$eMsgTpl, $module, $bootstrapClass
84-
));
82+
throw new Zend_Application_Resource_Exception(
83+
sprintf(
84+
$eMsgTpl, $module, $bootstrapClass
85+
)
86+
);
8587
} elseif ($default == $module) {
8688
if (!class_exists($bootstrapClass, false)) {
8789
$bootstrapClass = 'Bootstrap';
8890
if (!class_exists($bootstrapClass, false)) {
89-
throw new Zend_Application_Resource_Exception(sprintf(
90-
$eMsgTpl, $module, $bootstrapClass
91-
));
91+
throw new Zend_Application_Resource_Exception(
92+
sprintf(
93+
$eMsgTpl, $module, $bootstrapClass
94+
)
95+
);
9296
}
9397
}
9498
}
@@ -116,9 +120,9 @@ public function init()
116120
protected function bootstrapBootstraps($bootstraps)
117121
{
118122
$bootstrap = $this->getBootstrap();
119-
$out = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
123+
$out = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
120124

121-
foreach($bootstraps as $module => $bootstrapClass) {
125+
foreach ($bootstraps as $module => $bootstrapClass) {
122126
$moduleBootstrap = new $bootstrapClass($bootstrap);
123127
$moduleBootstrap->bootstrap();
124128
$out[$module] = $moduleBootstrap;

library/Zend/Application/Resource/Multidb.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function init()
114114
*/
115115
public function isDefault($db)
116116
{
117-
if(!$db instanceof Zend_Db_Adapter_Abstract) {
117+
if (!$db instanceof Zend_Db_Adapter_Abstract) {
118118
$db = $this->getDb($db);
119119
}
120120

library/Zend/Application/Resource/Navigation.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ public function init()
5757
if (!$this->_container) {
5858
$options = $this->getOptions();
5959

60-
if(isset($options['defaultPageType'])) {
61-
Zend_Navigation_Page::setDefaultPageType($options['defaultPageType']);
60+
if (isset($options['defaultPageType'])) {
61+
Zend_Navigation_Page::setDefaultPageType(
62+
$options['defaultPageType']
63+
);
6264
}
63-
65+
6466
$pages = isset($options['pages']) ? $options['pages'] : array();
6567
$this->_container = new Zend_Navigation($pages);
6668
}
@@ -93,15 +95,16 @@ public function store()
9395
protected function _storeRegistry()
9496
{
9597
$options = $this->getOptions();
96-
if(isset($options['storage']['registry']['key']) &&
97-
!is_numeric($options['storage']['registry']['key'])) // see ZF-7461
98-
{
99-
$key = $options['storage']['registry']['key'];
98+
// see ZF-7461
99+
if (isset($options['storage']['registry']['key'])
100+
&& !is_numeric($options['storage']['registry']['key'])
101+
) {
102+
$key = $options['storage']['registry']['key'];
100103
} else {
101104
$key = self::DEFAULT_REGISTRY_KEY;
102105
}
103106

104-
Zend_Registry::set($key,$this->getContainer());
107+
Zend_Registry::set($key, $this->getContainer());
105108
}
106109

107110
/**

library/Zend/Application/Resource/Translate.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function getTranslate()
9393
}
9494

9595
if (isset($options['options'])) {
96-
foreach($options['options'] as $key => $value) {
96+
foreach ($options['options'] as $key => $value) {
9797
$options[$key] = $value;
9898
}
9999
}
@@ -118,13 +118,15 @@ public function getTranslate()
118118
: self::DEFAULT_REGISTRY_KEY;
119119
unset($options['registry_key']);
120120

121-
if(Zend_Registry::isRegistered($key)) {
121+
if (Zend_Registry::isRegistered($key)) {
122122
$translate = Zend_Registry::get($key);
123-
if(!$translate instanceof Zend_Translate) {
123+
if (!$translate instanceof Zend_Translate) {
124124
require_once 'Zend/Application/Resource/Exception.php';
125-
throw new Zend_Application_Resource_Exception($key
126-
. ' already registered in registry but is '
127-
. 'no instance of Zend_Translate');
125+
throw new Zend_Application_Resource_Exception(
126+
$key
127+
. ' already registered in registry but is '
128+
. 'no instance of Zend_Translate'
129+
);
128130
}
129131

130132
$translate->addTranslation($options);

0 commit comments

Comments
 (0)