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

Commit aacf431

Browse files
committed
Merge remote-tracking branch 'zf2/master'
19 parents 46b66eb + 5dc451e + 6cc63be + 36c3273 + d866e82 + 826a0e1 + 5998122 + 34263bb + 73b49a3 + a7937fe + 18bc286 + 7c2f341 + 3fd24f6 + 91a7d10 + d7310a9 + 024435b + 9d596bf + 205ad91 + 827e841 commit aacf431

File tree

77 files changed

+495
-1485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+495
-1485
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis/run-tests.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

.travis/skipped-components

Lines changed: 0 additions & 7 deletions
This file was deleted.

.travis/tested-components

Lines changed: 0 additions & 61 deletions
This file was deleted.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zendframework/zend-ldap",
3-
"description": "Zend\\Ldap component",
3+
"description": "provides support for LDAP operations including but not limited to binding, searching and modifying entries in an LDAP directory",
44
"license": "BSD-3-Clause",
55
"keywords": [
66
"zf2",
@@ -9,11 +9,11 @@
99
"homepage": "https://github.com/zendframework/zend-ldap",
1010
"autoload": {
1111
"psr-4": {
12-
"Zend\\Ldap\\": "src/"
12+
"Zend\\Ldap": "src/"
1313
}
1414
},
1515
"require": {
16-
"php": ">=5.3.23",
16+
"php": ">=5.3.3",
1717
"ext-ldap": "*",
1818
"zendframework/zend-stdlib": "self.version"
1919
},

src/Attribute.php

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
<?php
22
/**
3-
* Zend Framework
3+
* Zend Framework (http://framework.zend.com/)
44
*
5-
* LICENSE
6-
*
7-
* This source file is subject to the new BSD license that is bundled
8-
* with this package in the file LICENSE.txt.
9-
* It is also available through the world-wide-web at this URL:
10-
* http://framework.zend.com/license/new-bsd
11-
* If you did not receive a copy of the license and are unable to
12-
* obtain it through the world-wide-web, please send an email
13-
* to license@zend.com so we can send you a copy immediately.
14-
*
15-
* @category Zend
16-
* @package Zend_Ldap
17-
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18-
* @license http://framework.zend.com/license/new-bsd New BSD License
5+
* @link http://github.com/zendframework/zf2 for the canonical source repository
6+
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7+
* @license http://framework.zend.com/license/new-bsd New BSD License
8+
* @package Zend_Ldap
199
*/
2010

2111
namespace Zend\Ldap;
@@ -27,8 +17,6 @@
2717
*
2818
* @category Zend
2919
* @package Zend_Ldap
30-
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
31-
* @license http://framework.zend.com/license/new-bsd New BSD License
3220
*/
3321
class Attribute
3422
{
@@ -58,7 +46,7 @@ public static function setAttribute(array &$data, $attribName, $value, $append =
5846
$valArray[] = $v;
5947
}
6048
}
61-
} else if ($value !== null) {
49+
} elseif ($value !== null) {
6250
$value = self::valueToLdap($value);
6351
if ($value !== null) {
6452
$valArray[] = $value;
@@ -95,10 +83,10 @@ public static function getAttribute(array $data, $attribName, $index = null)
9583
$retArray[] = self::valueFromLDAP($v);
9684
}
9785
return $retArray;
98-
} else if (is_int($index)) {
86+
} elseif (is_int($index)) {
9987
if (!isset($data[$attribName])) {
10088
return null;
101-
} else if ($index >= 0 && $index < count($data[$attribName])) {
89+
} elseif ($index >= 0 && $index < count($data[$attribName])) {
10290
return self::valueFromLDAP($data[$attribName][$index]);
10391
} else {
10492
return null;
@@ -260,7 +248,7 @@ public static function createPassword($password, $hashType = self::PASSWORD_HASH
260248
$password = '"' . $password . '"';
261249
if (function_exists('mb_convert_encoding')) {
262250
$password = mb_convert_encoding($password, 'UTF-16LE', 'UTF-8');
263-
} else if (function_exists('iconv')) {
251+
} elseif (function_exists('iconv')) {
264252
$password = iconv('UTF-8', 'UTF-16LE', $password);
265253
} else {
266254
$len = strlen($password);
@@ -375,7 +363,7 @@ private static function valueFromLdapDateTime($value)
375363
{
376364
if ($value instanceof DateTime) {
377365
return $value->format('U');
378-
} else if (is_string($value)) {
366+
} elseif (is_string($value)) {
379367
try {
380368
return Converter\Converter::fromLdapDateTime($value, false)->format('U');
381369
} catch (Converter\Exception\InvalidArgumentException $e) {

src/Collection.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
<?php
22
/**
3-
* Zend Framework
3+
* Zend Framework (http://framework.zend.com/)
44
*
5-
* LICENSE
6-
*
7-
* This source file is subject to the new BSD license that is bundled
8-
* with this package in the file LICENSE.txt.
9-
* It is also available through the world-wide-web at this URL:
10-
* http://framework.zend.com/license/new-bsd
11-
* If you did not receive a copy of the license and are unable to
12-
* obtain it through the world-wide-web, please send an email
13-
* to license@zend.com so we can send you a copy immediately.
14-
*
15-
* @category Zend
16-
* @package Zend_Ldap
17-
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18-
* @license http://framework.zend.com/license/new-bsd New BSD License
5+
* @link http://github.com/zendframework/zf2 for the canonical source repository
6+
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7+
* @license http://framework.zend.com/license/new-bsd New BSD License
8+
* @package Zend_Ldap
199
*/
2010

2111
namespace Zend\Ldap;
@@ -25,8 +15,6 @@
2515
*
2616
* @category Zend
2717
* @package Zend_Ldap
28-
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
29-
* @license http://framework.zend.com/license/new-bsd New BSD License
3018
*/
3119
class Collection implements \Iterator, \Countable
3220
{

src/Collection/DefaultIterator.php

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
<?php
22
/**
3-
* Zend Framework
3+
* Zend Framework (http://framework.zend.com/)
44
*
5-
* LICENSE
6-
*
7-
* This source file is subject to the new BSD license that is bundled
8-
* with this package in the file LICENSE.txt.
9-
* It is also available through the world-wide-web at this URL:
10-
* http://framework.zend.com/license/new-bsd
11-
* If you did not receive a copy of the license and are unable to
12-
* obtain it through the world-wide-web, please send an email
13-
* to license@zend.com so we can send you a copy immediately.
14-
*
15-
* @category Zend
16-
* @package Zend_Ldap
17-
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
18-
* @license http://framework.zend.com/license/new-bsd New BSD License
5+
* @link http://github.com/zendframework/zf2 for the canonical source repository
6+
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
7+
* @license http://framework.zend.com/license/new-bsd New BSD License
8+
* @package Zend_Ldap
199
*/
2010

2111
namespace Zend\Ldap\Collection;
@@ -29,8 +19,6 @@
2919
*
3020
* @category Zend
3121
* @package Zend_Ldap
32-
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33-
* @license http://framework.zend.com/license/new-bsd New BSD License
3422
*/
3523
class DefaultIterator implements \Iterator, \Countable
3624
{
@@ -140,7 +128,7 @@ public function setAttributeNameTreatment($attributeNameTreatment)
140128
if (is_callable($attributeNameTreatment)) {
141129
if (is_string($attributeNameTreatment) && !function_exists($attributeNameTreatment)) {
142130
$this->attributeNameTreatment = self::ATTRIBUTE_TO_LOWER;
143-
} else if (is_array($attributeNameTreatment)
131+
} elseif (is_array($attributeNameTreatment)
144132
&& !method_exists($attributeNameTreatment[0], $attributeNameTreatment[1])
145133
) {
146134
$this->attributeNameTreatment = self::ATTRIBUTE_TO_LOWER;
@@ -277,7 +265,7 @@ public function next()
277265
if ($code === Exception\LdapException::LDAP_SIZELIMIT_EXCEEDED) {
278266
// we have reached the size limit enforced by the server
279267
return;
280-
} else if ($code > Exception\LdapException::LDAP_SUCCESS) {
268+
} elseif ($code > Exception\LdapException::LDAP_SUCCESS) {
281269
throw new Exception\LdapException($this->ldap, 'getting next entry (' . $msg . ')');
282270
}
283271
}

src/Converter/Converter.php

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,23 @@
11
<?php
22
/**
3-
* Zend Framework
3+
* Zend Framework (http://framework.zend.com/)
44
*
5-
* LICENSE
6-
*
7-
* This source file is subject to the new BSD license that is bundled
8-
* with this package in the file LICENSE.txt.
9-
* It is also available through the world-wide-web at this URL:
10-
* http://framework.zend.com/license/new-bsd
11-
* If you did not receive a copy of the license and are unable to
12-
* obtain it through the world-wide-web, please send an email
13-
* to license@zend.com so we can send you a copy immediately.
14-
*
15-
* @category Zend
16-
* @package Zend_Ldap
5+
* @link http://github.com/zendframework/zf2 for the canonical source repository
176
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
187
* @license http://framework.zend.com/license/new-bsd New BSD License
8+
* @package Zend_Ldap
199
*/
2010

2111
namespace Zend\Ldap\Converter;
2212

2313
use DateTime;
2414
use DateTimeZone;
25-
use Zend\Date\Date;
2615

2716
/**
2817
* Zend\Ldap\Converter is a collection of useful LDAP related conversion functions.
2918
*
3019
* @category Zend
3120
* @package Zend_Ldap
32-
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
33-
* @license http://framework.zend.com/license/new-bsd New BSD License
3421
*/
3522
class Converter
3623
{
@@ -107,21 +94,19 @@ public static function toLdap($value, $type = self::STANDARD)
10794
default:
10895
if (is_string($value)) {
10996
return $value;
110-
} else if (is_int($value) || is_float($value)) {
97+
} elseif (is_int($value) || is_float($value)) {
11198
return (string)$value;
112-
} else if (is_bool($value)) {
99+
} elseif (is_bool($value)) {
113100
return self::toldapBoolean($value);
114-
} else if (is_object($value)) {
101+
} elseif (is_object($value)) {
115102
if ($value instanceof DateTime) {
116103
return self::toLdapDatetime($value);
117-
} else if ($value instanceof Date) {
118-
return self::toLdapDatetime($value);
119104
} else {
120105
return self::toLdapSerialize($value);
121106
}
122-
} else if (is_array($value)) {
107+
} elseif (is_array($value)) {
123108
return self::toLdapSerialize($value);
124-
} else if (is_resource($value) && get_resource_type($value) === 'stream') {
109+
} elseif (is_resource($value) && get_resource_type($value) === 'stream') {
125110
return stream_get_contents($value);
126111
} else {
127112
return null;
@@ -137,11 +122,10 @@ public static function toLdap($value, $type = self::STANDARD)
137122
* Converts a date-entity to an LDAP-compatible date-string
138123
*
139124
* The date-entity <var>$date</var> can be either a timestamp, a
140-
* DateTime Object, a string that is parseable by strtotime() or a Zend\Date\Date
141-
* Object.
125+
* DateTime Object, a string that is parseable by strtotime().
142126
*
143-
* @param integer|string|DateTime|Date $date The date-entity
144-
* @param boolean $asUtc Whether to return the LDAP-compatible date-string as UTC or as local value
127+
* @param integer|string|DateTime $date The date-entity
128+
* @param boolean $asUtc Whether to return the LDAP-compatible date-string as UTC or as local value
145129
* @return string
146130
* @throws Exception\InvalidArgumentException
147131
*/
@@ -151,10 +135,8 @@ public static function toLdapDateTime($date, $asUtc = true)
151135
if (is_int($date)) {
152136
$date = new DateTime('@' . $date);
153137
$date->setTimezone(new DateTimeZone(date_default_timezone_get()));
154-
} else if (is_string($date)) {
138+
} elseif (is_string($date)) {
155139
$date = new DateTime($date);
156-
} else if ($date instanceof Date) {
157-
$date = new DateTime($date->get(Date::ISO_8601));
158140
} else {
159141
throw new Exception\InvalidArgumentException('Parameter $date is not of the expected type');
160142
}
@@ -230,7 +212,7 @@ public static function fromLdap($value, $type = self::STANDARD, $dateTimeAsUtc =
230212
if (is_numeric($value)) {
231213
// prevent numeric values to be treated as date/time
232214
return $value;
233-
} else if ('TRUE' === $value || 'FALSE' === $value) {
215+
} elseif ('TRUE' === $value || 'FALSE' === $value) {
234216
return self::fromLdapBoolean($value);
235217
}
236218
if (preg_match('/^\d{4}[\d\+\-Z\.]*$/', $value)) {
@@ -384,7 +366,7 @@ public static function fromLdapBoolean($value)
384366
{
385367
if ('TRUE' === $value) {
386368
return true;
387-
} else if ('FALSE' === $value) {
369+
} elseif ('FALSE' === $value) {
388370
return false;
389371
} else {
390372
throw new Exception\InvalidArgumentException('The given value is not a boolean value');

0 commit comments

Comments
 (0)