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

Commit c039c51

Browse files
committed
use ! empty($this->prop) notation
- simplifies conditionals
1 parent b9c2813 commit c039c51

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

module/Application/view/error/404.phtml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1>A 404 error occurred</h1>
22
<h2><?= $this->message ?></h2>
33

4-
<?php if (!empty($this->reason)) : ?>
4+
<?php if (! empty($this->reason)) : ?>
55
<?php
66
switch ($this->reason) {
77
case \Zend\Mvc\Application::ERROR_CONTROLLER_CANNOT_DISPATCH:
@@ -27,24 +27,21 @@
2727
<p><?= $reasonMessage ?></p>
2828
<?php endif ?>
2929

30-
<?php if (isset($this->controller) && $this->controller) : ?>
30+
<?php if (! empty($this->controller)) : ?>
3131
<dl>
3232
<dt>Controller:</dt>
3333
<dd>
3434
<?= $this->escapeHtml($this->controller) ?>
3535
<?php
36-
if (isset($this->controller_class)
37-
&& $this->controller_class
38-
&& $this->controller_class != $this->controller
39-
) {
40-
echo '(' . sprintf('resolves to %s', $this->escapeHtml($this->controller_class)) . ')';
36+
if (! empty($this->controller_class) && $this->controller_class != $this->controller) {
37+
printf('(resolves to %s)', $this->escapeHtml($this->controller_class));
4138
}
4239
?>
4340
</dd>
4441
</dl>
4542
<?php endif ?>
4643

47-
<?php if (isset($this->display_exceptions) && $this->display_exceptions) : ?>
44+
<?php if (! empty($this->display_exceptions)) : ?>
4845
<?php if (isset($this->exception) && ($this->exception instanceof \Exception || $this->exception instanceof \Error)) : ?>
4946
<hr/>
5047

@@ -92,7 +89,7 @@
9289
<?php
9390
$ex = $ex->getPrevious();
9491
if (++$icount >= 50) {
95-
echo '<li>There may be more exceptions, but we have no enough memory to proccess it.</li>';
92+
echo '<li>There may be more exceptions, but we do not have enough memory to process it.</li>';
9693
break;
9794
}
9895
?>

module/Application/view/error/index.phtml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h1>An error occurred</h1>
22
<h2><?= $this->message ?></h2>
33

4-
<?php if (isset($this->display_exceptions) && $this->display_exceptions) : ?>
4+
<?php if (! empty($this->display_exceptions)) : ?>
55
<?php if (isset($this->exception) && ($this->exception instanceof \Exception || $this->exception instanceof \Error)) : ?>
66
<hr/>
77

@@ -27,8 +27,8 @@
2727

2828
<h2>Previous exceptions:</h2>
2929
<ul class="list-unstyled">
30-
<?php $icount = 0 ?>
31-
<?php while ($ex) : ?>
30+
<?php $icount = 0 ?>
31+
<?php while ($ex) : ?>
3232
<li>
3333
<h3><?= get_class($ex) ?></h3>
3434
<dl>
@@ -46,14 +46,14 @@
4646
</dd>
4747
</dl>
4848
</li>
49-
<?php
50-
$ex = $ex->getPrevious();
51-
if (++$icount >= 50) {
52-
echo '<li>There may be more exceptions, but we have no enough memory to proccess it.</li>';
53-
break;
54-
}
55-
?>
56-
<?php endwhile ?>
49+
<?php
50+
$ex = $ex->getPrevious();
51+
if (++$icount >= 50) {
52+
echo '<li>There may be more exceptions, but we do not have enough memory to process it.</li>';
53+
break;
54+
}
55+
?>
56+
<?php endwhile ?>
5757
</ul>
5858
<?php endif ?>
5959
<?php else : ?>

0 commit comments

Comments
 (0)