Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasiuk-hubspot committed Dec 18, 2019
1 parent f813047 commit ff1a04a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions lib/Factory/FactoryBase.php → lib/Factory/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
namespace HubSpot\Factory;

use GuzzleHttp\Client;
use HubSpot\Client\Crm\Owners\Api\DefaultApi;
use HubSpot\Client\Crm\Owners\Configuration;
use ReflectionClass;
use ReflectionException;

class FactoryBase
class Base
{
/** @var Client */
protected $client;
Expand All @@ -24,11 +25,14 @@ public function __construct($client, $config)
* @param string $name
* @param mixed $args
*
* @throws ReflectionException
*
* @return mixed
*/
public function __call($name, $args)
{
$resource = '\\HubSpot\\Client\\Crm\\'.ucfirst(get_class()).'\\Api\\'.ucfirst($name);
$className = (new ReflectionClass(get_class($this)))->getShortName();
$resource = '\\HubSpot\\Client\\Crm\\'.$className.'\\Api\\'.ucfirst($name);

return new $resource($this->client, $this->config);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Factory/Objects.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
* @method CreateNativeObjectsApi createNativeObjectsApi
* @method SearchApi searchApi()
*/
class Objects extends FactoryBase
class Objects extends Base
{
}
2 changes: 1 addition & 1 deletion lib/Factory/Owners.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
/**
* @method DefaultApi defaultApi()
*/
class Owners extends FactoryBase
class Owners extends Base
{
}

0 comments on commit ff1a04a

Please sign in to comment.