for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace seregazhuk\SmsIntel;
use seregazhuk\SmsIntel\Contracts\RequestInterface;
use seregazhuk\SmsIntel\Requests\RequestsContainer;
class Sender
{
/**
* @var RequestsContainer
*/
protected $requestsContainer;
* @param RequestsContainer $requestsContainer
public function __construct(RequestsContainer $requestsContainer)
$this->requestsContainer = $requestsContainer;
}
* Proxies all methods to appropriate Request object
*
* @param string $method
* @param array $arguments
* @return array
public function __call($method, $arguments)
$request = $this
->requestsContainer
->resolveRequestByAction($method);
return $this->callRequestMethod($request, $method, $arguments);
* @param RequestInterface $request
* @return mixed
protected function callRequestMethod(RequestInterface $request, $method, array $arguments)
switch (count($arguments)) {
case 1: return $request->{$method}($arguments[0]);
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
switch ($expr) { case "A": doSomething(); //right break; case "B": doSomethingElse(); //wrong break;
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.
As per the PSR-2 coding standard, the break (or other terminating) statement must be on a line of its own.
break
switch ($expr) { case "A": doSomething(); break; //wrong case "B": doSomething(); break; //right case "C:": doSomething(); return true; //right }
case 2: return $request->{$method}($arguments[0], $arguments[1]);
case 3: return $request->{$method}($arguments[0], $arguments[1], $arguments[2]);
case 4: return $request->{$method}($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4]);
default: return $request->{$method}($arguments);
According to the PSR-2, the body of a default statement must start on the line immediately following the statement.
switch ($expr) { default: doSomething(); //right break; } switch ($expr) { default: doSomething(); //wrong break; }
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.