forked from zendframework/zendframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated StaticValidator to PluginBroker
- Created ValidatorLoader and ValidatorBroker; will re-use with Zend\Filter\InputFilter and Zend\Form
- Loading branch information
1 parent
41dfc8d
commit 21201c6
Showing
4 changed files
with
348 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Validator | ||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Validator; | ||
|
||
use Zend\Loader\PluginBroker; | ||
|
||
/** | ||
* Broker for validator instances | ||
* | ||
* @category Zend | ||
* @package Zend_Validator | ||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
class ValidatorBroker extends PluginBroker | ||
{ | ||
/** | ||
* @var string Default plugin loading strategy | ||
*/ | ||
protected $defaultClassLoader = 'Zend\Validator\ValidatorLoader'; | ||
|
||
/** | ||
* Determine if we have a valid validator | ||
* | ||
* @param mixed $plugin | ||
* @return true | ||
* @throws Exception | ||
*/ | ||
protected function validatePlugin($plugin) | ||
{ | ||
if (!$plugin instanceof Validator) { | ||
throw new Exception('Validators must implement Zend\Validator\Validator'); | ||
} | ||
return true; | ||
} | ||
} |
Oops, something went wrong.