1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (c) 2011-2012 Andreas Heigl<[email protected]> |
4
|
|
|
* |
5
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
6
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
7
|
|
|
* in the Software without restriction, including without limitation the rights |
8
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
9
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
10
|
|
|
* furnished to do so, subject to the following conditions: |
11
|
|
|
* |
12
|
|
|
* The above copyright notice and this permission notice shall be included in |
13
|
|
|
* all copies or substantial portions of the Software. |
14
|
|
|
* |
15
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
18
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
20
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
21
|
|
|
* THE SOFTWARE. |
22
|
|
|
* |
23
|
|
|
* @package HeiglContact |
24
|
|
|
* @author Andreas Heigl<[email protected]> |
25
|
|
|
* @copyright 2011-2012 Andreas Heigl |
26
|
|
|
* @license http://www.opesource.org/licenses/mit-license.php MIT-License |
27
|
|
|
* @version 0.0 |
28
|
|
|
* @since 06.03.2012 |
29
|
|
|
* @link http://github.com/heiglandreas/php.ug |
30
|
|
|
*/ |
31
|
|
|
|
32
|
|
|
namespace Org_Heigl\Contact\Service; |
33
|
|
|
|
34
|
|
|
use Interop\Container\ContainerInterface; |
35
|
|
|
use Org_Heigl\Contact\Controller\ContactController; |
36
|
|
|
use Org_Heigl\Contact\Form\ContactForm; |
37
|
|
|
use Zend\ServiceManager\Factory\FactoryInterface; |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* The Contact-Controller Factory |
42
|
|
|
* |
43
|
|
|
* @category ContactForm |
44
|
|
|
* @package OrgHeiglContact |
45
|
|
|
* @author Andreas Heigl<[email protected]> |
46
|
|
|
* @copyright 2011-2012 Andreas Heigl |
47
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT-License |
48
|
|
|
* @version 0.0 |
49
|
|
|
* @since 06.03.2012 |
50
|
|
|
* @link http://github.com/heiglandreas/OrgHeiglContact |
51
|
|
|
*/ |
52
|
|
|
class ContactControllerFactory implements FactoryInterface |
53
|
|
|
{ |
54
|
|
|
/** |
55
|
|
|
* Create the ContactController |
56
|
|
|
* |
57
|
|
|
* @param ServiceLocator $services The ServiceLocator |
|
|
|
|
58
|
|
|
* |
59
|
|
|
* @see \Zend\ServiceManager\FactoryInterface::createService() |
60
|
|
|
* @return ContactController |
61
|
|
|
*/ |
62
|
|
|
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
63
|
|
|
{ |
64
|
|
|
$form = $container->get(ContactForm::class); |
65
|
|
|
$message = $container->get('message'); |
66
|
|
|
$transport = $container->get('transport'); |
67
|
|
|
|
68
|
|
|
$controller = new ContactController(); |
69
|
|
|
$controller->setContactForm($form); |
70
|
|
|
$controller->setMessage($message); |
71
|
|
|
$controller->setTransport($transport); |
72
|
|
|
|
73
|
|
|
return $controller; |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.