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

Commit

Permalink
allow null in setAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jan 17, 2016
1 parent 5925576 commit 5008575
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Barcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ class Barcode extends AbstractValidator
*/
public function __construct($options = null)
{
if ($options === null) {
$options['options']['adapter'] = $this->getAdapter();
}

if (!is_array($options) && !($options instanceof Traversable)) {
$options = ['adapter' => $options];
}
Expand Down Expand Up @@ -80,13 +76,17 @@ public function getAdapter()
/**
* Sets a new barcode adapter
*
* @param string|Barcode\AbstractAdapter $adapter Barcode adapter to use
* @param string|Barcode\AbstractAdapter|null $adapter Barcode adapter to use
* @param array $options Options for this adapter
* @return Barcode
* @throws Exception\InvalidArgumentException
*/
public function setAdapter($adapter, $options = null)
public function setAdapter($adapter = null, $options = null)
{
if ($adapter === null) {
$adapter = $this->getAdapter();
}

if (is_string($adapter)) {
$adapter = ucfirst(strtolower($adapter));
$adapter = 'Zend\\Validator\\Barcode\\' . $adapter;
Expand Down

0 comments on commit 5008575

Please # to comment.