utils

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NameToIdentifierRegexp = regexp.MustCompile("[^a-zA-Z0-9]")

Functions

func DefaultCacheDir

func DefaultCacheDir() string

func DefaultGraphsDir added in v0.3.0

func DefaultGraphsDir() string

func Exists added in v0.4.0

func Exists(path string) (bool, error)

func GenIndent

func GenIndent(level int) string

func IsEmbeddedConstant added in v0.3.0

func IsEmbeddedConstant(name string) bool

func IsSuperGlobal added in v0.3.0

func IsSuperGlobal(name string) bool

func NameToIdentifier

func NameToIdentifier(str string) string

func NormalizeSlashes

func NormalizeSlashes(str string) string

func OpenFile added in v0.3.0

func OpenFile(url string) error

func Percent added in v0.4.0

func Percent(x, y int64) float64

func ResolveRequirePath

func ResolveRequirePath(st *meta.ClassParseState, projectPath string, e ir.Node) (string, bool)

ResolveRequirePath resolves the path for the passed expression based on the project path and current state.

For the function to resolve the path correctly, the passed expression must be constant, otherwise, an empty string and a false flag will be returned.

Example:

require_once "./file.php";                     // Correct
require_once __DIR__ ."/file.php";             // Correct
require_once some_root(__DIR__) ."/file.php";  // Incorrect, some_root function is not constant

Note: For testing using package import, you need to take into account that the www folder is added to the path, so for all new tests, all test files must be placed in the www folder for golden tests, or the www folder must be added to the path for other tests for the imports to work correctly.

func Unquote added in v0.4.0

func Unquote(s string) string

Unquote returns unquoted version of s, if there are any quotes.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL