PHP Class Nwidart\Modules\Json

Afficher le fichier Open project: nwidart/laravel-modules Class Usage Examples

Protected Properties

Свойство Type Description
$attributes Illuminate\Support\Collection The attributes collection.
$filesystem Illuminate\Filesystem\Filesystem The laravel filesystem instance.
$path string The file path.

Méthodes publiques

Méthode Description
__call ( string $method, array $arguments = [] ) : mixed Handle call to __call method.
__construct ( mixed $path, Illuminate\Filesystem\Filesystem $filesystem = null ) The constructor.
__get ( string $key ) : mixed Handle magic method __get.
__toString ( ) : string Handle call to __toString method.
get ( $key, null $default = null ) : mixed Get the specified attribute from json file.
getAttributes ( ) : array Get file contents as array.
getContents ( ) : string Get file content.
getFilesystem ( ) : Illuminate\Filesystem\Filesystem Get filesystem.
getPath ( ) : string Get path.
make ( string $path, Illuminate\Filesystem\Filesystem $filesystem = null ) : static Make new instance.
save ( ) : boolean Save the current attributes array to the file storage.
set ( string $key, mixed $value ) Set a specific key & value.
setFilesystem ( Illuminate\Filesystem\Filesystem $filesystem ) Set filesystem.
setPath ( mixed $path ) Set path.
toJsonPretty ( array $data = null ) : string Convert the given array data to pretty json.
update ( array $data ) : boolean Update json contents from array data.

Method Details

__call() public méthode

Handle call to __call method.
public __call ( string $method, array $arguments = [] ) : mixed
$method string
$arguments array
Résultat mixed

__construct() public méthode

The constructor.
public __construct ( mixed $path, Illuminate\Filesystem\Filesystem $filesystem = null )
$path mixed
$filesystem Illuminate\Filesystem\Filesystem

__get() public méthode

Handle magic method __get.
public __get ( string $key ) : mixed
$key string
Résultat mixed

__toString() public méthode

Handle call to __toString method.
public __toString ( ) : string
Résultat string

get() public méthode

Get the specified attribute from json file.
public get ( $key, null $default = null ) : mixed
$key
$default null
Résultat mixed

getAttributes() public méthode

Get file contents as array.
public getAttributes ( ) : array
Résultat array

getContents() public méthode

Get file content.
public getContents ( ) : string
Résultat string

getFilesystem() public méthode

Get filesystem.
public getFilesystem ( ) : Illuminate\Filesystem\Filesystem
Résultat Illuminate\Filesystem\Filesystem

getPath() public méthode

Get path.
public getPath ( ) : string
Résultat string

make() public static méthode

Make new instance.
public static make ( string $path, Illuminate\Filesystem\Filesystem $filesystem = null ) : static
$path string
$filesystem Illuminate\Filesystem\Filesystem
Résultat static

save() public méthode

Save the current attributes array to the file storage.
public save ( ) : boolean
Résultat boolean

set() public méthode

Set a specific key & value.
public set ( string $key, mixed $value )
$key string
$value mixed

setFilesystem() public méthode

Set filesystem.
public setFilesystem ( Illuminate\Filesystem\Filesystem $filesystem )
$filesystem Illuminate\Filesystem\Filesystem

setPath() public méthode

Set path.
public setPath ( mixed $path )
$path mixed

toJsonPretty() public méthode

Convert the given array data to pretty json.
public toJsonPretty ( array $data = null ) : string
$data array
Résultat string

update() public méthode

Update json contents from array data.
public update ( array $data ) : boolean
$data array
Résultat boolean

Property Details

$attributes protected_oe property

The attributes collection.
protected Collection,Illuminate\Support $attributes
Résultat Illuminate\Support\Collection

$filesystem protected_oe property

The laravel filesystem instance.
protected Filesystem,Illuminate\Filesystem $filesystem
Résultat Illuminate\Filesystem\Filesystem

$path protected_oe property

The file path.
protected string $path
Résultat string