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

Commit

Permalink
Merge branch 'cs/zendframework/zendframework#6674-zend-view-cs-fixes'…
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Nov 22, 2014
171 parents a1038ed + 574f311 + c64cbb9 + 17f750b + 7eb9c53 + 274ca2b + b273593 + 7b4d532 + f3d9b3a + f7ab865 + d9d9b78 + fefc773 + 83cbc8a + 1b9fd60 + 8a8b989 + 10da323 + e6aba5a + b71d0a2 + 2aa926c + 8405746 + bf1a8de + f16339d + ed1dbc8 + dbf56da + bdb277e + 364ced3 + 9fccdf3 + 40f5963 + 9d7ddea + e1e4aa8 + 870703b + 958decf + e49a08e + a051e7e + b9f6e35 + 2bbef72 + aea30ce + faec0a2 + 098e166 + 51d6372 + 8757ace + 42477b6 + 32cf329 + 0ebadc5 + 188fa4d + a41bbf0 + a29bbbc + 941280d + d691226 + e547023 + d91c234 + 006ef75 + 69d1518 + 7dc0d1a + a995715 + e780008 + e810876 + 9e4090a + 269bf01 + 3a1f2fd + 0cab32d + 704cc7f + e20c9e6 + a0dfc1a + 76b3e1c + fd429e8 + 187ea79 + 2b43ea6 + e3b1be1 + 19f0ef6 + 33bf9c0 + 3729984 + a5ce396 + 698dbe0 + 0efca0b + 08b2a78 + ddaa846 + 7fe4493 + 0da7331 + 7226b1d + 851904c + a2eb795 + f658a03 + de83270 + 806df8a + 4e7ff23 + 409b768 + 1b97191 + d2649e3 + f0162d1 + 6f01416 + a2b3753 + 1786961 + d157fcb + 4444c37 + 192d20c + 811122b + 3a2cf9b + eb2029b + 7a6edab + 8d8a05d + c1ddf21 + 0090b4d + ef80e35 + 59b30de + 4656098 + 377b920 + ccba82c + 5d2770e + 41714a1 + 8adef43 + a78628f + b35fa7a + 3953c79 + aa28e42 + 38f9a49 + 47ed633 + 0a6bf6e + b61d89d + a1fbb6f + 238512b + f40a328 + 62dc143 + 328df3b + e12fe2d + e34a942 + 04e956d + a19a8c2 + ac4b6c0 + d28282e + bd5af3d + b976cb5 + 4feb67b + 7164be7 + 40174df + e4918ae + 1d9f9a2 + c77ae57 + 223b881 + c2f4e25 + e08b166 + e58e548 + 85e6bbd + 0ac2052 + c7ba6af + f443c57 + 1380626 + 5316b6e + a6136d4 + d233be3 + c100a2a + c6a0e2c + e7eef3c + 812f35d + 604cdcd + 5472285 + 6e2f420 + 76c4d1c + c60cca9 + 77f718e + 6bc8c90 + 6ec1d0f + 53d9070 + a67cdeb + 5d412ee + 132380c + 2809ef0 + a883a8d + 4aa93a8 + ab41e15 + b0f6c6d commit 171f5bf
Show file tree
Hide file tree
Showing 26 changed files with 36 additions and 83 deletions.
4 changes: 1 addition & 3 deletions src/Exception/BadMethodCallException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
/**
* Bad method call exception
*/
class BadMethodCallException
extends \BadMethodCallException
implements ExceptionInterface
class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
{
}
4 changes: 1 addition & 3 deletions src/Exception/DomainException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
/**
* Domain exception
*/
class DomainException
extends \DomainException
implements ExceptionInterface
class DomainException extends \DomainException implements ExceptionInterface
{
}
4 changes: 1 addition & 3 deletions src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
/**
* Invalid argument exception
*/
class InvalidArgumentException
extends \InvalidArgumentException
implements ExceptionInterface
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}
4 changes: 1 addition & 3 deletions src/Exception/InvalidHelperException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
/**
* Invalid helper exception
*/
class InvalidHelperException
extends \Exception
implements ExceptionInterface
class InvalidHelperException extends \Exception implements ExceptionInterface
{
}
4 changes: 1 addition & 3 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
/**
* Runtime exception
*/
class RuntimeException
extends \RuntimeException
implements ExceptionInterface
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}
3 changes: 1 addition & 2 deletions src/Exception/UnexpectedValueException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/**
* Unexpected value exception
*/
class UnexpectedValueException extends \UnexpectedValueException implements
ExceptionInterface
class UnexpectedValueException extends \UnexpectedValueException implements ExceptionInterface
{
}
3 changes: 1 addition & 2 deletions src/Helper/Cycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function toString()
* @param string $name
* @return Cycle
*/
public function assign(Array $data , $name = self::DEFAULT_NAME)
public function assign(array $data, $name = self::DEFAULT_NAME)
{
$this->setName($name);
$this->data[$name] = $data;
Expand Down Expand Up @@ -127,7 +127,6 @@ public function getName()
return $this->name;
}


