idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
57,100
static public function subclassOf ( $ value , $ className , $ message = null , $ propertyPath = null ) { if ( ! is_subclass_of ( $ value , $ className ) ) { $ message = $ message ? : sprintf ( 'Class "%s" was expected to be subclass of "%s".' , static :: stringify ( $ value ) , $ className ) ; throw static :: createExc...
Assert that value is subclass of given class - name .
57,101
static public function range ( $ value , $ minValue , $ maxValue , $ message = null , $ propertyPath = null ) { static :: integer ( $ value ) ; if ( $ value < $ minValue || $ value > $ maxValue ) { $ message = $ message ? : sprintf ( 'Number "%s" was expected to be at least "%d" and at most "%d".' , static :: stringify...
Assert that value is in range of integers .
57,102
static public function min ( $ value , $ minValue , $ message = null , $ propertyPath = null ) { static :: integer ( $ value ) ; if ( $ value < $ minValue ) { $ message = $ message ? : sprintf ( 'Number "%s" was expected to be at least "%d".' , static :: stringify ( $ value ) , static :: stringify ( $ minValue ) ) ; th...
Assert that a value is at least as big as a given limit
57,103
static public function max ( $ value , $ maxValue , $ message = null , $ propertyPath = null ) { static :: integer ( $ value ) ; if ( $ value > $ maxValue ) { $ message = $ message ? : sprintf ( 'Number "%s" was expected to be at most "%d".' , static :: stringify ( $ value ) , static :: stringify ( $ maxValue ) ) ; thr...
Assert that a number is smaller as a given limit
57,104
static public function file ( $ value , $ message = null , $ propertyPath = null ) { static :: string ( $ value , $ message ) ; static :: notEmpty ( $ value , $ message ) ; if ( ! is_file ( $ value ) ) { $ message = $ message ? : sprintf ( 'File "%s" was expected to exist.' , static :: stringify ( $ value ) ) ; throw s...
Assert that a file exists
57,105
static public function directory ( $ value , $ message = null , $ propertyPath = null ) { static :: string ( $ value , $ message ) ; if ( ! is_dir ( $ value ) ) { $ message = $ message ? : sprintf ( 'Path "%s" was expected to be a directory.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ val...
Assert that a directory exists
57,106
static public function readable ( $ value , $ message = null , $ propertyPath = null ) { static :: string ( $ value , $ message ) ; if ( ! is_readable ( $ value ) ) { $ message = $ message ? : sprintf ( 'Path "%s" was expected to be readable.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ va...
Assert that the value is something readable
57,107
static public function writeable ( $ value , $ message = null , $ propertyPath = null ) { static :: string ( $ value , $ message ) ; if ( ! is_writeable ( $ value ) ) { $ message = $ message ? : sprintf ( 'Path "%s" was expected to be writeable.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $...
Assert that the value is something writeable
57,108
static public function url ( $ value , $ message = null , $ propertyPath = null ) { static :: string ( $ value , $ message , $ propertyPath ) ; $ protocols = array ( 'http' , 'https' ) ; $ pattern = '~^ (%s):// ( ([\pL\pN\pS-]+\.)+[\pL]+ | ...
Assert that value is an URL .
57,109
static public function alnum ( $ value , $ message = null , $ propertyPath = null ) { try { static :: regex ( $ value , '(^([a-zA-Z]{1}[a-zA-Z0-9]*)$)' ) ; } catch ( AssertionFailedException $ e ) { $ message = $ message ? : sprintf ( 'Value "%s" is not alphanumeric, starting with letters and containing only letters an...
Assert that value is alphanumeric .
57,110
static public function true ( $ value , $ message = null , $ propertyPath = null ) { if ( $ value !== true ) { $ message = $ message ? : sprintf ( 'Value "%s" is not TRUE.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_TRUE , $ propertyPath ) ; } }
Assert that the value is boolean True .
57,111
static public function false ( $ value , $ message = null , $ propertyPath = null ) { if ( $ value !== false ) { $ message = $ message ? : sprintf ( 'Value "%s" is not FALSE.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_FALSE , $ propertyPath ) ; } }
Assert that the value is boolean False .
57,112
static public function classExists ( $ value , $ message = null , $ propertyPath = null ) { if ( ! class_exists ( $ value ) ) { $ message = $ message ? : sprintf ( 'Class "%s" does not exist.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_CLASS , $ prope...
Assert that the class exists .
57,113
static public function implementsInterface ( $ class , $ interfaceName , $ message = null , $ propertyPath = null ) { $ reflection = new \ ReflectionClass ( $ class ) ; if ( ! $ reflection -> implementsInterface ( $ interfaceName ) ) { $ message = $ message ? : sprintf ( 'Class "%s" does not implement interface "%s".' ...
Assert that the class implements the interface
57,114
static public function isJsonString ( $ value , $ message = null , $ propertyPath = null ) { if ( null === json_decode ( $ value ) && JSON_ERROR_NONE !== json_last_error ( ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not a valid JSON string.' , static :: stringify ( $ value ) ) ; throw static :: createExcep...
Assert that the given string is a valid json string .
57,115
static public function uuid ( $ value , $ message = null , $ propertyPath = null ) { $ value = str_replace ( array ( 'urn:' , 'uuid:' , '{' , '}' ) , '' , $ value ) ; if ( $ value === '00000000-0000-0000-0000-000000000000' ) { return ; } if ( ! preg_match ( '/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[1-5][0-9A-Fa-f]{3}-[0-9A-Fa-...
Assert that the given string is a valid UUID
57,116
static public function count ( $ countable , $ count , $ message = null , $ propertyPath = null ) { if ( $ count !== count ( $ countable ) ) { $ message = $ message ? : sprintf ( 'List does not contain exactly "%d" elements.' , static :: stringify ( $ countable ) , static :: stringify ( $ count ) ) ; throw static :: cr...
Assert that the count of countable is equal to count .
57,117
public function orderFormAction ( ) { return $ this -> render ( 'SuluSalesOrderBundle:Template:order.form.html.twig' , array ( 'systemUser' => $ this -> getSystemUserArray ( ) , 'termsOfPayment' => $ this -> getTermsArray ( self :: $ termsOfPaymentEntityName ) , 'termsOfDelivery' => $ this -> getTermsArray ( self :: $ ...
Returns Template for list
57,118
public function render ( ) { $ action = basename ( $ _SERVER [ 'SCRIPT_FILENAME' ] ) ; $ this -> table = new $ this -> table_class ( ) ; $ this -> table -> prepare_items ( ) ; ?> <div class="wrap"> <h2> <?php echo esc_html ( $ this -> get_title ( ) ) ?> </h2> <?php $ this -> before_table ( ) ; ?> <form action=" <?...
Render screen .
57,119
function addWidget ( $ regionBox , $ widget , $ priority = 0 ) { $ this -> __validateWidget ( $ widget ) ; $ regionBox = ( string ) $ regionBox ; if ( ! array_key_exists ( $ regionBox , $ this -> __widgets ) ) $ this -> __widgets [ $ regionBox ] = new PriorityQueue ( ) ; $ queue = $ this -> __widgets [ $ regionBox ] ; ...
Add Widget To Container
57,120
function getRegionWidgets ( $ regionBox ) { if ( ! array_key_exists ( $ regionBox , $ this -> __widgets ) ) return [ ] ; $ return = [ ] ; $ queue = $ this -> __widgets [ $ regionBox ] ; foreach ( $ queue as $ w ) $ return [ ] = $ w ; return $ return ; }
Get All Widgets In Region Box
57,121
function getWidgets ( ) { $ return = [ ] ; foreach ( array_keys ( $ this -> __widgets ) as $ region ) $ return [ $ region ] = $ this -> getRegionWidgets ( $ region ) ; return $ return ; }
Get All Widgets
57,122
public function startDueJobs ( $ current_time = null ) { foreach ( $ this -> jobs as $ job ) { $ schedule = CronExpression :: factory ( $ job -> schedule ) ; if ( $ schedule -> isDue ( $ current_time ) ) { $ this -> schedule -> run ( $ job ) ; } } }
Start Due Jobs
57,123
protected function getValue ( $ value , $ env_var , $ command ) { if ( $ this -> argument ( $ value ) ) { return $ this -> argument ( $ value ) ; } else { return fp_env ( $ env_var ) ? fp_env ( $ env_var ) : $ this -> call ( "publish:$command" ) ; } }
Get Value .
57,124
protected function obtainFields ( ) { $ this -> server = $ this -> getForgeServer ( ) ; $ this -> domain = $ this -> getDomain ( ) ; $ this -> project_type = $ this -> getProjectType ( ) ; $ this -> site_directory = $ this -> getSiteDirectory ( ) ; }
Obtain fields .
57,125
protected function createSiteOnForge ( ) { try { $ this -> info ( 'Creating site ' . $ this -> domain . ' on server ' . $ this -> server ) ; $ response = $ this -> http -> post ( $ this -> url , [ 'form_params' => [ 'domain' => $ this -> domain , 'project_type' => $ this -> project_type , 'directory' => $ this -> site_...
Create site on Forge .
57,126
protected function siteIsAlreadyCreated ( ) { $ this -> sites = $ this -> fetchSites ( fp_env ( 'ACACHA_FORGE_SERVER' ) ) ; $ this -> site = fp_env ( 'ACACHA_FORGE_SITE' ) ; if ( in_array ( $ this -> site , collect ( $ this -> sites ) -> pluck ( 'id' ) -> toArray ( ) ) ) { return true ; } return in_array ( $ this -> do...
Is site already created?
57,127
protected function executeOnError ( $ action ) { $ action .= 'OnError' ; if ( $ this -> isCallable ( $ this , $ action ) ) { $ event_name = $ this -> getModule ( ) -> getName ( ) . '.' . $ this -> getName ( ) . '.' . $ action ; $ result = $ this -> getEventManager ( ) -> dispatchBefore ( $ event_name , $ this ) ; if ( ...
Null is returned when no action OnError was found
57,128
public function getAddress ( ) { $ isUnix = $ this -> getAddressType ( ) === AF_UNIX ; $ address = array ( ) ; $ address [ 'transport' ] = $ this -> getTransport ( ) . ( $ isUnix ? ':///' : '://' ) ; $ address [ 'target' ] = $ this -> getTarget ( ) ; $ address [ 'port' ] = ( $ isUnix ? '' : ':' ) . $ this -> getTargetP...
Returns address to the socket to connect to
57,129
public function setAddressType ( $ addressType ) { if ( ! in_array ( $ addressType , array ( AF_INET , AF_INET6 , AF_UNIX ) ) ) { throw new \ DomainException ( 'Unsupported address type' ) ; } $ this -> addressType = $ addressType ; return $ this ; }
Sets address type
57,130
public function setTransport ( $ transport ) { if ( ! in_array ( $ transport , stream_get_transports ( ) ) ) { throw new \ DomainException ( sprintf ( 'Unsupported type of transport "%s"' , $ transport ) ) ; } $ this -> transport = $ transport ; return $ this ; }
Defines socket transport
57,131
public function setTargetPort ( $ targetPort ) { if ( $ this -> getAddressType ( ) != AF_UNIX && ! is_integer ( $ targetPort ) ) { throw new \ InvalidArgumentException ( 'Target port parameter must be an integer' ) ; } $ this -> targetPort = $ targetPort ; return $ this ; }
Sets target port
57,132
public function addConnectionFlag ( $ connectionFlag ) { if ( ! in_array ( $ connectionFlag , array ( STREAM_CLIENT_CONNECT , STREAM_CLIENT_PERSISTENT , STREAM_CLIENT_ASYNC_CONNECT ) ) ) { throw new \ InvalidArgumentException ( 'Invalid connection flag argument' ) ; } if ( ! in_array ( $ connectionFlag , $ this -> conn...
Adds a connection flag
57,133
public function connect ( ) { $ streamContext = stream_context_create ( array ( $ this -> getTransport ( ) => $ this -> getContextOptions ( ) ) ) ; $ streamResource = stream_socket_client ( $ this -> getAddress ( ) , $ errorCode , $ errorMessage , $ this -> getSocketTimeout ( ) , $ this -> getConnectionFlags ( ) , $ st...
Establishes a socket connection
57,134
public function disconnect ( ) { $ streamResource = $ this -> getStreamResource ( ) ; if ( is_resource ( $ streamResource ) ) { stream_socket_shutdown ( $ streamResource , STREAM_SHUT_RDWR ) ; $ this -> streamResource = null ; } return $ this ; }
Shutdowns a connection
57,135
function bind ( ) { $ sockUri = $ this -> getServerAddress ( ) ; $ scheme = parse_url ( $ sockUri , PHP_URL_SCHEME ) ; if ( ! in_array ( $ scheme , stream_get_transports ( ) ) ) throw new \ Exception ( sprintf ( 'Transport "%s" not supported.' , $ scheme ) ) ; if ( $ scheme == 'udp' ) $ socket = @ stream_socket_server ...
Open Socket Connection To Socket Uri and Bind Server Socket To Specific Port
57,136
function listen ( ) { $ sockUri = $ this -> getServerAddress ( ) ; if ( ! $ this -> isBinding ( ) ) throw new \ Exception ( 'Server not bind as local server.' ) ; $ scheme = parse_url ( $ sockUri , PHP_URL_SCHEME ) ; if ( $ scheme == 'udp' ) $ resource = $ this -> _listen_to_connectLessTransport ( ) ; else $ resource =...
Listen On Port To Accept Data On That Port From Client
57,137
function setServerAddress ( $ socketUri ) { if ( $ this -> socketUri ) throw new \ Exception ( sprintf ( 'Server Address is Immutable; currently have value: (%s).' , $ this -> socketUri ) ) ; $ this -> socketUri = ( string ) $ socketUri ; return $ this ; }
Immutable Set Socket Uri
57,138
function _listen_to_connectLessTransport ( ) { stream_socket_recvfrom ( $ this -> __socket_connected , 1 , 0 , $ remotePeer ) ; $ sockUri = $ this -> getServerAddress ( ) ; $ scheme = parse_url ( $ sockUri , PHP_URL_SCHEME ) ; $ client = new StreamClient ( $ scheme . '://' . $ remotePeer ) ; $ resource = $ client -> ge...
such as udp
57,139
function _listen_to_connectionOrientatedTransports ( ) { $ conn = @ stream_socket_accept ( $ this -> __socket_connected , $ this -> getTimeout ( ) ) ; if ( $ conn === false ) throw new exConnectionTimeout ( 'Connection Timeout.' ) ; $ resource = new ResourceStream ( $ conn ) ; return $ resource ; }
such as tcp
57,140
public function setExtension ( $ extension = '.png' ) { if ( substr ( $ extension , 0 , 1 ) != '.' ) { $ extension = '.' . $ extension ; } $ this -> extension = $ extension ; return $ this ; }
Set image extension .
57,141
public function setSize ( $ size = 32 ) { $ size = ( int ) $ size ; if ( $ size < 1 ) { $ size = 1 ; } if ( $ size > 2048 ) { $ size = 2048 ; } $ this -> size = $ size ; return $ this ; }
Set image size .
57,142
public function setDefault ( $ default ) { $ default = trim ( $ default ) ; if ( in_array ( ( string ) $ default , static :: $ defaultGravatars ) ) { $ this -> default = ( string ) $ default ; } elseif ( strpos ( $ default , 'http' ) !== false && filter_var ( $ default , FILTER_VALIDATE_URL ) ) { $ this -> default = ur...
Set the default gravatar should one not exist for the email .
57,143
public function setRating ( $ rating = 'g' ) { $ rating = ( string ) $ rating ; if ( in_array ( $ rating , static :: $ ageRatings ) ) { $ this -> rating = $ rating ; } return $ this ; }
Set age rating .
57,144
public function getGravatar ( $ email = null ) { if ( isset ( $ email ) ) { $ this -> setEmail ( ( string ) $ email ) ; } $ url = self :: BASE_URL ; if ( $ this -> secure ) { $ url = self :: BASE_URL_SECURE ; } $ url .= $ this -> email ; $ url .= $ this -> extension ; $ url .= '?s=' . $ this -> size ; $ url .= '&d=' . ...
Get the gravatar .
57,145
public function setEmail ( $ email = '' ) { $ email = ( string ) $ email ; $ email = trim ( $ email ) ; $ email = strtolower ( $ email ) ; if ( ! filter_var ( $ email , FILTER_VALIDATE_EMAIL ) ) { throw new \ InvalidArgumentException ( 'Email should be a valid email address' ) ; } $ this -> email = md5 ( $ email ) ; re...
Set email address .
57,146
public static function connect ( $ db , $ host = 'localhost' , $ port = 27017 ) { self :: $ cnxHandler = new \ MongoClient ( $ host . ':' . $ port ) ; self :: $ db = self :: $ cnxHandler -> $ db ; if ( ! self :: $ cnxHandler || ! self :: $ db ) { return false ; } else { return true ; } }
Etablit la connexion avec le serveur MongoDB
57,147
public static function update ( $ collection , $ criteriaQuery , $ data , $ multiple = false ) { static :: checkConnexion ( ) ; $ collection = self :: $ db -> $ collection ; if ( is_string ( $ criteriaQuery ) ) { $ criteriaQuery = json_decode ( $ criteriaQuery , true ) ; if ( ! $ criteriaQuery ) { throw new \ Exception...
Modifie un ou plusieurs documents d une collection .
57,148
public static function delete ( $ collection , $ criteriaQuery = array ( ) ) { static :: checkConnexion ( ) ; $ collection = self :: $ db -> $ collection ; if ( is_string ( $ criteriaQuery ) ) { $ criteriaQuery = json_decode ( $ criteriaQuery , true ) ; if ( ! $ criteriaQuery ) { throw new \ Exception ( 'criteriaQuery ...
Supprime un ou plusieurs enregistrements d une collection
57,149
public static function dropCollection ( $ collection ) { static :: checkConnexion ( ) ; $ collection = self :: $ db -> $ collection ; $ r = $ collection -> drop ( ) ; if ( $ r [ 'ok' ] ) { return true ; } return false ; }
Supprime une collection
57,150
public static function addCollection ( $ collection ) { static :: checkConnexion ( ) ; $ r = self :: $ db -> createCollection ( $ collection ) ; if ( gettype ( $ r ) == 'object' && get_class ( $ r ) == 'MongoCollection' ) { return true ; } return false ; }
Ajoute une collection
57,151
protected function exec ( $ url ) { $ client = $ this -> getRequest ( ) ; try { $ response = $ client -> request ( 'POST' , $ this -> buildRequestUrl ( ) , [ 'json' => [ 'longUrl' => $ url ] ] ) ; } catch ( \ GuzzleHttp \ Exception \ ClientException $ e ) { $ response = $ e -> getResponse ( ) ; } return $ this -> handl...
Executes a CURL request to the Google API
57,152
public static function initModules ( ) { $ cfg = ServiceContainer :: get ( 'config' ) ; $ moduleList = $ cfg -> getConfigData ( 'modules' ) ; if ( count ( $ moduleList ) > 0 ) { foreach ( $ moduleList as $ moduleName ) { self :: loadModule ( $ moduleName ) ; } } }
Autoload modules specified in config files
57,153
public static function loadModule ( $ moduleName ) { $ moduleConf = self :: getModuleConf ( $ moduleName ) ; try { if ( isset ( $ moduleConf [ 'requires_php_extension' ] ) && is_array ( $ moduleConf [ 'requires_php_extension' ] ) ) { self :: checkPhpExtensions ( $ moduleConf [ 'requires_php_extension' ] ) ; } $ tmpModu...
Loads a module and its dependencies and then returns the module reference
57,154
public function getModule ( $ moduleName ) { $ moduleName = strtolower ( $ moduleName ) ; if ( isset ( self :: $ _modules [ $ moduleName ] ) ) { return self :: $ _modules [ $ moduleName ] ; } else { try { return $ this -> loadModule ( $ moduleName ) ; } catch ( \ Exception $ e ) { throw new ModuleException ( "Cannot fi...
Get the instance of desired module
57,155
public function setController ( AController $ controller ) { if ( count ( self :: $ _modules ) > 0 ) { foreach ( self :: $ _modules as $ module ) { $ module -> setController ( $ controller ) ; } } }
Sets the Controller for each module
57,156
protected function configure ( ) { if ( ! is_null ( $ this -> signature ) ) { $ parser = new SignatureParser ( $ this ) ; $ parser -> parse ( $ this -> signature ) ; $ this -> setDescription ( $ this -> description ) ; } }
Configure the command if signature is set .
57,157
protected function argument ( $ key = null ) { if ( is_null ( $ key ) ) { return $ this -> input -> getArguments ( ) ; } return $ this -> input -> getArgument ( $ key ) ; }
Get the value of a command argument .
57,158
protected function option ( $ key = null ) { if ( is_null ( $ key ) ) { return $ this -> input -> getOptions ( ) ; } return $ this -> input -> getOption ( $ key ) ; }
Get the value of a command option .
57,159
public function addInput ( Input $ input ) { $ reflection = new \ ReflectionClass ( $ input ) ; $ method = 'add' . $ reflection -> getShortName ( ) ; if ( method_exists ( $ this , $ method ) ) { $ this -> $ method ( ... array_values ( $ input -> getAttributes ( ) ) ) ; } }
Add input to the command .
57,160
public function askPassword ( $ question ) { $ helper = $ this -> getHelper ( 'question' ) ; $ question = new Question ( $ question ) ; $ question -> setHidden ( true ) ; $ question -> setHiddenFallback ( false ) ; return $ helper -> ask ( $ this -> input , $ this -> getOutputInterface ( ) , $ question ) ; }
Ask a password .
57,161
public function choose ( $ question , array $ choices , $ default = null ) { $ helper = $ this -> getHelper ( 'question' ) ; $ question = new ChoiceQuestion ( $ question , $ choices , $ default ) ; $ question -> setErrorMessage ( 'Option %s is invalid.' ) ; return $ helper -> ask ( $ this -> input , $ this -> getOutput...
Ask a question where the answer is available from a list of predefined choices .
57,162
public function anticipate ( $ question , array $ autoCompletion , $ default = null ) { $ helper = $ this -> getHelper ( 'question' ) ; $ question = new Question ( $ question , $ default ) ; $ question -> setAutocompleterValues ( $ autoCompletion ) ; return $ helper -> ask ( $ this -> input , $ this -> getOutputInterfa...
Ask a question where some auto - completion help is provided .
57,163
public function choice ( $ question , array $ choices , $ default = null ) { $ helper = $ this -> getHelper ( 'question' ) ; $ question = new ChoiceQuestion ( $ question , $ choices , $ default ) ; $ question -> setMultiselect ( true ) ; return $ helper -> ask ( $ this -> input , $ this -> getOutputInterface ( ) , $ qu...
Ask a question where the answer is available from a list of predefined choices and more choices can be selected .
57,164
private function prepareFilename ( $ filename ) { $ this -> filename = $ filename ; if ( ! $ this -> filename ) { $ this -> filename = $ this -> content -> getMetadata ( 'uri' ) ; } if ( ! $ this -> filename || substr ( $ this -> filename , 0 , 6 ) === 'php://' ) { $ this -> filename = $ this -> name ; } }
Applies a file name to the POST file based on various checks .
57,165
public function nextSequence ( $ currentSequence = null ) { $ sequenceLength = count ( $ currentSequence ) ; $ k = null ; for ( $ i = 0 ; $ i < $ sequenceLength ; $ i ++ ) { if ( isset ( $ currentSequence [ $ i + 1 ] ) && $ currentSequence [ $ i ] < $ currentSequence [ $ i + 1 ] ) { $ k = $ i ; } } if ( is_null ( $ k )...
Get Next Sequence in order
57,166
public static function shift ( $ array , $ num ) { $ num = abs ( $ num ) + 1 ; $ n = count ( $ array ) ; $ used = array_fill ( 0 , $ n , false ) ; $ res = [ ] ; $ factorial = self :: factorial ( $ n ) ; if ( $ num > $ factorial ) { $ num = $ num % $ factorial ; if ( $ num == 0 ) { $ num = $ factorial - $ num ; } } for ...
Get by position
57,167
public function buildTag ( $ asset , $ type ) { $ attrs = $ this -> markSource ? $ this -> markAttr : [ ] ; switch ( $ type ) { case self :: ASSET_JS_FILE : return Html :: script ( $ asset , $ attrs ) ; break ; case self :: ASSET_JS : return Html :: scriptCode ( $ asset , $ attrs ) ; break ; case self :: ASSET_CSS_FILE...
create html tag
57,168
public function exists ( $ name , $ pos = null ) { if ( ! $ pos ) { foreach ( $ this -> getAssetTypes ( ) as $ type ) { $ assets = $ this -> getAssetsByPos ( $ type ) ; if ( isset ( $ assets [ $ name ] ) ) { return true ; } } } else { $ assets = $ this -> getAssetsByPos ( $ pos ) ; return isset ( $ assets [ $ name ] ) ...
check asset has exists
57,169
static function fromProvider ( $ provider , $ data ) { $ providername = __NAMESPACE__ . '\\providers\\' . ucfirst ( strtolower ( $ provider ) ) . 'Provider' ; return new self ( new $ providername ( $ data ) ) ; }
Generic instanciation method for any type of provider .
57,170
public function getPages ( ) { return ( int ) ceil ( ( float ) $ this -> provider -> count ( ) / ( float ) $ this -> pagelength ) ; }
Returns the total number of pages available .
57,171
public function getPagesList ( $ length = 10 ) { $ pagenum = $ this -> getPageNum ( ) ; $ pagecount = $ this -> getPages ( ) ; if ( $ length > $ pagecount ) { $ length = $ pagecount ; } $ delta = ceil ( $ length / 2 ) ; if ( $ pagenum <= 1 ) { $ lowerbound = 1 ; $ upperbound = min ( $ pagecount , $ length ) ; } else if...
Gets the list of pages surrounding the current one as an array .
57,172
public function setGetParams ( $ params ) { if ( ! is_array ( $ params ) ) { $ params = explode ( '&' , str_replace ( '?' , '' , $ params ) ) ; } $ get = array ( ) ; foreach ( $ params as $ varname => $ varval ) { if ( $ varname == 'p' ) continue ; if ( is_array ( $ varval ) ) { foreach ( $ varval as $ subval ) { $ get...
Sets the get parameters for the links .
57,173
function render ( $ class = '' , $ id = '' , $ return = false ) { $ link = $ this -> link . ( $ this -> getparams ? '?' . $ this -> getparams . '&' : '?' ) ; ?> <div <?= ( ( $ id != '' ) ? 'id="' . $ id . '"' : '' ) ?> <?= ( ( $ class != '' ) ? 'class="' . $ class . '"' : '' ) ?> > <a class="start" href=" <?= ...
Displays or returns the HTML list of pages .
57,174
protected function summary ( array $ parameters = [ ] ) { ksort ( $ parameters ) ; $ summary = '' ; foreach ( $ parameters as $ value ) { $ summary .= $ value ; } $ summary .= $ this -> config ( 'private_key' ) ; return md5 ( $ summary ) ; }
Generate control summary .
57,175
public static function checkRole ( $ roleName ) { return function ( $ params ) use ( $ roleName ) { \ Yii :: $ app -> user -> can ( $ roleName , $ params ) ; } ; }
Return a PHP callable that check user permission by role
57,176
public function getProgressToNextLevel ( ) { if ( $ this -> isTotal ( ) ) { return false ; } $ level = $ this -> getVirtualLevel ( ) ; $ currentLevelXp = $ this -> getSkill ( ) -> getXp ( $ level ) ; $ nextLevelXp = $ this -> getSkill ( ) -> getXp ( $ level + 1 ) ; if ( ! $ nextLevelXp ) { return false ; } $ totalXpInL...
Returns how far to the next level this skill is from 0 - 1 .
57,177
public function getRequests ( $ asSent = false ) { return array_map ( function ( $ t ) use ( $ asSent ) { return $ asSent ? $ t [ 'sent_request' ] : $ t [ 'request' ] ; } , $ this -> transactions ) ; }
Get all of the requests sent through the plugin .
57,178
public function getLastRequest ( $ asSent = false ) { return $ asSent ? end ( $ this -> transactions ) [ 'sent_request' ] : end ( $ this -> transactions ) [ 'request' ] ; }
Get the last request sent .
57,179
public static function setUnitOfWorkEntityChangeSet ( $ entity , $ changeSet , $ unitOfWork ) { $ reflectionClass = new ReflectionClass ( UnitOfWork :: class ) ; $ reflectionProperty = $ reflectionClass -> getProperty ( 'entityChangeSets' ) ; $ reflectionProperty -> setAccessible ( true ) ; $ changeSetFull = $ reflecti...
Set Entity Change Set
57,180
public static function getAllEntityClassNames ( EntityManager $ entityManager ) { $ classes = [ ] ; foreach ( $ entityManager -> getMetadataFactory ( ) -> getAllMetadata ( ) as $ meta ) { $ classes [ ] = $ meta -> getName ( ) ; } return $ classes ; }
Get all Entity Class Names
57,181
public static function getPropertiesByAnnotation ( $ entityClass , $ annotationClass , AnnotationReader $ reader ) { $ properties = [ ] ; $ reflectionClass = new ReflectionClass ( $ entityClass ) ; foreach ( $ reflectionClass -> getProperties ( ) as $ reflectionProperty ) { if ( false === self :: hasPropertyAnnotation ...
Get Properties by Annotation
57,182
public static function getPropertyAnnotation ( \ ReflectionProperty $ property , $ annotationClass , AnnotationReader $ reader ) { return $ reader -> getPropertyAnnotation ( $ property , $ annotationClass ) ; }
Get Property Annotation
57,183
public static function getEventListener ( $ className , EntityManager $ manager ) { foreach ( $ manager -> getEventManager ( ) -> getListeners ( ) as $ listeners ) { foreach ( $ listeners as $ listener ) { if ( $ listener instanceof $ className ) { return $ listener ; } } } return null ; }
Get Event Listener
57,184
public static function hasPropertyAnnotation ( \ ReflectionProperty $ property , $ annotationClass , AnnotationReader $ reader ) { if ( null === self :: getPropertyAnnotation ( $ property , $ annotationClass , $ reader ) ) { return false ; } return true ; }
Has Property Annotation
57,185
public function setWebRootPath ( $ path ) { if ( @ file_exists ( $ path ) && is_dir ( $ path ) ) { $ this -> web_root_path = realpath ( $ path ) . '/' ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Web root path "%s" was not found or is not a directory!' , $ path ) ) ; } return $ this ; }
Set the web root path
57,186
public function getTemplateObject ( $ _type , $ _ref = null ) { $ stack_name = ! is_null ( $ _ref ) ? $ _ref : $ this -> getTemplateObjectClassName ( $ _type ) ; if ( ! $ this -> registry -> isEntry ( $ stack_name , 'template_objects' ) ) { $ this -> createNewTemplateObject ( $ _type , $ _ref ) ; } return $ this -> reg...
Get a template object and create it if so
57,187
public function createNewTemplateObject ( $ _type , $ _ref = null ) { $ _cls = $ this -> getTemplateObjectClassName ( $ _type ) ; $ stack_name = ! is_null ( $ _ref ) ? $ _ref : $ _cls ; if ( class_exists ( $ _cls ) ) { try { $ _tpl_object = new $ _cls ( $ this ) ; } catch ( \ Exception $ e ) { throw new \ RuntimeExcept...
Create a new template object and reference it in the registry
57,188
public function findAsset ( $ file_path ) { $ real_path = $ this -> findRealPath ( $ file_path ) ; if ( $ real_path ) { return trim ( FilesystemHelper :: resolveRelatedPath ( $ this -> web_root_path , $ real_path ) , '/' ) ; } return null ; }
Find an asset file relative path web ready
57,189
public function findRealPath ( $ file_path ) { if ( @ file_exists ( $ file_path ) ) { return realpath ( $ file_path ) ; } if ( @ file_exists ( $ this -> web_root_path . $ file_path ) ) { return $ this -> web_root_path . $ file_path ; } return null ; }
Find a file absolute path in application
57,190
public function findByName ( $ name , array $ locations = [ ] ) { if ( empty ( $ locations ) ) { $ locations = $ this -> lookupPaths ; } $ finder = new Finder ; $ finder -> directories ( ) -> depth ( 0 ) -> name ( $ name ) -> in ( $ locations ) ; $ skeletons = iterator_to_array ( $ finder , true ) ; return reset ( $ sk...
Returns an array of found skeletons with that name in configured or given locations .
57,191
public function findAll ( array $ locations = [ ] ) { if ( empty ( $ locations ) ) { $ locations = $ this -> lookupPaths ; } $ finder = new Finder ; $ finder -> directories ( ) -> depth ( 0 ) -> sortByName ( ) -> in ( $ locations ) ; return iterator_to_array ( $ finder , true ) ; }
Returns an array of all found skeletons in the configured or given locations .
57,192
public function createFromComposerJson ( $ composer ) { $ sections = $ this -> getAutoloadSectionNames ( $ composer ) ; if ( empty ( $ sections ) ) { return array ( ) ; } $ validators = array ( ) ; foreach ( $ sections as $ section ) { $ validators [ ] = $ this -> createValidatorsFromSection ( $ section , $ composer [ ...
Generate validators for all information from the passed composer . json array .
57,193
public function createValidator ( $ section , $ type , $ information ) { switch ( $ type ) { case 'classmap' : return new ClassMapValidator ( $ section . '.' . $ type , $ information , $ this -> baseDir , $ this -> generator , $ this -> report ) ; case 'files' : return new FilesValidator ( $ section . '.' . $ type , $ ...
Create an validator .
57,194
private function getAutoloadSectionNames ( $ composer ) { $ sections = array ( ) ; if ( array_key_exists ( 'autoload' , $ composer ) ) { $ sections [ ] = 'autoload' ; } if ( array_key_exists ( 'autoload-dev' , $ composer ) ) { $ sections [ ] = 'autoload-dev' ; } return $ sections ; }
Ensure that a composer autoload section is present .
57,195
private function createValidatorsFromSection ( $ sectionName , $ section ) { $ validators = array ( ) ; foreach ( $ section as $ type => $ content ) { if ( $ validator = $ this -> createValidator ( $ sectionName , $ type , $ content ) ) { $ validators [ ] = $ validator ; } } return $ validators ; }
Create all validators for the passed section .
57,196
public function index ( $ id = 0 ) { $ post = $ this -> request -> _getPost ( ) ; $ buffers = [ ] ; foreach ( $ post as $ request ) { $ this -> prepareGetRequest ( $ request ) ; $ this -> controllerService -> callController ( $ request [ 'controller' ] , $ request [ 'method' ] , $ request [ 'id' ] , $ request [ 'params...
Dispatch all request
57,197
protected function formatBody ( $ value , array $ doc ) { $ value = $ this -> convertEncoding ( $ value ) ; $ value = mb_ereg_replace ( '<h[1-5].*?>(.*?)</h[1-5]>' , "<h3>\\1</h3>" , $ value ) ; $ value = str_replace ( '[jump]' , '<!-- [jump] , $ value ) ; $ value = mb_ereg_replace ( '<a\shref="\s+' , '<a href="' , $ ...
Performs specific body text formatting
57,198
protected function getFilePath ( $ type = 'image' , DateTime $ date = null ) { $ date = $ date ? : new DateTime ( ) ; return sprintf ( 'files/base/%s/%s/%s/%s/%s' , $ this -> getAccountKey ( ) , $ this -> getGroupKey ( ) , $ type , $ date -> format ( 'Y' ) , $ date -> format ( 'm' ) ) ; }
Returns a standard media path from supplied type and date .
57,199
final protected function getConfigValue ( $ path = null , $ returnValue = null ) { if ( null !== $ path ) { return $ this -> importer -> getPersister ( ) -> getConfigLoader ( ) -> getValues ( ) -> get ( $ path , $ returnValue ) ; } return $ this -> importer -> getPersister ( ) -> getConfigLoader ( ) -> getValues ( ) ; ...
Gets a configuration value