testphase
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • Phramework
    • Exceptions
    • Testphase
      • Exceptions
    • Validate

Classes

  • Binary
  • Expression
  • Globals
  • Server
  • TestParser
  • Testphase
  • Util

Class Util

Various utility methods

Namespace: Phramework\Testphase
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Since: 1.0.0
Located at Util.php

Methods summary

public static boolean
# isJSON( string $string )

Check if given string is valid JSON string

Check if given string is valid JSON string

Parameters

$string

Returns

boolean

Note

In php 7.0 json_decode has errors when string is empty
public static string
# readableRandomString( integer $length = 8 )

Create a random readable word

Create a random readable word

Parameters

$length
[Optional] String's length

Returns

string

Link

Source
public static array
# directoryToArray( string $directory, boolean $recursive = false, boolean $listDirs = false, boolean $listFiles = true, string $exclude = '', array $allowedFileTypes = [], boolean $relativePath = false )

Get an array that represents directory tree

Get an array that represents directory tree

Parameters

$directory
Directory path
$recursive
[Optional] Include sub directories
$listDirs
[Optional] Include directories on listing
$listFiles
[Optional] Include files on listing
$exclude

[Optional] Exclude paths that matches this regular expression

$allowedFileTypes

[Optional] Allowed file extensions, default [] (allow all)

$relativePath

[Optional] Return paths in relative form, default false

Returns

array

Link

Source
public static array
# cartesian( array $input )

Cartesian product

Cartesian product

Parameters

$input
[description]

Returns

array
[description]

Example

$input = [
    'arm' => ['A', 'B'],
    'gender' => ['Female', 'Male']
];

print_r(Util::cartesian($input));

Source

http://stackoverflow.com/a/6313346/2255129
testphase API documentation generated by ApiGen