YetiForceCompany/YetiForceCRM

View on GitHub
app/Conditions/RecordFields/AccountNameField.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php
/**
 * Account name record condition field file.
 *
 * @package UIType
 *
 * @copyright YetiForce S.A.
 * @license   YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
 * @author    Mariusz Krzaczkowski <m.krzaczkowski@yetiforce.com>
 */

namespace App\Conditions\RecordFields;

/**
 * Account name record condition field class.
 */
class AccountNameField extends BaseField
{
    /** {@inheritdoc} */
    public function getValue()
    {
        $recordValue = explode('|##|', parent::getValue());
        if (\count($recordValue) > 1) {
            $recordValue = trim("$recordValue[0] $recordValue[1]");
        } else {
            $recordValue = parent::getValue();
        }
        return $recordValue;
    }
}