Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
11 / 11
CRAP
100.00% covered (success)
100.00%
24 / 24
XMLStoredProcedure
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
11 / 11
12
100.00% covered (success)
100.00%
24 / 24
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 fromXML
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
9 / 9
 getName
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setName
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getModifies
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setModifies
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getResultType
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setResultType
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getXmlParameterList
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getStatement
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setStatement
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
<?php
declare(strict_types = 1);
namespace Siesta\XML;
/**
 * @author Gregor Müller
 */
class XMLStoredProcedure
{
    const ELEMENT_SP_NAME = "storedProcedure";
    const ELEMENT_SQL_NAME = "sql";
    const NAME = "name";
    const MODIFIES = "modifies";
    const RESULT_TYPE = "resultType";
    /**
     * @var string
     */
    protected $name;
    /**
     * @var bool
     */
    protected $modifies;
    /**
     * @var string
     */
    protected $resultType;
    /**
     * @var string
     */
    protected $statement;
    /**
     * @var XMLStoredProcedureParameter[]
     */
    protected $xmlParameterList;
    /**
     * XMLStoredProcedure constructor.
     */
    public function __construct()
    {
        $this->xmlParameterList = [];
    }
    /**
     * @param XMLAccess $xmlAccess
     */
    public function fromXML(XMLAccess $xmlAccess)
    {
        $this->setName($xmlAccess->getAttribute(self::NAME));
        $this->setModifies($xmlAccess->getAttributeAsBool(self::MODIFIES));
        $this->setResultType($xmlAccess->getAttribute(self::RESULT_TYPE));
        $this->setStatement($xmlAccess->getFirstChildByNameContent(self::ELEMENT_SQL_NAME));
        foreach ($xmlAccess->getXMLChildElementListByName(XMLStoredProcedureParameter::ELEMENT_PARAMETER_NAME) as $key => $xmlParameterAccess) {
            $xmlParameter = new XMLStoredProcedureParameter();
            $xmlParameter->fromXML($xmlParameterAccess);
            $this->xmlParameterList[] = $xmlParameter;
        }
    }
    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }
    /**
     * @return boolean
     */
    public function getModifies()
    {
        return $this->modifies;
    }
    /**
     * @param boolean $modifies
     */
    public function setModifies($modifies)
    {
        $this->modifies = $modifies;
    }
    /**
     * @return string
     */
    public function getResultType()
    {
        return $this->resultType;
    }
    /**
     * @param string $resultType
     */
    public function setResultType($resultType)
    {
        $this->resultType = $resultType;
    }
    /**
     * @return XMLStoredProcedureParameter[]
     */
    public function getXmlParameterList()
    {
        return $this->xmlParameterList;
    }
    /**
     * @return string
     */
    public function getStatement()
    {
        return $this->statement;
    }
    /**
     * @param string $statement
     */
    public function setStatement($statement)
    {
        $this->statement = $statement;
    }
}