This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Roofr\Proposal\Commands; | |
use Illuminate\Console\Command; | |
const PROPOSALTEAMIDENTIFIER = '@PRO-[1234,5678]'; | |
class NicDev extends Command | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Unlock a specific type of order. Unusually unlock after the confirm has been completed | |
* | |
* @param int $orderId Id of the object you unlock | |
* @return bool True on success | |
* @throws LockException | |
* @throws \Exception | |
*/ | |
public function unlock($orderId, $userId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function unlock($orderId, $userId) | |
{ | |
if (empty($this->type)) { | |
throw new LockException("Can not unlock the order: type is mandatory."); | |
} | |
if (empty($orderId)) { | |
throw new LockException("Can not unlock the order: no orderId was provided"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function unlock($orderId, $userId) | |
{ | |
$redis = $this->app['cache']; | |
if (empty($this->type) || empty($orderId) || !in_array($this->type, $this->availableType)) { | |
throw new LockException("Missing/Invalid parameters. Can't unlock for type: " . $this->type . " with id: " . $orderId); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (empty($result)) { | |
throw new LockException("This order wasn't locked. Can't unlock"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!empty($result)) { | |
/* multiple lines, including the reason to be of the function */ | |
} else { | |
throw new LockException("This order wasn't locked. Can't unlock"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function unlock($orderId, $userId) | |
{ | |
$redis = $this->app['cache']; | |
if (empty($this->type) || empty($orderId) || !in_array($this->type, $this->availableType)) { | |
throw new LockException("Missing/Invalid parameters. Can't unlock for type: " . $this->type . " with id: " . $orderId); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Unlock a specific type of order. Unusually unlock after the confirm has been completed | |
* | |
* @param int $orderId Id of the object you unlock | |
* @return bool True on success | |
* @throws LockException | |
* @throws \Exception | |
*/ | |
public function unlock($orderId, $userId) |