Source of file Exception.php

Size: 0,900 Bytes - Last Modified: 2015-12-22T09:12:14-05:00

../src/View/Helper/Exception.php

123456789101112131415161718192021222324252627282930313233343536
Covered by 2 test(s):
  • MvcLite\ViewHelperExceptionTest::testRender with data set "basic test"
  • MvcLite\ViewHelperExceptionTest::testRender with data set "null exception"
37
Covered by 1 test(s):
  • MvcLite\ViewHelperExceptionTest::testRender with data set "null exception"
383940
Covered by 1 test(s):
  • MvcLite\ViewHelperExceptionTest::testRender with data set "basic test"
414243
<?php
/**
 * Exception message view helper
 *
 * @category    PHP
 * @package     MvcLite
 * @subpackage  View\Helper
 * @since       File available since release 1.1.x
 * @author      Cory Collier <corycollier@corycollier.com>
 */

namespace MvcLite\View\Helper;

use MvcLite\View\HelperAbstract as HelperAbstract;

/**
 * Exception message view helper
 *
 * @category    PHP
 * @package     MvcLite
 * @subpackage  View\Helper
 * @since       Class available since release 1.1.x
 * @author      Cory Collier <corycollier@corycollier.com>
 */

class Exception extends HelperAbstract
{
    /**
     * Returns a string representation of an expected exception
     *
     * @param Exception $exception
     * @return string
     */
    public function render($exception = null)
    {
        if (is_null($exception)) {
            return '';
        }

        return $exception->getMessage();
    }
}