ConfigParser/NoSectionsConfigParser.php
- author
- Vítor Brandão <noisebleed@noiselabs.org>
- category
- NoiseLabs
- copyright
- (C) 2011 Vítor Brandão <noisebleed@noiselabs.org>
- package
- ConfigParser
- version
- 0.1.1
- Classes
- NoSectionsConfigParser
Description
This file is part of NoiseLabs-PHP-ToolKit
NoiseLabs-PHP-ToolKit is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
NoiseLabs-PHP-ToolKit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with NoiseLabs-PHP-ToolKit; if not, see http://www.gnu.org/licenses/.
Copyright (C) 2011 Vítor Brandão noisebleed@noiselabs.org
NoiseLabs\ToolKit\ConfigParser\NoSectionsConfigParser
- Extends from
- NoiseLabs\ToolKit\ConfigParser\BaseConfigParser
- Implements
- NoiseLabs\ToolKit\ConfigParser\NoSectionsConfigParserInterface
- author
- Vítor Brandão <noisebleed@noiselabs.org>
- Constants
- HAS_SECTIONS
- Methods
- options
- hasOption
- get
- getInt
- getFloat
- getBoolean
- _buildOutputString
Description
This class is a version of the ConfigParser class meant to be used for configuration files that don't have sections.
Constants
Methods
_buildOutputString
_buildOutputString(
)
:
Details
- visibility
- public
- final
- false
- static
- false
get
get(
NoiseLabs\ToolKit\ConfigParser\$option $option, NoiseLabs\ToolKit\ConfigParser\$fallback $fallback
=
null
)
:
NoiseLabs\ToolKit\ConfigParser\Option
Get an option value for the named section.
If the option doesn't exist in the configuration $defaults is used. If $defaults doesn't have this option too then we look for the $fallback parameter. If everything fails throw a NoOptionException.
Arguments
- $option
- NoiseLabs\ToolKit\ConfigParser\$option
Option name - $fallback
- NoiseLabs\ToolKit\ConfigParser\$fallback
A fallback value to use if the option isn't found in the configuration.
Output
- NoiseLabs\ToolKit\ConfigParser\Option
- value (if available)
Details
- visibility
- public
- final
- false
- static
- false
- throws
- Couldn't find the desired option in the configuration or as a fallback value.
getBoolean
getBoolean(
$option, $fallback
=
null
)
:
A convenience method which coerces the option value to a Boolean value.
Note that the accepted values for the option are '1', 'yes', 'true', and 'on', which cause this method to return TRUE, and '0', 'no', 'false', and 'off', which cause it to return FALSE. These string values are checked in a case-insensitive manner. Any other value will cause it to raise ValueException.
Arguments
- $option
- $fallback
Details
- visibility
- public
- final
- false
- static
- false
getFloat
getFloat(
$option, $fallback
=
null
)
:
A convenience method which coerces the option value to a floating point number.
Arguments
- $option
- $fallback
Details
- visibility
- public
- final
- false
- static
- false
getInt
getInt(
$option, $fallback
=
null
)
:
A convenience method which coerces the option value to an integer.
Arguments
- $option
- $fallback
Details
- visibility
- public
- final
- false
- static
- false
hasOption
hasOption(
$option
)
:
If the given option exists, return TRUE; otherwise return FALSE.
Arguments
- $option
Details
- visibility
- public
- final
- false
- static
- false
options
options(
)
:
Return a list of options available
Details
- visibility
- public
- final
- false
- static
- false