Function writeClass.

@param ClassGenerator $class
@param Filesystem     $filesystem
@param $destinationDir

@return string|false

@throws CliException
423030
protected function writeClass(ClassGenerator $class, Filesystem $filesystem, $destinationDir)
    {
        $className = $class->getName();
        $file = new FileGenerator([
            'fileName' => $className.'.php',
            'classes' => [$class],
        ]);
        $contents = $file->generate();

        $relativePath = $destinationDir.DIRECTORY_SEPARATOR.$file->getFilename();
        if ($filesystem->has($relativePath)) {
            throw new CliException(sprintf(
                'Could not generate migration. File already exists: %s',
                $relativePath
            ));
        }

        $result = $filesystem->write($relativePath, $contents);

        return $result ? $relativePath : false;
    }
480229
protected function define(ClassDefinition $class)
    {
        $class->property($this->name)->asString();

        $class->property($this->file)->asObject(File::class);
    }
1211369
static void writeClassToFile(String className, ClassWriter classWriter, String apiName){
        classWriter.visitEnd();

        byte[] constructedClass = classWriter.toByteArray();

        try (FileOutputStream os = new FileOutputStream(new File(getFinalPathPart(className, apiName)))){
            os.write(constructedClass);
        } catch (IOException e) {
            throw new AsmException("Exception while writing generated classes to the .class files.", e);
        }
    }
396511
private function generateProxyClass($class, $proxyClassName, $fileName, $file)
    {
        $methods = $this->generateMethods($class);
        $sleepImpl = $this->generateSleep($class);

        $placeholders = array(
            '<namespace>',
            '<proxyClassName>', '<className>',
            '<methods>', '<sleepImpl>'
        );

        if(substr($class->name, 0, 1) == "\\") {
            $className = substr($class->name, 1);
        } else {
            $className = $class->name;
        }

        $replacements = array(
            $this->proxyNamespace,
            $proxyClassName, $className,
            $methods, $sleepImpl
        );

        $file = str_replace($placeholders, $replacements, $file);

        file_put_contents($fileName, $file);
    }
417137
public static void writeConfigFile(String fileName, Class<?>[] classes, boolean sortClasses)
			throws SQLException, IOException {
		File rawDir = findRawDir(new File("."));
		if (rawDir == null) {
			System.err.println("Could not find " + RAW_DIR_NAME + " directory which is typically in the "
					+ RESOURCE_DIR_NAME + " directory");
		} else {
			File configFile = new File(rawDir, fileName);
			writeConfigFile(configFile, classes, sortClasses);
		}
	}
468622
private static function fdCssClass(&$data, $class) {
		$data[self::$FD__CSS_CLASS] = df_cc_s(dfa($data, self::$FD__CSS_CLASS), $class);
	}
234806
def write_class(self, obj, parent=None):
        
        self._writeStruct(">B", 1, (self.TC_CLASS,))
        self.write_classdesc(obj)
15838
protected function generateFileContent($class, $entity)
    {
        $generator  = new FileGenerator();
        $descriptor = $entity->getFileDescriptor();

        $generator->setClass($class);
        $generator->setDocblock(DocBlockGenerator::fromArray(array(
            'shortDescription' => 'Generated by Protobuf protoc plugin.',
            'longDescription'  => 'File descriptor : ' . $descriptor->getName(),
        )));

        return $generator->generate();
    }
455340
public static function executeCommand(string $class, ConsoleOutput $output, array $inputs) : int
    {
        if (!class_exists($class)) {
            throw new \RuntimeException((sprintf("Undefined class '%s'", $class)));
        }

        $command = new $class();

        if (!$command instanceof Command) {
            throw new \RuntimeException(sprintf("Invalid class '%s'", $class));
        }

        $input = new ArrayInput($inputs, $command->getDefinition());

        $command
            ->setInput($input)
            ->setOutput($output)
            ->setStart();

        return $command->execute($input, $output);
    }
1134964
private function copyDirectory(
        FilesystemInterface $source,
        FilesystemInterface $destination,
        $path
    ) {
        foreach ($source->listFiles($path) as $filePath) {
            $this->copyFile($source, $destination, $filePath);
        }
    }
222976
static function write($message,$level=self::ERR,$type='',$destination='') {
        if(!self::$storage){
            $type 	= 	$type ? : C('LOG_TYPE');
            $class  =   'Think\\Log\\Driver\\'. ucwords($type);
            $config['log_path'] = C('LOG_PATH');
            self::$storage = new $class($config);            
        }
        if(empty($destination)){
            $destination = C('LOG_PATH').date('y_m_d').'.log';        
        }
        self::$storage->write("{$level}: {$message}", $destination);
    }
477530
public void writeTo(OutputStream outputStream) {
        try {
            ClassWriter classWriter = generateClassBytes();

            writeClassToDisk(outputStream, classWriter);
        } catch (Throwable e) {
            throw new ClassGenerationException("Error generating annotation metadata: " + e.getMessage(), e);
        }
    }
1294112
private function writeClassTrailer(): void
  {
    $this->codeStore->appendSeparator();
    $this->codeStore->append('}');
    $this->codeStore->append('');
    $this->codeStore->appendSeparator();
  }
1295793
public static function dispose($path, $class) {
        $Main = static::getInterior($path, $class);
        $New  = static::getExterior($class);
        if ($New) {
            return $New;
        } else {
            return $Main;
        }
    }
472067
protected static function updateMap($class, $origin)
    {
        if (is_writable(self::$mapfile) ||
            is_writable(dirname(self::$mapfile))) {
            self::$map[$class] = $origin;
            file_put_contents(
                self::$mapfile,
                '<'."?php\n"
                . "// Autoload auto-generated classmap\n"
                . "return " . var_export(self::$map, true) . ';',
                LOCK_EX
            );
        }
    }
848851
protected function createFile($filename, $class) {
    $filename = trim($filename);
    $file = $class::create();
    $file->setName($filename);
    $file->Filename = $this->folder . $filename;
    $file->ParentID = $this->folderID;
    $file->write();
    return $file;
  }
793447
public static function assertDestinationInstanceOf($destination, string $class): void
    {
        if (!$destination instanceof $class) {
            throw new static(sprintf(
                'The destination must be an instance of %s but got %s.',
                $class,
                is_object($destination) ? get_class($destination) : gettype($destination)
            ));
        }
    }