<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/

#[\AllowDynamicProperties]
class Engine_Controller_Action extends Zend_Controller_Action
{
    // Session

    /**
     * Namespace unique to this controller
     *
     * @var Zend_Session_Namespace
     */
    protected $_session;

    /**
     * Gets a session namespace unique to this controller
     *
     * @return Zend_Session_Namespace
     */
    public function getSession()
    {
        if (is_null($this->_session)) {
            Engine_Loader::loadClass('Zend_Session_Namespace');
            $namespace = get_class($this);
            $this->_session = new Zend_Session_Namespace($namespace);
        }
        return $this->_session;
    }

    /**
     * Set the session namespace
     *
     * @param Zend_Session_Abstract $session
     * @return Engine_Controller_Action
     */
    public function setSession(Zend_Session_Abstract $session)
    {
        $this->_session = $session;
        return $this;
    }

    protected function _getParam($paramName, $default = null)
    {
        $value = $this->getRequest()->getParam($paramName);
        if ((null === $value) && (null !== $default)) {
            $value = $default;
        }

        return $value;
    }
}
