Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
vahid-sohrabloo committed Jul 5, 2012
10 parents 839d3b4 + 46b66eb + 5dc451e + 6cc63be + 36c3273 + d866e82 + 7c2f341 + 3fd24f6 + 91a7d10 + d7310a9 commit 024435b
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 104 deletions.
14 changes: 0 additions & 14 deletions .travis/run-tests.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .travis/skipped-components

This file was deleted.

61 changes: 0 additions & 61 deletions .travis/tested-components

This file was deleted.

12 changes: 3 additions & 9 deletions src/Converter/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

use DateTime;
use DateTimeZone;
use Zend\Date\Date;

/**
* Zend\Ldap\Converter is a collection of useful LDAP related conversion functions.
Expand Down Expand Up @@ -114,8 +113,6 @@ public static function toLdap($value, $type = self::STANDARD)
} else if (is_object($value)) {
if ($value instanceof DateTime) {
return self::toLdapDatetime($value);
} else if ($value instanceof Date) {
return self::toLdapDatetime($value);
} else {
return self::toLdapSerialize($value);
}
Expand All @@ -137,11 +134,10 @@ public static function toLdap($value, $type = self::STANDARD)
* Converts a date-entity to an LDAP-compatible date-string
*
* The date-entity <var>$date</var> can be either a timestamp, a
* DateTime Object, a string that is parseable by strtotime() or a Zend\Date\Date
* Object.
* DateTime Object, a string that is parseable by strtotime().
*
* @param integer|string|DateTime|Date $date The date-entity
* @param boolean $asUtc Whether to return the LDAP-compatible date-string as UTC or as local value
* @param integer|string|DateTime $date The date-entity
* @param boolean $asUtc Whether to return the LDAP-compatible date-string as UTC or as local value
* @return string
* @throws Exception\InvalidArgumentException
*/
Expand All @@ -153,8 +149,6 @@ public static function toLdapDateTime($date, $asUtc = true)
$date->setTimezone(new DateTimeZone(date_default_timezone_get()));
} else if (is_string($date)) {
$date = new DateTime($date);
} else if ($date instanceof Date) {
$date = new DateTime($date->get(Date::ISO_8601));
} else {
throw new Exception\InvalidArgumentException('Parameter $date is not of the expected type');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
use Zend\Ldap\Filter\Exception;

/**
* Zend\Ldap\Filter\LogicalFilter provides a base implementation for a grouping filter.
* Zend\Ldap\Filter\AbstractLogicalFilter provides a base implementation for a grouping filter.
*
* @category Zend
* @package Zend_Ldap
* @subpackage Filter
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class LogicalFilter extends AbstractFilter
abstract class AbstractLogicalFilter extends AbstractFilter
{
const TYPE_AND = '&';
const TYPE_OR = '|';
Expand Down Expand Up @@ -75,7 +75,7 @@ protected function __construct(array $subfilters, $symbol)
* Adds a filter to this grouping filter.
*
* @param AbstractFilter $filter
* @return LogicalFilter
* @return AbstractLogicalFilter
*/
public function addFilter(AbstractFilter $filter)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/AndFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class AndFilter extends LogicalFilter
class AndFilter extends AbstractLogicalFilter
{
/**
* Creates an 'and' grouping filter.
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/OrFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class OrFilter extends LogicalFilter
class OrFilter extends AbstractLogicalFilter
{
/**
* Creates an 'or' grouping filter.
Expand Down
5 changes: 2 additions & 3 deletions src/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace Zend\Ldap;

use Traversable;
use Zend\Stdlib\ArrayUtils;

/**
* @category Zend
Expand Down Expand Up @@ -216,7 +215,7 @@ public function getBoundUser()
* accountFilterFormat
* allowEmptyPassword
* useStartTls
* optRefferals
* optReferrals
* tryUsernameSplit
* networkTimeout
*
Expand All @@ -227,7 +226,7 @@ public function getBoundUser()
public function setOptions($options)
{
if ($options instanceof Traversable) {
$options = ArrayUtils::iteratorToArray($options);
$options = iterator_to_array($options);
}

$permittedOptions = array(
Expand Down
14 changes: 9 additions & 5 deletions test/Converter/ConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

use DateTime;
use DateTimeZone;
use Zend\Date\Date;
use Zend\Ldap\Converter\Converter;

/**
Expand Down Expand Up @@ -84,11 +83,11 @@ public function toLdapDateTimeProvider()
'utc' => false), '20100512131445+0300'),
array(array('date'=> '2010-05-12 13:14:45+0300',
'utc' => true), '20100512101445Z'),
array(array('date'=> new Date('2010-05-12T13:14:45+0300', Date::ISO_8601),
array(array('date'=> DateTime::createFromFormat(DateTime::ISO8601, '2010-05-12T13:14:45+0300'),
'utc' => true), '20100512101445Z'),
array(array('date'=> new Date('2010-05-12T13:14:45+0300', Date::ISO_8601),
array(array('date'=> DateTime::createFromFormat(DateTime::ISO8601, '2010-05-12T13:14:45+0300'),
'utc' => false), '20100512131445+0300'),
array(array('date'=> new Date('0', Date::TIMESTAMP),
array(array('date'=> date_timestamp_set(new DateTime(), 0),
'utc' => true), '19700101000000Z'),
);
}
Expand Down Expand Up @@ -153,7 +152,7 @@ public function toLdapProvider()
'type' => 0)),
array('FALSE', array('value'=> 0,
'type' => 1)),
array('19700101000000Z', array('value'=> new Date('1970-01-01T00:00:00+0000', Date::ISO_8601),
array('19700101000000Z', array('value'=> DateTime::createFromFormat(DateTime::ISO8601, '1970-01-01T00:00:00+0000'),
'type' => 0)),

);
Expand Down Expand Up @@ -192,6 +191,11 @@ public function testFromLdapBoolean()

/**
* @dataProvider fromLdapDateTimeProvider
*
* @param DateTime $expected
* @param string $convert
* @param boolean $utc
* @return void
*/
public function testFromLdapDateTime($expected, $convert, $utc)
{
Expand Down

0 comments on commit 024435b

Please sign in to comment.