protected function generateTool()
    {

        $this->data = $this->getMappedArguments();
        $generatorPath = str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)) . '/studentToolGenerator';
        $targetPath    = $generatorPath . '/generated-code/' . $this->data['client'] . '/' . $this->data['tool-id'];
        $templatePath  = $generatorPath . '/template';

        $objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($templatePath), \RecursiveIteratorIterator::SELF_FIRST);

        $patterns = $this -> getPatterns();
        $replacements = $this -> getReplacements();

        foreach($objects as $tplFile => $cursor){
            if(in_array(basename($tplFile), array('.', '..'))) {
                continue;
            }

            $toolFile = str_replace($templatePath, $targetPath, $tplFile);

            if($cursor->isDir() && !is_dir($toolFile)) {
                mkdir($toolFile, 0755, true);
            }
            else if($cursor->isFile()){
                $toolFile = dirname($toolFile) . '/' . str_replace('template', $this->data['tool-base'], basename($toolFile));
                $toolContent = str_replace($patterns, $replacements, file_get_contents($tplFile));
                file_put_contents($toolFile, $toolContent);
            }
        }
        return $targetPath;
    }