XeroPHP\Application::validateModelClass PHP Method

validateModelClass() public method

Validates and expands the provided model class to a full PHP class
public validateModelClass ( string $class ) : string
$class string
return string
    public function validateModelClass($class)
    {
        $config = $this->getConfig('xero');
        if ($class[0] !== '\\') {
            $class = sprintf('%s\\%s', $config['model_namespace'], $class);
        }
        if (!class_exists($class)) {
            throw new Exception("Class does not exist [{$class}]");
        }
        return $class;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @param string $class
  * @return $this
  */
 public function from($class)
 {
     $this->from = $this->app->validateModelClass($class);
     return $this;
 }