1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-11 15:44:49 +02:00

feat(core): Flextype Solid Core - next round #458

This commit is contained in:
Awilum
2020-08-14 20:27:10 +03:00
parent 6a3f40c464
commit 66a8c4bc8a
5 changed files with 58 additions and 58 deletions

View File

@@ -60,7 +60,7 @@ $flextype->get('/api/entries', function (Request $request, Response $response) u
$entries_token_file_path = PATH['project'] . '/tokens/entries/' . $token . '/token.yaml';
// Set entries token file
if ($entries_token_file_data = $flextype['yaml']->decode(Filesystem::read($entries_token_file_path))) {
if ($entries_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($entries_token_file_path))) {
if ($entries_token_file_data['state'] === 'disabled' ||
($entries_token_file_data['limit_calls'] !== 0 && $entries_token_file_data['calls'] >= $entries_token_file_data['limit_calls'])) {
return $response
@@ -83,7 +83,7 @@ $flextype->get('/api/entries', function (Request $request, Response $response) u
}
// Update calls counter
Filesystem::write($entries_token_file_path, $flextype['yaml']->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
Filesystem::write($entries_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -155,8 +155,8 @@ $flextype->post('/api/entries', function (Request $request, Response $response)
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set entries and access token file
if (($entries_token_file_data = $flextype['yaml']->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($entries_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($entries_token_file_data['state'] === 'disabled' ||
($entries_token_file_data['limit_calls'] !== 0 && $entries_token_file_data['calls'] >= $entries_token_file_data['limit_calls'])) {
return $response
@@ -186,7 +186,7 @@ $flextype->post('/api/entries', function (Request $request, Response $response)
$response_code = $create_entry ? 200 : 404;
// Update calls counter
Filesystem::write($entries_token_file_path, $flextype['yaml']->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
Filesystem::write($entries_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -259,8 +259,8 @@ $flextype->patch('/api/entries', function (Request $request, Response $response)
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set entries and access token file
if (($entries_token_file_data = $flextype['yaml']->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($entries_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($entries_token_file_data['state'] === 'disabled' ||
($entries_token_file_data['limit_calls'] !== 0 && $entries_token_file_data['calls'] >= $entries_token_file_data['limit_calls'])) {
return $response
@@ -290,7 +290,7 @@ $flextype->patch('/api/entries', function (Request $request, Response $response)
$response_code = $update_entry ? 200 : 404;
// Update calls counter
Filesystem::write($entries_token_file_path, $flextype['yaml']->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
Filesystem::write($entries_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -363,8 +363,8 @@ $flextype->put('/api/entries', function (Request $request, Response $response) u
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set entries and access token file
if (($entries_token_file_data = $flextype['yaml']->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($entries_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($entries_token_file_data['state'] === 'disabled' ||
($entries_token_file_data['limit_calls'] !== 0 && $entries_token_file_data['calls'] >= $entries_token_file_data['limit_calls'])) {
return $response
@@ -395,7 +395,7 @@ $flextype->put('/api/entries', function (Request $request, Response $response) u
$response_code = $rename_entry ? 200 : 404;
// Update calls counter
Filesystem::write($entries_token_file_path, $flextype['yaml']->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
Filesystem::write($entries_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -468,8 +468,8 @@ $flextype->put('/api/entries/copy', function (Request $request, Response $respon
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set entries and access token file
if (($entries_token_file_data = $flextype['yaml']->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($entries_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($entries_token_file_data['state'] === 'disabled' ||
($entries_token_file_data['limit_calls'] !== 0 && $entries_token_file_data['calls'] >= $entries_token_file_data['limit_calls'])) {
return $response
@@ -500,7 +500,7 @@ $flextype->put('/api/entries/copy', function (Request $request, Response $respon
$response_code = $copy_entry === null ? 200 : 404;
// Update calls counter
Filesystem::write($entries_token_file_path, $flextype['yaml']->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
Filesystem::write($entries_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -571,8 +571,8 @@ $flextype->delete('/api/entries', function (Request $request, Response $response
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set entries and access token file
if (($entries_token_file_data = $flextype['yaml']->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($entries_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($entries_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($entries_token_file_data['state'] === 'disabled' ||
($entries_token_file_data['limit_calls'] !== 0 && $entries_token_file_data['calls'] >= $entries_token_file_data['limit_calls'])) {
return $response
@@ -596,7 +596,7 @@ $flextype->delete('/api/entries', function (Request $request, Response $response
$response_code = $delete_entry ? 204 : 404;
// Update calls counter
Filesystem::write($entries_token_file_path, $flextype['yaml']->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
Filesystem::write($entries_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($entries_token_file_data, ['calls' => $entries_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response

View File

@@ -57,7 +57,7 @@ $flextype->get('/api/files', function (Request $request, Response $response) use
$files_token_file_path = PATH['project'] . '/tokens/files/' . $token . '/token.yaml';
// Set delivery token file
if ($files_token_file_data = $flextype['yaml']->decode(Filesystem::read($files_token_file_path))) {
if ($files_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($files_token_file_path))) {
if ($files_token_file_data['state'] === 'disabled' ||
($files_token_file_data['limit_calls'] !== 0 && $files_token_file_data['calls'] >= $files_token_file_data['limit_calls'])) {
return $response
@@ -84,7 +84,7 @@ $flextype->get('/api/files', function (Request $request, Response $response) use
$response_code = count($response_data['data']) > 0 ? 200 : 404;
// Update calls counter
Filesystem::write($files_token_file_path, $flextype['yaml']->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
Filesystem::write($files_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -156,8 +156,8 @@ $flextype->post('/api/files', function (Request $request, Response $response) us
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($files_token_file_data = $flextype['yaml']->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($files_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($files_token_file_data['state'] === 'disabled' ||
($files_token_file_data['limit_calls'] !== 0 && $files_token_file_data['calls'] >= $files_token_file_data['limit_calls'])) {
return $response
@@ -187,7 +187,7 @@ $flextype->post('/api/files', function (Request $request, Response $response) us
$response_code = Filesystem::has($create_file) ? 200 : 404;
// Update calls counter
Filesystem::write($files_token_file_path, $flextype['yaml']->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
Filesystem::write($files_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -260,8 +260,8 @@ $flextype->put('/api/files', function (Request $request, Response $response) use
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($files_token_file_data = $flextype['yaml']->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($files_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($files_token_file_data['state'] === 'disabled' ||
($files_token_file_data['limit_calls'] !== 0 && $files_token_file_data['calls'] >= $files_token_file_data['limit_calls'])) {
return $response
@@ -291,7 +291,7 @@ $flextype->put('/api/files', function (Request $request, Response $response) use
$response_code = $rename_file === true ? 200 : 404;
// Update calls counter
Filesystem::write($files_token_file_path, $flextype['yaml']->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
Filesystem::write($files_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -363,8 +363,8 @@ $flextype->put('/api/files/copy', function (Request $request, Response $response
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($files_token_file_data = $flextype['yaml']->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($files_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($files_token_file_data['state'] === 'disabled' ||
($files_token_file_data['limit_calls'] !== 0 && $files_token_file_data['calls'] >= $files_token_file_data['limit_calls'])) {
return $response
@@ -394,7 +394,7 @@ $flextype->put('/api/files/copy', function (Request $request, Response $response
$response_code = $copy_file === true ? 200 : 404;
// Update calls counter
Filesystem::write($files_token_file_path, $flextype['yaml']->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
Filesystem::write($files_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -464,8 +464,8 @@ $flextype->delete('/api/files', function (Request $request, Response $response)
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($files_token_file_data = $flextype['yaml']->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($files_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($files_token_file_data['state'] === 'disabled' ||
($files_token_file_data['limit_calls'] !== 0 && $files_token_file_data['calls'] >= $files_token_file_data['limit_calls'])) {
return $response
@@ -489,7 +489,7 @@ $flextype->delete('/api/files', function (Request $request, Response $response)
$response_code = $delete_file ? 204 : 404;
// Update calls counter
Filesystem::write($files_token_file_path, $flextype['yaml']->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
Filesystem::write($files_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -563,8 +563,8 @@ $flextype->patch('/api/files/meta', function (Request $request, Response $respon
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($files_token_file_data = $flextype['yaml']->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($files_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($files_token_file_data['state'] === 'disabled' ||
($files_token_file_data['limit_calls'] !== 0 && $files_token_file_data['calls'] >= $files_token_file_data['limit_calls'])) {
return $response
@@ -594,7 +594,7 @@ $flextype->patch('/api/files/meta', function (Request $request, Response $respon
$response_code = $update_file_meta ? 200 : 404;
// Update calls counter
Filesystem::write($files_token_file_path, $flextype['yaml']->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
Filesystem::write($files_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -668,8 +668,8 @@ $flextype->post('/api/files/meta', function (Request $request, Response $respons
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($files_token_file_data = $flextype['yaml']->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($files_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($files_token_file_data['state'] === 'disabled' ||
($files_token_file_data['limit_calls'] !== 0 && $files_token_file_data['calls'] >= $files_token_file_data['limit_calls'])) {
return $response
@@ -699,7 +699,7 @@ $flextype->post('/api/files/meta', function (Request $request, Response $respons
$response_code = $add_file_meta ? 200 : 404;
// Update calls counter
Filesystem::write($files_token_file_path, $flextype['yaml']->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
Filesystem::write($files_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -772,8 +772,8 @@ $flextype->delete('/api/files/meta', function (Request $request, Response $respo
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($files_token_file_data = $flextype['yaml']->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($files_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($files_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($files_token_file_data['state'] === 'disabled' ||
($files_token_file_data['limit_calls'] !== 0 && $files_token_file_data['calls'] >= $files_token_file_data['limit_calls'])) {
return $response
@@ -803,7 +803,7 @@ $flextype->delete('/api/files/meta', function (Request $request, Response $respo
$response_code = $delete_file_meta ? 200 : 404;
// Update calls counter
Filesystem::write($files_token_file_path, $flextype['yaml']->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
Filesystem::write($files_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($files_token_file_data, ['calls' => $files_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response

View File

@@ -66,7 +66,7 @@ $flextype->get('/api/folders', function (Request $request, Response $response) u
$folders_token_file_path = PATH['project'] . '/tokens/folders/' . $token . '/token.yaml';
// Set delivery token file
if ($folders_token_file_data = $flextype['yaml']->decode(Filesystem::read($folders_token_file_path))) {
if ($folders_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($folders_token_file_path))) {
if ($folders_token_file_data['state'] === 'disabled' ||
($folders_token_file_data['limit_calls'] !== 0 && $folders_token_file_data['calls'] >= $folders_token_file_data['limit_calls'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -92,7 +92,7 @@ $flextype->get('/api/folders', function (Request $request, Response $response) u
$response_code = count($response_data['data']) > 0 ? 200 : 404;
// Update calls counter
Filesystem::write($folders_token_file_path, $flextype['yaml']->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
Filesystem::write($folders_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -163,8 +163,8 @@ $flextype->post('/api/folders', function (Request $request, Response $response)
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($folders_token_file_data = $flextype['yaml']->decode(Filesystem::read($folders_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($folders_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($folders_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($folders_token_file_data['state'] === 'disabled' ||
($folders_token_file_data['limit_calls'] !== 0 && $folders_token_file_data['calls'] >= $folders_token_file_data['limit_calls'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -192,7 +192,7 @@ $flextype->post('/api/folders', function (Request $request, Response $response)
$response_code = $create_folder ? 200 : 404;
// Update calls counter
Filesystem::write($folders_token_file_path, $flextype['yaml']->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
Filesystem::write($folders_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -264,8 +264,8 @@ $flextype->put('/api/folders/copy', function (Request $request, Response $respon
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($folders_token_file_data = $flextype['yaml']->decode(Filesystem::read($folders_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($folders_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($folders_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($folders_token_file_data['state'] === 'disabled' ||
($folders_token_file_data['limit_calls'] !== 0 && $folders_token_file_data['calls'] >= $folders_token_file_data['limit_calls'])) {
return $response->withStatus($api_errors['0601']['http_status_code'])
@@ -295,7 +295,7 @@ $flextype->put('/api/folders/copy', function (Request $request, Response $respon
$response_code = $copy_folder ? 200 : 404;
// Update calls counter
Filesystem::write($folders_token_file_path, $flextype['yaml']->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
Filesystem::write($folders_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -367,8 +367,8 @@ $flextype->put('/api/folders', function (Request $request, Response $response) u
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($folders_token_file_data = $flextype['yaml']->decode(Filesystem::read($folders_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($folders_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($folders_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($folders_token_file_data['state'] === 'disabled' ||
($folders_token_file_data['limit_calls'] !== 0 && $folders_token_file_data['calls'] >= $folders_token_file_data['limit_calls'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -396,7 +396,7 @@ $flextype->put('/api/folders', function (Request $request, Response $response) u
$response_code = $rename_folder ? 200 : 404;
// Update calls counter
Filesystem::write($folders_token_file_path, $flextype['yaml']->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
Filesystem::write($folders_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response
@@ -466,8 +466,8 @@ $flextype->delete('/api/folders', function (Request $request, Response $response
$access_token_file_path = PATH['project'] . '/tokens/access/' . $access_token . '/token.yaml';
// Set files and access token file
if (($folders_token_file_data = $flextype['yaml']->decode(Filesystem::read($folders_token_file_path))) &&
($access_token_file_data = $flextype['yaml']->decode(Filesystem::read($access_token_file_path)))) {
if (($folders_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($folders_token_file_path))) &&
($access_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($access_token_file_path)))) {
if ($folders_token_file_data['state'] === 'disabled' ||
($folders_token_file_data['limit_calls'] !== 0 && $folders_token_file_data['calls'] >= $folders_token_file_data['limit_calls'])) {
return $response->withStatus($api_errors['0501']['http_status_code'])
@@ -489,7 +489,7 @@ $flextype->delete('/api/folders', function (Request $request, Response $response
$response_code = $delete_folder ? 204 : 404;
// Update calls counter
Filesystem::write($folders_token_file_path, $flextype['yaml']->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
Filesystem::write($folders_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($folders_token_file_data, ['calls' => $folders_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response

View File

@@ -55,7 +55,7 @@ $flextype->get('/api/images/{path:.+}', function (Request $request, Response $re
$delivery_images_token_file_path = PATH['project'] . '/tokens/images/' . $token . '/token.yaml';
// Set delivery token file
if ($delivery_images_token_file_data = $flextype['yaml']->decode(Filesystem::read($delivery_images_token_file_path))) {
if ($delivery_images_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($delivery_images_token_file_path))) {
if ($delivery_images_token_file_data['state'] === 'disabled' ||
($delivery_images_token_file_data['limit_calls'] !== 0 && $delivery_images_token_file_data['calls'] >= $delivery_images_token_file_data['limit_calls'])) {
return $response->withStatus($api_errors['0003']['http_status_code'])
@@ -64,7 +64,7 @@ $flextype->get('/api/images/{path:.+}', function (Request $request, Response $re
}
// Update calls counter
Filesystem::write($delivery_images_token_file_path, $flextype['yaml']->encode(array_replace_recursive($delivery_images_token_file_data, ['calls' => $delivery_images_token_file_data['calls'] + 1])));
Filesystem::write($delivery_images_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($delivery_images_token_file_data, ['calls' => $delivery_images_token_file_data['calls'] + 1])));
if (Filesystem::has(PATH['project'] . '/uploads/entries/' . $args['path'])) {
return $flextype['images']->getImageResponse($args['path'], $_GET);

View File

@@ -54,7 +54,7 @@ $flextype->get('/api/registry', function (Request $request, Response $response)
$registry_token_file_path = PATH['project'] . '/tokens/registry/' . $token . '/token.yaml';
// Set token file
if ($registry_token_file_data = $flextype['yaml']->decode(Filesystem::read($registry_token_file_path))) {
if ($registry_token_file_data = $flextype->container('yaml')->decode(Filesystem::read($registry_token_file_path))) {
if ($registry_token_file_data['state'] === 'disabled' ||
($registry_token_file_data['limit_calls'] !== 0 && $registry_token_file_data['calls'] >= $registry_token_file_data['limit_calls'])) {
return $response->withStatus($api_errors['0003']['http_status_code'])
@@ -75,7 +75,7 @@ $flextype->get('/api/registry', function (Request $request, Response $response)
}
// Update calls counter
Filesystem::write($registry_token_file_path, $flextype['yaml']->encode(array_replace_recursive($registry_token_file_data, ['calls' => $registry_token_file_data['calls'] + 1])));
Filesystem::write($registry_token_file_path, $flextype->container('yaml')->encode(array_replace_recursive($registry_token_file_data, ['calls' => $registry_token_file_data['calls'] + 1])));
if ($response_code === 404) {
// Return response