Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/psr-2_compliance' of git://github.com/RWOverdijk…
Browse files Browse the repository at this point in the history
…/zf2 into RWOverdijk-hotfix/psr-2_compliance
  • Loading branch information
Ralph Schindler committed Aug 13, 2012
2 parents 3953c79 + f29e5e9 commit 47ed633
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions src/Helper/Cycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Cycle extends AbstractHelper implements \Iterator
*/
public function __invoke(array $data = array(), $name = self::DEFAULT_NAME)
{
if(!empty($data))
if (!empty($data))
$this->data[$name] = $data;

$this->setName($name);
Expand Down Expand Up @@ -87,10 +87,10 @@ public function setName($name = self::DEFAULT_NAME)
{
$this->name = $name;

if(!isset($this->data[$this->name]))
if (!isset($this->data[$this->name]))
$this->data[$this->name] = array();

if(!isset($this->pointers[$this->name]))
if (!isset($this->pointers[$this->name]))
$this->rewind();

return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/DeclareVars.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __invoke()
{
$view = $this->getView();
$args = func_get_args();
foreach($args as $key) {
foreach ($args as $key) {
if (is_array($key)) {
foreach ($key as $name => $value) {
$this->declareVar($name, $value);
Expand Down
14 changes: 7 additions & 7 deletions src/Helper/HeadLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ public function itemToString(\stdClass $item)

foreach ($this->itemKeys as $itemKey) {
if (isset($attributes[$itemKey])) {
if(is_array($attributes[$itemKey])) {
foreach($attributes[$itemKey] as $key => $value) {
if (is_array($attributes[$itemKey])) {
foreach ($attributes[$itemKey] as $key => $value) {
$link .= sprintf('%s="%s" ', $key, ($this->autoEscape) ? $this->escape($value) : $value);
}
} else {
Expand Down Expand Up @@ -345,22 +345,22 @@ public function createDataStylesheet(array $args)

if (0 < count($args)) {
$media = array_shift($args);
if(is_array($media)) {
if (is_array($media)) {
$media = implode(',', $media);
} else {
$media = (string) $media;
}
}
if (0 < count($args)) {
$conditionalStylesheet = array_shift($args);
if(!empty($conditionalStylesheet) && is_string($conditionalStylesheet)) {
if (!empty($conditionalStylesheet) && is_string($conditionalStylesheet)) {
$conditionalStylesheet = (string) $conditionalStylesheet;
} else {
$conditionalStylesheet = null;
}
}

if(0 < count($args) && is_array($args[0])) {
if (0 < count($args) && is_array($args[0])) {
$extras = array_shift($args);
$extras = (array) $extras;
}
Expand Down Expand Up @@ -406,11 +406,11 @@ public function createDataAlternate(array $args)
$type = array_shift($args);
$title = array_shift($args);

if(0 < count($args) && is_array($args[0])) {
if (0 < count($args) && is_array($args[0])) {
$extras = array_shift($args);
$extras = (array) $extras;

if(isset($extras['media']) && is_array($extras['media'])) {
if (isset($extras['media']) && is_array($extras['media'])) {
$extras['media'] = implode(',', $extras['media']);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Helper/HeadStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ public function itemToString(\stdClass $item, $indent)
continue;
}
if ('media' == $key) {
if(false === strpos($value, ',')) {
if (false === strpos($value, ',')) {
if (!in_array($value, $this->mediaTypes)) {
continue;
}
} else {
$media_types = explode(',', $value);
$value = '';
foreach($media_types as $type) {
foreach ($media_types as $type) {
$type = trim($type);
if (!in_array($type, $this->mediaTypes)) {
continue;
Expand Down Expand Up @@ -395,7 +395,7 @@ public function createData($content, array $attributes)
{
if (!isset($attributes['media'])) {
$attributes['media'] = 'screen';
} else if(is_array($attributes['media'])) {
} elseif (is_array($attributes['media'])) {
$attributes['media'] = implode(',', $attributes['media']);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Model/ConsoleModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function setErrorLevel($errorLevel)
*/
public function getErrorLevel()
{
if(array_key_exists('errorLevel', $this->options)){
if (array_key_exists('errorLevel', $this->options)) {
return $this->options['errorLevel'];
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/JsonModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function serialize()
$variables = ArrayUtils::iteratorToArray($variables);
}

if(!is_null($this->jsonpCallback)) {
if (!is_null($this->jsonpCallback)) {
return $this->jsonpCallback.'('.Json::encode($variables).');';
} else {
return Json::encode($variables);
Expand Down
4 changes: 2 additions & 2 deletions src/Model/ViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ public function getOptions()
public function getVariable($name, $default = null)
{
$name = (string)$name;
if(array_key_exists($name,$this->variables)){
if (array_key_exists($name,$this->variables)) {
return $this->variables[$name];
}else{
} else {
return $default;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Renderer/ConsoleRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct($config = array())
$this->init();
}

public function setResolver(Resolver $resolver){}
public function setResolver(Resolver $resolver) {}

/**
* Return the template engine object
Expand Down Expand Up @@ -128,7 +128,7 @@ public function getFilterChain()
*/
public function render($model, $values = null)
{
if(!$model instanceof Model){
if (!$model instanceof Model) {
return '';
}

Expand All @@ -145,14 +145,14 @@ public function render($model, $values = null)

$values = $model->getVariables();

if(isset($values['result'])){
if (isset($values['result'])) {
// filter and append the result
$result .= $this->getFilterChain()->filter($values['result']);
}

if($model->hasChildren()){
if ($model->hasChildren()) {
// recursively render all children
foreach($model->getChildren() as $child){
foreach ($model->getChildren() as $child) {
$result .= $this->render($child, $values);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected function renderChildren(Model $model)
$child->setOption('has_parent', null);
$capture = $child->captureTo();
if (!empty($capture)) {
if($child->isAppend()) {
if ($child->isAppend()) {
$oldResult=$model->{$capture};
$model->setVariable($capture, $oldResult.$result);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/ViewEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function getResult()
*/
public function getParam($name, $default = null)
{
switch($name) {
switch ($name) {
case 'model':
return $this->getModel();
case 'renderer':
Expand Down
2 changes: 1 addition & 1 deletion test/Helper/CycleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function testTwoCyclesInLoop()
{
$expected = array(5,4,2,3);
$expected2 = array(7,34,8,6);
for($i=0;$i<4;$i++) {
for ($i=0;$i<4;$i++) {
$this->assertEquals($expected[$i], (string) $this->helper->__invoke($expected)->next());
$this->assertEquals($expected2[$i], (string) $this->helper->__invoke($expected2,'cycle2')->next());
}
Expand Down

0 comments on commit 47ed633

Please sign in to comment.