Large changes to inter-object interfaces + More

+ Created a new core interface (called RequestChainable) and applied it to most of the objects using a trait
+ Altered the `__construct()` and `fromJson()` methods of all model classes by replacing the second parameter ($apiRequester) with a $caller parameter
+ Altered the  `__construct()` method of all requester classes to make them accept $client by reference instead of by value
+ Altered the  `__construct()` method of all requester classes by replacing the second parameter ($authToken) with a $caller parameter
+ Changed the name of several methods and properties
+ Altered several docblocks
This commit is contained in:
Benjamin Blake
2020-02-26 20:23:06 -07:00
parent 57bf45938f
commit 70f978847e
21 changed files with 568 additions and 309 deletions

View File

@ -43,7 +43,8 @@ $giteaClient->setAuthToken('32e609ad39539c1d0e8544800bd49b1025ac6b49');
// $tags = $repository->tags();
// if ($tags && count($tags) > 0) {
// foreach ($tags as $tag) {
// var_dump(json_encode($tag));
// print("Processing ".$tag->getName()."\n");
// // var_dump(json_encode($tag));
// print("\n\n");
// }
// print("Total Tags: ".count($tags)."\n");
@ -52,20 +53,25 @@ $giteaClient->setAuthToken('32e609ad39539c1d0e8544800bd49b1025ac6b49');
// print("The repository could not be retrieved"."\n");
// }
// print("Getting all branches for the 'sl-product-catalog' repository \n\n");
// $repository = $giteaClient->repositories()->getByName("Sitelease", "sl-theme-recipe");
// if ($repository) {
// $branches = $repository->branches();
// if ($branches && count($branches) > 0) {
// //foreach ($branches as $branch) {
// var_dump($branches->getItem("master"));
// print("\n\n");
// //}
// print("Total Branches: ".count($branches)."\n");
// }
// } else {
// print("The repository could not be retrieved"."\n");
// }
print("Getting all branches for the 'sl-product-catalog' repository \n\n");
$repository = $giteaClient->repositories()->getByName("Sitelease", "sl-theme-recipe");
if ($repository) {
$branches = $repository->branches();
if ($branches && count($branches) > 0) {
foreach ($branches as $branch) {
// var_dump(json_encode($branch));
print("Processing ".$branch->getName()."\n");
$debugChain = $branch->debugRequestChain();
if ($debugChain) {
print("Chain ".$debugChain."\n");
}
print("\n\n");
}
print("Total Branches: ".count($branches)."\n");
}
} else {
print("The repository could not be retrieved"."\n");
}
// print("Getting contents of \"composer.json\" file \n\n");
// $rawFile = $giteaClient->repositories()->getRawFile("Sitelease", "sl-theme-recipe", "composer.json");
@ -94,17 +100,17 @@ $giteaClient->setAuthToken('32e609ad39539c1d0e8544800bd49b1025ac6b49');
// print("The repository could not be retrieved"."\n");
// }
print("Getting archive for the 'sl-product-catalog' repository \n\n");
$repository = $giteaClient->repositories()->getByName("Sitelease", "sl-theme-recipe");
if ($repository) {
$archive = $repository->archive("master");
if ($archive) {
print("Downloading Archive...\n");
file_put_contents("master.tar.gz", $archive);
print("Success!\n");
}
} else {
print("The archive could not be retrieved"."\n");
}
// print("Getting archive for the 'sl-product-catalog' repository \n\n");
// $repository = $giteaClient->repositories()->getByName("Sitelease", "sl-theme-recipe");
// if ($repository) {
// $archive = $repository->archive("master");
// if ($archive) {
// print("Downloading Archive...\n");
// file_put_contents("master.tar.gz", $archive);
// print("Success!\n");
// }
// } else {
// print("The archive could not be retrieved"."\n");
// }
print("Exiting script"."\n");