public function generateCommands(array $classes = null)
    {
        if (!isset($classes)) {
            $classes = array();
        }
        $path = dirname(__DIR__) . '/Api';

        if (\Phar::running(false)) {
            $iterator = new \Phar($path);
        } else {
            $iterator = new \DirectoryIterator($path);
        }

        foreach ($iterator as $file) {
            if (fnmatch('*.php', $file->getPathName())) {
                $classes[] = Application::API_NAMESPACE . basename($file, '.php');
            }
        }

        $commands = array();

        foreach ($classes as $class) {
            $api = new \ReflectionClass($class);
            if ($api->isAbstract()) {
                // skip abtract classes
                continue;
            }

            foreach ($api->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
                if (strstr($method->getName(), '__')) {
                    // skip magics
                    continue;
                }
                $commands[] = $this->generateCommand(strtolower($api->getShortName()), $method);
            }
        }
        return $commands;
    }