ChownOptions extends Options
Represents the available options for the Unix `chown` command.
This class provides a typed configuration object for building command-line arguments
used with the chown
command, such as recursive mode, verbose output,
dereferencing symbolic links, and ownership/group specifications.
Example:
$options = new ChownOptions
([
'recursive' => true ,
'verbose' => true ,
'group' => 'www-data' ,
'owner' => 'www-data' ,
'path' => '/var/www/html' ,
]);
echo (string) $options;
// --recursive --verbose
Tags
Table of Contents
Properties
- $from : string|null
- Restrict the operation to files owned by the specified owner:group.
- $group : string|null
- The group to assign to the file or directory.
- $noDereference : bool|null
- If true, do not dereference symbolic links when traversing directories.
- $owner : string|null
- The new owner (user) of the file or directory.
- $path : string|null
- The path to the file or directory to apply the ownership changes to.
- $recursive : bool|null
- Whether to operate recursively on directories and their contents.
- $reference : string|null
- Use the owner and group of the given reference file instead of specifying manually.
- $sudo : bool|null
- Indicates if the chown command must be executed with the sudo prefix.
- $verbose : bool|null
- Whether to output the names of processed files/directories.
Methods
- __toString() : string
- Converts this option set into a string representation of command-line arguments.
Properties
$from
Restrict the operation to files owned by the specified owner:group.
public
string|null
$from
= null
Example: "root:root"
Corresponds to: --from=USER:GROUP
$group
The group to assign to the file or directory.
public
string|null
$group
= null
$noDereference
If true, do not dereference symbolic links when traversing directories.
public
bool|null
$noDereference
= null
Corresponds to: --no-dereference
$owner
The new owner (user) of the file or directory.
public
string|null
$owner
= null
$path
The path to the file or directory to apply the ownership changes to.
public
string|null
$path
= null
This is usually the target of the chown
command.
$recursive
Whether to operate recursively on directories and their contents.
public
bool|null
$recursive
= null
Corresponds to: --recursive
or -R
$reference
Use the owner and group of the given reference file instead of specifying manually.
public
string|null
$reference
= null
Corresponds to: --reference=FILE
$sudo
Indicates if the chown command must be executed with the sudo prefix.
public
bool|null
$sudo
= null
$verbose
Whether to output the names of processed files/directories.
public
bool|null
$verbose
= null
Corresponds to: --verbose
or -v
Methods
__toString()
Converts this option set into a string representation of command-line arguments.
public
__toString() : string
Tags
Return values
string —A formatted string suitable for CLI usage.