diff --git a/src/CfCommunity/CfHelper/CfHelper.php b/src/CfCommunity/CfHelper/CfHelper.php index 230fa3c..d46a655 100644 --- a/src/CfCommunity/CfHelper/CfHelper.php +++ b/src/CfCommunity/CfHelper/CfHelper.php @@ -130,11 +130,11 @@ public function __call($methodName, $arguments) if (substr($methodName, 0, 3) !== 'get') { throw new \Exception('Method ' . $methodName . ' not exists'); } - if (substr($methodName, -strlen("Connector")) !== "Connector") { + $strSize = strlen("Connector"); + if (substr($methodName, -$strSize) !== "Connector") { throw new \Exception('Method ' . $methodName . ' not exists'); } - $connectorName = substr($methodName, 3); - $connectorName = substr_replace($connectorName, "Connector", 0); + $connectorName = strtolower(substr($methodName, 3, $strSize - 1)); $connector = $this->getConnector($connectorName); if (isset($this->connectorsState[$connector->getName()])) { @@ -159,4 +159,4 @@ public function getConnector($name) } throw new ConnectorNotFoundException($name); } -} \ No newline at end of file +}