aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar logmanoriginal <logmanoriginal@users.noreply.github.com> 2018-11-15 19:31:31 +0100
committerGravatar logmanoriginal <logmanoriginal@users.noreply.github.com> 2018-11-15 19:31:31 +0100
commit0a92b5d29b202fdb13b29c401bb9fb229ee47a12 (patch)
tree339182000e56c3bf2a9c5ebd352ccb89e3c3696f
parente3849f45abe18f65a073bbc123852b2c04c5b180 (diff)
downloadrss-bridge-0a92b5d29b202fdb13b29c401bb9fb229ee47a12.tar.gz
rss-bridge-0a92b5d29b202fdb13b29c401bb9fb229ee47a12.tar.zst
rss-bridge-0a92b5d29b202fdb13b29c401bb9fb229ee47a12.zip
[Bridge] Refactor Bridge::create to improve readability
-rw-r--r--lib/Bridge.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Bridge.php b/lib/Bridge.php
index 92ec6a3c..113e4380 100644
--- a/lib/Bridge.php
+++ b/lib/Bridge.php
@@ -74,25 +74,25 @@ class Bridge {
* @throws \InvalidArgumentException if the requested bridge name is invalid.
* @throws \Exception if the requested bridge doesn't exist in the working
* directory.
- * @param string $nameBridge Name of the bridge object.
+ * @param string $name Name of the bridge object.
* @return object|bool The bridge object or false if the class is not instantiable.
*/
- public static function create($nameBridge){
- if(!preg_match('/^[A-Z][a-zA-Z0-9-]*$/', $nameBridge)) {
+ public static function create($name){
+ if(!preg_match('/^[A-Z][a-zA-Z0-9-]*$/', $name)) {
throw new \InvalidArgumentException('Bridge name invalid!');
}
- $nameBridge = self::sanitizeBridgeName($nameBridge) . 'Bridge';
- $pathBridge = self::getWorkingDir() . $nameBridge . '.php';
+ $name = self::sanitizeBridgeName($name) . 'Bridge';
+ $filePath = self::getWorkingDir() . $name . '.php';
- if(!file_exists($pathBridge)) {
- throw new \Exception('Cache file ' . $pathBridge . ' does not exist!');
+ if(!file_exists($filePath)) {
+ throw new \Exception('Cache file ' . $filePath . ' does not exist!');
}
- require_once $pathBridge;
+ require_once $filePath;
- if((new \ReflectionClass($nameBridge))->isInstantiable()) {
- return new $nameBridge();
+ if((new \ReflectionClass($name))->isInstantiable()) {
+ return new $name();
}
return false;