Flow2Lab/EventSourcing

View on GitHub
Classes/Flow2Lab/EventSourcing/Domain/Model/ObjectName.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
namespace Flow2Lab\EventSourcing\Domain\Model;

use TYPO3\Flow\Annotations as Flow;

/**
 *  Message Type
 */
class ObjectName
{

    /**
     * @var string
     */
    protected $name;

    /**
     * @param mixed $subject
     */
    public function __construct($subject)
    {
        $name = is_object($subject) ? get_class($subject) : (string)$subject;
        $this->name = str_replace('\\', '.', $name);
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return $this->name;
    }

    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

}