mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 22:26:46 +02:00
refactor(core): code formating and refactoring
This commit is contained in:
@@ -15,6 +15,6 @@ if (flextype('registry')->get('flextype.settings.entries.fields.id.enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
flextype('entries')->setStorage('fetch.data.id', (string) Strings::create(flextype('entries')->getStorage('fetch.id'))->trimSlashes());
|
||||
flextype('entries')->setStorage('fetch.data.id', (string) strings(flextype('entries')->getStorage('fetch.id'))->trimSlashes());
|
||||
});
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ if (flextype('registry')->get('flextype.settings.entries.fields.slug.enabled'))
|
||||
return;
|
||||
}
|
||||
|
||||
$parts = Strings::create(flextype('entries')->getStorage('fetch.id'))->trimSlashes()->segments();
|
||||
$parts = strings(flextype('entries')->getStorage('fetch.id'))->trimSlashes()->segments();
|
||||
flextype('entries')->setStorage('fetch.data.slug', (string) end($parts));
|
||||
});
|
||||
}
|
||||
|
@@ -76,6 +76,6 @@ class Markdown
|
||||
|
||||
public function getCacheID($input): string
|
||||
{
|
||||
return Strings::create('markdown' . $input)->hash()->toString();
|
||||
return strings('markdown' . $input)->hash()->toString();
|
||||
}
|
||||
}
|
||||
|
@@ -115,6 +115,6 @@ class Shortcode
|
||||
*/
|
||||
public function getCacheID(string $input): string
|
||||
{
|
||||
return Strings::create('shortcode' . $input)->hash()->toString();
|
||||
return strings('shortcode' . $input)->hash()->toString();
|
||||
}
|
||||
}
|
||||
|
@@ -94,17 +94,17 @@ class Frontmatter
|
||||
$input = (string) preg_replace("/(\r\n|\r)/", "\n", $input);
|
||||
|
||||
// Parse Frontmatter and Body
|
||||
$parts = preg_split('/^[\s\r\n]?---[\s\r\n]?$/sm', PHP_EOL . Strings::create($input)->trimLeft()->toString());
|
||||
$parts = preg_split('/^[\s\r\n]?---[\s\r\n]?$/sm', PHP_EOL . strings($input)->trimLeft()->toString());
|
||||
|
||||
if (count($parts) < 3) {
|
||||
return ['content' => Strings::create($input)->trim()->toString()];
|
||||
return ['content' => strings($input)->trim()->toString()];
|
||||
}
|
||||
|
||||
return flextype('yaml')->decode(Strings::create($parts[1])->trim()->toString(), false) + ['content' => Strings::create(implode(PHP_EOL . '---' . PHP_EOL, array_slice($parts, 2)))->trim()->toString()];
|
||||
return flextype('yaml')->decode(strings($parts[1])->trim()->toString(), false) + ['content' => strings(implode(PHP_EOL . '---' . PHP_EOL, array_slice($parts, 2)))->trim()->toString()];
|
||||
}
|
||||
|
||||
public function getCacheID($input): string
|
||||
{
|
||||
return Strings::create('frontmatter' . $input)->hash()->toString();
|
||||
return strings('frontmatter' . $input)->hash()->toString();
|
||||
}
|
||||
}
|
||||
|
@@ -110,6 +110,6 @@ class Json
|
||||
|
||||
public function getCacheID($input): string
|
||||
{
|
||||
return Strings::create('json' . $input)->hash()->toString();
|
||||
return strings('json' . $input)->hash()->toString();
|
||||
}
|
||||
}
|
||||
|
@@ -143,6 +143,6 @@ class Yaml
|
||||
|
||||
public function getCacheID($input): string
|
||||
{
|
||||
return Strings::create('yaml' . $input)->hash()->toString();
|
||||
return strings('yaml' . $input)->hash()->toString();
|
||||
}
|
||||
}
|
||||
|
@@ -125,7 +125,7 @@ flextype()->container()['cache'] = static function () {
|
||||
if ($key === 'path' && in_array($driver_name, ['files', 'sqlite', 'leveldb'])) {
|
||||
$config['path'] = ! empty($value) ? PATH['tmp'] . '/' . $value : sys_get_temp_dir();
|
||||
} else {
|
||||
$config[Strings::create($key)->camel()->toString()] = $value;
|
||||
$config[strings($key)->camel()->toString()] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user