Mark V
1: <?php
2: namespace MOC\V\Component\Captcha;
3:
4: use MOC\V\Component\Captcha\Component\Bridge\Repository\SimplePhpCaptcha;
5: use MOC\V\Component\Captcha\Component\IBridgeInterface;
6: use MOC\V\Component\Captcha\Component\IVendorInterface;
7: use MOC\V\Component\Captcha\Vendor\Vendor;
8:
9: /**
10: * Class Captcha
11: *
12: * @package MOC\V\Component\Captcha
13: */
14: class Captcha implements IVendorInterface
15: {
16:
17: /** @var IVendorInterface $VendorInterface */
18: private $VendorInterface = null;
19:
20: /**
21: * @param IVendorInterface $VendorInterface
22: */
23: public function __construct(IVendorInterface $VendorInterface)
24: {
25:
26: $this->setVendorInterface($VendorInterface);
27: }
28:
29: /**
30: * @return IBridgeInterface
31: */
32: public static function getCaptcha()
33: {
34:
35: return self::getSimplePhpCaptcha();
36: }
37:
38: /**
39: * @return IBridgeInterface
40: */
41: public static function getSimplePhpCaptcha()
42: {
43:
44: $Doctrine = new Captcha(
45: new Vendor(
46: new SimplePhpCaptcha()
47: )
48: );
49:
50: return $Doctrine->getBridgeInterface();
51: }
52:
53: /**
54: * @return \MOC\V\Component\Captcha\Component\IBridgeInterface
55: */
56: public function getBridgeInterface()
57: {
58:
59: return $this->VendorInterface->getBridgeInterface();
60: }
61:
62: /**
63: * @return IVendorInterface
64: */
65: public function getVendorInterface()
66: {
67:
68: return $this->VendorInterface;
69: }
70:
71: /**
72: * @param IVendorInterface $VendorInterface
73: *
74: * @return IVendorInterface
75: */
76: public function setVendorInterface(IVendorInterface $VendorInterface)
77: {
78:
79: $this->VendorInterface = $VendorInterface;
80: return $this;
81: }
82:
83: /**
84: * @param IBridgeInterface $BridgeInterface
85: *
86: * @return \MOC\V\Component\Captcha\Component\IBridgeInterface
87: */
88: public function setBridgeInterface(IBridgeInterface $BridgeInterface)
89: {
90:
91: return $this->VendorInterface->setBridgeInterface($BridgeInterface);
92: }
93: }
94: