idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
4,300 | public function getAccountData ( \ Flowpack \ SingleSignOn \ Server \ Domain \ Model \ SsoClient $ ssoClient , \ TYPO3 \ Flow \ Security \ Account $ account ) { if ( $ this -> configuration !== NULL ) { $ configuration = $ this -> configuration ; } else { $ configuration = $ this -> getDefaultConfiguration ( $ ssoClien... | Map the given account as account data for an instance |
4,301 | protected function getDefaultConfiguration ( \ Flowpack \ SingleSignOn \ Server \ Domain \ Model \ SsoClient $ ssoClient , \ TYPO3 \ Flow \ Security \ Account $ account ) { if ( $ account -> getParty ( ) instanceof \ TYPO3 \ Party \ Domain \ Model \ Person ) { return array ( 'party' => array ( '_exposeType' => TRUE , '... | Get a default configuration depending on the type of party |
4,302 | public function getShowtimeDayByMovie ( Carbon $ date ) { $ showDay = new TheaterShowtimeDay ( ) ; $ theaters = $ this -> parseTheaters ( ) ; if ( count ( $ theaters ) > 0 ) { $ showDay -> setTheaters ( $ theaters ) ; $ showDay -> setDate ( $ date ) ; return $ showDay ; } return null ; } | Returns all Days of Showtimes by a Movie . |
4,303 | public function getShowtimeDayByTheater ( Carbon $ date ) { $ showDay = new MovieShowtimeDay ( ) ; $ movies = $ this -> parseMovies ( ) ; if ( count ( $ movies ) > 0 ) { $ showDay -> setMovies ( $ movies ) ; $ showDay -> setDate ( $ date ) ; return $ showDay ; } return null ; } | Returns all Days of Showtimes by a Theater . |
4,304 | public function parseMovies ( $ includeShowtimes = true ) { $ movieDivs = $ this -> crawler -> filter ( '#movie_results .movie' ) ; $ count = $ movieDivs -> count ( ) ; if ( $ count == 0 ) { return null ; } if ( $ count = 1 ) { $ justOneMovieFound = true ; } $ movies = $ movieDivs -> each ( function ( Crawler $ movieDi... | Parses the Movies from the result div . |
4,305 | public function parseTheaters ( $ includeShowtimes = true ) { $ theatersDivs = $ this -> crawler -> filter ( '#movie_results .theater' ) ; $ count = $ theatersDivs -> count ( ) ; if ( $ count == 0 ) { return null ; } if ( $ count = 1 ) { $ justOneTheaterFound = true ; } $ theaters = $ theatersDivs -> each ( function ( ... | Parses the Theaters from the result div . |
4,306 | private function parseShowtimeInfo ( Crawler $ resultDiv ) { $ showtimeSpans = $ resultDiv -> filter ( '.times' ) -> first ( ) ; return $ this -> parseShowtime ( $ showtimeSpans ) ; } | Gets Showtime Infos from a div . |
4,307 | private function parseShowtime ( Crawler $ timeSpan ) { $ showtime = new ShowtimeInfo ( ) ; $ texts = explode ( ' ' , str_replace ( ' ' , '' , $ timeSpan -> text ( ) ) ) ; if ( $ this -> getTime ( $ texts [ 0 ] ) == null ) { $ showtime -> setInfo ( $ texts [ 0 ] ) ; } $ times = [ ] ; foreach ( $ texts as $ text ) {... | Parses showtime infos from a individual div . |
4,308 | private function getTime ( $ input ) { preg_match ( '/(1[012]|[1-9]):[0-5][0-9](\\s)?(?i)(am|pm)/' , $ input , $ matches ) ; if ( count ( $ matches ) > 0 ) { return $ matches [ 0 ] ; } preg_match ( '/([01]?[0-9]|2[0-3]):[0-5][0-9]/' , $ input , $ matches ) ; if ( count ( $ matches ) > 0 ) { return $ matches [ 0 ] ; } r... | Parses the Time out of the times string . |
4,309 | public function putAll ( iterable $ values ) : MapInterface { foreach ( $ values as $ key => $ value ) { $ this -> put ( $ key , $ value ) ; } return $ this ; } | Creates associations for all keys and corresponding values of either an array or iterable object . |
4,310 | public function union ( Map $ map ) : MapInterface { $ map = new \ DS \ Map ( $ map ) ; $ items = $ this -> items -> union ( $ map ) ; return $ this -> duplicate ( $ items ) ; } | Creates a new map that contains the pairs of the current instance as well as the pairs of another map . |
4,311 | public function createClassDefinitionFile ( IntercessionClass $ class , $ file ) { $ dir = dirname ( $ file ) ; if ( ! file_exists ( $ dir ) ) { set_error_handler ( function ( ) use ( $ dir ) { throw new NotWritableException ( $ dir ) ; } ) ; mkdir ( $ dir ) ; restore_error_handler ( ) ; } if ( ! is_writable ( $ dir ) ... | Writes the definition of a class in a file |
4,312 | public function setDataFromPost ( ) { foreach ( $ this -> data as $ key => $ value ) { if ( isset ( $ _POST [ $ key ] ) ) { $ this -> data [ $ key ] = $ _POST [ $ key ] ; } } } | Esta funcion es para asignar los valores recibidos por POST . |
4,313 | static public function generateMethodName ( $ access , $ column ) { $ column = preg_split ( '/(?=\p{Lu})/u' , $ column ) ; $ column = implode ( '_' , $ column ) ; return sprintf ( '%s%s' , strtolower ( $ access ) , str_replace ( ' ' , '' , ucwords ( str_replace ( '_' , ' ' , strtolower ( $ column ) ) ) ) ) ; } | Generates a method name . |
4,314 | public function transform ( $ xslDocument ) { if ( $ xslDocument -> domDocument ) { $ processor = new \ XsltProcessor ( ) ; $ processor -> importStylesheet ( $ xslDocument -> domDocument ) ; $ htmlDomDocument = new self ; $ htmlDomDocument -> domDocument = $ processor -> transformToDoc ( $ this -> domDocument ) ; if ( ... | Merge the data and the XML template into an HTML page . |
4,315 | public static function clean_vars ( $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ key => $ val ) { $ value [ $ key ] = self :: clean_vars ( $ val ) ; } } else { $ value = self :: filter_simple_xss ( $ value ) ; } return $ value ; } | Realiza la limpieza de un string o conjunto de string llamando a la funcion filtro_xss |
4,316 | public static function create ( array $ data ) : Clan { $ clan = new Clan ( ) ; parent :: fill ( $ data , $ clan ) ; if ( is_array ( $ clan -> location ) ) { $ clan -> location = Location :: create ( $ clan -> location ) ; } if ( is_array ( $ clan -> memberList ) ) { $ members = [ ] ; foreach ( $ clan -> memberList as ... | Creates a clan object with the given data |
4,317 | public function searchUserByNamePaginated ( $ partial , $ page = 1 , array $ filters = null , $ limit = null , array $ order = null ) { $ filters [ 'partial_name' ] = $ partial ; return $ this -> findAll ( $ page , $ filters , $ limit , $ order ) ; } | Find user by partial name |
4,318 | public function updateUserCity ( $ user , $ country , $ city = null ) { $ this -> getManager ( ) -> updateUserCity ( $ user -> getId ( ) , $ country -> getId ( ) , $ city !== null ? $ city -> getId ( ) : null ) ; } | Updates a users city |
4,319 | public function exists ( $ pageName ) { $ ds = DIRECTORY_SEPARATOR ; $ path = app_path ( ) . $ ds . 'lablog' . $ ds . $ pageName . '.page' ; if ( $ this -> fs -> exists ( $ path ) ) { return true ; } return false ; } | Check that a page exists . |
4,320 | public function get ( $ pageName ) { $ ds = DIRECTORY_SEPARATOR ; $ path = app_path ( ) . $ ds . 'lablog' . $ ds . $ pageName . '.page' ; $ pageContent = $ this -> fs -> get ( $ path ) ; $ page = $ this -> config -> strip ( $ pageContent , '{PAGECONFIG}' ) ; $ pageObject = new Page ; $ pageObject -> name = $ pageName ;... | Get the full contents of a page . |
4,321 | public function each ( $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new \ InvalidArgumentException ( 'Mapping function is not callable!' ) ; } array_walk ( $ this -> attributes , $ callback ) ; return $ this ; } | Executes given callback function on every attribute array item |
4,322 | public function map ( $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new \ InvalidArgumentException ( 'Mapping function is not callable!' ) ; } $ this -> attributes = array_map ( $ callback , $ this -> attributes ) ; return $ this ; } | Executes given mapping function on every attribute array item |
4,323 | public function slice ( $ offset , $ limit ) { $ attributes = array_slice ( $ this -> attributes , $ offset , $ limit ) ; $ list = new self ( ) ; $ list -> assign ( $ attributes ) ; return $ list ; } | Returns new MutableList with sliced attribute array |
4,324 | public function filter ( $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new \ InvalidArgumentException ( 'Filter is not callable!' ) ; } $ attributes = array_filter ( $ this -> attributes , $ callback ) ; $ list = new self ( ) ; $ list -> assign ( $ attributes ) ; return $ list ; } | Returns new MutableList with filtered values from attribute array |
4,325 | public function sort ( $ callback = null ) { if ( is_callable ( $ callback ) ) { usort ( $ this -> attributes , $ callback ) ; } else { sort ( $ this -> attributes ) ; } return $ this ; } | Sorts alphabetically or using the given callback |
4,326 | public function unshift ( ) { $ args = func_get_args ( ) ; if ( ! empty ( $ args ) ) { foreach ( $ args as $ arg ) { array_unshift ( $ this -> attributes , $ arg ) ; } } return $ this ; } | Prepends one or more elements to the beginning of an array |
4,327 | public function push ( ) { $ args = func_get_args ( ) ; if ( ! empty ( $ args ) ) { foreach ( $ args as $ arg ) { array_push ( $ this -> attributes , $ arg ) ; } } return $ this ; } | Pushes one or more elements onto the end of array |
4,328 | protected function loadResourcesFromTheme ( string $ cacheKey , & $ theme ) { if ( ! $ theme instanceof \ Twig_Template ) { $ theme = $ this -> environment -> loadTemplate ( $ theme ) ; } if ( null === $ this -> template ) { $ this -> template = $ theme ; } $ currentTheme = $ theme ; $ context = $ this -> environment -... | Loads the resources for all blocks in a theme . |
4,329 | public function getFullBbCode ( ) : BbCode { $ bbcode = new BbCode ( ) ; $ bold = new Bold ( ) ; $ bbcode -> addTag ( $ bold ) ; $ underline = new Underline ( ) ; $ bbcode -> addTag ( $ underline ) ; $ italic = new Italic ( ) ; $ bbcode -> addTag ( $ italic ) ; $ link = new Link ; $ bbcode -> addTag ( $ link ) ; $ img ... | Create fully configured BbCode |
4,330 | public function renderBodyEnd ( & $ output ) { if ( $ this -> combineScriptFiles ) $ this -> combineScriptFiles ( self :: POS_END ) ; if ( ! isset ( $ this -> scriptFiles [ self :: POS_END ] ) && ! isset ( $ this -> scripts [ self :: POS_END ] ) && ! isset ( $ this -> scripts [ self :: POS_READY ] ) && ! isset ( $ this... | Inserts the scripts at the end of the body section . |
4,331 | protected function combineCssFiles ( ) { if ( count ( $ this -> cssFiles ) < 2 ) return ; $ cssFiles = array ( ) ; $ toBeCombined = array ( ) ; foreach ( $ this -> cssFiles as $ url => $ media ) { $ file = $ this -> getLocalPath ( $ url ) ; if ( $ file === false ) $ cssFiles [ $ url ] = $ media ; else { $ media = strto... | Combine the CSS files if cached enabled then cache the result so we won t have to do that Every time |
4,332 | protected function combineScriptFiles ( $ type = self :: POS_HEAD ) { if ( ! isset ( $ this -> scriptFiles [ $ type ] ) || count ( $ this -> scriptFiles [ $ type ] ) < 2 ) return ; $ scriptFiles = array ( ) ; $ toBeCombined = array ( ) ; foreach ( $ this -> scriptFiles [ $ type ] as $ url ) { $ file = $ this -> getLoca... | Combine script files we combine them based on their position each is combined in a separate file to load the required data in the required location . |
4,333 | private function getRelativeUrl ( $ from , $ to ) { $ relative = '' ; while ( true ) { if ( $ from === $ to ) return $ relative ; else if ( $ from === dirname ( $ from ) ) return $ relative . substr ( $ to , 1 ) ; if ( ! strncmp ( $ from . '/' , $ to , strlen ( $ from ) + 1 ) ) return $ relative . substr ( $ to , strle... | Calculate the relative url |
4,334 | private function getCombinedFileName ( $ name , $ files , $ type = '' ) { $ pos = strrpos ( $ name , '.' ) ; if ( ! $ pos ) $ pos = strlen ( $ pos ) ; $ hash = sprintf ( '%x' , crc32 ( implode ( '+' , $ files ) ) ) ; $ ret = substr ( $ name , 0 , $ pos ) ; if ( $ type !== '' ) $ ret .= '-' . $ type ; $ ret .= '-' . $ h... | Get unique filename for combined files |
4,335 | private function optimizeCssCode ( $ code ) { if ( YII_DEBUG ) return $ code ; require_once dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'CssMin.php' ; return CssMin :: minify ( $ code ) ; } | Optmize css strip any spaces and newline |
4,336 | private function optimizeScriptCode ( $ code ) { if ( YII_DEBUG ) return $ code ; require_once dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'JSMin.php' ; $ minified = JSMin :: minify ( $ code ) ; return ( $ minified === false ? $ code : $ minified ) ; } | Optimize script via google compiler |
4,337 | public function getAssets ( $ type = null , $ relativeTo = self :: RELATIVE_PATH ) { $ cssFiles = $ this -> cssFiles ; $ jsFiles = $ this -> jsFiles ; if ( $ this -> includeVendors !== false ) { if ( $ this -> includeVendors === true || in_array ( 'css' , $ this -> includeVendors ) ) { $ cssFiles = array_merge ( $ this... | Returns the list of asset files |
4,338 | public function getAsseticCollection ( $ type = null ) { list ( $ cssFiles , $ jsFiles ) = $ this -> getAssets ( ) ; return $ this -> filterAssetArray ( array ( $ this -> createAsseticCollection ( $ cssFiles ) , $ this -> createAsseticCollection ( $ jsFiles ) ) , $ type ) ; } | Returns a tuple where the both items are Assetic AssetCollection the first one being css files and the second js files |
4,339 | protected function createAsseticCollection ( $ files ) { $ assets = array ( ) ; foreach ( $ files as $ file ) { $ assets [ ] = new \ Assetic \ Asset \ FileAsset ( $ file ) ; } return new \ Assetic \ Asset \ AssetCollection ( $ assets ) ; } | Create an Assetic AssetCollection with the given files . Filenames will be converted to absolute path using the base path . |
4,340 | protected function getJsInitializationCode ( ) { $ js = '' ; if ( ( $ this -> initialization & self :: INITIALIZE_CONSTRUCTOR ) === self :: INITIALIZE_CONSTRUCTOR ) { $ js .= sprintf ( "var %s = new %s();\n" , $ this -> variableName , $ this -> javascriptClass ) ; } if ( ( $ this -> initialization & self :: INITIALIZE_... | Returns the js code needed to initialize the debug bar |
4,341 | public static function createFromDOSTimestamp ( $ timestamp , $ timezone = null ) { $ year = ( ( $ timestamp >> 25 ) & 0x7f ) + 1980 ; $ mon = ( $ timestamp >> 21 ) & 0x0f ; $ mday = ( $ timestamp >> 16 ) & 0x1f ; $ hours = ( $ timestamp >> 11 ) & 0x1f ; $ minutes = ( $ timestamp >> 5 ) & 0x3f ; $ seconds = 2 * ( $ tim... | Returns new Time object according to the specified DOS timestamp . |
4,342 | public function getDOSTimestamp ( ) { $ time = getdate ( $ this -> getTimestamp ( ) ) ; if ( $ time [ 'year' ] < 1980 ) { $ time [ 'year' ] = 1980 ; $ time [ 'mon' ] = 1 ; $ time [ 'mday' ] = 1 ; $ time [ 'hours' ] = 0 ; $ time [ 'minutes' ] = 0 ; $ time [ 'seconds' ] = 0 ; } return ( ( $ time [ 'year' ] - 1980 ) << 25... | Returns the DOS timestamp . |
4,343 | public function afterFetch ( $ saved , $ result ) { if ( is_array ( $ result ) ) { $ all = new ArrayCollection ( ) ; foreach ( $ result as $ entity ) { if ( $ entity instanceof Entity ) { $ all [ ] = self :: afterFetch ( $ saved , $ entity ) ; } } return $ all ; } if ( $ result instanceof Entity ) { $ result -> _saved ... | After Fetch entity hook |
4,344 | public function injectVirtualProperties ( $ entity ) { $ structure = $ this -> getEntityStructure ( $ entity ) ; if ( count ( $ structure -> relationProperties ) > 0 ) { foreach ( $ structure -> relationProperties as $ removeProperty ) { unset ( $ entity -> { $ removeProperty } ) ; } } } | Inject Virtual Properties for relations |
4,345 | public function registerEntity ( $ entityClassName ) { $ indexer = new EntityIndexer ( $ entityClassName ) ; $ structure = $ indexer -> getEntity ( ) ; $ this -> entities [ $ structure -> name ] = $ structure ; } | Register and index Entity class |
4,346 | public function isRegistered ( $ entityClassName ) { if ( $ entityClassName instanceof Entity ) { $ reflection = new \ ReflectionClass ( $ entityClassName ) ; $ entityClassName = $ reflection -> getName ( ) ; } return isset ( $ this -> entities [ $ entityClassName ] ) ; } | Is the entity already registered? |
4,347 | public function registerJoinTable ( $ joinTable ) { if ( ! $ joinTable instanceof JoinTable ) { throw new RelationException ( "Join Table register failure!" ) ; } if ( isset ( $ this -> joinTables [ $ joinTable -> name ] ) ) { return ; } $ this -> joinTables [ $ joinTable -> name ] = $ joinTable ; } | Register a join table . Don t use this directly! |
4,348 | public function getJoinTable ( $ name ) { if ( isset ( $ this -> joinTables [ $ name ] ) ) { return $ this -> joinTables [ $ name ] ; } return null ; } | Get the join table for the table name . |
4,349 | public function getEntityStructure ( $ entityClassName ) { if ( $ entityClassName instanceof Entity ) { $ reflection = new \ ReflectionClass ( $ entityClassName ) ; $ entityClassName = $ reflection -> getName ( ) ; } if ( ! $ this -> isRegistered ( $ entityClassName ) ) { $ this -> registerEntity ( $ entityClassName ) ... | Get entity structure class for using metadata |
4,350 | public function getId ( & $ entity ) { $ structure = $ this -> getEntityStructure ( $ entity ) ; if ( isset ( $ entity -> { $ structure -> primaryColumn -> propertyName } ) ) { return $ entity -> { $ structure -> primaryColumn -> propertyName } ; } return null ; } | Get entity ID value |
4,351 | public function getLazy ( $ entity , $ name ) { if ( ! in_array ( $ name , $ this -> getEntityStructure ( $ entity ) -> relationProperties ) ) { throw new RelationException ( "Property '" . $ name . "' is not a valid and declared property, or relation property!" ) ; } return RelationManager :: with ( $ entity ) -> fetc... | Will be called for getting the relationship result lazy loading . |
4,352 | public function setLazy ( $ entity , $ name , $ value ) { if ( ! in_array ( $ name , $ this -> getEntityStructure ( $ entity ) -> relationProperties ) ) { return ; } if ( ! $ value instanceof Entity && $ value !== null ) { throw new RelationException ( "Property '" . $ name . "' is a reference to a relationship, you sh... | Set a virtual property |
4,353 | public function refresh ( $ entity ) { if ( ! $ entity -> _saved ) return false ; $ structure = $ this -> getEntityStructure ( $ entity ) ; $ idColumn = $ structure -> primaryColumn -> name ; $ idValue = $ entity -> _id ; if ( $ structure -> primaryColumn -> type === 'integer' ) $ idValue = intval ( $ idValue ) ; $ ent... | Refresh Entity contents from database . |
4,354 | public function delete ( $ entity ) { $ query = new Query ( $ entity , false ) ; $ structure = $ this -> getEntityStructure ( $ entity ) ; if ( $ entity -> _saved ) { return $ query -> delete ( $ structure -> tableName ) -> where ( array ( $ structure -> primaryColumn -> name => $ entity -> _id ) ) -> apply ( ) ; } ret... | Delete entity from database |
4,355 | public static function get ( $ entity , $ primaryValue ) { $ query = new Query ( $ entity ) ; $ column = self :: getInstance ( ) -> getEntityStructure ( $ entity ) -> primaryColumn ; $ query -> where ( $ column -> name , $ primaryValue ) ; return $ query -> one ( ) ; } | Get Entity with Primary Key value |
4,356 | public function validator ( $ entity , $ data ) { return ValidationManager :: validator ( self :: getInstance ( ) -> getEntityStructure ( $ entity ) , $ data ) ; } | Get Validator class for data type . |
4,357 | public function listAction ( ) { $ problemFetcher = $ this -> get ( 'phlexible_problem.problem_fetcher' ) ; $ data = [ ] ; foreach ( $ problemFetcher -> fetch ( ) as $ problem ) { $ data [ ] = [ 'id' => strlen ( $ problem -> getId ( ) ) ? $ problem -> getId ( ) : md5 ( serialize ( $ problem ) ) , 'iconCls' => $ problem... | List problems . |
4,358 | public function init ( ) { $ this -> _swift [ 'transport' ] = \ Swift_SmtpTransport :: newInstance ( $ this -> smtp , $ this -> port , true === $ this -> ssl ? 'ssl' : '' ) ; $ this -> _swift [ 'transport' ] -> setUsername ( $ this -> username ) ; $ this -> _swift [ 'transport' ] -> setPassword ( $ this -> password ) ;... | init swift mailer |
4,359 | public function setBody ( ) { $ this -> _swift [ 'message' ] -> setBody ( $ this -> message , $ this -> contentType , $ this -> charset ) ; return $ this ; } | set mail body |
4,360 | protected function validateTypeName ( $ type , $ exists = null ) { if ( empty ( $ type ) && ! is_string ( $ type ) ) { throw new \ Exception ( "Identity type must be a valid string." ) ; } if ( ( $ exists === true ) && ! isset ( $ this -> types [ $ type ] ) ) { throw new \ Exception ( sprintf ( "Undefined Identity type... | Ensure type name is valid |
4,361 | public function attributeWas ( $ attrName ) { return $ this -> attributeChanged ( $ attrName ) ? $ this -> changedAttributes [ $ attrName ] : $ this -> attributes -> get ( $ attrName ) ; } | Returns the previous value of an attribute . If the attribute wasn t changed its current value is returned . |
4,362 | public function registerAttributeChange ( $ attrName , $ newValue ) { if ( ! $ this -> attributeChanged ( $ attrName ) ) { $ oldValue = $ this -> attributes -> get ( $ attrName ) ; if ( ( string ) $ newValue != ( string ) $ oldValue ) { $ this -> changedAttributes [ $ attrName ] = $ oldValue ; } } elseif ( ( string ) $... | Registers a new value for a given attribute . If the attribute hasn t changed yet the new value is stored as the original value of the attribute . If the attribute already has an original value stored and the new value equals to it the attribute change is unregistered . Otherwise the new value is ignored ; the original... |
4,363 | public function setCraftingSpeed ( float $ craftingSpeed ) : self { $ this -> craftingSpeed = ( int ) ( $ craftingSpeed * self :: FACTOR_CRAFTING_SPEED ) ; return $ this ; } | Sets the crafting speed of the machine . |
4,364 | public function setNumberOfItemSlots ( int $ numberOfItemSlots ) : self { if ( $ numberOfItemSlots === self :: VALUE_UNLIMITED_SLOTS ) { $ this -> numberOfItemSlots = self :: VALUE_UNLIMITED_SLOTS_DATABASE ; } else { $ this -> numberOfItemSlots = $ numberOfItemSlots ; } return $ this ; } | Sets the number of item slots available in the machine or - 1 if unlimited . |
4,365 | public function getNumberOfItemSlots ( ) : int { if ( $ this -> numberOfItemSlots === self :: VALUE_UNLIMITED_SLOTS_DATABASE ) { $ result = self :: VALUE_UNLIMITED_SLOTS ; } else { $ result = $ this -> numberOfItemSlots ; } return $ result ; } | Returns the number of item slots available in the machine or - 1 if unlimited . |
4,366 | public function setEnergyUsage ( float $ energyUsage ) : self { $ this -> energyUsage = ( int ) ( $ energyUsage * self :: FACTOR_ENERGY_USAGE ) ; return $ this ; } | Sets the energy usage of the machine . |
4,367 | public function getWallets ( $ page_offset = 0 , $ items_per_page = 50 ) { $ parameters = $ this -> addPagingToParameters ( [ ] , $ page_offset , $ items_per_page ) ; return $ this -> newAPIRequest ( 'GET' , 'wallets' , $ parameters ) ; } | Shows all wallets belonging to this client |
4,368 | public function createServerManagedWallet ( $ chain , $ name , $ unlock_phrase = null , $ notification_queue_name = null ) { $ parameter_overrides = [ ] ; if ( $ notification_queue_name !== null ) { $ parameter_overrides [ 'messageQueue' ] = $ notification_queue_name ; } if ( $ unlock_phrase !== null ) { $ parameter_ov... | Creates a wallet managed by substation |
4,369 | public function createClientManagedWallet ( $ chain , $ x_pub_key , $ name , $ notification_queue_name = null ) { $ parameter_overrides = [ 'xPubKey' => $ x_pub_key , ] ; if ( $ notification_queue_name !== null ) { $ parameter_overrides [ 'messageQueue' ] = $ notification_queue_name ; } return $ this -> createWallet ( ... | Creates a wallet where only the client owns the private key |
4,370 | public function createMonitorOnlyWallet ( $ chain , $ name , $ notification_queue_name = null ) { $ parameter_overrides = [ ] ; if ( $ notification_queue_name !== null ) { $ parameter_overrides [ 'messageQueue' ] = $ notification_queue_name ; } return $ this -> createWallet ( $ chain , $ name , 'monitor' , $ parameter_... | Creates a wallet with monitored addresses |
4,371 | public function createWallet ( $ chain , $ name , $ wallet_type , $ parameter_overrides = [ ] ) { $ parameters = array_merge ( [ 'chain' => $ chain , 'name' => $ name , 'walletType' => $ wallet_type , ] , $ parameter_overrides ) ; return $ this -> newAPIRequest ( 'POST' , 'wallets' , $ parameters ) ; } | A lower level interface for creating a wallet |
4,372 | public function getAddresses ( $ wallet_uuid , $ page_offset = 0 , $ items_per_page = 50 ) { $ parameters = $ this -> addPagingToParameters ( [ ] , $ page_offset , $ items_per_page ) ; return $ this -> newAPIRequest ( 'GET' , $ wallet_uuid . '/addresses' , $ parameters ) ; } | Fetches a list of all address for this wallet |
4,373 | public function getTXOsByHash ( $ wallet_uuid , $ address_hash , $ page = 0 ) { $ parameters = [ 'hash' => $ address_hash , 'pg' => ( string ) $ page , ] ; return $ this -> newAPIRequest ( 'GET' , $ wallet_uuid . '/address/txos' , $ parameters ) ; } | Fetches confirmed and unconfirmed txos for the given address hash |
4,374 | public function getTransactionById ( $ wallet_uuid , $ txid , $ address_uuid ) { $ parameters = [ 'uuid' => $ address_uuid , ] ; return $ this -> newAPIRequest ( 'GET' , $ wallet_uuid . '/address/transaction/' . $ txid , $ parameters ) ; } | Fetches confirmed and unconfirmed transactions for the given address id |
4,375 | public function submitSignedTransaction ( $ wallet_uuid , $ send_uuid , $ signed_transaction_hex ) { $ parameters = [ 'signedTransaction' => $ signed_transaction_hex , ] ; return $ this -> newAPIRequest ( 'PATCH' , $ wallet_uuid . '/send/' . $ send_uuid , $ parameters ) ; } | Broadcast a send from a client managed wallet |
4,376 | protected function createNewSendTransaction ( $ wallet_uuid , $ source_uuid , $ asset , $ destinations , $ send_parameters ) { if ( $ send_parameters === null ) { $ send_parameters = [ ] ; } if ( ! isset ( $ send_parameters [ 'requestId' ] ) ) { $ send_parameters [ 'requestId' ] = Uuid :: uuid4 ( ) -> toString ( ) ; } ... | Creates a new send and returns the send details |
4,377 | public function getViewPath ( $ view ) { if ( $ this -> finder ) { if ( file_exists ( $ file = $ this -> finder -> find ( $ view ) ) ) { return $ file ; } } if ( file_exists ( $ view ) ) { return $ view ; } elseif ( file_exists ( $ view . '.' . $ this -> extension ) ) { return $ view . '.' . $ this -> extension ; } for... | Get path of view |
4,378 | public function getHelperPath ( $ helper ) { if ( $ this -> finder ) { if ( file_exists ( $ file = $ this -> finder -> find ( $ helper ) ) ) { return $ file ; } } if ( file_exists ( $ helper ) ) { return $ helper ; } elseif ( file_exists ( $ helper . '.helper.php' ) ) { return $ helper . '.helper.php' ; } foreach ( $ t... | Get path of helper |
4,379 | public function set ( $ key , $ value = null ) { if ( func_num_args ( ) === 1 ) { $ key === '{}' && $ key = json_decode ( '{}' ) ; $ this -> results = $ key ; return ; } if ( $ value instanceof Closure ) { $ factory = $ this -> getFactory ( ) ; $ value ( $ factory ) ; $ this -> results [ $ key ] = $ factory -> getResul... | Set value to results |
4,380 | public function each ( $ data = [ ] , Closure $ callback ) { $ factory = $ this -> getFactory ( ) ; $ results = array ( ) ; foreach ( $ data as $ item ) { $ callback ( $ factory , $ item ) ; $ results [ ] = $ factory -> getResults ( ) ; } return $ results ; } | Each item array |
4,381 | public function partial ( $ partialView , $ data = [ ] , $ mergeData = [ ] ) { $ factory = $ this -> getFactory ( ) ; return $ factory -> render ( $ partialView , $ data , $ mergeData ) ; } | Render partial json view |
4,382 | public function & AddCssClasses ( $ cssClasses ) { $ cssClassesArr = gettype ( $ cssClasses ) == 'array' ? $ cssClasses : explode ( ' ' , ( string ) $ cssClasses ) ; $ this -> cssClasses = array_merge ( $ this -> cssClasses , $ cssClassesArr ) ; return $ this ; } | Add css classes strings for HTML element attribute class . Given css classes will be added after previously defined css classes . Default value is an empty array to not render HTML class attribute . You can define css classes as single string more classes separated by space or you can define css classes as array with s... |
4,383 | public function actionRoleAssign ( ) : void { $ username = $ this -> prompt ( 'Username:' , [ 'required' => true ] ) ; $ user = $ this -> findModel ( $ username ) ; $ roleName = $ this -> select ( 'Role:' , ArrayHelper :: map ( $ this -> authManager -> getRoles ( ) , 'name' , 'description' ) ) ; $ role = $ this -> auth... | Adds role to user . |
4,384 | public function actionRoleRevoke ( ) : void { $ username = $ this -> prompt ( 'Username:' , [ 'required' => true ] ) ; $ user = $ this -> findModel ( $ username ) ; $ roleName = $ this -> select ( 'Role:' , ArrayHelper :: merge ( [ 'all' => 'All Roles' ] , ArrayHelper :: map ( $ this -> authManager -> getRolesByUser ( ... | Removes role from user . |
4,385 | public function actionInit ( ) : void { $ this -> initSURole ( ) ; $ config = $ this -> loadConfig ( ) ; $ this -> applyConfig ( $ config ) ; $ this -> applyAssignConfig ( $ config ) ; $ this -> addAssignmentsToSu ( ) ; $ this -> log ( true ) ; } | Generates default roles . |
4,386 | protected function initSURole ( ) : void { $ this -> stdout ( "Init SU role \n" , Console :: FG_YELLOW ) ; $ this -> authManager -> removeAll ( ) ; $ su = $ this -> authManager -> createRole ( Rbac :: R_SU ) ; $ su -> description = 'Super User' ; $ this -> authManager -> add ( $ su ) ; } | Initialize the superuser role . |
4,387 | protected function applyConfig ( array $ config ) : void { $ this -> applyRules ( ArrayHelper :: get ( $ config , 'rules' , [ ] ) ) ; $ this -> applyRoles ( ArrayHelper :: get ( $ config , 'roles' , [ ] ) ) ; $ this -> applyPermissions ( ArrayHelper :: get ( $ config , 'permissions' , [ ] ) ) ; } | Apply received config for rbac . |
4,388 | protected function applyAssignConfig ( array $ config ) : void { $ this -> assignRoles ( ArrayHelper :: get ( $ config , 'roles' , [ ] ) ) ; $ this -> assignPermissions ( ArrayHelper :: get ( $ config , 'permissions' , [ ] ) ) ; } | Apply assignments . |
4,389 | protected function addAssignmentsToSu ( ) : void { $ roleSu = $ this -> authManager -> getRole ( Rbac :: R_SU ) ; $ this -> addRolesToSU ( $ roleSu ) ; $ this -> addPermissionsToSU ( $ roleSu ) ; } | Apply assignments to SU role . |
4,390 | protected function applyRules ( array $ config ) : void { $ this -> stdout ( "Init rules: " . count ( $ config ) . "\n" , Console :: FG_YELLOW ) ; foreach ( $ config as $ item ) { if ( $ rule = $ this -> applyRule ( $ item ) ) { $ this -> stdout ( "\t- success: " . $ rule -> name . "\n" , Console :: FG_GREEN ) ; } else... | Apply assignment rules . |
4,391 | protected function applyRoles ( array $ config ) : void { $ this -> stdout ( "Init roles: " . count ( $ config ) . "\n" , Console :: FG_YELLOW ) ; foreach ( $ config as $ item ) { if ( $ role = $ this -> applyRole ( $ item ) ) { $ this -> stdout ( "\t- success: " . $ role -> name . "\n" , Console :: FG_GREEN ) ; } else... | Apply assignment roles . |
4,392 | protected function applyPermissions ( array $ config ) : void { $ this -> stdout ( "Init permissions: " . count ( $ config ) . "\n" , Console :: FG_YELLOW ) ; foreach ( $ config as $ item ) { if ( $ permission = $ this -> applyPermission ( $ item ) ) { $ this -> stdout ( "\t- success: " . $ permission -> name . "\n" , ... | Apply assignment permissions . |
4,393 | protected function applyPermission ( array $ data ) { if ( ! ( $ name = ArrayHelper :: get ( $ data , 'name' ) ) ) { return false ; } if ( $ permission = $ this -> authManager -> getPermission ( $ name ) ) { return $ permission ; } $ permission = $ this -> authManager -> createPermission ( $ name ) ; $ permission -> de... | Apply assignment permission . |
4,394 | protected function applyRule ( array $ data ) { if ( ! ( $ class = ArrayHelper :: get ( $ data , 'class' ) ) || ! ( class_exists ( $ class ) ) ) { return false ; } $ rule = new $ class ; if ( ! $ rule instanceof Rule ) { return false ; } if ( $ ruleExist = $ this -> authManager -> getRule ( $ rule -> name ) ) { return ... | Apply assignment rule . |
4,395 | protected function assignRoles ( array $ config ) : void { $ this -> stdout ( "Assign roles: " . count ( $ config ) . "\n" , Console :: FG_YELLOW ) ; foreach ( $ config as $ item ) { if ( ! $ role = $ this -> assignRole ( $ item ) ) { $ this -> stdout ( "\t- error assigned role: " . Json :: encode ( $ item ) . "\n" , C... | Apply assignment all roles . |
4,396 | protected function assignPermissions ( array $ config ) : void { $ this -> stdout ( "Assign permissions: " . count ( $ config ) . "\n" , Console :: FG_YELLOW ) ; foreach ( $ config as $ item ) { if ( ! $ permission = $ this -> assignPermission ( $ item ) ) { $ this -> stdout ( "\t- error assigned permission: " . Json :... | Apply assignment all permissions . |
4,397 | protected function addRolesToSU ( Role $ roleSu ) { $ this -> stdout ( "Init SU assigning roles\n" , Console :: FG_YELLOW ) ; foreach ( $ this -> authManager -> getRoles ( ) as $ role ) { try { if ( $ role -> name !== $ roleSu -> name ) { $ this -> authManager -> addChild ( $ roleSu , $ role ) ; $ this -> stdout ( "\tA... | Added all assignment roles to role SU . |
4,398 | protected function addPermissionsToSU ( Role $ roleSu ) { $ this -> stdout ( "Init SU assigning permissions\n" , Console :: FG_YELLOW ) ; foreach ( $ this -> authManager -> getPermissions ( ) as $ permission ) { try { $ this -> authManager -> addChild ( $ roleSu , $ permission ) ; $ this -> stdout ( "\tAssign to SU per... | Added all assignment permissions to role SU . |
4,399 | public function getAuthorizationHeader ( ) { if ( ! is_null ( $ this -> bearerKey ) ) { return 'Bearer ' . $ this -> bearerKey ; } return 'ApiKey ' . $ this -> username . ':' . $ this -> apiKey ; } | Get the value of the Authorization header |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.