Ejemplo n.º 1
0
 /**
  * Gets all classes based on passed type, instantiates
  * them and stores them under $objects using
  * underscored keys
  *
  * @param string $type
  * @param \LewNelson\Namecheap\Connect\Connect $connection
  * @param array $configuration
  */
 public function __construct($type, $connection, $configuration)
 {
     $this->configuration = $configuration;
     $prefix = 'LewNelson/Namecheap/Objects/' . $type;
     $classes = Utilities::getClasses(__DIR__ . '/' . $type, $prefix);
     foreach ($classes as $class) {
         $full_namespace = Utilities::getFullNamespace($class);
         $object = new $full_namespace($configuration);
         $name = str_replace($prefix, '', $class);
         $name = Utilities::convertCamelCaseToUnderscore($name);
         $this->set($object, $name);
     }
     $this->setConnections($connection);
 }
 /**
  * @dataProvider getFullNamespaceValidValuesProvider
  */
 public function testGetFullNamespaceWithValidData($data, $expected_output)
 {
     $output = Utilities::getFullNamespace($data);
     $this->assertEquals($output, $expected_output);
 }
Ejemplo n.º 3
0
 /**
  * Sets object property for supplied method_type object
  *
  * @param NamecheapMethodTypesInterface $object
  * @param string $method_type
  */
 private function setMethodType(\LewNelson\Namecheap\NamecheapMethodTypesInterface $object, $method_type)
 {
     $method_type = Utilities::convertCamelCaseToUnderscore($method_type);
     $this->{$method_type} = $object;
 }