Skip to content
This repository has been archived by the owner on Dec 26, 2021. It is now read-only.

Commit

Permalink
revert to previous fix of issue gh-239
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Dec 11, 2017
1 parent b03bf62 commit 3d1216e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
10 changes: 0 additions & 10 deletions src/Bartlett/Reflect/Api/Analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,9 @@ public function dir()
* @return array metrics
* @throws \InvalidArgumentException if an analyser required is not installed
* @throws \RuntimeException if filter provided is not a closure
* @throws \DomainException if plateform constraint is not solved
*/
public function run($source, array $analysers, $alias = null, $format = false, $filter = false)
{
if (version_compare(PHP_VERSION, '7.1.0', 'ge')) {
throw new \DomainException(
sprintf(
'%s is unable to parse PHP scripts with syntax PHP 7.1 or greater',
$this->applicationName
)
);
}

$source = trim($source);
if ($alias) {
$alias = $source;
Expand Down
4 changes: 1 addition & 3 deletions src/Bartlett/Reflect/Api/BaseApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
abstract class BaseApi extends AbstractDispatcher
{
protected $client;
protected $applicationName;

private $token;
private $registerPlugins = true;
Expand All @@ -43,11 +42,10 @@ abstract class BaseApi extends AbstractDispatcher
* @param string $token
* @param string $appName
*/
public function __construct(ClientInterface $client, $token = null, $appName = 'MyApplication')
public function __construct(ClientInterface $client, $token = null)
{
$this->client = $client;
$this->token = $token;
$this->applicationName = (string) $appName;
}

/**
Expand Down
9 changes: 2 additions & 7 deletions src/Bartlett/Reflect/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class Client

private $client;
private $token;
private $applicationName;

/**
* Initialize a client for interacting with the API
Expand All @@ -43,12 +42,9 @@ class Client
* @param string $url
* @param string $appName
*/
public function __construct(ClientInterface $client = null, $url = self::API_V3, $appName = 'MyApplication')
public function __construct(ClientInterface $client = null, $url = self::API_V3)
{
$this->initializeClient($url, $client);

// available since release 4.2.0
$this->applicationName = $appName;
}

/**
Expand Down Expand Up @@ -93,8 +89,7 @@ public function api($name)
if ($this->client instanceof LocalClient) {
$this->client->setNamespace($ns . 'V3');
}
$api = new $class($this->client, $this->token, $this->applicationName);
return $api;
return new $class($this->client, $this->token);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Bartlett/Reflect/Console/CommandFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private function createCode($namespace, \ReflectionMethod $method)
return function (InputInterface $input, OutputInterface $output) use ($namespace, $method, $app) {
$methodName = $method->getName();

$client = new Client(Environment::getClient(), Client::API_V3, $app->getName() . ' ' . $app->getVersion());
$client = new Client(Environment::getClient());
$api = $client->api(strtolower($namespace));
$api->setEventDispatcher($app->getDispatcher());

Expand Down

0 comments on commit 3d1216e

Please sign in to comment.