for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace GarethEllis\Tldr;
class Client
{
protected $http;
protected $pagesUrl = "https://api.github.com/repos/tldr-pages/tldr/contents/pages/index.json?ref=master";
/**
* Client constructor.
* @param \GuzzleHttp\Client $http
*/
public function __construct($http)
$this->http = $http;
}
public function setPagesUrl(string $url)
$this->pagesUrl = $url;
public function getPagesUrl()
return $this->pagesUrl;
public function lookupPage(string $page)
$response = $this->http->get($this->getPagesUrl());
$contents = json_decode($response->getBody()->getContents(), true);
$pages = base64_decode($contents["content"]);
$json = json_decode($pages, true);
$pages = $json["commands"];
$pages = array_filter($pages, function ($foundPage) use ($page) {
return $foundPage["name"] === $page;
});
foreach ($pages as $page) {
foreach
This check looks for foreach loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.
Consider removing the loop.
This check looks for
foreach
loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.Consider removing the loop.