Fixed command interfaces

This commit is contained in:
2026-06-19 13:42:25 +00:00
parent 5f9f6ca2ff
commit 0027766a77
14 changed files with 39 additions and 14 deletions
+2 -1
View File
@@ -110,7 +110,7 @@ class ClassCreateCommand extends Command {
]; ];
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
if (!CredentialManager::isConfigured()) if (!CredentialManager::isConfigured())
throw new \Exception("The 'cloudobjects' CLI tool must be installed and authorized."); throw new \Exception("The 'cloudobjects' CLI tool must be installed and authorized.");
@@ -238,6 +238,7 @@ class ClassCreateCommand extends Command {
$output->writeln("Calling cloudobjects ..."); $output->writeln("Calling cloudobjects ...");
passthru("cloudobjects configuration-job:create ".$fullName.".xml"); passthru("cloudobjects configuration-job:create ".$fullName.".xml");
} }
return Command::SUCCESS;
} }
} }
+3 -1
View File
@@ -9,6 +9,7 @@ namespace CloudObjects\PhpMAE\Commands;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use CloudObjects\SDK\COIDParser; use CloudObjects\SDK\COIDParser;
use CloudObjects\PhpMAE\ClassValidator; use CloudObjects\PhpMAE\ClassValidator;
@@ -20,7 +21,7 @@ class ClassDeployCommand extends AbstractObjectCommand {
->addArgument('coid', InputArgument::REQUIRED, 'The COID of the object.'); ->addArgument('coid', InputArgument::REQUIRED, 'The COID of the object.');
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->requireCloudObjectsCLI(); $this->requireCloudObjectsCLI();
$this->parse($input->getArgument('coid')); $this->parse($input->getArgument('coid'));
@@ -67,6 +68,7 @@ class ClassDeployCommand extends AbstractObjectCommand {
break; break;
} }
$output->writeln(""); $output->writeln("");
return Command::SUCCESS;
} }
} }
+3 -1
View File
@@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use ML\IRI\IRI; use ML\IRI\IRI;
use Guzzle\Http\Exception\BadResponseException; use Guzzle\Http\Exception\BadResponseException;
use CloudObjects\SDK\COIDParser; use CloudObjects\SDK\COIDParser;
@@ -55,7 +56,7 @@ class ClassTestEnvCommand extends AbstractObjectCommand {
} }
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->requireCloudObjectsCLI(); $this->requireCloudObjectsCLI();
$container = $this->getContainer(); $container = $this->getContainer();
@@ -93,6 +94,7 @@ class ClassTestEnvCommand extends AbstractObjectCommand {
$cmd->upload($output); $cmd->upload($output);
}); });
} }
return Command::SUCCESS;
} }
} }
+3 -1
View File
@@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use JsonRpc\Client; use JsonRpc\Client;
use CloudObjects\PhpMAE\TestEnvironmentManager; use CloudObjects\PhpMAE\TestEnvironmentManager;
@@ -33,7 +34,7 @@ class ClassTestEnvRPCCommand extends AbstractObjectCommand {
->addArgument('parameters', InputArgument::IS_ARRAY, 'The parameters for the method.'); ->addArgument('parameters', InputArgument::IS_ARRAY, 'The parameters for the method.');
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->requireCloudObjectsCLI(); $this->requireCloudObjectsCLI();
$container = $this->getContainer(); $container = $this->getContainer();
@@ -68,6 +69,7 @@ class ClassTestEnvRPCCommand extends AbstractObjectCommand {
: json_encode($client->result, JSON_PRETTY_PRINT)); : json_encode($client->result, JSON_PRETTY_PRINT));
else else
$output->writeln("<error>RPC has failed!</error>"); $output->writeln("<error>RPC has failed!</error>");
return Command::SUCCESS;
} }
} }
+3 -1
View File
@@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use CloudObjects\PhpMAE\ClassValidator; use CloudObjects\PhpMAE\ClassValidator;
class ClassValidateCommand extends AbstractObjectCommand { class ClassValidateCommand extends AbstractObjectCommand {
@@ -22,7 +23,7 @@ class ClassValidateCommand extends AbstractObjectCommand {
->addOption('watch', null, InputOption::VALUE_NONE, 'Keep watching for changes of the file and revalidate automatically.'); ->addOption('watch', null, InputOption::VALUE_NONE, 'Keep watching for changes of the file and revalidate automatically.');
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->parse($input->getArgument('coid')); $this->parse($input->getArgument('coid'));
$this->assertRDF(); $this->assertRDF();
if (!in_array('coid://phpmae.dev/Class', $this->rdfTypes) if (!in_array('coid://phpmae.dev/Class', $this->rdfTypes)
@@ -52,6 +53,7 @@ class ClassValidateCommand extends AbstractObjectCommand {
} }
}); });
} }
return Command::SUCCESS;
} }
} }
@@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use CloudObjects\SDK\COIDParser; use CloudObjects\SDK\COIDParser;
class DependenciesAddAttachmentCommand extends AbstractObjectCommand { class DependenciesAddAttachmentCommand extends AbstractObjectCommand {
@@ -22,7 +23,7 @@ class DependenciesAddAttachmentCommand extends AbstractObjectCommand {
->addOption('upload', null, InputOption::VALUE_NONE, 'Calls "cloudobjects" to actually upload the file to CloudObjects.'); ->addOption('upload', null, InputOption::VALUE_NONE, 'Calls "cloudobjects" to actually upload the file to CloudObjects.');
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->requireCloudObjectsCLI(); $this->requireCloudObjectsCLI();
$this->parse($input->getArgument('coid-target')); $this->parse($input->getArgument('coid-target'));
@@ -58,6 +59,7 @@ class DependenciesAddAttachmentCommand extends AbstractObjectCommand {
$output->writeln("Calling cloudobjects ..."); $output->writeln("Calling cloudobjects ...");
passthru("cloudobjects attachment:put ".(string)$this->coid." ".$filename); passthru("cloudobjects attachment:put ".(string)$this->coid." ".$filename);
} }
return Command::SUCCESS;
} }
} }
@@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use CloudObjects\SDK\COIDParser; use CloudObjects\SDK\COIDParser;
class DependenciesAddClassCommand extends AbstractAddDependenciesCommand { class DependenciesAddClassCommand extends AbstractAddDependenciesCommand {
@@ -24,7 +25,7 @@ class DependenciesAddClassCommand extends AbstractAddDependenciesCommand {
parent::configure(); parent::configure();
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->requireCloudObjectsCLI(); $this->requireCloudObjectsCLI();
$this->parse($input->getArgument('coid-target')); $this->parse($input->getArgument('coid-target'));
@@ -73,6 +74,7 @@ class DependenciesAddClassCommand extends AbstractAddDependenciesCommand {
$output->writeln("You can find the documentation for the available class methods on this page:"); $output->writeln("You can find the documentation for the available class methods on this page:");
$output->writeln("➡️ https://cloudobjects.io/".$coidClass->getHost().$coidClass->getPath()); $output->writeln("➡️ https://cloudobjects.io/".$coidClass->getHost().$coidClass->getPath());
$output->writeln(""); $output->writeln("");
return Command::SUCCESS;
} }
} }
@@ -9,6 +9,7 @@ namespace CloudObjects\PhpMAE\Commands;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use CloudObjects\SDK\COIDParser; use CloudObjects\SDK\COIDParser;
class DependenciesAddStaticTextCommand extends AbstractAddDependenciesCommand { class DependenciesAddStaticTextCommand extends AbstractAddDependenciesCommand {
@@ -23,7 +24,7 @@ class DependenciesAddStaticTextCommand extends AbstractAddDependenciesCommand {
parent::configure(); parent::configure();
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->requireCloudObjectsCLI(); $this->requireCloudObjectsCLI();
$this->parse($input->getArgument('coid-target')); $this->parse($input->getArgument('coid-target'));
@@ -58,6 +59,7 @@ class DependenciesAddStaticTextCommand extends AbstractAddDependenciesCommand {
$output->writeln(""); $output->writeln("");
$output->writeln("3) Use \$this->".$key." wherever required."); $output->writeln("3) Use \$this->".$key." wherever required.");
$output->writeln(""); $output->writeln("");
return Command::SUCCESS;
} }
} }
@@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use CloudObjects\SDK\COIDParser; use CloudObjects\SDK\COIDParser;
class DependenciesAddTemplateCommand extends AbstractAddDependenciesCommand { class DependenciesAddTemplateCommand extends AbstractAddDependenciesCommand {
@@ -25,7 +26,7 @@ class DependenciesAddTemplateCommand extends AbstractAddDependenciesCommand {
parent::configure(); parent::configure();
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->requireCloudObjectsCLI(); $this->requireCloudObjectsCLI();
$this->parse($input->getArgument('coid-target')); $this->parse($input->getArgument('coid-target'));
@@ -70,6 +71,7 @@ class DependenciesAddTemplateCommand extends AbstractAddDependenciesCommand {
$output->writeln(""); $output->writeln("");
$output->writeln("3) Render your template by calling \$this->".$key."Template->render(\$context)."); $output->writeln("3) Render your template by calling \$this->".$key."Template->render(\$context).");
$output->writeln(""); $output->writeln("");
return Command::SUCCESS;
} }
} }
@@ -9,6 +9,7 @@ namespace CloudObjects\PhpMAE\Commands;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use CloudObjects\SDK\COIDParser; use CloudObjects\SDK\COIDParser;
class DependenciesAddWebAPICommand extends AbstractAddDependenciesCommand { class DependenciesAddWebAPICommand extends AbstractAddDependenciesCommand {
@@ -23,7 +24,7 @@ class DependenciesAddWebAPICommand extends AbstractAddDependenciesCommand {
parent::configure(); parent::configure();
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->requireCloudObjectsCLI(); $this->requireCloudObjectsCLI();
$this->parse($input->getArgument('coid-target')); $this->parse($input->getArgument('coid-target'));
@@ -67,6 +68,7 @@ class DependenciesAddWebAPICommand extends AbstractAddDependenciesCommand {
$output->writeln(""); $output->writeln("");
$output->writeln("3) Make API requests in your class by calling methods on \$this->".$key."Api."); $output->writeln("3) Make API requests in your class by calling methods on \$this->".$key."Api.");
$output->writeln(""); $output->writeln("");
return Command::SUCCESS;
} }
} }
+2 -1
View File
@@ -25,7 +25,7 @@ class InterfaceCreateCommand extends Command {
->addOption('confjob', null, InputOption::VALUE_OPTIONAL, 'Calls "cloudobjects" to create a configuration job for the new interface.', false); ->addOption('confjob', null, InputOption::VALUE_OPTIONAL, 'Calls "cloudobjects" to create a configuration job for the new interface.', false);
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
if (!CredentialManager::isConfigured()) if (!CredentialManager::isConfigured())
throw new \Exception("The 'cloudobjects' CLI tool must be installed and authorized."); throw new \Exception("The 'cloudobjects' CLI tool must be installed and authorized.");
@@ -79,6 +79,7 @@ class InterfaceCreateCommand extends Command {
$output->writeln("Calling cloudobjects ..."); $output->writeln("Calling cloudobjects ...");
passthru("cloudobjects configuration-job:create ".$fullName.".xml"); passthru("cloudobjects configuration-job:create ".$fullName.".xml");
} }
return Command::SUCCESS;
} }
} }
+3 -1
View File
@@ -9,6 +9,7 @@ namespace CloudObjects\PhpMAE\Commands;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use CloudObjects\SDK\COIDParser; use CloudObjects\SDK\COIDParser;
use CloudObjects\PhpMAE\ClassValidator; use CloudObjects\PhpMAE\ClassValidator;
@@ -20,7 +21,7 @@ class InterfaceDeployCommand extends AbstractObjectCommand {
->addArgument('coid', InputArgument::REQUIRED, 'The COID of the object.'); ->addArgument('coid', InputArgument::REQUIRED, 'The COID of the object.');
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->parse($input->getArgument('coid')); $this->parse($input->getArgument('coid'));
$this->assertRDF(); $this->assertRDF();
if (!in_array('coid://phpmae.dev/Interface', $this->rdfTypes)) if (!in_array('coid://phpmae.dev/Interface', $this->rdfTypes))
@@ -45,6 +46,7 @@ class InterfaceDeployCommand extends AbstractObjectCommand {
? $object['coid://cloudobjects.io/isVisibleTo'][0]['value'] ? $object['coid://cloudobjects.io/isVisibleTo'][0]['value']
: 'coid://cloudobjects.io/Vendor'; : 'coid://cloudobjects.io/Vendor';
$path = $this->coid->getHost().$this->coid->getPath(); $path = $this->coid->getHost().$this->coid->getPath();
return Command::SUCCESS;
} }
} }
@@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use CloudObjects\PhpMAE\ClassValidator; use CloudObjects\PhpMAE\ClassValidator;
class InterfaceValidateCommand extends AbstractObjectCommand { class InterfaceValidateCommand extends AbstractObjectCommand {
@@ -21,7 +22,7 @@ class InterfaceValidateCommand extends AbstractObjectCommand {
->addOption('watch', null, InputOption::VALUE_OPTIONAL, 'Keep watching for changes of the file and revalidate automatically.', null); ->addOption('watch', null, InputOption::VALUE_OPTIONAL, 'Keep watching for changes of the file and revalidate automatically.', null);
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
$this->parse($input->getArgument('coid')); $this->parse($input->getArgument('coid'));
$this->assertRDF(); $this->assertRDF();
if (!in_array('coid://phpmae.dev/Interface', $this->rdfTypes)) if (!in_array('coid://phpmae.dev/Interface', $this->rdfTypes))
@@ -47,6 +48,7 @@ class InterfaceValidateCommand extends AbstractObjectCommand {
$output->writeln('<error>'.get_class($e).'</error> '.$e->getMessage()); $output->writeln('<error>'.get_class($e).'</error> '.$e->getMessage());
} }
}); });
return Command::SUCCESS;
} }
} }
@@ -22,7 +22,7 @@ class TestEnvironmentStartCommand extends Command {
->addOption('host', null, InputOption::VALUE_OPTIONAL, 'Bind test environment to this host.', '127.0.0.1'); ->addOption('host', null, InputOption::VALUE_OPTIONAL, 'Bind test environment to this host.', '127.0.0.1');
} }
protected function execute(InputInterface $input, OutputInterface $output) { protected function execute(InputInterface $input, OutputInterface $output): int {
if (!CredentialManager::isConfigured()) if (!CredentialManager::isConfigured())
throw new \Exception("The 'cloudobjects' CLI tool must be installed and authorized."); throw new \Exception("The 'cloudobjects' CLI tool must be installed and authorized.");
@@ -49,6 +49,7 @@ class TestEnvironmentStartCommand extends Command {
die("THRU!"); die("THRU!");
} }
} }
return Command::SUCCESS;
} }
} }