create the file.

@param $source
@param $data
@return bool
481092
public static function create($source, $data)
    {
        try {
            $file = @fopen($source, 'w');
            @fwrite($file, $data);
            @fclose($file);
            return true;
        } catch (\Exception $e) {
            return false;
        }
    }
1125495
protected function create($name, $data)
    {
        return $this->getManager()->getFactory()->make(
            $name,
            [$data, $this->getManager(), $this]
        );
    }
148817
public function make($data)
    {
        $parts = $this->splitData($data['data'], ['meta', 'body']);

        $meta = self::parseYaml($parts['meta']);

        return $this->createAndFill([
            'id'     => $data['id'],
            'title'  => $meta['title'],
            'date'   => $data['date'],
            'data'   => isset($meta['data']) ? $meta['data'] : [],
            'body'   => $parts['body'],
        ]);
    }
895132
public function import( $key, $source ) {
		$filename = $this->prepare_write( $key );

		if ( $filename ) {
			return copy( $source, $filename ) && touch( $filename );
		}

		return false;
	}
1164142
public static function copy(String $source, String $target) : Bool
    {
        return Filesystem::copy(Info::rpath($source), Info::rpath($target));
    }
959846
public static function create($data)
    {
        if ($data instanceof self) {
            return $data;
        }

        if (\is_array($data)) {
            return new self('', $data);
        }

        throw new InvalidException('Failed to create document. Invalid data passed.');
    }
597524
public function fromFile( $source = null )
	{
		$typesFilename = is_null( $source )
			? dirname( __FILE__ ) . "/" . XBRL_Types::$filename
			: $source;

		if ( ! file_exists( $typesFilename ) ) return;

		$json = file_get_contents( $typesFilename );
		if ( $json === false ) return false;

		return $this->fromJSON( $json );
	}
133735
protected function createResource($data, $path)
    {
        //if the GD Library is not installed
        if (!function_exists('gd_info')) {
            //throw error
            throw ImageException::forGDNotInstalled();
        }

        # imagecreatefromgd — Create a new image from GD file or URL
        # imagecreatefromgif — Create a new image from file or URL
        # imagecreatefromjpeg — Create a new image from file or URL
        # imagecreatefrompng — Create a new image from file or URL
        # imagecreatefromstring — Create a new image from the image stream in the string
        # imagecreatefromwbmp — Create a new image from file or URL
        # imagecreatefromxbm — Create a new image from file or URL
        # imagecreatefromxpm — Create a new image from file or URL

        $resource = false;

        if (!$path) {
            return imagecreatefromstring($data);
        }

        //depending on the extension lets load
        //the file using the right GD loader
        switch ($this->type) {
            case 'gd':
                $resource = imagecreatefromgd($data);
                break;
            case 'gif':
                $resource = imagecreatefromgif($data);
                break;
            case 'jpg':
            case 'jpeg':
            case 'pjpeg':
                $resource = imagecreatefromjpeg($data);
                break;
            case 'png':
                $resource = imagecreatefrompng($data);
                break;
            case 'bmp':
            case 'wbmp':
                $resource = imagecreatefromwbmp($data);
                break;
            case 'xbm':
                $resource = imagecreatefromxbm($data);
                break;
            case 'xpm':
                $resource = imagecreatefromxpm($data);
                break;
        }

        //if there is no resource still
        if (!$resource) {
            //throw error
            ImageException::forInvalidImageFile($path);
        }

        return $resource;
    }
378414
public static function copy(string $source, string $destination, array $options = []) : bool {
		if (is_dir($source)) {
			// we need to skip directories
			if (!empty($options['skip_directories']) && in_array(basename($source), $options['skip_directories'])) {
				return true;
			}
			// open directory for reading
			$dir = opendir($source);
			if (!file_exists($destination)) {
				if (!self::mkdir($destination)) return false;
			}
			while (($file = readdir($dir)) !== false) {
				if ($file == '.' || $file == '..') continue;
				if (empty($options['skip_files']) || (!empty($options['skip_files']) && !in_array($file, $options['skip_files']))) {
					if (!self::copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file, $options)) return false;
				}
			}
			closedir($dir);
			return true;
		} else {
			return copy($source, $destination);
		}
	}
152288
public function createNewRecord($data) {
        $people_email = new $this->model;

        $people_email['people_id']     = $data['people_id'];
        $people_email['email_id']      = $data['email_id'];

        if ($people_email->save()) {

            // Return the new ID
            return $people_email->id;
        }

        return false;
    }
45195
public function put($source, $to, $data = [])
    {
        $content = file_get_contents(__DIR__.'/stubs'.$source);

        $to_dir = dirname($to);

        !file_exists($to_dir) && mkdir($to_dir, 0775, true);

        $content = $this->parse($data, $content);

        !file_exists($to) && file_put_contents($to, $content);
    }
572567
public function create($source)
    {
        $this->setInvoiceSource($source);
        $this->setPropertySources();
        $this->invoice = array();
        $this->invoice[Tag::Customer] = $this->getCustomer();
        $this->invoice[Tag::Customer][Tag::Invoice] = $this->getInvoice();
        $this->invoice[Tag::Customer][Tag::Invoice][Tag::Line] = $this->getInvoiceLines();
        $emailAsPdf = $this->getEmailAsPdf(!empty($this->invoice[Tag::Customer][Tag::Email]) ? $this->invoice[Tag::Customer][Tag::Email] : '');
        if (!empty($emailAsPdf)) {
            $this->invoice[Tag::Customer][Tag::Invoice][Tag::EmailAsPdf] = $emailAsPdf;
        }
        return $this->invoice;
    }
511817
public function createNewRecord($data) {

        $email = new $this->model;

        $email->email_type_id = $data['email_type_id'];
        $email->title         = $data['title'];
        $email->description   = $data['description'];
        $email->comments      = $data['comments'];
        $email->created_at    = $data['created_at'];
        $email->created_by    = $data['created_by'];
        $email->updated_at    = $data['updated_at'];
        $email->updated_by    = $data['updated_by'];
        $email->locked_at     = null;
        $email->locked_by     = null;

        if ($email->save()) {

            // Return the new ID
            return $email->id;
        }

        return false;
    }
130807
protected function writeFile( string $file, string $data, bool $append = false )
	{
		return $this->write(
			$file, $data, $append
		);
	}
177825
public static function copyRecursive($source, $destination)
    {
        if (is_dir($source)) {
            $dir_handle = opendir($source);

            while ($file = readdir($dir_handle)) {
                if ($file != "." && $file != "..") {
                    self::mkDir($destination);

                    if (is_dir($source . "/" . $file)) {
                        if (!is_dir($destination . "/" . $file)) {
                            mkdir($destination . "/" . $file);
                        }
                        self::copyRecursive($source . "/" . $file, $destination . "/" . $file);
                    } else {
                        copy($source . "/" . $file, $destination . "/" . $file);
                    }
                }
            }
            closedir($dir_handle);
        } else {
            copy($source, $destination);
        }

        return true;
    }
1144418
public function create( $data )
	{
		$record = $this->fill( $data );

		if( is_array($record) )
		{
			$this->collection()->insert($record);
		}

		return $record;
	}
1301306
public static function save( $fileName, $data )
	{
		$yaml	= FS_File_YAML_Spyc::YAMLDump( $data );
		return FS_File_Writer::save( $fileName, $yaml );
	}