for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Desmond\functions\core;
use Desmond\functions\DesmondFunction;
use Desmond\ArgumentHelper;
use Desmond\exceptions\ArgumentException;
class Add extends DesmondFunction
{
use ArgumentHelper;
public function id()
return '+';
}
public function run(array $args)
$value = 0;
foreach ($args as $arg) {
if (!$this->isDesmondType('Number', $arg)) {
throw new ArgumentException('"+" expects arguments to be Numbers.');
$value += $arg->value();
return $this->newReturnType('Number', abs($value));