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
Westin Shafer
committed
May 17, 2017
1 parent
2370d07
commit e06ed57
Showing
5 changed files
with
48 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace WShafer\PSR11FlySystem\Config; | ||
|
||
use WShafer\PSR11FlySystem\Exception\MissingConfigException; | ||
|
||
abstract class ConfigurationAbstract | ||
{ | ||
protected $config = []; | ||
|
||
public function __construct(array $config) | ||
{ | ||
$this->validateConfig($config); | ||
$this->config = $config; | ||
} | ||
|
||
protected function validateConfig($config) | ||
{ | ||
if (empty($config)) { | ||
throw new MissingConfigException( | ||
'No config found' | ||
); | ||
} | ||
|
||
if (empty($config['type'])) { | ||
throw new MissingConfigException( | ||
'No config key of "type" found in adaptor config array.' | ||
); | ||
} | ||
} | ||
|
||
public function getType() | ||
{ | ||
return $this->config['type']; | ||
} | ||
|
||
public function getOptions() | ||
{ | ||
return $this->config['options'] ?? []; | ||
} | ||
} |
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