LFT
  • Namespace
  • Class
  • Tree

Namespaces

  • Docoflow
    • Contracts
    • Entity
    • Facades
    • Models
    • Traits
  • Docolight
    • Agno
      • Traits
    • Container
    • Http
      • Contracts
    • Rest
      • Handler
      • Http
    • Support
      • Debug
      • Traits
  • Docotory
    • Traits
  • None

Classes

  • Docoflow\Docoflow
  • Docoflow\Entity\Group
  • Docoflow\Entity\Step
  • Docoflow\Entity\Verificator
  • Docoflow\Facades\Action
  • Docoflow\Facades\Activity
  • Docoflow\Facades\Flo
  • Docoflow\Facades\StateActivity
  • Docoflow\Flo
  • Docoflow\Models\Workflow
  • Docoflow\Models\WorkflowAction
  • Docoflow\Models\WorkflowActivity
  • Docoflow\Models\WorkflowGroups
  • Docoflow\Models\WorkflowNotification
  • Docoflow\Models\WorkflowState
  • Docoflow\Models\WorkflowStateActivity
  • Docoflow\Models\WorkflowStep
  • Docoflow\Models\WorkflowVerificator
  • Docolight
  • Docolight\Agno\AgnoModule
  • Docolight\Container\Container
  • Docolight\Http\Headers
  • Docolight\Http\JsonResponse
  • Docolight\Http\MimeResponse
  • Docolight\Http\Response
  • Docolight\Http\ResponseFactory
  • Docolight\Rest\Handler\RestfulErrorHandler
  • Docolight\Rest\Http\RestFulController
  • Docolight\Support\ActiveRecordWrapper
  • Docolight\Support\Arr
  • Docolight\Support\Carbonate
  • Docolight\Support\ClassLoader
  • Docolight\Support\Collection
  • Docolight\Support\CollectionDataProvider
  • Docolight\Support\Debug\Dumper
  • Docolight\Support\Debug\HtmlDumper
  • Docolight\Support\Facade
  • Docolight\Support\Factory
  • Docolight\Support\Fluent
  • Docolight\Support\Html
  • Docolight\Support\IterablePager
  • Docolight\Support\Repository
  • Docolight\Support\Set
  • Docolight\Support\Str
  • Docotory\Factory

Interfaces

  • Docoflow\Contracts\DocoflowContract
  • Docoflow\Contracts\ValidationStatus
  • Docolight\Http\Contracts\Arrayable

Traits

  • Docoflow\Traits\BulkValidator
  • Docoflow\Traits\Entity
  • Docoflow\Traits\HasMutator
  • Docoflow\Traits\Validable
  • Docolight\Agno\Traits\HasAssetsUrl
  • Docolight\Agno\Traits\HasAutoload
  • Docolight\Support\Traits\Macroable
  • Docotory\Traits\HasFactories

Exceptions

  • Docolight\Container\BindingResolutionException
  • Docotory\ResolvingTypeException

Functions

  • array_add
  • array_build
  • array_collapse
  • array_divide
  • array_dot
  • array_except
  • array_first
  • array_flatten
  • array_forget
  • array_get
  • array_has
  • array_last
  • array_only
  • array_pluck
  • array_pull
  • array_replace_value
  • array_set
  • array_sort
  • array_sort_recursive
  • array_where
  • cache
  • camel_case
  • class_basename
  • class_uses_recursive
  • collect
  • container
  • data_get
  • dd
  • def
  • dump
  • e
  • ends_with
  • fluent
  • get
  • head
  • input
  • last
  • object_get
  • preg_replace_sub
  • request
  • response
  • session
  • snake_case
  • starts_with
  • str_contains
  • str_finish
  • str_is
  • str_limit
  • str_random
  • str_replace_array
  • str_slug
  • studly_case
  • title_case
  • trait_uses_recursive
  • transaction
  • trimtolower
  • value
  • with
  1 <?php
  2 
  3 namespace Docolight\Support;
  4 
  5 use ArrayAccess;
  6 
  7 /**
  8  * A class to access your items in dot notation.
  9  *
 10  * @author Krisan Alfa Timur <krisanalfa@docotel.co.id>
 11  */
 12 class Repository implements ArrayAccess
 13 {
 14     /**
 15      * All of the configuration items.
 16      *
 17      * @var array
 18      */
 19     protected $items = [];
 20 
 21     /**
 22      * Create a new configuration repository.
 23      *
 24      * @param array $items
 25      */
 26     public function __construct(array $items = array())
 27     {
 28         $this->items = $items;
 29     }
 30 
 31     /**
 32      * Determine if the given configuration value exists.
 33      *
 34      * @param string $key
 35      *
 36      * @return bool
 37      */
 38     public function has($key)
 39     {
 40         return array_has($this->items, $key);
 41     }
 42 
 43     /**
 44      * Get the specified configuration value.
 45      *
 46      * @param string $key
 47      * @param mixed  $default
 48      *
 49      * @return mixed
 50      */
 51     public function get($key, $default = null)
 52     {
 53         return array_get($this->items, $key, $default);
 54     }
 55 
 56     /**
 57      * Set a given configuration value.
 58      *
 59      * @param array|string $key
 60      * @param mixed        $value
 61      */
 62     public function set($key, $value = null)
 63     {
 64         if (is_array($key)) {
 65             foreach ($key as $innerKey => $innerValue) {
 66                 array_set($this->items, $innerKey, $innerValue);
 67             }
 68         } else {
 69             array_set($this->items, $key, $value);
 70         }
 71     }
 72 
 73     /**
 74      * Prepend a value onto an array configuration value.
 75      *
 76      * @param string $key
 77      * @param mixed  $value
 78      */
 79     public function prepend($key, $value)
 80     {
 81         $array = $this->get($key);
 82 
 83         array_unshift($array, $value);
 84 
 85         $this->set($key, $array);
 86     }
 87 
 88     /**
 89      * Push a value onto an array configuration value.
 90      *
 91      * @param string $key
 92      * @param mixed  $value
 93      */
 94     public function push($key, $value)
 95     {
 96         $array = $this->get($key);
 97 
 98         $array[] = $value;
 99 
100         $this->set($key, $array);
101     }
102 
103     /**
104      * Get all of the configuration items for the application.
105      *
106      * @return array
107      */
108     public function all()
109     {
110         return $this->items;
111     }
112 
113     /**
114      * Determine if the given configuration option exists.
115      *
116      * @param string $key
117      *
118      * @return bool
119      */
120     public function offsetExists($key)
121     {
122         return $this->has($key);
123     }
124 
125     /**
126      * Get a configuration option.
127      *
128      * @param string $key
129      *
130      * @return mixed
131      */
132     public function offsetGet($key)
133     {
134         return $this->get($key);
135     }
136 
137     /**
138      * Set a configuration option.
139      *
140      * @param string $key
141      * @param mixed  $value
142      */
143     public function offsetSet($key, $value)
144     {
145         $this->set($key, $value);
146     }
147 
148     /**
149      * Unset a configuration option.
150      *
151      * @param string $key
152      */
153     public function offsetUnset($key)
154     {
155         $this->set($key, null);
156     }
157 }
158 
LFT API documentation generated by ApiGen