2017 © Pedro Peláez
 

library fileworker

image

mdeschermeier/fileworker

  • Tuesday, June 6, 2017
  • by mdeschermeier
  • Repository
  • 1 Watchers
  • 1 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

mdeschermeier\FileWorker

A simple package for searching, renaming, deleting, reading, and writing .csv files., (*1)

  • Class name: FileWorker
  • Namespace: mdeschermeier\FileWorker

Methods

getCSVData

mixed FileWorker::getCSVData(string $filename, integer $max_line_size, string $delim)

Given a csv filename, parses the file and returns associative array of records with the header in the 'header' key of the returned array and a 2D array of records in the 'data' key., (*2)

  • Visibility: public
  • This method is static.

Arguments

  • $filename string
  • $max_line_size integer
  • $delim string

writeCSVData

boolean FileWorker::writeCSVData(array $data, string $filename, array $header, string $mode)

Given a 2D array of records, a filename (or path), and optionally an array of header fields, this function will write data to a csv formatted file., (*3)

Also optionally takes a file write mode setting., (*4)

  • Visibility: public
  • This method is static.

Arguments

  • $data array
  • $filename string
  • $header array
  • $mode string

deleteFile

boolean FileWorker::deleteFile(string $filename)

Simple wrapper for deleting files., (*5)

  • Visibility: public
  • This method is static.

Arguments

  • $filename string

findFilesByExt

mixed FileWorker::findFilesByExt(string $dir, string $filetypes, boolean $regex_passed)

File search utility by file extension. Supports regex matching via passing the pattern in through the second parameter, just be sure to flip $regex_passed to true if passing regex. Supplying just the first parameter returns all files found., (*6)

  • Visibility: public
  • This method is static.

Arguments

  • $dir string
  • $filetypes string
  • $regex_passed boolean

findFilesByName

mixed FileWorker::findFilesByName(string $dir, string $term, boolean $regex_passed)

File search utility by filename. Supports regex matching via passing the pattern in through the second parameter, just be sure to flip $regex_passed to true if passing regex. Supplying just the first parameter returns all files found., (*7)

  • Visibility: public
  • This method is static.

Arguments

  • $dir string
  • $term string
  • $regex_passed boolean

renameFile

mixed FileWorker::renameFile(string $original_name, string $new_name, string $parent_dir)

Simple wrapper for renaming files. Optional $parent_dir parameter for renaming files in non-local directories., (*8)

  • Visibility: public
  • This method is static.

Arguments

  • $original_name string
  • $new_name string
  • $parent_dir string

buildRegex

string FileWorker::buildRegex(string $term, boolean $regex_passed)

Compiles various search terms into regex patterns for use with public class methods. Returns a pattern that matches everything by default., (*9)

  • Visibility: private
  • This method is static.

Arguments

  • $term string
  • $regex_passed boolean

README.md generated with evert/phpdoc-md., (*10)

The Versions

06/06 2017

dev-master

9999999-dev

  Sources   Download

MIT

08/03 2017

v1.0

1.0.0.0

  Sources   Download

MIT

The Development Requires