File: docs/_sources/api/atk4/core/ConfigTrait.rst.txt

Recommend this page to a friend!
  Classes of Francesco Danti  >  ATK4 i18next PHP  >  docs/_sources/api/atk4/core/ConfigTrait.rst.txt  >  Download  
File: docs/_sources/api/atk4/core/ConfigTrait.rst.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: ATK4 i18next PHP
Translate application texts like il8next-PHP
Author: By
Last change:
Date: 1 year ago
Size: 3,759 bytes


Class file image Download
.. rst-class:: phpdoctorst

.. role:: php(code)
	:language: php


.. php:namespace:: atk4\core

.. php:trait:: ConfigTrait

	.. rst-class:: phpdoc-description
		| This trait makes it possible for you to read config files and various configurations
		| use:
		| 1\. use Trait in your APP Class
		|    use \\atk4\\core\\ConfigTrait;
		| 2\. create config\-default\.php and/or config\.php file and add config values like
		|    $config\[\'key\'\] = \'value\';
		| 3\. call $this\-\>readConfig\(\);
		|    before using config\.
		`vendor/atk4/core/src/ConfigTrait.php#15 <>`_


.. php:attr:: public static _configTrait

	.. rst-class:: phpdoc-description
		| Check this property to see if trait is present in the object\.
		`vendor/atk4/core/src/ConfigTrait.php#22 <>`_
	:Type: bool 

.. php:attr:: protected static config

	.. rst-class:: phpdoc-description
		| This property stores config values\. Use getConfig\(\) method to access its values\.
		`vendor/atk4/core/src/ConfigTrait.php#29 <>`_
	:Type: array 


.. rst-class:: public

	.. php:method:: public readConfig( $files=\[config\.php\], $format=php)
		.. rst-class:: phpdoc-description
			| Read config file or files and store it in $config property\.
			| Supported formats:
			| php         \- PHP file with $config\[\'foo\'\] = \'bar\' structure
			| php\-inline  \- PHP file with return \[\'foo\' =\> \'bar\'\] structure
			| json        \- JSON file with \{\'foo\':\'bar\'\} structure
			| yaml        \- YAML file with yaml structure
			`vendor/atk4/core/src/ConfigTrait.php#47 <>`_
			* **$files** (string | array)  One or more filenames
			* **$format** (string)  Optional format for config files

		:Throws: :any:`\\atk4\\core\\Exception <atk4\\core\\Exception>` 
		:Returns: $this 

.. rst-class:: public

	.. php:method:: public setConfig( $paths=\[\], $value=null)
		.. rst-class:: phpdoc-description
			| Manually set configuration option\.
			`vendor/atk4/core/src/ConfigTrait.php#107 <>`_
			* **$paths** (string | array)  Path to configuration element to set or array of [path=>value]
			* **$value** (mixed)  Value to set

		:Returns: $this 

.. rst-class:: public

	.. php:method:: public getConfig( $path, $default_value=null)
		.. rst-class:: phpdoc-description
			| Get configuration element\.
			`vendor/atk4/core/src/ConfigTrait.php#136 <>`_
			* **$path** (string)  Path to configuration element.
			* **$default_value** (mixed)  Default value returned if element don't exist

		:Returns: mixed 

.. rst-class:: protected

	.. php:method:: protected _lookupConfigElement( $path, $create_elements=false)
		.. rst-class:: phpdoc-description
			| Internal method to lookup config element by given path\.
			`vendor/atk4/core/src/ConfigTrait.php#157 <>`_
			* **$path** (string)  Path to navigate to
			* **$create_elements** (bool)  Should we create elements it they don't exist


For more information send a message to info at phpclasses dot org.