@param string $replacement
@param string $filePath

@return self
974557
public function replaceEntityRepositoriesNamespace(string $replacement, string $filePath): self
    {
        $this->findReplace(
            AbstractGenerator::FIND_ENTITY_REPOSITORIES_NAMESPACE,
            $this->namespaceHelper->tidy($replacement),
            $filePath
        );

        return $this;
    }
847131
protected function postCopy(
        string $filePath
    ): void {
        $this->fileCreationTransaction::setPathCreated($filePath);
        $this->findAndReplaceHelper->replaceName(
            $this->codeHelper->classy($this->className),
            $filePath,
            FieldGenerator::FIND_ENTITY_FIELD_NAME
        );
        $this->findAndReplaceHelper->findReplace(
            $this->codeHelper->consty(FieldGenerator::FIND_ENTITY_FIELD_NAME),
            $this->codeHelper->consty($this->className),
            $filePath
        );
        $this->codeHelper->tidyNamespacesInFile($filePath);
        $this->setGetterToIsForBools($filePath);
    }
241987
public function replaceOne($document, $replacement, $options = [])
    {
        $query = new ReplaceOne($this->documentManager, $this, $document, $replacement, $options);
        if (isset($options['getQuery']) && $options['getQuery']) {
            return $query;
        } else {
            return $query->execute();
        }
    }
1267764
public function setPath($path, $type = 'replace', $replace = '')
    {
        $oldPath = (!empty($this->url['path']) ? $this->url['path'] : '');

        switch ($type) {
            case 'add':
                $path = $oldPath . $path;
                break;
            case 'remove':
                $path = str_replace($path, '', $oldPath);
                break;
            case 'replace':
            default:
                $path = str_replace($replace, $path, $oldPath);
                break;
        }

        $this->url['path'] = $path;

        return $this;
    }
993401
public function setFile($filePath)
    {
        if (is_file($filePath)) {
            $this->file = new SplFileInfo($filePath);

            if (file_exists(
                $propertiesFilePath = $this->file->getPath() . DIRECTORY_SEPARATOR . str_replace(
                        '.phtml',
                        '.json',
                        strtolower($this->file->getBasename())
                    )
            )) {
                $properties = file_get_contents($propertiesFilePath);
                $properties = json_decode($properties, true);

                if (isset($properties[ 'vars' ])) {
                    $this->vars = $properties[ 'vars' ];
                }

                if (isset($properties[ 'presets' ])) {
                    $this->presets = new SplArrayObject($properties[ 'presets' ]);
                }
            }
        }

        return $this;
    }
873257
public function findReplaceRegex(
        string $find,
        string $replace,
        string $filePath
    ): self {
        $contents = \ts\file_get_contents($filePath);
        $contents = preg_replace($find, $replace, $contents);
        file_put_contents($filePath, $contents);

        return $this;
    }
1107575
public function replace($search, $replace): Method
    {
        $this->docComment->replace($search, $replace);

        return $this;
    }
97937
public function findReplace(
        string $find,
        string $replace,
        string $filePath
    ): self {
        $contents = \ts\file_get_contents($filePath);
        $contents = str_replace($find, $replace, $contents);
        file_put_contents($filePath, $contents);

        return $this;
    }
160720
public function copyContent(string $newFolderPath): self
    {
        $newFolderPath = normalize_path($newFolderPath);

        if (is_dir($newFolderPath)) {
            if (recursive_copy($this->getPath(), $newFolderPath)) {
                return self::load($newFolderPath);
            }
        }
        throw new FolderException('Cannot copy folder content, because the destination folder path ('.$newFolderPath.') does not exist',
            FolderException::DONT_EXIST);
    }
603095
protected function interfacePostCopy(
        string $filePath
    ): void {
        $this->findAndReplaceHelper->replaceFieldInterfaceNamespace($this->interfaceNamespace, $filePath);
        $this->replaceDefaultValueInInterface($filePath);
        $this->postCopy($filePath);
    }
1115557
public static function createFromFilePath ($filePath)
    {
        if (!is_file($filePath))
        {
            throw new \InvalidArgumentException("File does not exist");
        }
        else if (!is_readable($filePath))
        {
            throw new \InvalidArgumentException("File to download is not readable.");
        }

        return new FileDownload(fopen($filePath, "rb"));
    }
149401
public static function getInstance($filePath = "/data/config/", $fileExt = "json")
    {
        if (!self::$instance) {
            self::$instance = new self($filePath, $fileExt);
        }

        return self::$instance;
    }
136674
public function addFiles($filePaths): self
    {
        if (is_string($filePaths)) {
            $filePaths = [$filePaths];
        }

        foreach ($filePaths as $filePath) {
            if (! empty($filePath)) {
                file_put_contents($this->manifestPath, $filePath.PHP_EOL, FILE_APPEND);
            }
        }

        return $this;
    }
107868
public function addAttachment($filePath, $filename = null) {

		if(file_exists($filePath)) {
			$this->attachments[] = ['path' => $filePath, 'filename' => $filename];
		}
		
		return $this;

	}
834229
public function replaceFieldTraitNamespace(string $replacement, string $filePath): self
    {
        if (false === \ts\stringContains($replacement, AbstractGenerator::ENTITY_FIELD_TRAIT_NAMESPACE)) {
            throw new \RuntimeException(
                '$replacement ' . $replacement . ' does not contain '
                . AbstractGenerator::ENTITY_FIELD_TRAIT_NAMESPACE
            );
        }
        $this->findReplace(
            AbstractGenerator::FIND_FIELD_TRAIT_NAMESPACE,
            $this->namespaceHelper->tidy($replacement),
            $filePath
        );

        return $this;
    }
531111
public function replace($column, $target, $replacement)
    {
        $this->queryBuilder->replace($column, $target, $replacement);
        return $this;
    }
466465
public function setFilePath($filePath)
    {
        $this->filePath = $filePath;
        $this->releaseHandle();
        $this->onFileChanged();

        return $this;
    }