/**
* Return all elements
*
Expand Down
1 change: 0 additions & 1 deletion src/Helper/EscapeCss.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Zend\View\Helper;


/**
* Helper for escaping values
*/
Expand Down
1 change: 0 additions & 1 deletion src/Helper/EscapeHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Zend\View\Helper;


/**
* Helper for escaping values
*/
Expand Down
1 change: 0 additions & 1 deletion src/Helper/EscapeHtmlAttr.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Zend\View\Helper;


/**
* Helper for escaping values
*/
Expand Down
1 change: 0 additions & 1 deletion src/Helper/EscapeJs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Zend\View\Helper;


/**
* Helper for escaping values
*/
Expand Down
1 change: 0 additions & 1 deletion src/Helper/EscapeUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Zend\View\Helper;


/**
* Helper for escaping values
*/
Expand Down
13 changes: 4 additions & 9 deletions src/Helper/HeadLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,9 @@ public function __call($method, $args)
}

if (1 > $argc) {
throw new Exception\BadMethodCallException(sprintf(
'%s requires at least one argument',
$method
));
throw new Exception\BadMethodCallException(
sprintf('%s requires at least one argument', $method)
);
}

if (is_array($args[0])) {
Expand Down Expand Up @@ -266,7 +265,6 @@ public function set($value)
return $this->getContainer()->set($value);
}


