FOF30\Generator\Command\Generate::getClass PHP Method

getClass() protected method

protected getClass ( )
    protected function getClass()
    {
        $input = $this->input;
        $class = 'FOF30\\Generator\\Command\\Generate';
        $return = '';
        $layout = strtolower($input->get('layout'));
        if (in_array($layout, array("1", 'item', 'default', 'form'), true)) {
            $class .= '\\Layout';
            if ($layout === "1") {
                $return = $class . '\\Layouts';
            } else {
                $return = $class . '\\' . ucfirst($layout) . 'Layout';
            }
        } else {
            $commands = array('controller', 'model', 'view', 'mvc');
            foreach ($commands as $command) {
                if (!$input->get($command)) {
                    continue;
                }
                $return = $class . '\\' . ucfirst($command) . '\\' . ucfirst($command);
                break;
            }
        }
        if (!$return || !class_exists($return)) {
            throw new \RuntimeException("Can not understand which object to generate. Please consult the documentation");
        }
        return $return;
    }