for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* Micro
*
* @author Raffael Sahli <[email protected]>
* @copyright Copryright (c) 2012-2017 gyselroth GmbH (https://gyselroth.com)
* @license GPLv3 https://opensource.org/licenses/GPL-3.0
*/
namespace Micro\Auth\Adapter;
use \Psr\Log\LoggerInterface as Logger;
use \Micro\Auth\Adapter\AdapterInterface;
abstract class AbstractAdapter implements AdapterInterface
{
* Identity
* @var string
protected $identifier;
* attribute sync cache
* @var int
protected $attr_sync_cache = 0;
* attribute map
* @var Iterable
protected $map = [];
* Ldap connect
* @param Iterable $config
* @param Logger $logger
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
public function __construct(?Iterable $config, Logger $logger)
$this->logger = $logger;
logger
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->setOptions($config);
}
* Get attribute sync cache
* @return int
public function getAttributeSyncCache(): int
return $this->attr_sync_cache;
* Set options
* @return AdapterInterface
public function setOptions(?Iterable $config=null): AdapterInterface
if ($config === null) {
return $this;
foreach ($config as $option => $value) {
switch ($option) {
case 'map':
$this->map = $value;
break;
case 'attr_sync_cache':
$this->attr_sync_cache = (int)$value;
* Get identifier
* @return string
public function getIdentifier(): string
return $this->identifier;
* Get attribute map
* @return Iterable
public function getAttributeMap(): Iterable
return $this->map;
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.