Skip to content

Commit

Permalink
dont allow a provider to be null
Browse files Browse the repository at this point in the history
Signed-off-by: Felix N眉sse <[email protected]>
  • Loading branch information
newhinton committed Oct 2, 2022
1 parent 480db17 commit 9b4c835
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/ProviderHandler/ProviderDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ function __construct($appName, IConfig $config) {
* @return Name of the Provider
*/
function getProviderByName($name): Provider {

$provider = $this->definitions[$name];
if($provider == null) {
return new Unsplash($this->appName, $this->config, "Unsplash");
}
return $this->definitions[$name];
}

Expand All @@ -91,7 +96,7 @@ function getProviderByName($name): Provider {
*
* @return Array with Names of Provider
*/
function getAllProviderNames(){
function getAllProviderNames() {
$i=0;
$tmp=[];
foreach ($this->definitions as &$value) {
Expand Down

0 comments on commit 9b4c835

Please sign in to comment.