VuFind API Documentation

Writer
in package

Class to update VuFind configuration settings

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Site

Table of Contents

$content  : string
Content of file
$filename  : string
Configuration file to write
__construct()  : mixed
Constructor
clear()  : void
Remove a setting (convenience wrapper around set to null).
getContent()  : string
Get the modified file's contents as a string.
save()  : bool
Save the modified file to disk. Return true on success, false on error.
set()  : void
Change/add a setting
buildContent()  : string
Write an ini file, adapted from http://php.net/manual/function.parse-ini-file.php
buildContentArrayLines()  : string
Support method for buildContent -- format an array into lines
buildContentLine()  : string
Support method for buildContent -- format a line
buildContentValue()  : string
Support method for buildContent -- format a value

Properties

$content

Content of file

protected string $content

$filename

Configuration file to write

protected string $filename

Methods

__construct()

Constructor

public __construct(string $filename[, string|array<string|int, mixed>|null $content = null ][, array<string|int, mixed> $comments = [] ]) : mixed
Parameters
$filename : string

Configuration file to write

$content : string|array<string|int, mixed>|null = null

Content to load into file (set to null to load contents of existing file specified by $filename; set to array to build string in combination with $comments; set to string to use raw config string)

$comments : array<string|int, mixed> = []

Comments to associate with content (ignored if $content is not an array).

Tags
throws
Exception
Return values
mixed

clear()

Remove a setting (convenience wrapper around set to null).

public clear(string $section, string $setting) : void
Parameters
$section : string

Section to change/add

$setting : string

Setting within section to change/add

Return values
void

getContent()

Get the modified file's contents as a string.

public getContent() : string
Return values
string

save()

Save the modified file to disk. Return true on success, false on error.

public save() : bool
Return values
bool

set()

Change/add a setting

public set(string $section, string $setting, string $value) : void
Parameters
$section : string

Section to change/add

$setting : string

Setting within section to change/add

$value : string

Value to set (or null to unset)

Return values
void

buildContent()

Write an ini file, adapted from http://php.net/manual/function.parse-ini-file.php

protected buildContent(array<string|int, mixed> $assoc_arr, array<string|int, mixed> $comments) : string
Parameters
$assoc_arr : array<string|int, mixed>

Array to output

$comments : array<string|int, mixed>

Comments to inject

Return values
string

buildContentArrayLines()

Support method for buildContent -- format an array into lines

protected buildContentArrayLines(string $key, array<string|int, mixed> $value) : string
Parameters
$key : string

Configuration key

$value : array<string|int, mixed>

Configuration value

Return values
string

Formatted line

buildContentLine()

Support method for buildContent -- format a line

protected buildContentLine(string $key, mixed $value[, int $tab = 17 ]) : string
Parameters
$key : string

Configuration key

$value : mixed

Configuration value

$tab : int = 17

Tab size to help values line up

Return values
string

Formatted line

buildContentValue()

Support method for buildContent -- format a value

protected buildContentValue(mixed $e) : string
Parameters
$e : mixed

Value to format

Return values
string

Value formatted for output to ini file.

Search results