for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by IntelliJ IDEA.
* User: uni
* Date: 22.11.17
* Time: 19:13
*/
namespace JPBernius\FMeat\Services;
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Exception\RequestException;
use JPBernius\FMeat\Entities\{
CalendarWeek,
Week
};
use JPBernius\FMeat\Exeptions\NetworkingException;
use JPBernius\FMeat\Utilities\UrlBuilder;
* Class NetworkService
* @package JPBernius\FMeat\Services
class NetworkService
{
/** @var HttpClient */
private $httpClient;
/** @var UrlBuilder */
private $urlBuilder;
* NetworkService constructor.
* @param HttpClient $httpClient
* @param UrlBuilder $urlBuilder
public function __construct(HttpClient $httpClient, UrlBuilder $urlBuilder)
$this->httpClient = $httpClient;
$this->urlBuilder = $urlBuilder;
}
* @param int $week
$week
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @param int $year
$year
* @param string $location
* @return Week
* @throws NetworkingException
public function getWeekWithLocation(CalendarWeek $calendarWeek, string $location): Week
$url = $this->urlBuilder->getUrlForLocationYearWeek($location, $calendarWeek);
try {
$response = $this->httpClient->get($url);
$jsonResponse = (string)$response->getBody();
$jsonObject = json_decode($jsonResponse);
return Week::fromJson($jsonObject);
} catch (RequestException $requestException) {
throw new NetworkingException();
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.