Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Ramljak <22823970+piqusy@users.noreply.github.com>
Co-authored-by: Goran Alković <77000136+goranalkovic-infinum@users.noreply.github.com>
  • Loading branch information
3 people authored May 6, 2024
1 parent 05b57e6 commit a1325b3
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 32 deletions.
18 changes: 9 additions & 9 deletions src/Cache/AbstractManifestCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,45 +302,45 @@ protected function getCacheBuilder(): array
'hasInnerBlocks' => 'boolean',
],
'validation' => [
'blockName',
'$schema',
'title',
'description',
'namespace',
'blockName',
'blockFullName',
'keywords',
'icon',
'category',
'description',
'title',
'$schema',
],
],
self::COMPONENTS_KEY => [
'path' => 'blocksDestinationComponents',
'multiple' => true,
'id' => 'componentName',
'validation' => [
'componentName',
'$schema',
'title',
'componentName',
],
],
self::VARIATIONS_KEY => [
'path' => 'blocksDestinationVariations',
'id' => 'name',
'multiple' => true,
'validation' => [
'name',
'$schema',
'parentName',
'title',
'icon',
'description',
'icon',
'name',
'parentName',
],
],
self::WRAPPER_KEY => [
'path' => 'blocksDestinationWrapper',
'validation' => [
'$schema',
'title'
'title',
],
],
],
Expand Down
4 changes: 2 additions & 2 deletions src/CustomPostType/PostTypeExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ protected function getPostTypeArguments(): array
'name' => esc_html_x(
'%label%',
'post type plural name',
'infobip'
'eightshift-libs'
),
'singular_name' => esc_html_x(
'%plural_label%',
'post type singular name',
'infobip'
'eightshift-libs'
),
],
// phpcs:enable
Expand Down
4 changes: 2 additions & 2 deletions src/CustomTaxonomy/TaxonomyExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ protected function getTaxonomyArguments(): array
'name' => esc_html_x(
'%label%',
'taxonomy plural name',
'infobip'
'eightshift-libs'
),
'singular_name' => esc_html_x(
'%plural_label%',
'taxonomy singular name',
'infobip'
'eightshift-libs'
),
],
// phpcs:enable
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function missingItemException(string $name, string $type): Invalid
return new InvalidBlock(
\sprintf(
/* translators: %1$s is going to be replaced with the component/block name, %2$s with type. */
\esc_html__('You are trying to get %1$s %2$s. Please check if you have it in your project.', 'eightshift-libs'),
\esc_html__('Trying to get %1$s %2$s. Please check if it exists in the project.', 'eightshift-libs'),
$name,
$type
)
Expand Down
10 changes: 5 additions & 5 deletions src/Exception/InvalidManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function missingManifestKeyException(string $key, string $path): I
\sprintf(
/* translators: %s is replaced by the missing key in the manifest.json */
\esc_html__(
'%1$s key does not exist in manifest.json on this %2$s path. Please check if provided key is correct.',
'%1$s key does not exist in manifest.json at %2$s. Please check if the provided key is correct.',
'eightshift-libs'
),
$key,
Expand Down Expand Up @@ -83,7 +83,7 @@ public static function missingManifestException(string $path): InvalidManifest
}

/**
* Throws error if manifest try to access on none allowed path.
* Throws error if trying to access manifest on non allowed path.
*
* @param string $path Missing manifest path.
*
Expand All @@ -95,7 +95,7 @@ public static function notAllowedManifestPathException(string $path): InvalidMan
\sprintf(
/* translators: %s is replaced by the path privided */
\esc_html__(
'You are trying to get manifest.json outside of the Blocks folder. Please review your implementation. Path you are providing is: %s',
'Trying to get manifest.json from outside of the Blocks folder. Please check your implementation. Path provided: %s',
'eightshift-libs'
),
$path
Expand All @@ -104,7 +104,7 @@ public static function notAllowedManifestPathException(string $path): InvalidMan
}

