ManaPHP\Mvc\Model\Manager::getModelSource PHP Method

getModelSource() public method

Returns the mapped source for a model
public getModelSource ( ManaPHP\Mvc\ModelInterface | string $model ) : string
$model ManaPHP\Mvc\ModelInterface | string
return string
    public function getModelSource($model)
    {
        $modelName = is_string($model) ? $model : get_class($model);
        if (!isset($this->_sources[$modelName])) {
            if ($this->_recallGetModelSource) {
                return Text::underscore(Text::contains($modelName, '\\') ? substr($modelName, strrpos($modelName, '\\') + 1) : $modelName);
            }
            $modelInstance = is_string($model) ? new $model() : $model;
            /** @noinspection NotOptimalIfConditionsInspection */
            if (!isset($this->_sources[$modelName])) {
                $this->_recallGetModelSource = true;
                $this->_sources[$modelName] = $modelInstance->getSource();
                $this->_recallGetModelSource = false;
            }
        }
        return $this->_sources[$modelName];
    }