Skip to content

Commit

Permalink
[Validator] renamed methods that do not follow CS
Browse files Browse the repository at this point in the history
requiredOptions -> getRequiredOptions
targets -> getTargets
defaultOption -> getDefaultOption
  • Loading branch information
fabpot committed Mar 30, 2011
1 parent 525702b commit f92055c
Show file tree
Hide file tree
Showing 38 changed files with 73 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class Unique extends Constraint
public $path;
public $documentManager;

public function defaultOption()
public function getDefaultOption()
{
return 'path';
}

public function requiredOptions()
public function getRequiredOptions()
{
return array('path');
}
Expand All @@ -39,7 +39,7 @@ public function validatedBy()
return 'doctrine_odm.mongodb.unique';
}

public function targets()
public function getTargets()
{
return Constraint::CLASS_CONSTRAINT;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Form/Configurable.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract class Configurable
* The names of the required options
* @var array
*/
private $requiredOptions = array();
private $getRequiredOptions = array();

/**
* Reads, validates and stores the given options
Expand All @@ -63,7 +63,7 @@ public function __construct(array $options = array())
}

// check required options
if ($diff = array_diff_key($this->requiredOptions, $this->options)) {
if ($diff = array_diff_key($this->getRequiredOptions, $this->options)) {
throw new MissingOptionsException(sprintf('%s requires the following options: \'%s\'.', get_class($this), implode('", "', array_keys($diff))), array_keys($diff));
}
}
Expand Down Expand Up @@ -117,7 +117,7 @@ protected function addOption($name, $value = null, array $allowedValues = array(
protected function addRequiredOption($name, array $allowedValues = array())
{
$this->knownOptions[$name] = true;
$this->requiredOptions[$name] = true;
$this->getRequiredOptions[$name] = true;

// only test if the option is set, otherwise an error will be thrown
// anyway
Expand Down
22 changes: 11 additions & 11 deletions src/Symfony/Component/Validator/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ abstract class Constraint
* existing properties in this class. The values should be the value for these
* properties.
*
* Alternatively you can override the method defaultOption() to return the
* Alternatively you can override the method getDefaultOption() to return the
* name of an existing property. If no associative array is passed, this
* property is set instead.
*
* You can force that certain options are set by overriding
* requiredOptions() to return the names of these options. If any
* getRequiredOptions() to return the names of these options. If any
* option is not set here, an exception is thrown.
*
* @param mixed $options The options (as associative array)
Expand All @@ -73,15 +73,15 @@ abstract class Constraint
* @throws InvalidOptionsException When you pass the names of non-existing
* options
* @throws MissingOptionsException When you don't pass any of the options
* returned by requiredOptions()
* returned by getRequiredOptions()
* @throws ConstraintDefinitionException When you don't pass an associative
* array, but defaultOption() returns
* array, but getDefaultOption() returns
* NULL
*/
public function __construct($options = null)
{
$invalidOptions = array();
$missingOptions = array_flip((array)$this->requiredOptions());
$missingOptions = array_flip((array)$this->getRequiredOptions());

if (is_array($options) && count($options) == 1 && isset($options['value'])) {
$options = $options['value'];
Expand All @@ -97,7 +97,7 @@ public function __construct($options = null)
}
}
} else if (null !== $options && ! (is_array($options) && count($options) === 0)) {
$option = $this->defaultOption();
$option = $this->getDefaultOption();

if (null === $option) {
throw new ConstraintDefinitionException(
Expand Down Expand Up @@ -158,7 +158,7 @@ public function addImplicitGroupName($group)
* @return string
* @see __construct()
*/
public function defaultOption()
public function getDefaultOption()
{
return null;
}
Expand All @@ -171,7 +171,7 @@ public function defaultOption()
* @return array
* @see __construct()
*/
public function requiredOptions()
public function getRequiredOptions()
{
return array();
}
Expand All @@ -187,7 +187,7 @@ public function requiredOptions()
*/
public function validatedBy()
{
return get_class($this) . 'Validator';
return get_class($this).'Validator';
}

/**
Expand All @@ -199,5 +199,5 @@ public function validatedBy()
*
* @return string|array One or more constant values
*/
abstract public function targets();
}
abstract public function getTargets();
}
6 changes: 3 additions & 3 deletions src/Symfony/Component/Validator/Constraints/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ class All extends \Symfony\Component\Validator\Constraint
{
public $constraints = array();

public function defaultOption()
public function getDefaultOption()
{
return 'constraints';
}

public function requiredOptions()
public function getRequiredOptions()
{
return array('constraints');
}

/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/Blank.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Blank extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Validator/Constraints/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ class Callback extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function requiredOptions()
public function getRequiredOptions()
{
return array('methods');
}

/**
* {@inheritDoc}
*/
public function defaultOption()
public function getDefaultOption()
{
return 'methods';
}

/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::CLASS_CONSTRAINT;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Validator/Constraints/Choice.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ class Choice extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function defaultOption()
public function getDefaultOption()
{
return 'choices';
}

/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Validator/Constraints/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class Collection extends \Symfony\Component\Validator\Constraint
public $extraFieldsMessage = 'The fields {{ fields }} were not expected';
public $missingFieldsMessage = 'The fields {{ fields }} are missing';

public function requiredOptions()
public function getRequiredOptions()
{
return array('fields');
}

/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Country extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Date extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DateTime extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Email extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/False.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class False extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class File extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/Ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct($options = null)
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Language extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/Constraints/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Locale extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Validator/Constraints/Max.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ class Max extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function defaultOption()
public function getDefaultOption()
{
return 'limit';
}

/**
* {@inheritDoc}
*/
public function requiredOptions()
public function getRequiredOptions()
{
return array('limit');
}

/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Validator/Constraints/MaxLength.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ class MaxLength extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function defaultOption()
public function getDefaultOption()
{
return 'limit';
}

/**
* {@inheritDoc}
*/
public function requiredOptions()
public function getRequiredOptions()
{
return array('limit');
}

/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Validator/Constraints/Min.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ class Min extends \Symfony\Component\Validator\Constraint
/**
* {@inheritDoc}
*/
public function defaultOption()
public function getDefaultOption()
{
return 'limit';
}

/**
* {@inheritDoc}
*/
public function requiredOptions()
public function getRequiredOptions()
{
return array('limit');
}

/**
* {@inheritDoc}
*/
public function targets()
public function getTargets()
{
return self::PROPERTY_CONSTRAINT;
}
Expand Down
Loading

0 comments on commit f92055c

Please sign in to comment.