idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
239,600
private function getUserRememberMe ( Request $ req , Response $ res ) { $ cookie = $ this -> getRememberMeCookie ( $ req ) ; if ( ! $ cookie ) { return false ; } $ user = $ cookie -> verify ( $ req , $ this -> auth ) ; if ( ! $ user ) { $ this -> destroyRememberMeCookie ( $ req , $ res ) ; return false ; } $ signedInUs...
Tries to get an authenticated user via remember me .
239,601
private function getRememberMeCookie ( Request $ req ) { $ encoded = $ req -> cookies ( $ this -> rememberMeCookieName ( ) ) ; if ( ! $ encoded ) { return false ; } return RememberMeCookie :: decode ( $ encoded ) ; }
Gets the decoded remember me cookie from the request .
239,602
private function sendRememberMeCookie ( UserInterface $ user , RememberMeCookie $ cookie , Response $ res ) { $ sessionCookie = session_get_cookie_params ( ) ; $ res -> setCookie ( $ this -> rememberMeCookieName ( ) , $ cookie -> encode ( ) , $ cookie -> getExpires ( time ( ) ) , $ sessionCookie [ 'path' ] , $ sessionC...
Stores a remember me session cookie on the response .
239,603
private function destroyRememberMeCookie ( Request $ req , Response $ res ) { $ cookie = $ this -> getRememberMeCookie ( $ req ) ; if ( $ cookie ) { $ cookie -> destroy ( ) ; } $ sessionCookie = session_get_cookie_params ( ) ; $ res -> setCookie ( $ this -> rememberMeCookieName ( ) , '' , time ( ) - 86400 , $ sessionCo...
Destroys the remember me cookie .
239,604
public function setCookie ( $ cookie_key , $ cookie_value , $ expire = null , $ path = null , $ domain = null , $ secure = null , $ httpOnly = null ) { if ( $ this -> isSingle ( ) ) { ResponseKit :: setCookie ( $ cookie_key , $ cookie_value , $ expire , $ path , $ domain , $ secure , $ httpOnly ) ; } }
Set Cookie Value
239,605
public function delCookies ( $ cookie_keys ) { if ( $ this -> isSingle ( ) ) { foreach ( $ cookie_keys as $ cookie_key ) { $ this -> delCookie ( $ cookie_key ) ; } } }
Delete Multi Cookies
239,606
private function createCommandProphecy ( ) { $ prophet = new Prophet ; $ prophecy = $ prophet -> prophesize ( ) -> willImplement ( InlineConfigCommandInterface :: class ) ; $ prophecy -> setName ( 'foo' ) -> shouldBeCalled ( ) ; $ prophecy -> getConfig ( ) -> willReturn ( [ 'name' => 'foo' ] ) ; return $ prophecy ; }
override prophecy creation
239,607
private function validateComponentKeys ( array $ v ) { $ diff = array_diff_key ( $ v , array_flip ( $ this -> enabledComponentTypes ) ) ; if ( ! empty ( $ diff ) ) { throw new InvalidConfigurationException ( sprintf ( 'Only "%s" component types are supported for configuration, "%s" more given.' , implode ( '", "' , $ t...
Validate given array keys are all registered components .
239,608
private function hydrateTemplatesNode ( NodeBuilder $ node ) { $ node -> booleanNode ( 'default' ) -> defaultFalse ( ) -> end ( ) -> scalarNode ( 'path' ) -> cannotBeEmpty ( ) -> end ( ) -> arrayNode ( 'contents' ) -> prototype ( 'scalar' ) -> cannotBeEmpty ( ) -> end ( ) -> end ( ) ; return $ node ; }
Hydrate given node with templates configuration nodes .
239,609
private function hydrateZonesNode ( NodeBuilder $ node ) { $ node -> booleanNode ( 'main' ) -> defaultFalse ( ) -> end ( ) -> booleanNode ( 'virtual' ) -> defaultFalse ( ) -> end ( ) -> arrayNode ( 'aggregation' ) -> addDefaultsIfNotSet ( ) -> beforeNormalization ( ) -> always ( function ( $ v ) { if ( is_string ( $ v ...
Hydrate given node with zones configuration nodes .
239,610
private function hydrateComponentsNode ( NodeBuilder $ node ) { $ node -> scalarNode ( 'path' ) -> end ( ) -> scalarNode ( 'controller' ) -> end ( ) -> arrayNode ( 'config' ) -> useAttributeAsKey ( 'name' ) -> prototype ( 'array' ) -> useAttributeAsKey ( 'name' ) -> beforeNormalization ( ) -> always ( function ( $ v ) ...
Hydrate given node with components configuration nodes .
239,611
public function process ( $ inputFile , $ outputFile = null ) { if ( ! file_exists ( $ inputFile ) || ! is_readable ( $ inputFile ) ) { throw new InvalidFileArgumentException ( sprintf ( 'File %s does not exist or is not readable' , $ inputFile ) ) ; } $ arguments = array ( '-quiet' , '-inter' , '0.5' , '-tmp' , dirnam...
Processes a file
239,612
public static function create ( $ conf = array ( ) , LoggerInterface $ logger = null ) { if ( ! $ conf instanceof ConfigurationInterface ) { $ conf = new Configuration ( $ conf ) ; } $ binaries = $ conf -> get ( 'mp4box.binaries' , array ( 'MP4Box' ) ) ; return static :: load ( $ binaries , $ logger , $ conf ) ; }
Creates an MP4Box binary adapter .
239,613
public function injectWidgetDependencies ( WidgetInterface $ widget , ServiceLocatorInterface $ serviceLocator ) { $ sm = $ serviceLocator -> getServiceLocator ( ) ; if ( ! $ sm ) throw new \ Exception ( 'Service Manager can`t found.' ) ; if ( $ widget instanceof ViewRendererPlugInterface ) { if ( ! $ sm -> has ( 'View...
Inject required dependencies into the widget .
239,614
public function loadXmlFile ( $ path , $ parse = false ) { $ this -> preserveWhiteSpace = false ; $ bool = file_exists ( $ path ) ; if ( ! $ bool ) { $ this -> error = 'file_not_exists' ; return false ; } $ bool = @ $ this -> load ( $ path ) ; if ( ! $ bool ) { $ this -> error = 'loading_file_error' ; return false ; } ...
load xml file optionally check file DTD
239,615
public function saveXmlFile ( $ path = '' ) { $ this -> formatOutput = true ; if ( $ path ) { $ bool = @ $ this -> save ( $ path ) ; if ( ! $ bool ) { $ this -> error = 'save_file_error' ; return false ; } return true ; } return $ this -> saveXML ( ) ; }
save xml file optionally will return as string
239,616
protected function searchByAttributeRecurrent ( DOMNodeList $ node , $ value , array $ list = [ ] ) { foreach ( $ node as $ child ) { if ( $ child -> nodeType === 1 ) { if ( $ child -> hasChildNodes ( ) ) { $ list = $ this -> searchByAttributeRecurrent ( $ child -> childNodes , $ value , $ list ) ; } $ attribute = $ ch...
search for all nodes with given attribute return list of nodes with attribute value as key
239,617
final protected function generate_rendered_tags ( ) { $ data_sources = $ this -> data_sources ; $ data_sources [ ] = $ this -> recipient ; $ tags = $ this -> manager -> render_tags ( $ data_sources ) ; $ rendered = array ( ) ; foreach ( $ tags as $ tag => $ value ) { $ rendered [ '{' . $ tag . '}' ] = $ value ; } $ thi...
Generate the rendered forms of the tags .
239,618
public function add_data_source ( \ Serializable $ source , $ name = '' ) { if ( $ name ) { $ this -> data_sources [ $ name ] = $ source ; } else { $ this -> data_sources [ ] = $ source ; } $ this -> regenerate ( ) ; return $ this ; }
Add a data source .
239,619
protected function get_data_to_serialize ( ) { return array ( 'recipient' => $ this -> recipient -> ID , 'message' => $ this -> message , 'subject' => $ this -> subject , 'strategy' => $ this -> strategy , 'manager' => $ this -> manager -> get_type ( ) , 'data_sources' => $ this -> data_sources ) ; }
Get the data to serialize .
239,620
protected function do_unserialize ( array $ data ) { $ this -> recipient = get_user_by ( 'id' , $ data [ 'recipient' ] ) ; $ this -> message = $ data [ 'message' ] ; $ this -> subject = $ data [ 'subject' ] ; $ this -> manager = Factory :: make ( $ data [ 'manager' ] ) ; $ this -> strategy = $ data [ 'strategy' ] ; $ t...
Do the actual unserialization .
239,621
public function hasFailed ( ) { if ( $ this -> failed == false || $ this -> passed == true ) { $ this -> failed = true ; $ this -> passed = false ; } }
Set booleans if validator failed
239,622
public function hasPassed ( ) { if ( $ this -> passed == false || $ this -> failed == true ) { $ this -> passed = true ; $ this -> failed = false ; } }
Set booleans if validator passed
239,623
protected function renderFormActions ( ) { $ rowPlugin = $ this -> getRowPlugin ( ) ; if ( ! empty ( $ this -> formActionElements ) ) { $ this -> getElement ( ) -> addChild ( $ rowPlugin ( $ this -> formActionElements , true ) -> getElement ( ) ) ; } return $ this ; }
Render the form action elements when needed .
239,624
public function getString ( $ varname ) { $ value = $ this -> get ( $ varname ) ; return $ value === null ? null : trim ( $ value ) ; }
Gets the configuration option value as a trimmed string .
239,625
public function getBool ( $ varname ) { $ value = $ this -> getString ( $ varname ) ; return $ value === null ? null : $ value && strtolower ( $ value ) !== 'off' ; }
Gets configuration option value as a boolean . Interprets the string value off as false .
239,626
public function getNumeric ( $ varname ) { $ value = $ this -> getString ( $ varname ) ; return is_numeric ( $ value ) ? $ value + 0 : null ; }
Gets configuration option value as an integer .
239,627
public function resolve ( ) { $ url = $ this -> request -> url ( ) ; $ tmp = explode ( '/' , $ url ) ; $ last_seg = end ( $ tmp ) ; return $ this -> repository -> findBySlug ( $ last_seg ) ; }
Resolve the post .
239,628
public function isValid ( ) { $ valid = true ; $ this -> validate ( ) ; foreach ( $ this -> getIterator ( ) as $ element ) { if ( $ element instanceof ValidationAwareInterface ) { $ valid = $ element -> isValid ( ) ? $ valid : false ; } } return $ valid ; }
Checks if all elements are valid
239,629
public function get ( $ name ) { $ selected = null ; foreach ( $ this as $ element ) { if ( $ element -> getName ( ) == $ name ) { $ selected = $ element ; break ; } if ( $ element instanceof ContainerInterface ) { $ selected = $ element -> get ( $ name ) ; if ( null !== $ selected ) { break ; } } } return $ selected ;...
Gets element by name
239,630
public function setValues ( array $ values ) { foreach ( $ values as $ name => $ value ) { if ( $ element = $ this -> get ( $ name ) ) { $ element -> setValue ( $ value ) ; } } return $ this ; }
Sets the values form matched elements
239,631
public function validate ( ) { foreach ( $ this as $ element ) { if ( $ element instanceof ValidationAwareInterface || $ element instanceof ContainerInterface ) { $ element -> validate ( ) ; } } return $ this ; }
Runs validation chain in all its elements
239,632
public static function isAbsolute ( $ path ) { list ( $ prefix , $ path , $ absolute ) = self :: _startNormalize ( $ path ) ; return $ absolute ; }
says if the given path is an absolute one or not .
239,633
protected static function _normalizePath ( $ originalPath , $ alwaysArray , $ basePath = '' ) { list ( $ prefix , $ path , $ absolute ) = self :: _startNormalize ( $ originalPath ) ; if ( ! $ absolute && $ basePath ) { list ( $ prefix , $ path , $ absolute ) = self :: _startNormalize ( $ basePath . '/' . $ originalPath...
it returns components of a path after normalization in an array .
239,634
function attainAuthorizationUrl ( iGrantAuthorizeRequest $ grant ) { $ grantParams = $ grant -> assertAuthorizeParams ( ) ; $ response = $ this -> call ( new GetAuthorizeUrl ( $ grantParams ) ) ; if ( $ ex = $ response -> hasException ( ) ) throw $ ex ; return $ response -> expected ( ) ; }
Builds the authorization URL
239,635
function attainAccessToken ( iGrantTokenRequest $ grant ) { $ grantParams = $ grant -> assertTokenParams ( ) ; $ response = $ this -> call ( new Token ( $ grantParams ) ) ; if ( $ ex = $ response -> hasException ( ) ) throw $ ex ; $ r = $ response -> expected ( ) ; if ( ! $ r -> get ( 'access_token' ) ) return $ r ; re...
Requests an access token using a specified grant .
239,636
function withGrant ( $ grantTypeName , array $ overrideOptions = [ ] ) { $ options = [ 'scopes' => $ this -> defaultScopes , 'client_id' => $ this -> clientId , 'client_secret' => $ this -> clientSecret , ] ; if ( ! empty ( $ overrideOptions ) ) $ options = array_merge ( $ options , $ overrideOptions ) ; if ( $ grantTy...
Retrieve Specific Grant Type
239,637
protected function platform ( ) { if ( ! $ this -> platform ) $ this -> platform = new PlatformRest ; $ this -> platform -> setServerUrl ( $ this -> serverUrl ) ; return $ this -> platform ; }
Get Client Platform
239,638
public function render ( $ filename , $ vars = array ( ) ) { $ localTemplate = $ this -> templateDir . '/' . $ filename ; $ themeTemplate = locate_template ( $ filename ) ; if ( ! file_exists ( $ localTemplate ) && ! file_exists ( $ themeTemplate ) ) { throw new NotFoundException ( "View at $localTemplate or $themeTemp...
Renders a template file .
239,639
public function isGranted ( $ resource , $ action = 'view' ) { return $ this -> aclOperator -> isAccessGranted ( $ resource , $ this -> getPermission ( $ action ) ) ; }
Returns whether the user has access granted or not on the given resource for the given action .
239,640
public function generateResourcePath ( $ resource , $ action = 'show' ) { $ configuration = $ this -> registry -> findConfiguration ( $ resource ) ; $ routeName = $ configuration -> getRoute ( $ action ) ; $ route = $ this -> findRoute ( $ routeName ) ; $ requirements = $ route -> getRequirements ( ) ; $ accessor = Pro...
Generates an admin path for the given resource and action .
239,641
public function getPermission ( $ action ) { $ action = strtoupper ( $ action ) ; if ( $ action == 'LIST' ) { return 'VIEW' ; } elseif ( $ action == 'SHOW' ) { return 'VIEW' ; } elseif ( $ action == 'NEW' ) { return 'CREATE' ; } elseif ( $ action == 'EDIT' ) { return 'EDIT' ; } elseif ( $ action == 'REMOVE' ) { return ...
Returns the permission for the given action .
239,642
public function findRoute ( $ routeName ) { $ i18nRouterClass = 'JMS\I18nRoutingBundle\Router\I18nRouterInterface' ; if ( interface_exists ( $ i18nRouterClass ) && $ this -> router instanceof $ i18nRouterClass ) { $ route = $ this -> router -> getOriginalRouteCollection ( ) -> get ( $ routeName ) ; } else { $ route = $...
Finds the route definition .
239,643
protected function setupDefaultMachine ( array $ config ) { $ io_name = isset ( $ config [ 'io_name' ] ) ? ( string ) $ config [ 'io_name' ] : 'item' ; $ no_default_transitions = ! empty ( $ config [ 'crud_machine_no_default_transitions' ] ) ; $ this -> states = array_replace_recursive ( $ no_default_transitions ? arra...
Setup basic CRUD machine .
239,644
protected function recalculateTree ( ) { if ( ! $ this -> nested_sets_enabled ) { throw new \ RuntimeException ( 'Nested sets are disabled for this entity.' ) ; } $ q_table = $ this -> flupdo -> quoteIdent ( $ this -> table ) ; $ cols = $ this -> nested_sets_table_columns ; $ c_order_by = $ this -> nested_sets_order_by...
Recalculate nested - sets tree indices
239,645
private function recalculateSubTree ( $ set , $ left , $ depth , $ q_table , $ c_order_by , $ c_id , $ c_parent_id , $ c_left , $ c_right , $ c_depth ) { foreach ( $ set as $ row ) { $ id = $ row [ 'id' ] ; $ this -> flupdo -> update ( $ q_table ) -> set ( "$c_left = ?" , $ left ) -> set ( "$c_depth = ?" , $ depth ) ->...
Recalculate given subtree .
239,646
protected function _setOptions ( array $ options ) { if ( isset ( $ options [ 'escape' ] ) ) { if ( ! is_callable ( $ options [ 'escape' ] ) ) { throw new InvalidArgumentException ( 'Mustache constructor "escape" option must be callable' ) ; } $ this -> _escape = $ options [ 'escape' ] ; } if ( isset ( $ options [ 'cha...
Helper function for setting options from constructor args .
239,647
public function render ( $ template = null , $ view = null , $ partials = null ) { if ( $ template === null ) $ template = $ this -> _template ; if ( $ partials !== null ) $ this -> _partials = $ partials ; $ otag_orig = $ this -> _otag ; $ ctag_orig = $ this -> _ctag ; $ view [ 'baseUrl' ] = $ this -> server -> siteUr...
Render the given template and view object .
239,648
protected function _renderTemplate ( $ template ) { if ( $ section = $ this -> _findSection ( $ template ) ) { list ( $ before , $ type , $ tag_name , $ content , $ after ) = $ section ; $ rendered_before = $ this -> _renderTags ( $ before ) ; $ rendered_content = '' ; $ val = $ this -> _getVariable ( $ tag_name ) ; sw...
Internal render function used for recursive calls .
239,649
protected function _renderPragmas ( $ template ) { $ this -> _localPragmas = $ this -> _pragmas ; if ( strpos ( $ template , $ this -> _otag . '%' ) === false ) { return $ template ; } $ regEx = $ this -> _preparePragmaRegEx ( $ this -> _otag , $ this -> _ctag ) ; return preg_replace_callback ( $ regEx , array ( $ this...
Initialize pragmas and remove all pragma tags .
239,650
protected function _hasPragma ( $ pragma_name ) { if ( array_key_exists ( $ pragma_name , $ this -> _localPragmas ) && $ this -> _localPragmas [ $ pragma_name ] ) { return true ; } else { return false ; } }
Check whether this Mustache has a specific pragma .
239,651
protected function _getPragmaOptions ( $ pragma_name ) { if ( ! $ this -> _hasPragma ( $ pragma_name ) ) { if ( $ this -> _throwsException ( MustacheException :: UNKNOWN_PRAGMA ) ) { throw new MustacheException ( 'Unknown pragma: ' . $ pragma_name , MustacheException :: UNKNOWN_PRAGMA ) ; } } return ( is_array ( $ this...
Return pragma options if any .
239,652
protected function _renderTags ( $ template ) { if ( strpos ( $ template , $ this -> _otag ) === false ) { return $ template ; } $ first = true ; $ this -> _tagRegEx = $ this -> _prepareTagRegEx ( $ this -> _otag , $ this -> _ctag , true ) ; $ html = '' ; $ matches = array ( ) ; while ( preg_match ( $ this -> _tagRegEx...
Loop through and render individual Mustache tags .
239,653
protected function _renderTag ( $ modifier , $ tag_name , $ leading , $ trailing ) { switch ( $ modifier ) { case '=' : return $ this -> _changeDelimiter ( $ tag_name , $ leading , $ trailing ) ; break ; case '!' : return $ this -> _renderComment ( $ tag_name , $ leading , $ trailing ) ; break ; case '>' : case '<' : r...
Render the named tag given the specified modifier .
239,654
protected function _stringHasR ( $ str ) { foreach ( func_get_args ( ) as $ arg ) { if ( strpos ( $ arg , "\r" ) !== false ) { return true ; } } return false ; }
Returns true if any of its args contains the \ r character .
239,655
protected function _renderEscaped ( $ tag_name , $ leading , $ trailing ) { $ value = $ this -> _renderUnescaped ( $ tag_name , '' , '' ) ; if ( isset ( $ this -> _escape ) ) { $ rendered = call_user_func ( $ this -> _escape , $ value ) ; } else { $ rendered = htmlentities ( $ value , ENT_COMPAT , $ this -> _charset ) ...
Escape and return the requested tag .
239,656
protected function _renderUnescaped ( $ tag_name , $ leading , $ trailing ) { $ val = $ this -> _getVariable ( $ tag_name ) ; if ( $ this -> _varIsCallable ( $ val ) ) { $ val = $ this -> _renderTemplate ( call_user_func ( $ val ) ) ; } return $ leading . $ val . $ trailing ; }
Return the requested tag unescaped .
239,657
protected function _renderPartial ( $ tag_name , $ leading , $ trailing ) { $ partial = $ this -> _getPartial ( $ tag_name ) ; if ( $ leading !== null && $ trailing !== null ) { $ whitespace = trim ( $ leading , "\r\n" ) ; $ partial = preg_replace ( '/(\\r?\\n)(?!$)/s' , "\\1" . $ whitespace , $ partial ) ; } $ view = ...
Render the requested partial .
239,658
protected function _changeDelimiter ( $ tag_name , $ leading , $ trailing ) { list ( $ otag , $ ctag ) = explode ( ' ' , $ tag_name ) ; $ this -> _otag = $ otag ; $ this -> _ctag = $ ctag ; $ this -> _tagRegEx = $ this -> _prepareTagRegEx ( $ this -> _otag , $ this -> _ctag ) ; if ( $ leading !== null && $ trailing !==...
Change the Mustache tag delimiter . This method also replaces this object s current tag RegEx with one using the new delimiters .
239,659
protected function _pushContext ( & $ local_context ) { $ new = array ( ) ; $ new [ ] = & $ local_context ; foreach ( array_keys ( $ this -> _context ) as $ key ) { $ new [ ] = & $ this -> _context [ $ key ] ; } $ this -> _context = $ new ; }
Push a local context onto the stack .
239,660
protected function _popContext ( ) { $ new = array ( ) ; $ keys = array_keys ( $ this -> _context ) ; array_shift ( $ keys ) ; foreach ( $ keys as $ key ) { $ new [ ] = & $ this -> _context [ $ key ] ; } $ this -> _context = $ new ; }
Remove the latest context from the stack .
239,661
protected function _getVariable ( $ tag_name ) { if ( $ tag_name === '.' ) { return $ this -> _context [ 0 ] ; } else if ( strpos ( $ tag_name , '.' ) !== false ) { $ chunks = explode ( '.' , $ tag_name ) ; $ first = array_shift ( $ chunks ) ; $ ret = $ this -> _findVariableInContext ( $ first , $ this -> _context ) ; ...
Get a variable from the context array .
239,662
protected function _getPartial ( $ tag_name ) { if ( ( is_array ( $ this -> _partials ) || $ this -> _partials instanceof ArrayAccess ) && isset ( $ this -> _partials [ $ tag_name ] ) ) { return $ this -> _partials [ $ tag_name ] ; } else { $ partial_file = $ this -> server -> getRelAppPath ( 'views/' . $ tag_name . '....
Retrieve the partial corresponding to the requested tag name .
239,663
public function setName ( $ name ) { $ attrName = $ this -> isMultiple ( ) ? "{$name}[]" : $ name ; $ this -> setAttribute ( 'name' , $ attrName ) ; $ this -> name = $ name ; if ( $ label = $ this -> getLabel ( ) ) { $ this -> getLabel ( ) -> setAttribute ( 'for' , $ this -> generateId ( ) ) ; } return $ this ; }
Sets input name
239,664
public function setLabel ( $ label ) { $ this -> label = $ this -> checkLabel ( $ label ) ; $ class = $ this -> label -> getAttribute ( 'class' ) ; $ this -> label -> setAttribute ( 'for' , $ this -> generateId ( ) ) -> setAttribute ( 'class' , trim ( "control-label {$class}" ) ) ; return $ this ; }
Sets the input label
239,665
protected function generateId ( ) { $ inputId = static :: $ idPrefix . $ this -> getName ( ) ; if ( $ this -> isMultiple ( ) ) { $ inputId = "{$inputId}-{$this->instances}" ; } $ this -> setAttribute ( 'id' , $ inputId ) ; return $ inputId ; }
Generate input id based on provided name
239,666
protected function checkLabel ( $ label ) { if ( $ label instanceof ElementInterface ) { return $ label ; } return $ this -> createLabel ( $ this -> translate ( $ label ) ) ; }
Check provided label
239,667
protected function createLabel ( $ label ) { if ( ! is_string ( $ label ) ) { throw new InvalidArgumentException ( "Provided label is not a string or an ElementInterface " . "interface object." ) ; } $ element = class_exists ( $ label ) ? $ this -> createLabelFromClass ( $ label ) : new Label ( '' , $ label ) ; return ...
Creates label from string
239,668
public function setRequired ( $ required ) { $ this -> required = ( boolean ) $ required ; if ( $ this -> isRequired ( ) ) { $ this -> setAttribute ( 'required' ) ; return $ this ; } if ( $ this -> getAttributes ( ) -> containsKey ( 'required' ) ) { $ this -> getAttributes ( ) -> remove ( 'required' ) ; } return $ this...
Sets the required flag for this input
239,669
public function getInstanceValue ( ) { $ value = $ this -> getValue ( ) ; if ( is_array ( $ value ) && array_key_exists ( $ this -> instances , $ this -> value ) ) { $ value = $ value [ $ this -> instances ] ; } return $ value ; }
If input is multiple get the instance value of it
239,670
protected function updateInstance ( ) { $ this -> instances ++ ; $ id = $ this -> generateId ( ) ; $ this -> setAttribute ( $ id , $ id ) ; if ( $ label = $ this -> getLabel ( ) ) { $ label -> setAttribute ( 'for' , $ id ) ; } return $ this ; }
Updates input id and link it to its label
239,671
public function addRepositoryDefinition ( RepositoryDefinitionInterface $ repositoryDefinition ) { $ slug = $ repositoryDefinition -> getSlug ( ) ; if ( isset ( $ this -> repositoriesBySlug [ $ slug ] ) ) { throw new DomainErrorException ( 'Two repositories has the same "' . $ slug . '" slug!' ) ; } $ this -> repositor...
Add a repository definition to the pool
239,672
function fromRelation ( $ relationship , $ repository , \ Closure $ loadCallback ) { $ class = $ relationship -> getType ( ) ; return $ this -> fromEntity ( $ relationship , $ class , $ repository , $ loadCallback ) ; }
Creates a proxy object for an Everyman relationship .
239,673
function fromEntity ( $ entity , $ class , $ repository , $ callback = null ) { $ meta = $ repository -> fromClass ( $ class ) ; $ proxy = $ this -> createProxy ( $ meta ) ; $ proxy -> __setMeta ( $ meta ) ; $ proxy -> __setEntity ( $ entity ) ; $ proxy -> __setLoadCallback ( $ callback ) ; $ proxy -> __setEntity ( $ e...
Creates a proxy object for a Everyman node or relationship .
239,674
private function createProxy ( GraphElement $ meta ) { $ proxyClass = $ meta -> getProxyClass ( ) ; $ className = $ meta -> getName ( ) ; if ( class_exists ( $ proxyClass , false ) ) { return $ this -> newInstance ( $ proxyClass ) ; } $ targetFile = "{$this->proxyDir}/$proxyClass.php" ; if ( $ this -> debug || ! file_e...
Creates a proxy class for a graph element .
239,675
private function newInstance ( $ proxyClass ) { static $ prototypes = array ( ) ; if ( ! array_key_exists ( $ proxyClass , $ prototypes ) ) { $ prototypes [ $ proxyClass ] = unserialize ( sprintf ( 'O:%d:"%s":0:{}' , strlen ( $ proxyClass ) , $ proxyClass ) ) ; } return clone $ prototypes [ $ proxyClass ] ; }
Create a new instance of a proxy class object .
239,676
private function methodProxy ( $ method , $ meta ) { $ property = $ meta -> findProperty ( $ method -> getName ( ) ) ; if ( ! $ property ) { return ; } if ( $ property -> isProperty ( ) && ! $ property -> isStart ( ) && ! $ property -> isEnd ( ) ) { return ; } $ parts = array ( ) ; $ arguments = array ( ) ; foreach ( $...
Creates proxy methods from the reflection method handle and meta information .
239,677
public static function remove ( $ path ) { if ( is_dir ( $ path ) ) { if ( false === ( $ dir = opendir ( $ path ) ) ) { throw FileException :: removeFailed ( $ path ) ; } while ( false !== ( $ item = readdir ( $ dir ) ) ) { if ( ( '.' === $ item ) || ( '..' === $ item ) ) { continue ; } self :: remove ( $ path . DIRECT...
Recursively removes a path from the file system .
239,678
protected function serialize ( $ value ) { if ( ! is_array ( $ value ) ) { return $ value ; } return Serialize :: serialize ( $ value , $ this -> serializer ) ; }
Serialize value .
239,679
protected function microtime ( $ microtime = null ) { list ( $ usec , $ sec ) = explode ( " " , $ microtime ? : microtime ( ) ) ; return ( float ) $ usec + ( float ) $ sec ; }
Returns a microtime .
239,680
public function binaryFile ( $ file , $ status = 200 , array $ headers = [ ] , $ public = true , $ contentDisposition = null , $ autoEtag = false , $ autoLastModified = true ) { return new BinaryFileResponse ( $ file , $ status , $ headers , $ public , $ contentDisposition , $ autoEtag , $ autoLastModified ) ; }
Create a new BinaryFileResponse
239,681
public function fileDownload ( $ file ) { $ response = new SymfonyResponse ( ) ; $ response -> headers -> set ( 'Content-Disposition' , $ response -> headers -> makeDisposition ( ResponseHeaderBag :: DISPOSITION_ATTACHMENT , $ file ) ) ; return $ response ; }
Create a new file download response
239,682
private function generateMeta ( ) : void { $ generator = new Meta \ Generator ( ) ; $ generator -> register ( $ this -> generateMetaDataForRouter ( Broker :: getInstance ( ) , 'getRouter' ) ) ; $ generator -> register ( $ this -> generateMetaDataForRouter ( Broker :: getInstance ( ) -> getRouter ( Locator \ ByClassName...
Generates file with meta
239,683
public function setRequest ( $ request , $ waitForResult = true ) { $ this -> previousRequest = $ this -> request ; $ this -> request = $ request ; $ this -> waitForResult = $ waitForResult ; $ this -> bucket -> refresh ( $ this ) ; return $ this ; }
Sets the request the client is interested in .
239,684
public function seleccionarBd ( $ basedatos ) { if ( $ this -> pdo -> exec ( 'USE ' . $ basedatos ) === false ) { if ( $ this -> arrojarExcepciones ) { throw new \ RuntimeException ( 'No se pudo seleccionar base de datos.' ) ; } return false ; } return true ; }
Selecciona la base de datos interna .
239,685
public function prepararValor ( $ valor , $ tipo = 'txt' , $ permiteVacio = false ) { if ( is_array ( $ valor ) ) { if ( empty ( $ valor ) ) { return 'NULL' ; } foreach ( $ valor as $ llave => $ v ) { $ valor [ $ llave ] = $ this -> prepararValor ( $ v , $ tipo ) ; } return $ valor ; } if ( $ tipo == 'bol' || $ tipo ==...
Prepara valor segun tipo especificado .
239,686
public function obtenerPrimero ( $ clase = null , array $ claseArgs = [ ] ) { $ resultado = $ this -> obtener ( null , null , $ clase , $ claseArgs ) ; if ( $ resultado !== false ) { return array_shift ( $ resultado ) ; } return false ; }
Devuelve el primer registro generado por la consulta de la sentencia interna .
239,687
public function ejecutar ( ) { if ( empty ( $ this -> sentencia ) ) { if ( $ this -> arrojarExcepciones ) { throw new \ InvalidArgumentException ( 'La sentencia a ejecutar se encuentra vacia.' ) ; } return false ; } $ resultado = $ this -> pdo -> exec ( $ this -> sentencia ) ; if ( $ resultado === false ) { if ( $ this...
Ejecuta la sentencia interna .
239,688
public function preparar ( ) { if ( empty ( $ this -> sentencia ) ) { if ( $ this -> arrojarExcepciones ) { throw new \ InvalidArgumentException ( 'La sentencia a preparar se encuentra vacia.' ) ; } } return $ this -> pdo -> prepare ( $ this -> sentencia ) ; }
Prepara la sentencia interna para su uso exterior .
239,689
public function seleccionar ( $ campos , $ tabla ) { if ( is_array ( $ campos ) ) { $ this -> sentencia = 'SELECT ' . implode ( ', ' , $ campos ) ; } else { $ this -> sentencia = 'SELECT ' . $ campos ; } $ this -> sentencia .= ' FROM ' . $ tabla ; return $ this ; }
Inicia la sentencia interna con SELECT .
239,690
public function donde ( array $ params = null ) { if ( $ params ) { $ terminos_sql = [ ] ; foreach ( $ params as $ llave => $ valor ) { $ llave = trim ( $ llave ) ; if ( false === ( $ temp = strpos ( $ llave , ' ' ) ) ) { $ restante = $ llave ; } else { $ restante = substr ( $ llave , 0 , $ temp ) ; $ operador = substr...
Prepara los campos que filtran la sentencia interna .
239,691
public function limitar ( $ pos , $ limite = null ) { if ( $ limite ) { $ this -> sentencia .= ' LIMIT ' . $ pos . ',' . $ limite ; } else { $ this -> sentencia .= ' LIMIT ' . $ pos ; } return $ this ; }
Implementa LIMIT a la sentencia interna .
239,692
public function actualizar ( $ tabla , array $ params ) { $ terminos_sql = [ ] ; foreach ( $ params as $ llave => $ valor ) { $ temp = explode ( '|' , $ llave ) ; $ campo = $ temp [ 0 ] ; if ( isset ( $ temp [ 1 ] ) ) { $ tipo = $ temp [ 1 ] ; } else { $ tipo = 'auto' ; } $ terminos_sql [ ] = $ campo . ' = ' . $ this -...
Inicia la sentencia interna con UPDATE .
239,693
public function insertar ( $ tabla , array $ params ) { $ columnas = [ ] ; $ valores = [ ] ; foreach ( $ params as $ llave => $ valor ) { $ temp = explode ( '|' , $ llave ) ; $ campo = $ temp [ 0 ] ; if ( isset ( $ temp [ 1 ] ) ) { $ tipo = $ temp [ 1 ] ; } else { $ tipo = 'auto' ; } $ columnas [ ] = $ campo ; $ valore...
Inicia la sentencia interna con INSERT .
239,694
public function get ( $ url , $ data ) { curl_setopt ( $ this -> _ch , CURLOPT_CUSTOMREQUEST , 'GET' ) ; curl_setopt ( $ this -> _ch , CURLOPT_URL , sprintf ( "%s?%s" , $ url , http_build_query ( $ data , '' , '&' , PHP_QUERY_RFC3986 ) ) ) ; curl_setopt ( $ this -> _ch , CURLOPT_HTTPHEADER , array ( "Accept:application...
Perform an HTTP GET
239,695
protected function _initialize ( ) { $ this -> _ch = curl_init ( ) ; $ this -> _last_info = FALSE ; curl_setopt ( $ this -> _ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ this -> _ch , CURLOPT_SSL_VERIFYPEER , false ) ; curl_setopt ( $ this -> _ch , CURLOPT_TIMEOUT , 60 ) ; curl_setopt ( $ this -> _ch , CURLOP...
Initialize the curl resource and options
239,696
protected function _exec ( ) { $ response = curl_exec ( $ this -> _ch ) ; $ this -> _last_info = curl_getinfo ( $ this -> _ch ) ; $ error = curl_error ( $ this -> _ch ) ; if ( $ error ) { throw new \ Exception ( $ error ) ; } return $ response ; }
Execute a curl request . Maintain the info from the request in a variable
239,697
public function get ( AbstractModel $ model ) { if ( ! $ this -> repo -> isModel ( $ model ) ) { throw new InvalidArgumentException ( sprintf ( 'Model must be %s, was %s' , $ this -> repo -> getModelClass ( ) , get_class ( $ model ) ) ) ; } if ( $ this -> map -> contains ( $ model ) ) { return $ this -> map [ $ model ]...
Get Links object associated with this model . If there is none an empty Links object is created .
239,698
protected function getKeysForSource ( int $ sourceId ) : \ Traversable { $ row = $ this -> getRow ( $ sourceId ) ; foreach ( $ this -> extractors as $ extractor ) { switch ( true ) { case $ extractor instanceof MultiStringExtractorInterface : foreach ( $ extractor -> keys ( $ row ) as $ key ) { yield $ extractor -> nam...
Get the keys for the source id .
239,699
protected function createValueReader ( int $ sourceId , int $ targetId , ExtractorInterface $ extractor , string $ trail ) : TranslationValueInterface { return new TranslationValue ( $ this , $ sourceId , $ targetId , $ extractor , $ trail ) ; }
Create a value reader instance .