-
Notifications
You must be signed in to change notification settings - Fork 136
Conversation
|
||
namespace Zend\Validator; | ||
|
||
final class GPSPoint extends AbstractValidator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is final
class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Link from @manuakasam in Comments below.
With my commits, the Code Coverage decreased. Is there a way i can also cover the private Methods to increase the CC? |
In regard of naming conventions this should be renamed to GpsPointValidator |
I think the suffix validator is needless because the word is already in the Namespace. Also all other Validators did not have this suffix. |
@zf2timo Sorry, I meant GpsPoint only. |
return false; | ||
} | ||
|
||
list($lat, $long) = explode(',', $value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the explode
have the third argument 2
to ensure no more than 2 values are returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weierophinney Yes, it's cleaner. But should i make this change, because it was already merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the change during merge, iirc.
On Jul 17, 2015 6:56 AM, "zf2timo" notifications@github.com wrote:
In src/GpsPoint.php
#18 (comment)
:
\* If $value fails validation, then this method returns false, and
\* getMessages() will return an array of messages that explain why the
\* validation failed.
*
\* @param mixed $value
\* @return bool
\* @throws Exception\RuntimeException If validation of $value is impossible
*/
- public function isValid($value)
- {
if (strpos($value, ',') === false) {
$this->error(GpsPoint::INCOMPLETE_COORDINATE, $value);
return false;
}
list($lat, $long) = explode(',', $value);
@weierophinney https://github.com/weierophinney Yes, it's cleaner. But
should i make this change, because it was already merged.—
Reply to this email directly or view it on GitHub
https://github.com/zendframework/zend-validator/pull/18/files#r34882834.
Merged to develop for release with 2.6.0 |
In this PR i want to introduce a new Validator, which validates GPS Coordinates. The requirements to the Validator are:
Basic Unit Tests are included.
Please Review the code and let me know your opinion.