<?php

namespace dgsoft\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for CompanyName StructType
 * @package Dg
 * @subpackage Structs
 */
class DgCompanyName extends DgCompanyNameType
{
    /**
     * The _
     * @var \dgsoft\StructType\DgCompanyNameType
     */
    public $_;
    /**
     * The ContactName
     * @var string
     */
    public $ContactName;
    /**
     * Constructor method for CompanyName
     * @uses DgCompanyName::set_()
     * @uses DgCompanyName::setContactName()
     * @param \dgsoft\StructType\DgCompanyNameType $_
     * @param string $contactName
     */
    public function __construct(\dgsoft\StructType\DgCompanyNameType $_ = null, $contactName = null)
    {
        $this
            ->set_($_)
            ->setContactName($contactName);
    }
    /**
     * Get _ value
     * @return \dgsoft\StructType\DgCompanyNameType|null
     */
    public function get_()
    {
        return $this->_;
    }
    /**
     * Set _ value
     * @param \dgsoft\StructType\DgCompanyNameType $_
     * @return \dgsoft\StructType\DgCompanyName
     */
    public function set_(\dgsoft\StructType\DgCompanyNameType $_ = null)
    {
        $this->_ = $_;
        return $this;
    }
    /**
     * Get ContactName value
     * @return string|null
     */
    public function getContactName()
    {
        return $this->ContactName;
    }
    /**
     * Set ContactName value
     * @param string $contactName
     * @return \dgsoft\StructType\DgCompanyName
     */
    public function setContactName($contactName = null)
    {
        // validation for constraint: string
        if (!is_null($contactName) && !is_string($contactName)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($contactName)), __LINE__);
        }
        $this->ContactName = $contactName;
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return \dgsoft\StructType\DgCompanyName
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
