|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
/** Auth forms */ |
|
11
|
|
|
namespace Auth\Factory\Form; |
|
12
|
|
|
|
|
13
|
|
|
use Interop\Container\ContainerInterface; |
|
14
|
|
|
use Zend\ServiceManager\FactoryInterface; |
|
15
|
|
|
use Zend\ServiceManager\ServiceLocatorInterface; |
|
16
|
|
|
use Auth\Form\SocialProfilesFieldset; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Factory for a SocialProfilesFieldset |
|
20
|
|
|
* |
|
21
|
|
|
* @author Mathias Gelhausen <[email protected]> |
|
22
|
|
|
*/ |
|
23
|
|
|
class SocialProfilesFieldsetFactory implements FactoryInterface |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* Creates a {@link SocialProfilesFieldset} |
|
27
|
|
|
* |
|
28
|
|
|
* Uses config from the config key [form_element_config][attach_social_profiles_fieldset] |
|
29
|
|
|
* to configure fetch_url, preview_url and name or uses the defaults: |
|
30
|
|
|
* - fetch_url: Route named "auth-social-profiles" with the suffix "?network=%s" |
|
31
|
|
|
* - preview_url: Route named "lang/applications/detail" with the suffix "?action=social-profile&network=%s" |
|
32
|
|
|
* - name: "social_profiles" |
|
33
|
|
|
* |
|
34
|
|
|
* @param ContainerInterface $container |
|
35
|
|
|
* @param string $requestedName |
|
36
|
|
|
* @param null|array $options |
|
37
|
|
|
* |
|
38
|
|
|
* @return object |
|
39
|
|
|
* @throws ServiceNotFoundException if unable to resolve the service. |
|
40
|
|
|
* @throws ServiceNotCreatedException if an exception is raised when |
|
41
|
|
|
* creating a service. |
|
42
|
|
|
* @throws ContainerException if any other error occurs |
|
43
|
|
|
*/ |
|
44
|
|
|
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
45
|
|
|
{ |
|
46
|
|
|
/* @var $router \Zend\Mvc\Router\RouteStackInterface */ |
|
47
|
|
|
|
|
48
|
|
|
$router = $container->get('Router'); |
|
49
|
|
|
$config = $container->get('Config'); |
|
50
|
|
|
$options = isset($config['form_element_config']['attach_social_profiles_fieldset']) |
|
51
|
|
|
? $config['form_element_config']['attach_social_profiles_fieldset'] |
|
52
|
|
|
: array(); |
|
53
|
|
|
|
|
54
|
|
|
if (!isset($options['fetch_url'])) { |
|
55
|
|
|
$options['fetch_url'] = |
|
56
|
|
|
$router->assemble(array('action' => 'fetch'), array('name' => 'auth-social-profiles')) |
|
57
|
|
|
. '?network=%s'; |
|
58
|
|
|
} |
|
59
|
|
|
if (!isset($options['preview_url'])) { |
|
60
|
|
|
$options['preview_url'] = |
|
61
|
|
|
$router->assemble(array('id' => 'null'), array('name' => 'lang/applications/detail'), true) |
|
|
|
|
|
|
62
|
|
|
. '?action=social-profile&network=%s'; |
|
63
|
|
|
} |
|
64
|
|
View Code Duplication |
if (isset($options['name'])) { |
|
|
|
|
|
|
65
|
|
|
$name = $options['name']; |
|
66
|
|
|
unset($options['name']); |
|
67
|
|
|
} else { |
|
68
|
|
|
$name = 'social_profiles'; |
|
69
|
|
|
} |
|
70
|
|
|
$options['is_disable_capable'] = false; |
|
71
|
|
|
$options['is_disable_elements_capable'] = false; |
|
72
|
|
|
|
|
73
|
|
|
$fieldset = new SocialProfilesFieldset($name, $options); |
|
74
|
|
|
|
|
75
|
|
|
return $fieldset; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @param ServiceLocatorInterface $serviceLocator |
|
80
|
|
|
* @return SocialProfilesFieldset |
|
81
|
|
|
* @see \Zend\ServiceManager\FactoryInterface::createService() |
|
82
|
|
|
*/ |
|
83
|
|
|
public function createService(ServiceLocatorInterface $serviceLocator) |
|
84
|
|
|
{ |
|
85
|
|
|
return $this($serviceLocator->getServiceLocator(), SocialProfilesFieldset::class); |
|
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignorePhpDoc annotation to the duplicate definition and it will be ignored.