Twitter\Intents\Tweet::addRelated PHP Method

addRelated() public method

Add a related Twitter account
Since: 1.0.0
public addRelated ( string $username, string $label = '' ) : __CLASS__
$username string Twitter username
$label string brief description of how the account relates to the Tweet content
return __CLASS__ support chaining
    public function addRelated($username, $label = '')
    {
        $username = \Twitter\Helpers\Validators\ScreenName::trim($username);
        if ($username) {
            // normalize passed parameter
            $comparison_username = strtolower($username);
            if (!isset($this->related[$comparison_username])) {
                if ($this->validate_inputs) {
                    if (\Twitter\Helpers\Validators\ScreenName::isValid($username)) {
                        $this->related[$comparison_username] = trim($label);
                    }
                } else {
                    $this->related[$comparison_username] = trim($label);
                }
            }
        }
        return $this;
    }