/**
* Create HTML link element from data item
*
Expand Down Expand Up @@ -300,10 +298,7 @@ public function itemToString(stdClass $item)
return '';
}

if (isset($attributes['conditionalStylesheet'])
&& !empty($attributes['conditionalStylesheet'])
&& is_string($attributes['conditionalStylesheet'])
) {
if (isset($attributes['conditionalStylesheet']) && !empty($attributes['conditionalStylesheet']) && is_string($attributes['conditionalStylesheet'])) {
// inner wrap with comment end and start if !IE
if (str_replace(' ', '', $attributes['conditionalStylesheet']) === '!IE') {
$link = '<!-->' . $link . '<!--';
Expand Down
11 changes: 2 additions & 9 deletions src/Helper/HeadMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ public function __invoke($content = null, $keyValue = null, $keyType = 'name', $
*/
public function __call($method, $args)
{
if (preg_match(
'/^(?P<action>set|(pre|ap)pend|offsetSet)(?P<type>Name|HttpEquiv|Property|Itemprop)$/',
$method,
$matches)
) {
if (preg_match('/^(?P<action>set|(pre|ap)pend|offsetSet)(?P<type>Name|HttpEquiv|Property|Itemprop)$/', $method, $matches)) {
$action = $matches['action'];
$type = $this->normalizeType($matches['type']);
$argc = count($args);
Expand Down Expand Up @@ -265,10 +261,7 @@ public function itemToString(stdClass $item)
$modifiersString
);

if (isset($item->modifiers['conditional'])
&& !empty($item->modifiers['conditional'])
&& is_string($item->modifiers['conditional'])
) {
if (isset($item->modifiers['conditional']) && !empty($item->modifiers['conditional']) && is_string($item->modifiers['conditional'])) {
// inner wrap with comment end and start if !IE
if (str_replace(' ', '', $item->modifiers['conditional']) === '!IE') {
$meta = '<!-->' . $meta . '<!--';
Expand Down
18 changes: 4 additions & 14 deletions src/Helper/HeadScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,7 @@ public function createData($type, array $attributes, $content = null)
protected function isDuplicate($file)
{
foreach ($this->getContainer() as $item) {
if (($item->source === null)
&& array_key_exists('src', $item->attributes)
&& ($file == $item->attributes['src'])
) {
if (($item->source === null) && array_key_exists('src', $item->attributes) && ($file == $item->attributes['src'])) {
return true;
}
}
Expand All @@ -347,10 +344,7 @@ protected function isDuplicate($file)
*/
protected function isValid($value)
{
if ((!$value instanceof stdClass)
|| !isset($value->type)
|| (!isset($value->source) && !isset($value->attributes))
) {
if ((!$value instanceof stdClass) || !isset($value->type) || (!isset($value->source) && !isset($value->attributes))) {
return false;
}

Expand All @@ -372,8 +366,7 @@ public function itemToString($item, $indent, $escapeStart, $escapeEnd)
if (!empty($item->attributes)) {
foreach ($item->attributes as $key => $value) {
if ((!$this->arbitraryAttributesAllowed() && !in_array($key, $this->optionalAttributes))
|| in_array($key, array('conditional', 'noescape'))
) {
|| in_array($key, array('conditional', 'noescape'))) {
continue;
}
if ('defer' == $key) {
Expand Down Expand Up @@ -404,10 +397,7 @@ public function itemToString($item, $indent, $escapeStart, $escapeEnd)
}
$html .= '</script>';

if (isset($item->attributes['conditional'])
&& !empty($item->attributes['conditional'])
&& is_string($item->attributes['conditional'])
) {
if (isset($item->attributes['conditional']) && !empty($item->attributes['conditional']) && is_string($item->attributes['conditional'])) {
// inner wrap with comment end and start if !IE
if (str_replace(' ', '', $item->attributes['conditional']) === '!IE') {
$html = '<!-->' . $html . '<!--';
Expand Down
5 changes: 1 addition & 4 deletions src/Helper/HeadStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,7 @@ public function createData($content, array $attributes)
*/
protected function isValid($value)
{
if ((!$value instanceof stdClass)
|| !isset($value->content)
|| !isset($value->attributes)
) {
if ((!$value instanceof stdClass) || !isset($value->content) || !isset($value->attributes)) {
return false;
}

Expand Down
4 changes: 1 addition & 3 deletions src/Helper/HeadTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ public function renderTitle()

if (null !== ($translator = $this->getTranslator())) {
foreach ($this as $item) {
$items[] = $translator->translate(
$item, $this->getTranslatorTextDomain()
);
$items[] = $translator->translate($item, $this->getTranslatorTextDomain());
}
} else {
foreach ($this as $item) {
Expand Down
3 changes: 2 additions & 1 deletion src/Helper/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ protected function inject(NavigationHelper $helper)

if ($this->getInjectTranslator() && !$helper->hasTranslator()) {
$helper->setTranslator(
$this->getTranslator(), $this->getTranslatorTextDomain()
$this->getTranslator(),
$this->getTranslatorTextDomain()
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Helper/Navigation/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ public function renderPartial($container = null, $partial = null)
if (count($partial) != 2) {
throw new Exception\InvalidArgumentException(
'Unable to render menu: A view partial supplied as '
. 'an array must contain two values: partial view '
. 'script and module where script can be found'
. 'an array must contain two values: partial view '
. 'script and module where script can be found'
);
}

Expand Down
3 changes: 1 addition & 2 deletions src/Helper/Navigation/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ public function getDomSitemap(AbstractContainer $container = null)
if (!$this->getUseSitemapValidators() ||
$priorityValidator->isValid($priority)) {
$urlNode->appendChild(
$dom->createElementNS(self::SITEMAP_NS, 'priority',
$priority)
$dom->createElementNS(self::SITEMAP_NS, 'priority', $priority)
);
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/Helper/Placeholder/Container/AbstractStandalone.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,12 @@ public function setContainerClass($name)
{
if (!class_exists($name)) {
throw new Exception\DomainException(
sprintf('%s expects a valid container class name; received "%s", which did not resolve',
sprintf(
'%s expects a valid container class name; received "%s", which did not resolve',
__METHOD__,
$name
));
)
);
}

if (!in_array('Zend\View\Helper\Placeholder\Container\AbstractContainer', class_parents($name))) {
Expand Down
10 changes: 6 additions & 4 deletions src/Helper/Placeholder/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,12 @@ public function setContainerClass($name)
{
if (!class_exists($name)) {
throw new Exception\DomainException(
sprintf('%s expects a valid registry class name; received "%s", which did not resolve',
__METHOD__,
$name
));
sprintf(
'%s expects a valid registry class name; received "%s", which did not resolve',
__METHOD__,
$name
)
);
}

if (!in_array('Zend\View\Helper\Placeholder\Container\AbstractContainer', class_parents($name))) {
Expand Down
1 change: 0 additions & 1 deletion src/Model/ConsoleModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Zend\View\Model;


class ConsoleModel extends ViewModel
{
const RESULT = 'result';
Expand Down
1 change: 0 additions & 1 deletion src/Model/ModelInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ public function setTerminal($terminate);
*/
public function terminate();


/**
* Set flag indicating whether or not append to child with the same capture
*
Expand Down
1 change: 0 additions & 1 deletion src/Model/ViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class ViewModel implements ModelInterface, ClearableModelInterface, RetrievableC
*/
protected $variables = array();


/**
* Is this append to child with the same capture?
*
Expand Down
8 changes: 2 additions & 6 deletions src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public function stream_open($path, $mode, $options, &$opened_path)
* Convert <?= ?> to long-form <?php echo ?> and <?php ?> to <?php ?>
*
*/
$this->data = preg_replace('/\<\?\=/', "<?php echo ", $this->data);
$this->data = preg_replace('/<\?(?!xml|php)/s', '<?php ', $this->data);
$this->data = preg_replace('/\<\?\=/', "<?php echo ", $this->data);
$this->data = preg_replace('/<\?(?!xml|php)/s', '<?php ', $this->data);

/**
* file_get_contents() won't update PHP's stat cache, so we grab a stat
Expand Down Expand Up @@ -109,7 +109,6 @@ public function stream_read($count)
return $ret;
}


/**
* Tells the current position in the stream.
*
Expand All @@ -120,7 +119,6 @@ public function stream_tell()
return $this->pos;
}


/**
* Tells if we are at the end of the stream.
*
Expand All @@ -131,7 +129,6 @@ public function stream_eof()
return $this->pos >= strlen($this->data);
}


/**
* Stream statistics.
*
Expand All @@ -142,7 +139,6 @@ public function stream_stat()
return $this->stat;
}


/**
* Seek to a specific point in the stream.
*
Expand Down

0 comments on commit 171f5bf

Please sign in to comment.