aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2015-06-01 13:51:05 +0200
committerMarc Alexander <admin@m-a-styles.de>2015-09-09 08:27:38 +0200
commit8c2cbc0599b9d62fde730b2891c73c9c053682e7 (patch)
treecd49d32dc40b29c57f934cbcf178a00dda259023
parent1af6f052d80e693d289258d490c1187a064093b9 (diff)
downloadforums-8c2cbc0599b9d62fde730b2891c73c9c053682e7.tar
forums-8c2cbc0599b9d62fde730b2891c73c9c053682e7.tar.gz
forums-8c2cbc0599b9d62fde730b2891c73c9c053682e7.tar.bz2
forums-8c2cbc0599b9d62fde730b2891c73c9c053682e7.tar.xz
forums-8c2cbc0599b9d62fde730b2891c73c9c053682e7.zip
[ticket/13904] Remove magic method from factory and allow short names
PHPBB3-13904
-rw-r--r--phpBB/phpbb/files/factory.php27
1 files changed, 3 insertions, 24 deletions
diff --git a/phpBB/phpbb/files/factory.php b/phpBB/phpbb/files/factory.php
index 9385ad678e..508c50c6ce 100644
--- a/phpBB/phpbb/files/factory.php
+++ b/phpBB/phpbb/files/factory.php
@@ -35,13 +35,15 @@ class factory
*
* @param string $name Service name
*
- * @return object|false Requested service or false if service could not be
+ * @return object|bool Requested service or false if service could not be
* found by the container
*/
public function get($name)
{
$service = false;
+ $name = (strpos($name, 'files.') === false) ? 'files.' . $name : $name;
+
try
{
$service = $this->container->get($name);
@@ -53,27 +55,4 @@ class factory
return $service;
}
-
- /**
- * Magic function for handling get calls, e.g. get_fileupload() or
- * get_filespec() and turning them into call for files. services like
- * files.fileupload.
- *
- * @param string $name Name of called function
- * @param mixed $arguments Possible supplied arguments
- *
- * @return object|false Requested service or false if service could not be
- * found by the container
- */
- public function __call($name, $arguments)
- {
- if (substr($name, 0, 4) === 'get_')
- {
- return $this->get('files.' . substr($name, 4));
- }
- else
- {
- return false;
- }
- }
}