for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Zeeshanu\Yell;
use Zeeshanu\Yell\Exceptions\UndefinedPropertyException;
trait Scream
{
/**
* Check if the property that user trying to get exists or not. If the property
* doesn't exist then throw an exception.
*
* @param string $propertyName
* @throws UndefinedPropertyException
* @return void
*/
public function __get($propertyName)
if (! property_exists($this, $propertyName)) {
throw new UndefinedPropertyException($this->getScreamErrorMessage("get"));
getScreamErrorMessage()
$propertyName
This check looks for function calls that miss required arguments.
}
* Check if the property that user trying to set exists or not. If the property
* @param mixed $value
public function __set($propertyName, $value)
$value
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
throw new UndefinedPropertyException($this->getScreamErrorMessage("set", $propertyName));
* Generates an exception message.
* @param string $errorType
* @return string Exception message
public function getScreamErrorMessage($errorType, $propertyName)
return 'Trying to ' . $errorType . ' undefined property $' . $propertyName . ' in class ' . get_class($this);
This check looks for function calls that miss required arguments.