PHP Classes

File: src/App/Databag/DatabagContext.php

Recommend this page to a friend!
  Packages of Thierry Feuzeu   Jaxon   src/App/Databag/DatabagContext.php   Download  
File: src/App/Databag/DatabagContext.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon
Call PHP classes from JavaScript using AJAX
Author: By
Last change:
Date: 1 year ago
Size: 1,122 bytes
 

 

Contents

Class file image Download
<?php

namespace Jaxon\App\Databag;

class DatabagContext
{
    /**
     * @var Databag
     */
    protected $xDatabag;

    /**
     * @var string
     */
    protected $sName;

    /**
     * The constructor
     *
     * @param Databag $xDatabag
     * @param string $sName
     */
    public function __construct(Databag $xDatabag, string $sName)
    {
        $this->xDatabag = $xDatabag;
        $this->sName = $sName;
    }

    /**
     * @param string $sKey
     * @param mixed $xValue
     *
     * @return void
     */
    public function set(string $sKey, $xValue): void
    {
        $this->xDatabag->set($this->sName, $sKey, $xValue);
    }

    /**
     * @param string $sKey
     * @param mixed $xValue
     *
     * @return void
     */
    public function new(string $sKey, $xValue): void
    {
        $this->xDatabag->new($this->sName, $sKey, $xValue);
    }

    /**
     * @param string $sKey
     * @param mixed $xValue
     *
     * @return mixed
     */
    public function get(string $sKey, $xValue = null): mixed
    {
        return $this->xDatabag->get($this->sName, $sKey, $xValue);
    }
}