[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Filesystem/ -> Patcher.php (summary)

Joomla! Content Management System

Copyright: (C) 2012 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 503 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Patcher:: (12 methods):
  __construct()
  getInstance()
  reset()
  apply()
  addFile()
  add()
  splitLines()
  findHeader()
  findHunk()
  applyHunk()
  getSource()
  getDestination()


Class: Patcher  - X-Ref

A Unified Diff Format Patcher class

__construct()   X-Ref
Constructor

The constructor is protected to force the use of FilesystemPatcher::getInstance()


getInstance()   X-Ref
Method to get a patcher

return: Patcher  an instance of the patcher

reset()   X-Ref
Reset the patcher

return: Patcher  This object for chaining

apply()   X-Ref
Apply the patches

return: integer  The number of files patched

addFile($filename, $root = JPATH_BASE, $strip = 0)   X-Ref
Add a unified diff file to the patcher

param: string   $filename  Path to the unified diff file
param: string   $root      The files root path
param: integer  $strip     The number of '/' to strip
return: Patcher  $this for chaining

add($udiff, $root = JPATH_BASE, $strip = 0)   X-Ref
Add a unified diff string to the patcher

param: string   $udiff  Unified diff input string
param: string   $root   The files root path
param: integer  $strip  The number of '/' to strip
return: Patcher  $this for chaining

splitLines($data)   X-Ref
Separate CR or CRLF lines

param: string  $data  Input string
return: array  The lines of the inputdestination file

findHeader(&$lines, &$src, &$dst)   X-Ref
Find the diff header

The internal array pointer of $lines is on the next line after the finding

param: array   $lines  The udiff array of lines
param: string  $src    The source file
param: string  $dst    The destination file
return: boolean  TRUE in case of success, FALSE in case of failure

findHunk(&$lines, &$srcLine, &$srcSize, &$dstLine, &$dstSize)   X-Ref
Find the next hunk of difference

The internal array pointer of $lines is on the next line after the finding

param: array   $lines    The udiff array of lines
param: string  $srcLine  The beginning of the patch for the source file
param: string  $srcSize  The size of the patch for the source file
param: string  $dstLine  The beginning of the patch for the destination file
param: string  $dstSize  The size of the patch for the destination file
return: boolean  TRUE in case of success, false in case of failure

applyHunk(&$lines, $src, $dst, $srcLine, $srcSize, $dstLine, $dstSize)   X-Ref
Apply the patch

param: array   $lines    The udiff array of lines
param: string  $src      The source file
param: string  $dst      The destination file
param: string  $srcLine  The beginning of the patch for the source file
param: string  $srcSize  The size of the patch for the source file
param: string  $dstLine  The beginning of the patch for the destination file
param: string  $dstSize  The size of the patch for the destination file
return: void

getSource($src)   X-Ref
Get the lines of a source file

param: string  $src  The path of a file
return: array  The lines of the source file

getDestination($dst, $src)   X-Ref
Get the lines of a destination file

param: string  $dst  The path of a destination file
param: string  $src  The path of a source file
return: array  The lines of the destination file



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer