我试图将Gistlog的动态复制作为我的编程技能的基准,并且在测试应用程序时我一直遇到问题。当应用程序运行时,我将gist输入到输入栏中,但是当我转到下一页时,会出现此错误,说明其中一个方法的参数太少:__ construct()。它还声明当预期为1时使用0个参数。我在程序中使用该方法,如此文件中所示:
<?php
namespace Gistlog\Gists;
use Github\Client as Client;
/**
* Created by PhpStorm.
* User: JHaro
* Date: 3/4/2017
* Time: 8:14 AM
*/
class GistRepository
{
private $github;
public function __construct(Github\Client $github)
{
$this->github = $github;
}
/*
* @param $url
* return $gist
*/
public function getByUrl($url)
{
$id = $this->extractedIdFromUrl($url);
$gist = $this->getById($id);
return Gist::fromGithub($gist);
}
public function extractedIdFromUrl($url)
{
$segments = explode('/', $url);
return last($segments);
}
/**
* @param $id
*/
public function getById($id)
{
$gist = $this->github->gists()->show($id);
dd($gist);
}
}
如何修复此程序以解决此错误?