Giter Site home page Giter Site logo

domain-driven-design's Issues

Add raisedBy to Event Interface

Currently we are depending on the data() method of the Event interface to learn who raised the event. Maybe it's time to learn about the accountability in the raisedBy() method.

Add FileAttachingEntity Trait

<?php
/**
 * Created by PhpStorm.
 * User: ericksonreyes
 * Date: 2019-09-11
 * Time: 14:55
 */

namespace EricksonReyes\DomainDrivenDesign;


trait FileAttachingEntity
{
    /**
     * @var array
     */
    private $attachments = [];


    /**
     * @return array
     */
    public function attachments(): array
    {
        return $this->attachments;
    }

    /**
     * @param string $attachmentId
     * @param string $fileName
     * @param string $fileType
     * @param string $fileSize
     * @param string $fileLocation
     * @param string $fileContent
     */
    protected function attachFile(
        string $attachmentId,
        string $fileName,
        string $fileType,
        string $fileSize,
        string $fileLocation,
        string $fileContent
    ): void
    {
        $this->attachments[$attachmentId] = [
            'id' => $attachmentId,
            'fileName' => $fileName,
            'fileType' => $fileType,
            'fileSize' => $fileSize,
            'fileLocation' => $fileLocation,
            'fileContent' => $fileContent
        ];
    }

    /**
     * @param string $attachmentId
     */
    protected function detachFile(string $attachmentId): void
    {
        if (array_key_exists($attachmentId, $this->attachments())) {
            unset($this->attachments[$attachmentId]);
        }
    }
}

Implement isEmpty() and isNotEmpty() to String Value Object

Create interfaces CanBeEmpty and CannotBeEmpty interfaces inside the Common/Attributes namespace.

interface CanBeEmpty
{
    /**
     * @return bool
     */
    public function isEmpty(): bool;
}

and

interface CannotBeEmpty
{
    /**
     * @return bool
     */
    public function isNotEmpty(): bool;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.