Commit 2a77c97a authored by Felix Flor's avatar Felix Flor

update the error messages if wrong or not enough arguments given

parent da6f8281
No preview for this file type
......@@ -16,10 +16,10 @@ function checkGivenArguments(array $argv) : void {
$path = realpath($argv[1]);
if(!isset($path) || !isset($argv[2]))
exitWithErrorMessage("Not enough arguments! ( aphpanalyse <PATH> <OUTPUT> )\n");
exitWithErrorMessage("APHPAutoanalyse: Not enough arguments given!\n\t\t aphpanalyse <PATH> <OPTIONS> [--testfile <TEMPLATE>]\n\t\t <PATH> /path/to/dir\n\t\t <OPTIONS> --console-full | --testfile\n\t\t [--testfile <TEMPLATE>] --developer | --monitor\n");
if(!is_dir($path))
exitWithErrorMessage("There is no directory found on path \"$path\"\n");
exitWithErrorMessage("APHPAutoanalyse: There is no directory found on path \"$path\"\n");
/**
* checks the readability of file and directories given in argument.
......@@ -36,19 +36,19 @@ function checkGivenArguments(array $argv) : void {
}
}
if($notReadableFileOrDirectoryCounter > 0){
exitWithErrorMessage("There are sone or more Files which are not readable. Check the Output above for Details.\nChange the file Permissions. To do that use this command \"$ chmod u+r <FILE>\"\n");
exitWithErrorMessage("APHPAutoanalyse: There are sone or more Files which are not readable. Check the Output above for Details.\nChange the file Permissions. To do that use this command \"$ chmod u+r <FILE>\"\n");
}
if(!isset($argv[2]))
exitWithErrorMessage("You have to give argument for output. ( aphpanalyse <PATH> <OUTPUT> [ --console-full | --testfile ] ).\n");
exitWithErrorMessage("APHPAutoanalyse: You have to give argument for output. ( aphpanalyse <PATH> <OUTPUT> [ --console-full | --testfile ] ).\n");
$acceptedOutputArguments = array("--console-full", "--testfile");
if(!in_array($argv[2], $acceptedOutputArguments))
exitWithErrorMessage("The Argument you have given is not valid. Avaible Options: <OUTPUT> [ --console-full | --testfile ].\n");
exitWithErrorMessage("APHPAutoanalyse: The Argument you have given is not valid. Avaible Options: <OUTPUT> [ --console-full | --testfile ].\n");
if($argv[2] == "--testfile" && !isset($argv[3]))
exitWithErrorMessage("Missing Argument for --testfile. Avaible Options: [<TEMPLATE>] [ --developer | --monitor ].\n");
exitWithErrorMessage("APHPAutoanalyse: Missing Argument for --testfile. Avaible Options: [<TEMPLATE>] [ --developer | --monitor ].\n");
if($argv[2] == "--testfile" && !($argv[3] == "--developer" || $argv[3] == "--monitor"))
exitWithErrorMessage("The Argument you have given is not valid. Avaible Options: [<TEMPLATE>] [ --developer | --monitor ].\n");
exitWithErrorMessage("APHPAutoanalyse: The Argument you have given is not valid. Avaible Options: [<TEMPLATE>] [ --developer | --monitor ].\n");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment