Skip to content

Instantly share code, notes, and snippets.

View dersonsena's full-sized avatar

Kilderson Sena dersonsena

View GitHub Profile
<?php
namespace App;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
class CommandListener
{
/**
<?php
namespace GoSale\RabbitMQ;
abstract class HandlerAbstract implements HandlerInterface
{
/**
* @var array
*/
protected $payload;
<?php
class CreateAction extends Action
{
private function save(Product $model)
{
$bodyParams = Yii::$app->getRequest()->getBodyParams();
if (!isset($bodyParams['colors']) || empty($bodyParams['colors'])) {
<?php
namespace Tests\Unit\Domain\Auth;
use App\Domain\Auth\JWTHelper;
use App\Domain\Client\Client;
use App\Domain\Group;
use App\Domain\User\User;
use PHPUnit\Framework\TestCase;
<?php
namespace Tests\Unit\Domain\User\Behaviors;
use Yii;
use App\Domain\User\Behaviors\CryptPassword;
use App\Domain\User\User;
use yii\db\ActiveRecord;
use Tests\TestCase;
@dersonsena
dersonsena / CitiesAction.php
Created November 26, 2019 01:49
Repository Approach in Yii2
<?php
// https://gitlab.com/getto/go-sale/blob/develop/services/auth/src/Http/Location/CitiesAction.php
namespace App\Http\Location;
use Yii;
use App\Domain\Location\CityRepository;
use yii\base\Action;
@dersonsena
dersonsena / Api.js
Created November 29, 2019 18:51
Service Layer in React Project
// src/utils/services/Api.js
import Http from './Http'
/**
* @typedef {Api}
*/
export default class Api {
static base = '/v1';
<?php
class Xpto
{
public function addPoints($amount)
{
return $this->addOrRemovePoints($amount, 'add');
}
public function removePoints($amount)
{
<?php
namespace App\Domains\Auth\Forms;
use Yii;
use App\Domains\User\Entity\User;
use yii\base\Model;
/**
* LoginForm is the model behind the login form.
<?php
namespace App\Infra\DomainActions;
use App\Infra\ActiveRecord\ActiveRecordAbstract;
abstract class ActionsAbstract
{
/**
* @return string