/**
* Throws error if manifest try to access on none allowed path item.
* Throws error if trying to access manifest on non allowed path item.
*
* @param string $path Missing manifest path.
*
Expand All @@ -116,7 +116,7 @@ public static function notAllowedManifestPathItemException(string $path): Invali
\sprintf(
/* translators: %s is replaced by the path privided */
\esc_html__(
'You are tryng to get manifest.json from outside of the Blocks items folder. Allowed folders are: %1$s. Path you are providing is: %2$s',
'Trying to load manifest.json from outside of allowed folders. Manifest can only be loaded from: %1$s. Provided path: %2$s',
'eightshift-libs'
),
\implode(', ', [
Expand Down
8 changes: 4 additions & 4 deletions src/Exception/InvalidPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function missingDirectoryException(string $path): InvalidPath
return new InvalidPath(
\sprintf(
/* translators: %s is going to be replaced with the missing directory path. */
\esc_html__('Failed to read directory on this %s path. Please check again.', 'eightshift-libs'),
\esc_html__('Failed to read the directory at "%s". Please check the implementation and try again.', 'eightshift-libs'),
$path,
)
);
Expand All @@ -47,7 +47,7 @@ public static function missingFileException(string $path): InvalidPath
return new InvalidPath(
\sprintf(
/* translators: %s is going to be replaced with the missing file path. */
\esc_html__('Failed to open file on this %s path. Please check again.', 'eightshift-libs'),
\esc_html__('Failed to open the file at "%s". Please check the implementation and try again.', 'eightshift-libs'),
$path,
)
);
Expand All @@ -66,7 +66,7 @@ public static function missingFileWithExampleException(string $path, string $exa
return new InvalidPath(
\sprintf(
/* translators: %1$s is going to be replaced with the missing file path. %2$s is going to be replaced with the expected file name. */
\esc_html__('Failed to open file on this %1$s path. The file expecing should be called %2$s.', 'eightshift-libs'),
\esc_html__('Failed to open the file at "%1$s". Expected file: "%2$s".', 'eightshift-libs'),
$path,
$example
)
Expand All @@ -86,7 +86,7 @@ public static function wrongOrNotAllowedParentPathException(string $pathName, st
return new InvalidPath(
\sprintf(
/* translators: %1$s is going to be replaced with the missing file path name. %2$s is going to be replaced with the allowed path names. */
\esc_html__('You are using wrong or not allowed parent path. You are using %1$s but we only allow %2$s. Please review your implementation.', 'eightshift-libs'),
\esc_html__('Parent path is incorrect or not allowed. Path used: "%1$s". Allowed path: "%2$s". Please check the implementation.', 'eightshift-libs'),
$pathName,
$allowed
)
Expand Down
4 changes: 2 additions & 2 deletions src/Helpers/ApiTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait ApiTrait
/**
* Return API success response array.
*
* @param string $msg Msg for the user.
* @param string $msg Message for the user.
* @param array<int|string, mixed> $additional Additonal data to attach to response.
*
* @return array<string, array<mixed>|int|string>
Expand Down Expand Up @@ -66,7 +66,7 @@ public static function getApiWarningPublicOutput(string $msg, array $additional
/**
* Return API error response array.
*
* @param string $msg Msg for the user.
* @param string $msg Message for the user.
* @param array<string, mixed> $additional Additonal data to attach to response.
*
* @return array<string, array<mixed>|int|string>
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/DeprecatedTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ trait DeprecatedTrait
*
* @throws InvalidPath If the file is missing.
*
* @deprecated 8.0.0 Use Components::render() instead. This method will be removed in the next major release.
* @deprecated 8.0.0 Use Helpers::render() instead. This method will be removed in the next major release.
*
* @return string Partial html.
*/
Expand Down
4 changes: 0 additions & 4 deletions src/Helpers/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ public static function getProjectPaths(string $type = '', string $suffix = '', s
$internalPrefix = \dirname(__FILE__, 3);
$path = self::joinPaths([...$testsDataPath]);
}

break;
case 'srcDestination':
$path = $srcPath;
Expand All @@ -254,7 +253,6 @@ public static function getProjectPaths(string $type = '', string $suffix = '', s
$internalPrefix = \dirname(__FILE__, 3);
$path = self::joinPaths([$cliOutputPath, $srcPath]);
}

break;
case 'cliOutput':
case 'root':
Expand All @@ -264,7 +262,6 @@ public static function getProjectPaths(string $type = '', string $suffix = '', s
$internalPrefix = \dirname(__FILE__, 3);
$path = $cliOutputPath;
}

break;
case 'wpContent':
$internalPrefix = \dirname(__FILE__, 8);
Expand Down Expand Up @@ -342,7 +339,6 @@ public static function getProjectPaths(string $type = '', string $suffix = '', s
case 'blocksSourceWrapper':
$name = 'wrapper';
break;

case 'blocksGlobalAssetsDestination':
$path = self::joinPaths([$assetsPath]);

Expand Down
4 changes: 2 additions & 2 deletions src/Helpers/ObjectHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public static function parseManifest(string $manifest): array
}

/**
* Get current url with params.
* Get current URL with params.
*
* @return string
*/
Expand All @@ -286,7 +286,7 @@ public static function getCurrentUrl(): string
/**
* Clean url from query params.
*
* @param string $url Url to clean.
* @param string $url URL to clean.
*
* @return string
*/
Expand Down

0 comments on commit a1325b3

Please sign in to comment.