<?php

namespace App\Model\Crates;


class BattleNetProfile
{
    /** @var array */
    protected $data;

    /**
     * BattleNetProfile constructor.
     * @param array $data
     */
    public function __construct(array $data)
    {
        $this->data = $data;
    }

    public function getProfileId()
    {
        return $this->data['id'];
    }

    public function getBattleTag()
    {
        return $this->data['battletag'];
    }

    public function extractNickname()
    {
        // remove unique number
        $split = explode('#', $this->getBattleTag());
        if (count($split) > 1) {
            array_pop($split);
        }

        return implode('#', $split);
    }

}