idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
59,400 | public static function _genSQL ( $ params = array ( ) , & $ db = FALSE ) { if ( ! isset ( $ params [ 'select' ] ) ) { $ params [ 'select' ] = '*' ; } if ( ! isset ( $ params [ 'from' ] ) ) { $ params [ 'from' ] = '`' . static :: $ dbTable . '`' ; } if ( $ db === FALSE ) { $ db = & self :: _getDbSlave ( ) ; } if ( ! ( $... | Generate the SQL for a query on the model |
59,401 | public static function _toXML ( $ params = array ( ) , $ attributes = FALSE , & $ db = FALSE ) { $ class = str_replace ( '\\' , '_' , str_replace ( 'sonic\\model\\' , '' , strtolower ( get_called_class ( ) ) ) ) ; $ doc = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; $ xml = $ doc -> createElement ( 'elements' ) ; $ doc -> a... | Return a DOM tree with objects for given query parameters |
59,402 | public static function _toJSON ( $ params = array ( ) , $ attributes = FALSE , $ addClass = FALSE , & $ db = FALSE ) { $ rows = static :: _toArray ( $ params , $ attributes , $ db ) ; if ( $ addClass ) { $ class = str_replace ( '\\' , '_' , str_replace ( 'sonic\\model\\' , '' , strtolower ( get_called_class ( ) ) ) ) ;... | Return a JSON encoded string with objects for given query parameters |
59,403 | public static function _toArray ( $ params = array ( ) , $ attributes = FALSE , & $ db = FALSE ) { if ( $ attributes === FALSE ) { $ attributes = array ( ) ; $ obj = new static ; foreach ( array_keys ( static :: $ attributes ) as $ name ) { if ( $ obj -> attributeGet ( $ name ) ) { $ attributes [ ] = $ name ; } } } if ... | Return an array with object attributes for given query parameters |
59,404 | public static function _getRelationPaths ( $ endClass , $ fork = array ( ) , $ paths = array ( ) , $ processed = array ( ) , $ depth = 0 ) { if ( $ endClass [ 0 ] == '\\' ) { $ endClass = substr ( $ endClass , 1 ) ; } if ( $ fork === FALSE ) { $ fork = array ( ) ; } $ class = get_called_class ( ) ; $ processed [ ] = st... | Return an array of available paths to a related class |
59,405 | public static function _getRelation ( $ obj , $ path , $ params = array ( ) ) { foreach ( $ path as $ class => $ name ) { $ class = get_class ( $ obj ) ; $ childClass = $ class :: $ attributes [ $ name ] [ 'relation' ] ; if ( $ obj -> iget ( $ name ) ) { $ params [ 'where' ] [ ] = array ( $ childClass :: $ pk , $ obj -... | Return a related object for a given object and path |
59,406 | public static function _getChildren ( $ class , $ id , $ recursive = FALSE , $ key = FALSE , $ params = array ( ) ) { if ( $ class [ 0 ] == '\\' ) { $ class = substr ( $ class , 1 ) ; } $ parent = get_called_class ( ) ; $ var = FALSE ; foreach ( $ class :: $ attributes as $ name => $ attribute ) { if ( isset ( $ attrib... | Return child objects with an attribute matching the current class and specified ID |
59,407 | public function getFromPivot ( \ Sonic \ Model $ target , \ Sonic \ Model $ pivot , $ key = FALSE , $ params = [ ] ) { $ sourceClass = get_called_class ( ) ; $ sourceRef = FALSE ; foreach ( $ pivot :: $ attributes as $ name => $ attribute ) { if ( isset ( $ attribute [ 'relation' ] ) && $ attribute [ 'relation' ] == $ ... | Return related objects from a many - to - many pivot table |
59,408 | public static function _getGrid ( $ params = array ( ) , $ relations = array ( ) , & $ db = FALSE ) { if ( ! $ params || ! isset ( $ params [ 'limit' ] ) ) { $ params [ 'limit' ] = array ( 0 , 50 ) ; } if ( $ relations ) { $ objs = static :: _getObjects ( $ params , $ db ) ; $ data = array ( ) ; foreach ( $ objs as $ o... | Return an array of items with total result count |
59,409 | public static function & _getResource ( $ name ) { if ( is_array ( $ name ) ) { return Sonic :: getResource ( $ name ) ; } else if ( isset ( static :: $ defaultResources [ $ name ] ) ) { return Sonic :: getResource ( static :: $ defaultResources [ $ name ] ) ; } else { return Sonic :: getSelectedResource ( $ name ) ; }... | Return a class resource This will either be the default as defined for the class or the global framework resource |
59,410 | public static function & _getRandomDbResource ( $ group ) { $ obj = FALSE ; while ( Sonic :: countResourceGroup ( $ group ) > 0 ) { $ name = Sonic :: selectRandomResource ( $ group ) ; $ obj = & Sonic :: getResource ( array ( $ group , $ name ) ) ; if ( $ obj instanceof \ PDO ) { if ( $ obj instanceof Resource \ Db ) {... | Return random database resource object |
59,411 | private function changelog ( $ type ) { if ( isset ( static :: $ changelogIgnore ) ) { if ( static :: $ changelogIgnore === TRUE || is_array ( static :: $ changelogIgnore ) && in_array ( $ type , static :: $ changelogIgnore ) ) { return FALSE ; } } if ( ! ( $ this -> getResource ( 'changelog' ) instanceof Resource \ Ch... | Whether to write to the changelog |
59,412 | public function css ( $ path , $ plugin = false , $ appendTime = true , array $ attributes = [ ] ) { $ href = $ this -> getUrl ( $ path , $ plugin , $ appendTime ) ; return '<link rel="stylesheet" type="text/css" href="' . $ href . '"' . $ this -> _renderAttributes ( $ attributes ) . '>' ; } | Output a link stylesheet tag for a specific css file and optionally append a last modified timestamp to clear the browser cache . |
59,413 | public function js ( $ path , $ plugin = false , $ appendTime = true , array $ attributes = [ ] ) { $ src = $ this -> getUrl ( $ path , $ plugin , $ appendTime ) ; return '<script type="text/javascript" src="' . $ src . '"' . $ this -> _renderAttributes ( $ attributes ) . '></script>' ; } | Output a script tag for a specific js file and optionally append a last modified timestamp to clear the browser cache . |
59,414 | public function getUrl ( $ path , $ plugin , $ appendTime = true ) { $ pathParts = explode ( '/' , $ path ) ; $ isAssetPath = ( $ pathParts [ 0 ] === 'ASSETS' ) ; if ( $ isAssetPath ) { $ absPath = $ this -> _getBaseAssetPath ( $ plugin ) . join ( '/' , array_slice ( $ pathParts , 1 ) ) ; } else { $ absPath = $ this ->... | Get the asset url for a specific file . |
59,415 | protected function _getBasePath ( $ plugin = false ) { if ( $ plugin !== false ) { return $ this -> _getPluginPath ( $ plugin ) . 'webroot' . DS ; } return WWW_ROOT ; } | Get the base path to the app webroot or a plugin webroot . |
59,416 | protected function _renderAttributes ( array $ attributes = [ ] ) { $ attributeStrings = [ ] ; foreach ( $ attributes as $ attribute => $ value ) { $ attributeStrings [ ] = $ attribute . '="' . htmlentities ( $ value ) . '"' ; } if ( empty ( $ attributeStrings ) ) { return '' ; } return ' ' . join ( ' ' , $ attributeSt... | Render attribute key value pairs as html attributes . |
59,417 | public function renderWidget ( ) { echo Html :: beginTag ( 'div' , [ 'class' => 'nestable-box' ] ) ; foreach ( $ this -> items as $ item ) { $ this -> renderGroup ( $ item ) ; } echo Html :: endTag ( 'div' ) ; if ( $ this -> hasModel ( ) ) { echo Html :: activeHiddenInput ( $ this -> model , $ this -> attribute ) ; } e... | Initializes and renders the widget |
59,418 | public function http ( ) { $ this -> writeln ( 'Starting swoole http server...' ) ; $ server = new HttpServer ( $ this -> swooleConfig [ 'http' ] [ 'host' ] ?? self :: DEFAULT_SWOOLE_HOST , $ this -> swooleConfig [ 'http' ] [ 'port' ] ?? self :: DEFAULT_SWOOLE_PORT ) ; $ server -> on ( 'Request' , function ( $ request ... | Swoole Http Server |
59,419 | public function tcp ( ) { $ this -> writeln ( 'Starting swoole tcp server...' ) ; $ server = new TcpServer ( $ this -> swooleConfig [ 'tcp' ] [ 'host' ] ?? self :: DEFAULT_SWOOLE_HOST , $ this -> swooleConfig [ 'tcp' ] [ 'port' ] ?? self :: DEFAULT_SWOOLE_PORT ) ; $ server -> set ( [ 'open_eof_split' => true , 'package... | Swoole Tcp Server |
59,420 | public function udp ( ) { $ this -> writeln ( 'Starting swoole udp server...' ) ; $ udpServer = new TcpServer ( $ this -> swooleConfig [ 'upd' ] [ 'host' ] ?? self :: DEFAULT_SWOOLE_HOST , $ this -> swooleConfig [ 'upd' ] [ 'port' ] ?? self :: DEFAULT_SWOOLE_PORT , SWOOLE_PROCESS , SWOOLE_SOCK_UDP ) ; $ udpServer -> se... | Swoole UDP Server |
59,421 | public function websocket ( ) { $ this -> writeln ( 'Starting swoole websocket server...' ) ; $ ws = new WebsocketServer ( $ this -> swooleConfig [ 'ws' ] [ 'host' ] ?? self :: DEFAULT_SWOOLE_HOST , $ this -> swooleConfig [ 'ws' ] [ 'port' ] ?? self :: DEFAULT_SWOOLE_PORT ) ; $ ws -> on ( 'open' , function ( $ ws , $ r... | Swoole Websocket Server |
59,422 | public function mqtt ( ) { $ this -> writeln ( 'Starting swoole mqtt server...' ) ; $ serv = new TcpServer ( $ this -> swooleConfig [ 'tcp' ] [ 'host' ] ?? self :: DEFAULT_SWOOLE_HOST , $ this -> swooleConfig [ 'tcp' ] [ 'port' ] ?? self :: DEFAULT_SWOOLE_PORT , SWOOLE_BASE ) ; $ serv -> set ( array ( 'open_mqtt_protoc... | Swoole Mqtt Server |
59,423 | public function udpClient ( ) { $ this -> writeln ( 'Starting demo swoole udp client...' ) ; $ client = new TcpClient ( SWOOLE_SOCK_UDP , SWOOLE_SOCK_ASYNC ) ; $ client -> on ( 'connect' , function ( $ cli ) { $ cli -> send ( JsonHelper :: encode ( [ 'handler' => SwooleTcpJob :: class ] ) . self :: EOF ) ; } ) ; $ clie... | Swoole UDP Client Demo |
59,424 | public function websocketClient ( ) { $ this -> writeln ( 'Starting demo websocket client...' ) ; $ client = new Client ( 'ws://' . ( $ this -> swooleConfig [ 'ws' ] [ 'host' ] ?? self :: DEFAULT_SWOOLE_HOST ) . ':' . ( $ this -> swooleConfig [ 'ws' ] [ 'port' ] ?? self :: DEFAULT_SWOOLE_PORT ) ) ; $ client -> send ( J... | Websocket Client Demo |
59,425 | final protected function map ( ) { $ result = df_map_0 ( [ ] , $ met = $ this -> isRequirementMet ( ) ? null : $ this -> requirement ( ) ) ; if ( $ met ) { try { $ result += $ this -> fetch ( ) ; } catch ( \ Exception $ e ) { $ result = $ this -> exception ( $ e ) ; } } return $ result ; } | 2017 - 07 - 02 |
59,426 | public function getControllerOptions ( ) { if ( empty ( $ this -> controllerOptions ) ) { $ routePluginManager = $ this -> getServiceLocator ( ) ; if ( empty ( $ routePluginManager ) ) { throw new Exception \ RuntimeException ( 'ServiceLocator not set' ) ; } $ sl = $ routePluginManager -> getServiceLocator ( ) ; if ( e... | Fetches and returns the associated ListControllerOptions for this route |
59,427 | protected function extractValue ( ModelStubInterface $ model , $ name , $ value , $ extractName = true ) { $ modelHydrator = $ model -> getHydrator ( ) ; if ( ! $ modelHydrator || ! method_exists ( $ modelHydrator , 'extractValue' ) ) { throw new Exception \ RuntimeException ( 'Model hydrator must be set and must have ... | Extract a value in order to be used within datagateway context |
59,428 | protected function extractName ( ModelStubInterface $ model , $ name ) { if ( $ model -> getObjectPrototype ( ) instanceof HydratorAwareInterface ) { $ objectHydrator = $ model -> getObjectPrototype ( ) -> getHydrator ( ) ; if ( ! $ objectHydrator || ! method_exists ( $ objectHydrator , 'hydrateName' ) ) { throw new Ex... | Extract a name in order to be used within datagateway context |
59,429 | protected function _getSpaceAlignmentInArray ( $ lineIndex , $ testable ) { if ( ! $ lineIndex ) { return ; } $ tokens = $ testable -> tokens ( ) ; $ lines = $ testable -> lines ( ) ; $ lineCache = $ testable -> lineCache ( ) ; $ prevLine = $ lines [ $ lineIndex - 1 ] ; $ previousTokens = $ lineCache [ $ testable -> fi... | Return the minimal space required for a multilined expression in an array definition . |
59,430 | protected function _getIndent ( $ line ) { $ count = $ space = $ tab = 0 ; $ end = strlen ( $ line ) ; while ( ( $ count < $ end ) && ( $ line [ $ count ] === "\t" ) ) { $ tab ++ ; $ count ++ ; } while ( ( $ count < $ end ) && ( $ line [ $ count ] === ' ' ) ) { $ space ++ ; $ count ++ ; } return array ( 'space' => $ sp... | Will determine how many tabs are at the beginning of a line . |
59,431 | public function configure ( $ prefix , $ resourceName , array $ options ) { $ this -> prefix = $ prefix ; $ this -> resourceName = $ resourceName ; $ this -> options = $ this -> getOptionsResolver ( ) -> resolve ( $ options ) ; return $ this ; } | Configures the pool builder . |
59,432 | private function createEntityClassParameter ( ) { $ id = $ this -> getServiceId ( 'class' ) ; if ( ! $ this -> container -> hasParameter ( $ id ) ) { $ this -> container -> setParameter ( $ id , $ this -> options [ 'entity' ] ) ; } $ this -> configureInheritanceMapping ( $ this -> prefix . '.' . $ this -> resourceName ... | Creates the entity class parameter . |
59,433 | private function createConfigurationDefinition ( ) { $ id = $ this -> getServiceId ( 'configuration' ) ; if ( ! $ this -> container -> has ( $ id ) ) { $ definition = new Definition ( self :: CONFIGURATION ) ; $ definition -> setFactory ( [ new Reference ( 'ekyna_admin.pool_factory' ) , 'createConfiguration' ] ) -> set... | Creates the Configuration service definition . |
59,434 | private function buildTemplateList ( $ templatesConfig ) { $ templateNamespace = self :: DEFAULT_TEMPLATES ; if ( is_string ( $ templatesConfig ) ) { $ templateNamespace = $ templatesConfig ; } $ templatesList = [ ] ; foreach ( self :: $ templates as $ name => $ extensions ) { foreach ( $ extensions as $ extension ) { ... | Builds the templates list . |
59,435 | private function createManagerDefinition ( ) { $ id = $ this -> getServiceId ( 'manager' ) ; if ( ! $ this -> container -> has ( $ id ) ) { $ this -> container -> setAlias ( $ id , new Alias ( $ this -> getManagerServiceId ( ) ) ) ; } } | Creates the manager definition . |
59,436 | private function createRepositoryDefinition ( ) { $ id = $ this -> getServiceId ( 'repository' ) ; if ( ! $ this -> container -> has ( $ id ) ) { $ definition = new Definition ( $ class = $ this -> getServiceClass ( 'repository' ) ) ; $ definition -> setArguments ( [ new Reference ( $ this -> getServiceId ( 'manager' )... | Creates the Repository service definition . |
59,437 | private function createOperatorDefinition ( ) { $ id = $ this -> getServiceId ( 'operator' ) ; if ( ! $ this -> container -> has ( $ id ) ) { $ definition = new Definition ( $ this -> getServiceClass ( 'operator' ) ) ; $ definition -> setArguments ( [ new Reference ( $ this -> getManagerServiceId ( ) ) , new Reference ... | Creates the operator service definition . |
59,438 | private function createControllerDefinition ( ) { $ id = $ this -> getServiceId ( 'controller' ) ; if ( ! $ this -> container -> has ( $ id ) ) { $ definition = new Definition ( $ this -> getServiceClass ( 'controller' ) ) ; $ definition -> addMethodCall ( 'setConfiguration' , [ new Reference ( $ this -> getServiceId (... | Creates the Controller service definition . |
59,439 | private function configureTranslations ( ) { if ( null !== array_key_exists ( 'translation' , $ this -> options ) && is_array ( $ this -> options [ 'translation' ] ) ) { $ translatable = $ this -> options [ 'entity' ] ; $ translation = $ this -> options [ 'translation' ] [ 'entity' ] ; $ id = sprintf ( '%s.%s_translati... | Configure the translation |
59,440 | private function configureInheritanceMapping ( $ id , $ entity , $ repository ) { $ entities = [ $ id => [ 'class' => $ entity , 'repository' => $ repository , ] , ] ; if ( $ this -> container -> hasParameter ( 'ekyna_core.entities' ) ) { $ entities = array_merge ( $ this -> container -> getParameter ( 'ekyna_core.enti... | Configures mapping inheritance . |
59,441 | private function getServiceClass ( $ name ) { $ serviceId = $ this -> getServiceId ( $ name ) ; $ parameterId = $ serviceId . '.class' ; if ( $ this -> container -> hasParameter ( $ parameterId ) ) { $ class = $ this -> container -> getParameter ( $ parameterId ) ; } elseif ( array_key_exists ( $ name , $ this -> optio... | Returns the service class for the given name . |
59,442 | public function getDescription ( ) { return isset ( $ this -> _data [ self :: PROFILE ] [ self :: DESCRIPTION ] ) ? $ this -> _data [ self :: PROFILE ] [ self :: DESCRIPTION ] : null ; } | Retrieves the user s description . |
59,443 | public function getName ( ) { return isset ( $ this -> _data [ self :: PROFILE ] [ self :: NAME ] ) ? $ this -> _data [ self :: PROFILE ] [ self :: NAME ] : null ; } | Retrieves the user s name . |
59,444 | public function getLocation ( ) { return isset ( $ this -> _data [ self :: PROFILE ] [ self :: LOCATION ] ) ? $ this -> _data [ self :: PROFILE ] [ self :: LOCATION ] : null ; } | Retrieves the user s location . |
59,445 | public function getTwitter ( ) { return isset ( $ this -> _data [ self :: PROFILE ] [ self :: TWITTER_USERNAME ] ) ? $ this -> _data [ self :: PROFILE ] [ self :: TWITTER_USERNAME ] : null ; } | Retrieves the user s twitter username . |
59,446 | public function getWebsite ( ) { return isset ( $ this -> _data [ self :: PROFILE ] [ self :: WEBSITE ] ) ? $ this -> _data [ self :: PROFILE ] [ self :: WEBSITE ] : null ; } | Retrievs the user s website . |
59,447 | public function getServices ( ) { return isset ( $ this -> _data [ self :: PROFILE ] [ self :: SERVICES ] ) ? $ this -> _data [ self :: PROFILE ] [ self :: SERVICES ] : null ; } | Retrieves the user s services . |
59,448 | public function getQwerly ( ) { return isset ( $ this -> _data [ self :: PROFILE ] [ self :: QWERLY ] ) ? $ this -> _data [ self :: PROFILE ] [ self :: QWERLY ] : null ; } | Retrieves the user s qwerly username . |
59,449 | public function getFacebook ( ) { return isset ( $ this -> _data [ self :: PROFILE ] [ self :: FACEBOOK_ID ] ) ? $ this -> _data [ self :: PROFILE ] [ self :: FACEBOOK_ID ] : null ; } | Retrieves the user s facebook id . |
59,450 | function alphaId ( $ in , $ to_num = false , $ pad_up = false , $ pass_key = null ) { $ out = '' ; $ index = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' ; $ base = strlen ( $ index ) ; if ( $ pass_key !== null ) { for ( $ n = 0 ; $ n < strlen ( $ index ) ; $ n ++ ) { $ i [ ] = substr ( $ index , $ ... | Translates a number to a short alhanumeric version |
59,451 | protected function _buildRequest ( ) { $ this -> _request = $ this -> _factory -> getNewCancelBuildRequest ( $ this -> _api , $ this -> _order ) -> build ( ) ; return $ this ; } | Build order cancel payload . |
59,452 | protected function _sendRequest ( ) { $ this -> _response = $ this -> _factory -> getNewCancelSendRequest ( $ this -> _api , $ this -> _request ) -> send ( ) ; return $ this ; } | Send order cancel payload . |
59,453 | protected function _processResponse ( ) { $ this -> _factory -> getNewCancelProcessResponse ( $ this -> _response , $ this -> _order ) -> process ( ) ; return $ this ; } | Process order cancel response . |
59,454 | public static function create ( $ code , $ value = 0 ) { $ cd = strtoupper ( $ code ) ; list ( $ symbol , $ precision , $ name ) = self :: getDefinition ( $ cd ) ; $ crcy = new Currency ( $ value , $ cd , $ symbol , $ precision , $ name ) ; $ crcy -> setLocale ( self :: getLocale ( ) ) ; return $ crcy ; } | Create a currency |
59,455 | protected static function getDefinition ( $ code ) { $ currencies = self :: getDefinitions ( ) ; $ nodes = $ currencies -> xpath ( "//currency[@code='{$code}']" ) ; if ( empty ( $ nodes ) ) { throw new \ InvalidArgumentException ( "Unknown currency: {$code}" ) ; } $ cNode = $ nodes [ 0 ] ; $ def = array ( self :: creat... | Get a currency definition |
59,456 | protected static function getDefinitions ( ) { if ( empty ( self :: $ definitions ) ) { self :: $ definitions = \ simplexml_load_file ( __DIR__ . '/currencies.xml' ) ; } return self :: $ definitions ; } | Load currency definitions |
59,457 | protected static function createSymbol ( \ SimpleXMLElement $ sNode , $ code ) { switch ( ( string ) $ sNode [ 'type' ] ) { case 'UCS' : $ symbol = ( string ) $ sNode [ 'UTF-8' ] ; break ; case null : default : $ symbol = $ code ; break ; } return $ symbol ; } | Create currency symbol from the symbol node |
59,458 | protected static function createName ( \ SimpleXMLElement $ currency ) { $ locale = self :: getLocale ( ) ; $ nodes = $ currency -> xpath ( "name[@lang='{$locale}']" ) ; if ( count ( $ nodes ) > 0 ) { return ( string ) $ nodes [ 0 ] ; } $ lang = \ locale_get_primary_language ( $ locale ( ) ) ; $ nodes = $ currency -> x... | Find closest matching name for a currency based on currently set locale . Default to en entry if none more suitable found |
59,459 | protected function getTotal ( $ directory , array $ options = array ( ) ) { $ options [ 'count' ] = true ; return ( int ) $ this -> scanner -> scan ( $ directory , $ options ) ; } | Returns a total number of scanned files |
59,460 | protected function getRelativePath ( $ path = null ) { if ( ! isset ( $ path ) ) { $ path = $ this -> scanner -> getInitialPath ( true ) ; } return gplcart_path_normalize ( gplcart_path_relative ( $ path ) ) ; } | Returns a relative file path or initial directory |
59,461 | protected function move ( $ src , $ dest , & $ errors = 0 , & $ success = 0 ) { $ this -> copy ( $ src , $ dest , $ errors , $ success ) ; if ( empty ( $ errors ) ) { gplcart_file_delete_recursive ( $ src , $ errors ) ; } return empty ( $ errors ) ; } | Moves a file to a new destination |
59,462 | protected function isInitialPath ( $ file ) { $ current_path = gplcart_path_normalize ( $ file -> getRealPath ( ) ) ; $ initial_path = gplcart_path_normalize ( $ this -> scanner -> getInitialPath ( true ) ) ; return $ current_path === $ initial_path ; } | Whether the current file is the initial file manager path |
59,463 | public function setLocation ( Location $ location ) { foreach ( $ this -> handlers as $ handler ) { if ( $ handler instanceof LocationAwareHandlerInterface ) { $ handler -> setLocation ( $ location ) ; } } } | Passes location to location aware handlers |
59,464 | public function setContent ( Content $ content ) { foreach ( $ this -> handlers as $ handler ) { if ( $ handler instanceof ContentAwareHandlerInterface ) { $ handler -> setContent ( $ content ) ; } } } | Passes content to content aware handlers |
59,465 | public function httpAction ( ) { $ status = self :: STATUS_SUCCESS ; $ responses = array ( ) ; $ exception = null ; $ data = null ; $ debug = $ this -> getRouteParam ( 'debug' , false ) ; try { $ service = $ this -> fetchService ( ) ; $ operation = $ service ? $ this -> fetchOperation ( ) : false ; if ( ! $ service ) {... | Performs service operation matched by HTTP router |
59,466 | public function consoleAction ( ) { $ request = $ this -> getRequest ( ) ; $ service = $ this -> fetchService ( ) ; $ operation = $ this -> fetchOperation ( ) ; $ query = $ this -> fetchConsoleQuery ( ) ; if ( ! $ request instanceof ConsoleRequest ) { throw new \ RuntimeException ( 'You can only use this action from a ... | Performs service operation routed by console router |
59,467 | protected function prepareHttpResponse ( $ data , $ status , $ exception = null ) { $ error = $ this -> getRequest ( ) -> getHeader ( self :: HEADER_ERRORS , self :: HEADER_ERRORS_DEFAULT ) ; $ forceHtmlContentType = $ this -> getRequest ( ) -> getHeader ( self :: HEADER_FORCE_CONTENT_HTML , false ) ; if ( $ error inst... | Prepares HTTP response |
59,468 | protected function prepareConsoleResponse ( $ data , \ Exception $ exception = null , $ verbose = false , $ silent = false ) { $ response = new ConsoleResponse ( ) ; try { if ( is_array ( $ data ) || is_object ( $ data ) ) { $ json = JsonEncoder :: encode ( $ data , true ) ; $ data = Json :: prettyPrint ( $ json ) . "\... | Prepares console response |
59,469 | protected function fetchService ( ) { $ service = $ this -> getRouteParam ( 'service' ) ; $ service = $ this -> parseCanonicalName ( $ service , true ) ; if ( preg_match ( $ this -> servicePattern , $ service ) ) { return $ service ; } else { return false ; } } | Parse service name from request |
59,470 | protected function fetchOperation ( ) { $ operation = $ this -> getRouteParam ( 'operation' ) ; if ( $ operation !== null ) { $ operation = $ this -> parseCanonicalName ( $ operation ) ; if ( preg_match ( $ this -> operationPattern , $ operation ) ) { return $ operation ; } else { return false ; } } else { $ operation ... | Parse operation name from request |
59,471 | protected function fetchParams ( ) { $ contentType = $ this -> getRequest ( ) -> getHeaders ( ) -> get ( 'Content-Type' ) ; if ( $ contentType ) { $ contentTypeParts = explode ( ';' , $ contentType -> getFieldValue ( ) ) ; $ contentType = strtolower ( trim ( $ contentTypeParts [ 0 ] ) ) ; } if ( $ contentType === 'appl... | Parse parameters from request |
59,472 | public function get ( $ id , Cargo \ Container $ container = null ) { if ( $ this -> container -> has ( $ id ) || ! class_exists ( $ id ) ) { return $ this -> container -> get ( $ id , $ container ? : $ this ) ; } $ this -> add ( $ id , null ) ; return $ this -> get ( $ id , $ container ) ; } | fetch from container or if the service is a class name we ll try to resolve it automatically |
59,473 | public function setOptions ( $ options ) { if ( ! is_array ( $ options ) && ! $ options instanceof Traversable ) { throw new \ InvalidArgumentException ( sprintf ( 'Expected an array or Traversable; received "%s"' , ( is_object ( $ options ) ? get_class ( $ options ) : gettype ( $ options ) ) ) ) ; } foreach ( $ option... | Configure service loader |
59,474 | public function getCommandManager ( ) { if ( $ this -> commandManager === null ) { $ this -> commandManager = new CommandManager ( ) ; $ this -> commandManager -> setServiceLoader ( $ this ) ; } return $ this -> commandManager ; } | Retrieve command manager |
59,475 | public function registerServices ( $ services ) { if ( ! is_array ( $ services ) && ! ( $ services instanceof Traversable ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( 'Expected an array or Traversable; received "%s"' , ( is_object ( $ services ) ? get_class ( $ services ) : gettype ( $ services ) ) ... | Batch register services |
59,476 | public function load ( $ id , $ options = null ) { $ id = $ this -> normalizeServiceId ( $ id ) ; if ( ! isset ( $ this -> services [ $ id ] ) ) { throw new Exception \ ServiceNotFoundException ( sprintf ( 'Service ID "%s" does not exist' , $ id ) ) ; } if ( $ options == null ) { $ options = $ this -> services [ $ id ]... | Loads specific service by ID |
59,477 | public function getServiceOptions ( $ id ) { $ id = $ this -> normalizeServiceId ( $ id ) ; if ( ! isset ( $ this -> services [ $ id ] ) ) { throw new Exception \ ServiceNotFoundException ( sprintf ( 'Service ID "%s" does not exist' , $ id ) ) ; } return $ this -> services [ $ id ] [ 'options' ] ; } | Retrieve options for service |
59,478 | public function exists ( $ name ) { $ name = $ this -> normalizeServiceName ( $ name ) ; return $ this -> getCommandManager ( ) -> hasListeners ( $ name ) ; } | Test if a service exists |
59,479 | public function getServicePluginManager ( ) { if ( $ this -> servicePluginManager === null ) { $ this -> servicePluginManager = new ServicePluginManager ( ) ; $ that = $ this ; $ this -> servicePluginManager -> addInitializer ( function ( $ instance , $ serviceManager ) use ( $ that ) { $ name = $ serviceManager -> get... | Retrieve service manager |
59,480 | public function register ( CommandInterface $ command ) { $ name = $ command -> getCommand ( ) ; if ( array_key_exists ( $ name , $ this -> commands ) ) { throw new CommandException ( "Command with name '$name' already registered" ) ; } $ this -> commands [ $ name ] = $ command ; } | Registers a command . |
59,481 | public function getCommandIfExists ( $ string ) { if ( starts_with ( $ string , $ this -> id ) ) { foreach ( $ this -> commands as $ commandName => $ command ) { if ( starts_with ( $ string , $ this -> id . $ commandName ) ) { return $ command ; } } } } | Check if the given string contains a command if so return the registered command . |
59,482 | protected function rebuildDatabase ( ) { $ this -> schemaTool -> dropDatabase ( ) ; $ entityMeta = $ this -> em -> getMetadataFactory ( ) -> getAllMetadata ( ) ; $ this -> schemaTool -> updateSchema ( $ entityMeta ) ; } | Builds the DB Schema |
59,483 | private function locateFile ( ) { $ filePath = locate_template ( $ this -> templatesPath , false , false ) ; if ( ! $ filePath ) { $ filePath = $ this -> defaultPath ; } return $ filePath ; } | Locate template file |
59,484 | public function daysOfWeek ( $ daysOfWeek ) { if ( empty ( $ daysOfWeek ) || is_string ( $ daysOfWeek ) === false || strlen ( $ daysOfWeek ) < 3 ) { return null ; } $ daysOfWeek = explode ( ',' , $ daysOfWeek ) ; $ allowedValues = [ 'mon' , 'tue' , 'wed' , 'thu' , 'fri' , 'sat' , 'sun' ] ; foreach ( $ daysOfWeek as $ d... | Parses a string like mon tue wed thu fri sat sun into a array |
59,485 | public function setPackage ( $ package ) { if ( $ package != $ this -> package ) { $ this -> layoutLocation = null ; } $ this -> package = $ this -> treatPackageName ( $ package ) ; } | Set the package name |
59,486 | public function setLayout ( $ file ) { if ( strstr ( $ file , '::' ) ) { $ file = explode ( '::' , $ file ) ; $ package = $ file [ 0 ] ; $ file = $ file [ 1 ] ; } else { $ package = $ this -> package ; } $ this -> assignDeclaredLayout ( $ package , $ file ) ; } | Set the layout location |
59,487 | private function assignDeclaredLayout ( $ package , $ file ) { $ file = lcfirst ( $ file ) ; if ( substr ( strtolower ( $ file ) , - 6 ) == '.phtml' ) { $ file = substr ( $ file , 0 , - 6 ) ; } $ package = $ this -> app -> getPackage ( $ package ) ; $ pathPieces = array ( $ package [ 'package_path' ] , 'res' , 'layout'... | Assign the path to the layout file |
59,488 | private function getPathForView ( ) { $ methodName = lcfirst ( $ this -> method ) ; $ className = lcfirst ( $ this -> class ) ; $ package = $ this -> app -> getPackage ( $ this -> package ) ; $ pathPieces = array ( $ package [ 'package_path' ] , 'res' , 'view' , $ className , $ methodName ) ; $ path = implode ( self ::... | Get the path for a view file . |
59,489 | private function inflate ( $ filePath ) { $ currentDirectory = rtrim ( dirname ( $ this -> currentView ) , self :: DS ) ; $ currentDirectory .= self :: DS ; if ( substr ( $ filePath , - 6 , 6 ) != '.phtml' ) { $ filePath .= '.phtml' ; } $ searchPath = realpath ( $ currentDirectory . $ filePath ) ; if ( $ searchPath != ... | Inflate a given |
59,490 | public function getCredentialsByService ( $ serviceName ) { if ( ! in_array ( $ serviceName , $ this -> getInitializedServices ( ) ) ) { throw new DomainException ( sprintf ( "Credentials for service '%s' was not initialized" , $ serviceName ) ) ; } return $ this -> serviceCredentials [ $ serviceName ] ; } | Returns credentials for notification service |
59,491 | public function addRepository ( $ repositoryClass , $ serviceId , $ entityClass ) { $ repositoryDefinition = $ this -> definitionFactory -> build ( $ repositoryClass , $ serviceId , $ entityClass ) ; $ this -> definitions [ ] = $ repositoryDefinition ; } | Add a repository service from Symfony DIC to the pool |
59,492 | public function createPool ( ) { $ pool = new RepositoryPool ( ) ; foreach ( $ this -> definitions as $ definition ) { $ pool -> addRepositoryDefinition ( $ definition ) ; } return $ pool ; } | Factory method for the EntityPool |
59,493 | static public function from ( $ class ) { if ( is_object ( $ class ) ) { $ class = get_class ( $ class ) ; } if ( empty ( self :: $ prototypes [ $ class ] ) ) { self :: $ prototypes [ $ class ] = new static ( $ class ) ; } return self :: $ prototypes [ $ class ] ; } | Returns the prototype associated with the specified class or object . |
59,494 | protected function getConsolidatedMethods ( ) { if ( $ this -> consolidatedMethods !== null ) { return $ this -> consolidatedMethods ; } $ methods = $ this -> methods ; if ( $ this -> parent ) { $ methods += $ this -> parent -> getConsolidatedMethods ( ) ; } return $ this -> consolidatedMethods = $ methods ; } | Consolidate the methods of the prototype . |
59,495 | protected function revokeConsolidatedMethods ( ) { $ class = $ this -> class ; foreach ( self :: $ prototypes as $ prototype ) { if ( ! is_subclass_of ( $ prototype -> class , $ class ) ) { continue ; } $ prototype -> consolidatedMethods = null ; } $ this -> consolidatedMethods = null ; } | Revokes the consolidated methods of the prototype . |
59,496 | public function offsetSet ( $ method , $ callback ) { self :: $ prototypes [ $ this -> class ] -> methods [ $ method ] = $ callback ; $ this -> revokeConsolidatedMethods ( ) ; } | Adds or replaces the specified method of the prototype . |
59,497 | public function offsetGet ( $ method ) { $ methods = $ this -> getConsolidatedMethods ( ) ; if ( ! isset ( $ methods [ $ method ] ) ) { throw new Exception ( "$method, $this->class" ) ; } return $ methods [ $ method ] ; } | Returns the callback associated with the specified method . |
59,498 | public static function addOptions ( InputDefinition $ definition , array $ fields , $ description ) { foreach ( $ fields as $ field => $ type ) { $ mode = 'array' === $ type ? InputOption :: VALUE_REQUIRED | InputOption :: VALUE_IS_ARRAY : InputOption :: VALUE_REQUIRED ; if ( ! $ definition -> hasOption ( $ field ) && ... | Add options in input definition . |
59,499 | public static function getFieldValue ( InputInterface $ input , $ fieldName ) { $ value = null ; if ( $ input -> hasArgument ( $ fieldName ) ) { $ value = $ input -> getArgument ( $ fieldName ) ; } elseif ( $ input -> hasOption ( $ fieldName ) ) { $ value = $ input -> getOption ( $ fieldName ) ; } return $ value ; } | Get field value in console input . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.