apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Common

Source Location: /PHP_CodeSniffer-3.1.1/src/Util/Common.php

Class Overview


Basic util functions.


Author(s):

Copyright:

  • 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 15]
Basic util functions.


[ Top ]


Class Variables

$allowedTypes = array(
                                   'array',
                                   'boolean',
                                   'float',
                                   'integer',
                                   'mixed',
                                   'object',
                                   'string',
                                   'resource',
                                   'callable',
                                  )

[line 23]

An array of variable types for param/var we will check.
  • Access: public

Type:   string[]


[ Top ]



Method Detail

cleanSniffClass   [line 435]

string cleanSniffClass( string $sniffClass)

Removes project-specific information from a sniff class name.
  • Access: public

Parameters:

string   $sniffClass   —  The fully qualified sniff class name.

[ Top ]

detectLineEndings   [line 139]

string detectLineEndings( string $contents)

Detects the EOL character being used in a string.
  • Access: public

Parameters:

string   $contents   —  The contents to check.

[ Top ]

getSniffCode   [line 406]

string getSniffCode( string $sniffClass)

Given a sniff class name, returns the code for the sniff.
  • Access: public

Parameters:

string   $sniffClass   —  The fully qualified sniff class name.

[ Top ]

isCamelCaps   [line 222]

boolean isCamelCaps( string $string, [boolean $classFormat = false], [boolean $public = true], [boolean $strict = true])

Returns true if the specified string is in the camel caps format.
  • Access: public

Parameters:

string   $string   —  The string the verify.
boolean   $classFormat   —  If true, check to see if the string is in the class format. Class format strings must start with a capital letter and contain no underscores.
boolean   $public   —  If true, the first character in the string must be an a-z character. If false, the character must be an underscore. This argument is only applicable if $classFormat is false.
boolean   $strict   —  If true, the string must not have two capital letters next to each other. If false, a relaxed camel caps policy is used to allow for acronyms.

[ Top ]

isPharFile   [line 43]

mixed isPharFile( string $path)

Return TRUE if the path is a PHAR file.
  • Access: public

Parameters:

string   $path   —  The path to use.

[ Top ]

isUnderscoreName   [line 294]

boolean isUnderscoreName( string $string)

Returns true if the specified string is in the underscore caps format.
  • Access: public

Parameters:

string   $string   —  The string to verify.

[ Top ]

prepareForOutput   [line 165]

string prepareForOutput( string $content, [string[] $exclude = array()])

Prepares token content for output to screen.

Replaces invisible characters so they are visible. On non-Windows OSes it will also colour the invisible characters.

  • Access: public

Parameters:

string   $content   —  The content to prepare.
string[]   $exclude   —  A list of characters to leave invisible. Can contain \r, \n, \t and a space.

[ Top ]

realpath   [line 63]

mixed realpath( string $path)

CodeSniffer alternative for realpath.

Allows for PHAR support.

  • Access: public

Parameters:

string   $path   —  The path to use.

[ Top ]

stripBasepath   [line 111]

string stripBasepath( string $path, string $basepath)

Removes a base path from the front of a file path.
  • Access: public

Parameters:

string   $path   —  The path of the file.
string   $basepath   —  The base path to remove. This should not end with a directory separator.

[ Top ]

suggestType   [line 335]

string suggestType( string $varType)

Returns a valid variable type for param/var tag.

If type is not one of the standard type, it must be a custom type. Returns the correct type name suggestion if type name is invalid.

  • Access: public

Parameters:

string   $varType   —  The variable type to process.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:27:18 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.