-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
319 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Project Specific | ||
/public | ||
/vendor | ||
/vendor-prefixed | ||
/node_modules | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Project Specific | ||
/public | ||
/vendor | ||
/vendor-prefixed | ||
/node_modules | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
/** | ||
* Class that registers WPCLI command for ModifyAdminAppearance. | ||
* | ||
* @package EightshiftLibs\ModifyAdminAppearance | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace EightshiftLibs\ModifyAdminAppearance; | ||
|
||
use EightshiftLibs\Cli\AbstractCli; | ||
use EightshiftLibs\Cli\ParentGroups\CliCreate; | ||
use EightshiftLibs\Helpers\Helpers; | ||
|
||
/** | ||
* Class OptimizationCli | ||
*/ | ||
class OptimizationCli extends AbstractCli | ||
{ | ||
/** | ||
* Get WPCLI command parent name | ||
* | ||
* @return string | ||
*/ | ||
public function getCommandParentName(): string | ||
{ | ||
return CliCreate::COMMAND_NAME; | ||
} | ||
|
||
/** | ||
* Get WPCLI command name | ||
* | ||
* @return string | ||
*/ | ||
public function getCommandName(): string | ||
{ | ||
return 'optimization'; | ||
} | ||
|
||
/** | ||
* Get WPCLI command doc | ||
* | ||
* @return array<string, array<int, array<string, bool|string>>|string> | ||
*/ | ||
public function getDoc(): array | ||
{ | ||
return [ | ||
'shortdesc' => 'Create optimization class.', | ||
'longdesc' => $this->prepareLongDesc(" | ||
## USAGE | ||
Used to create optimization service class remove unecesery WP core stuff for faster loading. | ||
## EXAMPLES | ||
# Create service class: | ||
$ wp {$this->commandParentName} {$this->getCommandParentName()} {$this->getCommandName()} | ||
## RESOURCES | ||
Service class will be created from this example: | ||
https://github.com/infinum/eightshift-libs/blob/develop/src/Optimization/OptimizationExample.php | ||
"), | ||
]; | ||
} | ||
|
||
/* @phpstan-ignore-next-line */ | ||
public function __invoke(array $args, array $assocArgs) | ||
{ | ||
$assocArgs = $this->prepareArgs($assocArgs); | ||
|
||
$this->getIntroText($assocArgs); | ||
|
||
$className = $this->getClassShortName(); | ||
|
||
// Read the template contents, and replace the placeholders with provided variables. | ||
$this->getExampleTemplate(__DIR__, $className) | ||
->renameClassName($className) | ||
->renameGlobals($assocArgs) | ||
->outputWrite(Helpers::getProjectPaths('srcDestination', 'Optimization'), "{$className}.php", $assocArgs); | ||
} | ||
} |
Oops, something went wrong.