Skip to content

Drupal\helper\File\ComposerFile

Helper for working with Drupal's Composer file.

Implements:

Stringable

Extend:

Drupal\helper\File\JsonFile

Methods

Name Description
exec Runs a composer command.

Inherited methods

Name Description
__construct File constructor.
__debugInfo -
__toString Returns the path to the file as a string
_bad_state_ex -
decodeData {@inheritdoc}
encodeData {@inheritdoc}
getATime Gets last access time of the file
getBasename Gets the base name of the file
getCTime Gets the inode change time
getExtension Gets the file extension
getFileInfo Gets an SplFileInfo object for the file
getFilename Gets the filename
getGroup Gets the file group
getInode Gets the inode for the file
getLinkTarget Gets the target of a link
getMTime Gets the last modified time
getOwner Gets the owner of the file
getPath Gets the path without filename
getPathInfo Gets an SplFileInfo object for the path
getPathname Gets the path to the file
getPerms Gets file permissions
getRealPath Gets absolute path to file
getSize Gets file size
getType Gets file type
isDir Tells if the file is a directory
isExecutable Tells if the file is executable
isFile Tells if the object references a regular file
isLink Tells if the file is a link
isReadable Tells if file is readable
isWritable Tells if the entry is writable
openFile Gets an SplFileObject object for the file
readData Gets contents of a file.
setFileClass Sets the class used with SplFileInfo::openFile
setInfoClass Sets the class used with SplFileInfo::getFileInfo and SplFileInfo::getPathInfo
validateReadable Validates that the directory is and file are readable.
validateWritable Validates that the directory and file are both writable.
writeData Writes contents to a file.

ComposerFile::exec

Description

public exec (string $command, mixed $result_code)

Runs a composer command.

Note: USE THIS AT YOUR OWN RISK. YOU ARE RESPONSIBLE FOR ESCAPING THE
INPUT TO THE $command PARAMETER.

Parameters

  • (string) $command :
    The composer command to run, without the "composer" part.
  • (mixed) $result_code :
    The result code from running the command, modified by reference.

Return Values

void

Throws Exceptions

\RuntimeException