Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit 021acbc

Browse files
author
fhein
committed
Renamed validate members to validateServiceName.
validate -> validateServiceName validateArray -> validateServiceNameArray validateConfig -> validateServiceNameConfig
1 parent 6293fb5 commit 021acbc

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/ServiceManager.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ public function configure(array $config)
339339
{
340340
// This is a bulk update/initial configuration
341341
// So we check all definitions
342-
$this->validateConfig($config);
342+
$this->validateServiceNameConfig($config);
343343

344344
if (isset($config['services'])) {
345345
$this->services = $config['services'] + $this->services;
@@ -422,7 +422,7 @@ public function configure(array $config)
422422
*/
423423
public function setAlias($alias, $target)
424424
{
425-
$this->validate($alias);
425+
$this->validateServiceName($alias);
426426
$this->doSetAlias($alias, $target);
427427
}
428428

@@ -447,7 +447,7 @@ public function setInvokableClass($name, $class = null)
447447
*/
448448
public function setFactory($name, $factory)
449449
{
450-
$this->validate($name);
450+
$this->validateServiceName($name);
451451
$this->factories[$name] = $factory;
452452
}
453453

@@ -503,7 +503,7 @@ public function addInitializer($initializer)
503503
*/
504504
public function setService($name, $service)
505505
{
506-
$this->validate($name);
506+
$this->validateServiceName($name);
507507
$this->services[$name] = $service;
508508
}
509509

@@ -515,7 +515,7 @@ public function setService($name, $service)
515515
*/
516516
public function setShared($name, $flag)
517517
{
518-
$this->validate($name);
518+
$this->validateServiceName($name);
519519
$this->shared[$name] = (bool) $flag;
520520
}
521521

@@ -813,10 +813,10 @@ private function createFactoriesForInvokables(array $invokables)
813813
* @throws ContainerModificationsNotAllowedException if the
814814
* provided service name is invalid.
815815
*/
816-
private function validate($service)
816+
private function validateServiceName($service)
817817
{
818818
// Important: Next three lines must kept equal to the three
819-
// lines of validateArray (see below) which are marked as code
819+
// lines of validateServiceNameArray (see below) which are marked as code
820820
// duplicate!
821821
if (! isset($this->services[$service]) ?: $this->allowOverride) {
822822
return;
@@ -843,18 +843,18 @@ private function validate($service)
843843
* @throws ContainerModificationsNotAllowedException if any
844844
* array keys is invalid.
845845
*/
846-
private function validateArray(array $services)
846+
private function validateServiceNameArray(array $services)
847847
{
848848
$keys = \array_keys($services);
849849
foreach ($keys as $service) {
850-
// This is a code duplication from validate (see above).
851-
// validate is almost a one liner, so we reproduce it
850+
// This is a code duplication from validateServiceName (see above).
851+
// validateServiceName is almost a one liner, so we reproduce it
852852
// here for the sake of performance of aggregated service
853853
// manager configurations (we save the overhead the function
854854
// call would produce)
855855
//
856856
// Important: Next three lines MUST kept equal to the first
857-
// three lines of validate!
857+
// three lines of validateServiceName!
858858
if (! isset($this->services[$service]) ?: $this->allowOverride) {
859859
return;
860860
}
@@ -881,7 +881,7 @@ private function validateArray(array $services)
881881
* @throws ContainerModificationsNotAllowedException if any
882882
* service key is invalid.
883883
*/
884-
private function validateConfig(array $config)
884+
private function validateServiceNameConfig(array $config)
885885
{
886886
if ($this->allowOverride || ! $this->configured) {
887887
return;
@@ -891,12 +891,12 @@ private function validateConfig(array $config)
891891

892892
foreach ($sections as $section) {
893893
if (isset($config[$section])) {
894-
$this->validateArray($config[$section]);
894+
$this->validateServiceNameArray($config[$section]);
895895
}
896896
}
897897

898898
if (isset($config['lazy_services']['class_map'])) {
899-
$this->validateArray($config['lazy_services']['class_map']);
899+
$this->validateServiceNameArray($config['lazy_services']['class_map']);
900900
}
901901
}
902902

0 commit comments

Comments
 (0)