public function __construct(ApiCredentials $credentials, Country $country) { $credentials->getPropertyObject('webapiKey')->validate(); $this->properties = ['credentials' => new Property(['default' => $credentials, 'validator' => function ($val) { if (!$val instanceof ApiCredentials) { throw new ValidationException(); } }, 'lock' => true]), 'country' => new Property(['default' => $country, 'validator' => function ($val) { if (!$val instanceof Country) { throw new \Exception('Not instance of Country'); } }, 'lock' => true]), 'userId' => new Property([]), 'sessionId' => new Property([])]; }
<?php /** * hash_password.php * * @author Jan Chren <dev.rindeal AT outlook.com> * @copyright Copyright (c) 2015, Jan Chren. All Rights Reserved. * @license Please view the LICENSE file * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use Rindeal\Allegro\Client\ApiCredentials; require_once __DIR__ . '/../vendor/autoload.php'; echo 'Password: '; $pass = trim(fgets(STDIN)); printf("Hashed password: %s\n", ApiCredentials::hashPassword($pass));