本文整理汇总了PHP中Filesystem::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::get方法的具体用法?PHP Filesystem::get怎么用?PHP Filesystem::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filesystem
的用法示例。
在下文中一共展示了Filesystem::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processFile
/**
* Process a php target file to append PHP syntax-sensitive content
* from multiple template sources.
*
* @param string $file, a php file to modify
* @param array $templates list of key (property name), value (template file)
* @param string $data used to replace placeholders inside all template files
* @param Boolean $front, set location to the front of the array
*/
protected function processFile($file, $templates, $data, $front = false)
{
$content = $this->files->get($file);
$phpParser = new GenericPhpParser($content, $data, $this->parser);
foreach ($templates as $property => $template) {
$phpParser->parse($property, $template, $front);
}
$content = $phpParser->prettyPrint();
if (!is_null($content)) {
$this->files->put($file, $content);
}
}
示例2: create
public function create(array $data)
{
try {
$this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE);
$projectFile = $this->repository->skipPresenter()->create($data);
$this->storage->put($projectFile->getFileName(), $this->filesystem->get($data['file']));
return ['success' => true];
} catch (ValidatorException $e) {
return ['error' => true, 'message' => $e->getMessageBag(), "messageDev" => 'ValidatorException'];
} catch (\Exception $e) {
return ["error" => true, "message" => 'Falha ao gravar registro.', "messageDev" => $e->getMessage()];
}
}
示例3: extendLexicon
protected function extendLexicon(array &$aLexicon)
{
$sPatchFile = Config::get('path.real.root') . Config::get('path.relative.root_to_app') . Config::get('path.relative.app_to_data') . Config::get('jsreal.lexicon.simple_nlg.extension.' . $this->sLanguage);
$sJsonExtension = Filesystem::get($sPatchFile);
$aExtension = Conversion::getArrayFromJson($sJsonExtension);
$aLexicon = array_merge_recursive($aLexicon, $aExtension);
}
示例4: newTempDir
protected static function newTempDir()
{
$tmp['tok'] = getUser() . time() . rand(5, 20);
$tmp['dir'] = addslash(self::$config['tempdir']) . '.rutorrent/.fman/' . $tmp['tok'] . '/';
Filesystem::get()->mkdir($tmp['dir'], true, 777);
return $tmp;
}
示例5: getTemplate
/**
* Get a form template by name
*
* @param string $type
* @return string
*/
protected function getTemplate($type = 'list')
{
return $this->file->get(static::$templatePath . "/{$type}.txt");
}
示例6: applyLexiconPatchToTestVerb
protected function applyLexiconPatchToTestVerb(array &$aTestConjugatedVerb)
{
$aTenseList = array('p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'ps1', 'ps2', 'ps3', 'ps4', 'ps5', 'ps6', 's1', 's2', 's3', 's4', 's5', 's6', 'ip2', 'ip4', 'ip5', 'pr', 'pp');
$sPatchFile = Config::get('path.real.root') . Config::get('path.relative.root_to_app') . Config::get('path.relative.app_to_data') . Config::get('jsreal.lexicon.simple_nlg.patch.' . $this->sLanguage);
$sJsonPatch = Filesystem::get($sPatchFile);
$aPatch = Conversion::getArrayFromJson($sJsonPatch);
foreach ($aPatch as $sUnit => $aInfo) {
if (isset($aInfo['V'])) {
foreach ($aInfo['V'] as $sTenseAndPerson => $sConjugatedVerb) {
if (Arr::in($aTenseList, $sTenseAndPerson)) {
$aTestConjugatedVerb[$sUnit][$sTenseAndPerson] = $sConjugatedVerb;
}
}
}
}
}
示例7: __construct
public function __construct($sFileRealPath, $sStrStart, $sStrEnd)
{
$sFullContent = Filesystem::get($sFileRealPath);
$this->sSelectedContent = Str::getStringBetween($sFullContent, $sStrStart, $sStrEnd);
}
示例8: testCopyFails
public function testCopyFails()
{
$adapter = $this->getMock('League\\Flysystem\\AdapterInterface');
$adapter->expects($this->exactly(2))->method('has')->withConsecutive(['file.txt'], ['files/copied.txt'])->willReturnOnConsecutiveCalls(true, false);
$adapter->expects($this->once())->method('copy')->with('file.txt', 'files/copied.txt')->willReturn(false);
$filesystem = new Filesystem($adapter);
/** @var File $file */
$file = $filesystem->get('file.txt', new File());
$result = $file->copy('files/copied.txt');
$this->assertFalse($result);
}