<?php

namespace MusicBrainz\Value;

/**
 * An area
 */
class Area
{
    /**
     * The MusikBrainz Identifier for the area
     *
     * @var string
     */
    private $id;

    /**
     * The area name
     *
     * @var Name
     */
    private $name;

    /**
     * Sort index
     *
     * @var string
     */
    private $sortName;

    /**
     * Constructs an area.
     *
     * @param array $area Array of values
     */
    public function __construct(array $area = [])
    {
        $this->id       = isset($area['id']) ? (string) $area['id'] : '';
        $this->name     = new Name(isset($area['name']) ? (string) $area['name'] : '');
        $this->sortName = isset($area['sort-name']) ? (string) $area['sort-name'] : '';
    }

    /**
     * Returns the area name.
     *
     * @return string
     */
    public function __toString(): string
    {
        return (string) $this->name;
    }
}

<?php

namespace MusicBrainz\Value;

/**
 * An area
 */
class Area
{
    use Accessor\GetMBIDTrait;
    use Accessor\GetNameTrait;
    use Accessor\GetSortNameTrait;

    /**
     * Constructs an area.
     *
     * @param array $area Array of values
     */
    public function __construct(array $area = [])
    {
        $this->MBID     = new MBID(isset($area['id']) ? (string) $area['id'] : '');
        $this->name     = new Name(isset($area['name']) ? (string) $area['name'] : '');
        $this->sortName = isset($area['sort-name']) ? (string) $area['sort-name'] : '';
    }

    /**
     * Returns the area name.
     *
     * @return string
     */
    public function __toString(): string
    {
        return (string) $this->name;
    }
}

Use traits and MBID value in the model of an area.
Use traits and MBID value in the model of an area.
