idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
50,300 | public function reverse_left_and_right_4value_shorthands ( $ property , $ value ) { $ shorthands = & $ this -> parser -> data [ 'csstidy' ] [ 'shorthands' ] ; if ( isset ( $ shorthands [ $ property ] ) ) { $ property_right = $ shorthands [ $ property ] [ 1 ] ; $ property_left = $ shorthands [ $ property ] [ 3 ] ; $ v =... | Reversing 4 values shorthands properties |
50,301 | public function reverse_left_and_right_4value_radius_shorthands ( $ property , $ value ) { $ shorthands = & $ this -> parser -> data [ 'csstidy' ] [ 'radius_shorthands' ] ; if ( isset ( $ shorthands [ $ property ] ) ) { $ v = $ this -> dissolve_4value_radius_shorthands ( $ property , $ value ) ; if ( $ v [ $ shorthands... | Reversing 4 values radius shorthands properties |
50,302 | public function reverse_left_and_right_background ( $ value ) { $ values = $ this -> dissolve_short_bg ( $ value ) ; if ( isset ( $ values [ 'background-position' ] ) and $ values [ 'background-position' ] ) { $ v = $ this -> reverse_left_and_right_background_position ( $ values [ 'background-position' ] ) ; if ( $ v !... | Reversing background shorthands |
50,303 | public function reverse_left_and_right_background_position ( $ value ) { if ( strpos ( $ value , ',' ) !== false ) { $ values = $ this -> explode_ws ( ',' , $ value ) ; if ( count ( $ values ) > 1 ) { foreach ( $ values as $ k => $ v ) { $ values [ $ k ] = $ this -> reverse_left_and_right_background_position ( $ v ) ; ... | Reversing background position shorthands |
50,304 | protected function hydrateAssociations ( $ entity , $ data ) { if ( isset ( $ data [ 'relationships' ] ) && is_array ( $ data [ 'relationships' ] ) ) { $ metadata = $ this -> entityManager -> getClassMetadata ( get_class ( $ entity ) ) ; foreach ( $ data [ 'relationships' ] as $ name => $ data ) { if ( ! isset ( $ meta... | Map JSON API resource relations to doctrine entity . |
50,305 | public function isApprovalRequired ( $ key ) { if ( $ this -> isApprovalNotRequired ( $ key ) ) { return false ; } if ( in_array ( $ key , $ this -> approvalRequired ( ) ) || $ this -> approvalRequired ( ) == [ '*' ] ) { return true ; } return ! empty ( $ this -> approvalNotRequired ( ) ) ; } | Determine if modification of the given attribute requires approval |
50,306 | public function selectSubjects ( ) { $ this -> defaultData ( ) ; $ memberProperty = $ this -> getProperty ( GroupsService :: PROPERTY_MEMBERS_URI ) ; $ memberForm = tao_helpers_form_GenerisTreeForm :: buildTree ( $ this -> getCurrentInstance ( ) , $ memberProperty ) ; $ memberForm -> setData ( 'title' , __ ( 'Select gr... | Render the tree to select the group related subjects |
50,307 | public function isGroupClass ( core_kernel_classes_Class $ clazz ) { return $ clazz -> equals ( $ this -> getRootClass ( ) ) || $ clazz -> isSubClassOf ( $ this -> getRootClass ( ) ) ; } | Check if the Class in parameter is a subclass of the Group Class |
50,308 | public function getGroups ( User $ user ) { $ groups = $ user -> getPropertyValues ( self :: PROPERTY_MEMBERS_URI ) ; array_walk ( $ groups , function ( & $ group ) { $ group = new core_kernel_classes_Resource ( $ group ) ; } ) ; return $ groups ; } | get the groups of a user |
50,309 | public function getUsers ( $ groupUri ) { $ subjectClass = TestTakerService :: singleton ( ) -> getRootClass ( ) ; $ users = $ subjectClass -> searchInstances ( array ( self :: PROPERTY_MEMBERS_URI => $ groupUri ) , array ( 'recursive' => true , 'like' => false ) ) ; return $ users ; } | gets the users of a group |
50,310 | public function addUser ( $ userUri , core_kernel_classes_Resource $ group ) { $ user = new \ core_kernel_classes_Resource ( $ userUri ) ; return $ user -> setPropertyValue ( new core_kernel_classes_Property ( self :: PROPERTY_MEMBERS_URI ) , $ group ) ; } | Add a User to a Group |
50,311 | public function removeUser ( $ userUri , core_kernel_classes_Resource $ group ) { $ user = new \ core_kernel_classes_Resource ( $ userUri ) ; return $ user -> removePropertyValue ( new core_kernel_classes_Property ( self :: PROPERTY_MEMBERS_URI ) , $ group ) ; } | Remove a User from a Group |
50,312 | public function badWords ( ) { $ words = explode ( ' ' , $ this -> text ) ; return collect ( $ this -> dictionary ) -> filter ( function ( $ value ) use ( $ words ) { if ( $ this -> strict ) { return str_contains ( strtolower ( $ this -> text ) , strtolower ( $ value [ 'word' ] ) ) ; } return in_array ( strtolower ( $ ... | Return the bad words contained in the text . |
50,313 | public function filter ( ) { $ bad_words = collect ( $ this -> badWords ( ) ) -> pluck ( 'word' ) -> toArray ( ) ; return collect ( explode ( ' ' , $ this -> text ) ) -> map ( function ( $ value ) use ( $ bad_words ) { if ( $ this -> strict ) { return ( str_contains ( strtolower ( $ value ) , $ bad_words ) ) ? $ this -... | Filter the string blocking the bad words with the blocker string . |
50,314 | private function blockWord ( $ word ) { if ( $ this -> strictClean ) { return str_repeat ( $ this -> blocker [ 0 ] , strlen ( $ word ) ) ; } return $ this -> blocker ; } | Returns the blocked word . |
50,315 | public function register_hooks ( HookProviderInterface $ provider ) { if ( $ provider instanceof PluginAwareInterface ) { $ provider -> set_plugin ( $ this ) ; } $ provider -> register_hooks ( ) ; return $ this ; } | Register a hook provider . |
50,316 | public static function create ( $ slug , $ filename = '' ) { if ( empty ( $ filename ) ) { $ backtrace = debug_backtrace ( DEBUG_BACKTRACE_PROVIDE_OBJECT , 1 ) ; $ filename = $ backtrace [ 0 ] [ 'file' ] ; } return ( new Plugin ( ) ) -> set_basename ( plugin_basename ( $ filename ) ) -> set_directory ( plugin_dir_path ... | Create a plugin instance . |
50,317 | protected function add_filter ( $ hook , $ method , $ priority = 10 , $ arg_count = 1 ) { return add_filter ( $ hook , $ this -> map_filter ( $ this -> get_wp_filter_id ( $ hook , $ method , $ priority ) , $ method , $ arg_count ) , $ priority , $ arg_count ) ; } | Add a WordPress filter . |
50,318 | protected function add_action ( $ hook , $ method , $ priority = 10 , $ arg_count = 1 ) { return $ this -> add_filter ( $ hook , $ method , $ priority , $ arg_count ) ; } | Add a WordPress action . |
50,319 | protected function remove_filter ( $ hook , $ method , $ priority = 10 , $ arg_count = 1 ) { return remove_filter ( $ hook , $ this -> map_filter ( $ this -> get_wp_filter_id ( $ hook , $ method , $ priority ) , $ method , $ arg_count ) , $ priority , $ arg_count ) ; } | Remove a WordPress filter . |
50,320 | protected function remove_action ( $ hook , $ method , $ priority = 10 , $ arg_count = 1 ) { return $ this -> remove_filter ( $ hook , $ method , $ priority , $ arg_count ) ; } | Remove a WordPress action . |
50,321 | protected function map_filter ( $ id , $ method , $ arg_count ) { if ( empty ( $ this -> filter_map [ $ id ] ) ) { $ this -> filter_map [ $ id ] = function ( ) use ( $ method , $ arg_count ) { return call_user_func_array ( [ $ this , $ method ] , array_slice ( func_get_args ( ) , 0 , $ arg_count ) ) ; } ; } return $ th... | Map a filter to a closure that inherits the class internal scope . |
50,322 | protected function load_textdomain ( ) { $ plugin_rel_path = dirname ( $ this -> plugin -> get_basename ( ) ) . '/languages' ; load_plugin_textdomain ( $ this -> plugin -> get_slug ( ) , false , $ plugin_rel_path ) ; } | Load the text domain to localize the plugin . |
50,323 | public function addBreadcrumb ( ) { $ this -> updateBreadcrumbNode ( ) ; $ nodeId = $ this -> session -> get ( 'tl_page_node' ) ; if ( $ nodeId < 1 ) { return ; } $ trail = $ this -> getBreadcrumbTrail ( $ nodeId ) ; if ( 0 === count ( $ trail ) ) { $ this -> session -> set ( 'tl_page_node' , 0 ) ; return ; } $ this ->... | Override the default breadcrumb menu we want to show folder pages before root pages . |
50,324 | public function showFallbackWarning ( ) { $ request = $ this -> requestStack -> getCurrentRequest ( ) ; if ( $ request -> query -> has ( 'act' ) ) { return ; } $ messages = \ System :: importStatic ( 'Messages' ) ; \ Message :: addRaw ( $ messages -> languageFallback ( ) ) ; if ( $ this -> hasInvalidTopLevels ( ) ) { \... | Show a warning if there is no language fallback page . |
50,325 | public function configureFolderPage ( $ dc ) { if ( null === $ dc -> activeRecord || 'folder' !== $ dc -> activeRecord -> type ) { return ; } $ this -> db -> update ( 'tl_page' , [ 'alias' => '' , 'noSearch' => '1' , 'sitemap' => 'map_never' , 'published' => '1' , 'start' => '' , 'stop' => '' , ] , [ 'id' => $ dc -> id... | Sets fixed configuration for a folder page . |
50,326 | public function onSaveType ( $ value , $ dc ) { if ( 'root' !== $ value && 'folder' !== $ value && $ dc -> activeRecord -> pid === 0 ) { throw new \ Exception ( $ GLOBALS [ 'TL_LANG' ] [ 'ERR' ] [ 'topLevelRoot' ] ) ; } return $ value ; } | Make sure that top - level pages are root pages or folders . |
50,327 | public function onSavePublished ( $ value , $ dc ) { if ( null !== $ dc -> activeRecord && 'folder' === $ dc -> activeRecord -> type ) { return '1' ; } return $ value ; } | A folder page can never be unpublished . |
50,328 | public function adjustAlias ( $ value , $ dc ) { if ( ! Config :: get ( 'folderUrl' ) ) { return $ value ; } if ( $ dc -> activeRecord && $ dc -> activeRecord -> type === 'folder' ) { $ childRecords = Database :: getInstance ( ) -> getChildRecords ( [ $ dc -> id ] , 'tl_page' ) ; $ this -> updateChildren ( $ childRecor... | Adjust the alias of the page . |
50,329 | public function getPageTypes ( $ dc ) { $ options = [ ] ; $ rootAllowed = true ; if ( $ dc -> activeRecord -> pid > 0 ) { $ rootAllowed = false ; $ parentType = $ this -> db -> fetchColumn ( 'SELECT type FROM tl_page WHERE id=?' , [ $ dc -> activeRecord -> pid ] ) ; if ( $ parentType === 'folder' ) { $ rootAllowed = tr... | Returns all allowed page types as array . |
50,330 | private function updateBreadcrumbNode ( ) { $ request = $ this -> requestStack -> getCurrentRequest ( ) ; if ( $ request -> query -> has ( 'pn' ) ) { $ this -> session -> set ( 'tl_page_node' , ( int ) $ request -> query -> get ( 'pn' ) ) ; $ params = array_merge ( $ request -> get ( '_route_params' ) , $ request -> qu... | Sets a new node if input value is given . |
50,331 | private function updateChildren ( array $ ids ) { if ( count ( $ ids ) < 1 ) { return ; } foreach ( $ ids as $ id ) { $ alias = $ this -> db -> fetchColumn ( 'SELECT alias FROM tl_page WHERE id=?' , [ $ id ] ) ; $ alias = $ this -> cleanAlias ( $ alias ) ; $ this -> db -> update ( 'tl_page' , [ 'alias' => $ alias ] , [... | Update the children pages . |
50,332 | public static function decode ( $ hash ) { $ minlng = - 180 ; $ maxlng = 180 ; $ minlat = - 90 ; $ maxlat = 90 ; for ( $ i = 0 , $ c = strlen ( $ hash ) ; $ i < $ c ; $ i ++ ) { $ v = strpos ( self :: $ table , $ hash [ $ i ] ) ; if ( 1 & $ i ) { if ( 16 & $ v ) { $ minlat = ( $ minlat + $ maxlat ) / 2 ; } else { $ max... | decode a geohash string to a geographical area |
50,333 | public function toSql ( ) : string { $ sql = $ this -> queryRelate -> getQuery ( ) -> toSql ( ) ; $ this -> resetQueryRelate ( ) ; return $ sql ; } | return run sql . |
50,334 | public function setUpperLimitMst ( ) { $ alg = new AlgorithmTspMst ( $ this -> graph ) ; $ this -> upperLimit = $ alg -> getWeight ( ) ; return $ this ; } | automatically sets upper limit to use for branch - and - bound from the MST heuristic |
50,335 | private function sumEdges ( array $ edges ) { $ sum = 0 ; foreach ( $ edges as $ edge ) { $ sum += $ edge -> getWeight ( ) ; } return $ sum ; } | get sum of weight of given edges |
50,336 | public function isSimple ( ) { $ vertices = $ this -> walk -> getVertices ( ) -> getVector ( ) ; if ( $ this -> isCycle ( ) ) { unset ( $ vertices [ 0 ] ) ; } return ! $ this -> hasArrayDuplicates ( $ vertices ) ; } | check whether this walk is simple |
50,337 | private function hasArrayDuplicates ( $ array ) { $ compare = array ( ) ; foreach ( $ array as $ element ) { if ( in_array ( $ element , $ compare , true ) ) { return true ; } else { $ compare [ ] = $ element ; } } return false ; } | checks whether ths given array contains duplicate identical entries |
50,338 | public function getCycleNegative ( ) { $ verticesVisited = array ( ) ; foreach ( $ this -> graph -> getVertices ( ) -> getMap ( ) as $ vid => $ vertex ) { if ( ! isset ( $ verticesVisited [ $ vid ] ) ) { $ alg = new SpMooreBellmanFord ( $ vertex ) ; try { foreach ( $ alg -> getVertices ( ) -> getIds ( ) as $ vid ) { $ ... | Searches all vertices for the first negative cycle |
50,339 | private function getVerticesSubtreeRecursive ( Vertex $ vertex , array & $ vertices , Vertex $ ignore = null ) { if ( isset ( $ vertices [ $ vertex -> getId ( ) ] ) ) { throw new UnexpectedValueException ( 'Vertex already visited' ) ; } $ vertices [ $ vertex -> getId ( ) ] = $ vertex ; foreach ( $ this -> getVerticesNe... | get subtree for given Vertex and ignore path to parent ignoreVertex |
50,340 | private function getVerticesNeighbor ( Vertex $ vertex ) { $ vertices = array ( ) ; foreach ( $ vertex -> getEdges ( ) as $ edge ) { if ( ! ( $ edge instanceof UndirectedEdge ) ) { throw new UnexpectedValueException ( 'Directed edge encountered' ) ; } $ vertices [ ] = $ edge -> getVertexToFrom ( $ vertex ) ; } return n... | get neighbor vertices for given start vertex |
50,341 | protected function checkBalance ( ) { $ alg = new AlgorithmFlow ( $ this -> graph ) ; $ balance = $ alg -> getBalance ( ) ; $ tolerance = 0.000001 ; if ( $ balance >= $ tolerance || $ balance <= - $ tolerance ) { throw new UnexpectedValueException ( 'The given graph is not balanced value is: ' . $ balance ) ; } return ... | check if balance is okay and throw exception otherwise |
50,342 | protected function addEdgesSorted ( Edges $ edges , SplPriorityQueue $ sortedEdges ) { foreach ( $ edges as $ edge ) { if ( ! $ edge -> isLoop ( ) ) { $ sortedEdges -> insert ( $ edge , - $ edge -> getWeight ( ) ) ; } } } | helper method to add a set of Edges to the given set of sorted edges |
50,343 | public function getVertices ( ) { $ visited = array ( ) ; $ todo = array ( $ this -> vertex ) ; while ( $ vertex = array_shift ( $ todo ) ) { if ( ! isset ( $ visited [ $ vertex -> getId ( ) ] ) ) { $ visited [ $ vertex -> getId ( ) ] = $ vertex ; foreach ( array_reverse ( $ this -> getVerticesAdjacent ( $ vertex ) -> ... | calculates an iterative depth - first search |
50,344 | public function createGraph ( ) { $ newgraph = $ this -> graph -> createGraphCloneEdgeless ( ) ; foreach ( $ this -> graph -> getEdges ( ) as $ edge ) { if ( ! ( $ edge instanceof EdgeDirected ) ) { throw new UnexpectedValueException ( 'Edge is undirected' ) ; } $ flow = $ edge -> getFlow ( ) ; if ( $ flow === NULL ) {... | create residual graph |
50,345 | private function mergeParallelEdges ( Edge $ newEdge ) { $ parallelEdges = $ newEdge -> getEdgesParallel ( ) ; if ( $ parallelEdges ) { $ mergedCapacity = 0 ; foreach ( $ parallelEdges as $ parallelEdge ) { $ mergedCapacity += $ parallelEdge -> getCapacity ( ) ; } $ newEdge -> setCapacity ( $ newEdge -> getCapacity ( )... | Will merge all edges that are parallel to to given edge |
50,346 | public function getVertexRoot ( ) { foreach ( $ this -> graph -> getVertices ( ) as $ vertex ) { if ( $ this -> isVertexPossibleRoot ( $ vertex ) ) { return $ vertex ; } } throw new UnderflowException ( 'No possible root found. Either empty graph or no Vertex with proper degree found.' ) ; } | get root vertex for this in - tree |
50,347 | public function hasDirected ( ) { foreach ( $ this -> set -> getEdges ( ) as $ edge ) { if ( $ edge instanceof EdgeDirected ) { return true ; } } return false ; } | checks whether the graph has any directed edges |
50,348 | public function hasUndirected ( ) { foreach ( $ this -> set -> getEdges ( ) as $ edge ) { if ( $ edge instanceof EdgeUndirected ) { return true ; } } return false ; } | checks whether the graph has any undirected edges |
50,349 | public function createGraph ( ) { $ graphResult = $ this -> startVertex -> getGraph ( ) -> createGraphClone ( ) ; foreach ( $ graphResult -> getEdges ( ) as $ edge ) { if ( ! ( $ edge instanceof EdgeDirected ) ) { throw new UnexpectedValueException ( 'Undirected edges not supported for edmonds karp' ) ; } $ edge -> set... | Returns max flow graph |
50,350 | public function getFlowMax ( ) { $ resultGraph = $ this -> createGraph ( ) ; $ start = $ resultGraph -> getVertex ( $ this -> startVertex -> getId ( ) ) ; $ maxFlow = 0 ; foreach ( $ start -> getEdgesOut ( ) as $ edge ) { $ maxFlow = $ maxFlow + $ edge -> getFlow ( ) ; } return $ maxFlow ; } | Returns max flow value |
50,351 | public function getColors ( ) { $ colors = array ( ) ; foreach ( $ this -> graph -> getVertices ( ) -> getMap ( ) as $ vid => $ startVertex ) { if ( ! isset ( $ colors [ $ vid ] ) ) { $ queue = array ( $ startVertex ) ; $ colors [ $ vid ] = 0 ; do { $ vertex = array_shift ( $ queue ) ; $ color = $ colors [ $ vertex -> ... | get map of vertex ID to vertex color |
50,352 | public function getColorVertices ( ) { $ colors = $ this -> getColors ( ) ; $ ret = array ( 0 => array ( ) , 1 => array ( ) ) ; foreach ( $ this -> graph -> getVertices ( ) -> getMap ( ) as $ vid => $ vertex ) { $ ret [ $ colors [ $ vid ] ] [ $ vid ] = $ vertex ; } return $ ret ; } | get groups of vertices per color |
50,353 | public function createGraphGroups ( ) { $ colors = $ this -> getColors ( ) ; $ graph = $ this -> graph -> createGraphClone ( ) ; foreach ( $ graph -> getVertices ( ) -> getMap ( ) as $ vid => $ vertex ) { $ vertex -> setGroup ( $ colors [ $ vid ] ) ; } return $ graph ; } | create new graph with valid groups set according to bipartition colors |
50,354 | public function isBalanced ( ) { foreach ( $ this -> graph -> getVertices ( ) as $ vertex ) { if ( $ this -> getDegreeInVertex ( $ vertex ) !== $ this -> getDegreeOutVertex ( $ vertex ) ) { return false ; } } return true ; } | checks whether the indegree of every vertex equals its outdegree |
50,355 | public function isVertexSource ( Vertex $ vertex ) { foreach ( $ vertex -> getEdges ( ) as $ edge ) { if ( $ edge -> hasVertexTarget ( $ vertex ) ) { return false ; } } return true ; } | checks whether this vertex is a source i . e . its indegree is zero |
50,356 | public function isVertexSink ( Vertex $ vertex ) { foreach ( $ vertex -> getEdges ( ) as $ edge ) { if ( $ edge -> hasVertexStart ( $ vertex ) ) { return false ; } } return true ; } | checks whether this vertex is a sink i . e . its outdegree is zero |
50,357 | public function hasCycle ( ) { $ components = new ConnectedComponents ( $ this -> graph ) ; if ( $ components -> isSingle ( ) ) { $ alg = new Degree ( $ this -> graph ) ; foreach ( $ this -> graph -> getVertices ( ) as $ vertex ) { if ( $ alg -> getDegreeVertex ( $ vertex ) & 1 ) { return false ; } } return true ; } re... | check whether this graph has an eulerian cycle |
50,358 | public function createGraph ( ) { $ newgraph = $ this -> graph -> createGraphCloneEdgeless ( ) ; foreach ( $ this -> graph -> getEdges ( ) as $ edge ) { if ( ! ( $ edge instanceof EdgeDirected ) ) { throw new UnexpectedValueException ( 'Edge is undirected' ) ; } $ newgraph -> createEdgeCloneInverted ( $ edge ) ; } retu... | create transpose graph |
50,359 | public function setDirection ( $ direction ) { if ( $ direction !== self :: DIRECTION_FORWARD && $ direction !== self :: DIRECTION_REVERSE && $ direction !== self :: DIRECTION_BOTH ) { throw new InvalidArgumentException ( 'Invalid direction given' ) ; } $ this -> direction = $ direction ; return $ this ; } | set direction in which to follow adjacent vertices |
50,360 | public function isSingle ( ) { try { $ vertex = $ this -> graph -> getVertices ( ) -> getVertexFirst ( ) ; } catch ( UnderflowException $ e ) { return false ; } $ alg = $ this -> createSearch ( $ vertex ) ; return ( count ( $ this -> graph -> getVertices ( ) ) === count ( $ alg -> getVertices ( ) ) ) ; } | check whether this graph consists of only a single component |
50,361 | public function getNumberOfComponents ( ) { $ visitedVertices = array ( ) ; $ components = 0 ; foreach ( $ this -> graph -> getVertices ( ) -> getMap ( ) as $ vid => $ vertex ) { if ( ! isset ( $ visitedVertices [ $ vid ] ) ) { $ newVertices = $ this -> createSearch ( $ vertex ) -> getVertices ( ) -> getIds ( ) ; ++ $ ... | count number of connected components |
50,362 | public function createGraphsComponents ( ) { $ visitedVertices = array ( ) ; $ graphs = array ( ) ; foreach ( $ this -> graph -> getVertices ( ) -> getMap ( ) as $ vid => $ vertex ) { if ( ! isset ( $ visitedVertices [ $ vid ] ) ) { $ alg = $ this -> createSearch ( $ vertex ) ; $ newVertices = $ alg -> getVertices ( ) ... | separate input graph into separate independant and unconnected graphs |
50,363 | public function isBipartit ( ) { if ( $ this -> getNumberOfGroups ( ) !== 2 ) { return false ; } foreach ( $ this -> graph -> getVertices ( ) as $ vertex ) { $ group = $ vertex -> getGroup ( ) ; foreach ( $ vertex -> getVerticesEdge ( ) as $ vertexNeighbor ) { if ( $ vertexNeighbor -> getGroup ( ) === $ group ) { retur... | checks whether the input graph s vertex groups are a valid bipartition |
50,364 | public function getGroups ( ) { $ groups = array ( ) ; foreach ( $ this -> graph -> getVertices ( ) as $ vertex ) { $ groups [ $ vertex -> getGroup ( ) ] = true ; } return array_keys ( $ groups ) ; } | get vector of all group numbers |
50,365 | public function getVerticesGroup ( $ group ) { $ vertices = array ( ) ; foreach ( $ this -> graph -> getVertices ( ) -> getMap ( ) as $ vid => $ vertex ) { if ( $ vertex -> getGroup ( ) === $ group ) { $ vertices [ $ vid ] = $ vertex ; } } return new Vertices ( $ vertices ) ; } | get set of all Vertices in the given group |
50,366 | public function isWeighted ( ) { foreach ( $ this -> set -> getEdges ( ) as $ edge ) { if ( $ edge -> getWeight ( ) !== NULL ) { return true ; } } return false ; } | checks whether this graph has any weighted edges |
50,367 | public function getWeightMin ( ) { $ min = NULL ; foreach ( $ this -> set -> getEdges ( ) as $ edge ) { $ weight = $ edge -> getWeight ( ) ; if ( $ weight !== null && ( $ min === NULL || $ weight < $ min ) ) { $ min = $ weight ; } } return $ min ; } | get minimum weight assigned to all edges |
50,368 | protected function getParsedResponse ( RequestInterface $ request ) : string { $ response = $ this -> getHttpClient ( ) -> sendRequest ( $ request ) ; $ statusCode = $ response -> getStatusCode ( ) ; if ( 401 === $ statusCode || 403 === $ statusCode ) { throw new InvalidCredentials ( ) ; } elseif ( 429 === $ statusCode... | Send request and return contents . If content is empty an exception will be thrown . |
50,369 | public static function block_tags ( $ reset = false ) { if ( empty ( self :: $ block_tags ) || $ reset ) { self :: $ block_tags = \ array_merge ( \ array_flip ( \ array_filter ( \ array_keys ( Elements :: $ html5 ) , function ( $ tag ) { return Elements :: isA ( $ tag , Elements :: BLOCK_TAG ) ; } ) ) , \ array_flip ( ... | Retrieves an array of block tags . |
50,370 | public static function inappropriate_tags ( $ reset = false ) { if ( empty ( self :: $ inappropriate_tags ) || $ reset ) { self :: $ inappropriate_tags = \ array_flip ( \ array_merge ( \ array_filter ( \ array_keys ( Elements :: $ html5 ) , function ( $ tag ) { return Elements :: isA ( $ tag , Elements :: VOID_TAG ) ||... | Retrieves an array of tags that we should never touch . |
50,371 | public static function nodelist_to_array ( \ DOMNodeList $ list ) { $ out = [ ] ; foreach ( $ list as $ node ) { $ out [ \ spl_object_hash ( $ node ) ] = $ node ; } return $ out ; } | Converts \ DOMNodeList to array ; |
50,372 | private static function get_adjacent_chr ( \ DOMNode $ node , $ position , $ length , callable $ get_textnode ) { $ textnode = $ get_textnode ( $ node ) ; if ( isset ( $ textnode ) && isset ( $ textnode -> data ) ) { $ func = Strings :: functions ( $ textnode -> data ) ; if ( ! empty ( $ func ) ) { return \ preg_replac... | Retrieves a character from the given \ DOMNode . |
50,373 | private static function get_adjacent_textnode ( callable $ iterate , callable $ get_adjacent_parent , \ DOMNode $ node = null ) { if ( ! isset ( $ node ) || self :: is_block_tag ( $ node ) ) { return null ; } $ adjacent = null ; $ iterated_node = $ node ; while ( null !== $ iterated_node && null === $ adjacent ) { $ ad... | Retrieves an adjacent \ DOMText sibling if there is one . |
50,374 | public static function get_first_textnode ( \ DOMNode $ node = null , $ recursive = false ) { return self :: get_edge_textnode ( [ __CLASS__ , __FUNCTION__ ] , $ node , $ recursive , false ) ; } | Retrieves the first \ DOMText child of the element . Block - level child elements are ignored . |
50,375 | public static function get_last_textnode ( \ DOMNode $ node = null , $ recursive = false ) { return self :: get_edge_textnode ( [ __CLASS__ , __FUNCTION__ ] , $ node , $ recursive , true ) ; } | Retrieves the last \ DOMText child of the element . Block - level child elements are ignored . |
50,376 | private static function get_edge_textnode ( callable $ get_textnode , \ DOMNode $ node = null , $ recursive = false , $ reverse = false ) { if ( ! isset ( $ node ) ) { return null ; } if ( $ node instanceof \ DOMText ) { return $ node ; } elseif ( ! $ node instanceof \ DOMElement || $ recursive && self :: is_block_tag ... | Retrieves an edge \ DOMText child of the element specified by the callable . Block - level child elements are ignored . |
50,377 | public static function get_block_parent_name ( \ DOMNode $ node ) { $ parent = self :: get_block_parent ( $ node ) ; if ( ! empty ( $ parent ) ) { return $ parent -> tagName ; } else { return '' ; } } | Retrieves the tag name of the nearest block - level parent . |
50,378 | public static function is_block_tag ( \ DOMNode $ node ) { return $ node instanceof \ DOMElement && isset ( self :: $ block_tags [ $ node -> tagName ] ) ; } | Determines if a node is a block tag . |
50,379 | public static function get_styled_quotes ( $ style , Settings $ settings ) { if ( isset ( self :: $ styles [ $ style ] ) ) { return new Simple_Quotes ( self :: $ styles [ $ style ] [ self :: _OPEN ] , self :: $ styles [ $ style ] [ self :: _CLOSE ] ) ; } if ( self :: DOUBLE_GUILLEMETS_FRENCH === $ style ) { $ space = $... | Creates a new Quotes object in the given style . |
50,380 | public function with_value ( $ value ) { if ( $ this -> value === $ value ) { return $ this ; } $ cloned_token = clone $ this ; $ cloned_token -> value = $ value ; return $ cloned_token ; } | Create a new token with the same type but a different value . If the value is unchanged the original token is returned . |
50,381 | protected function do_hyphenate ( array $ tokens , Settings $ settings , $ hyphen = U :: SOFT_HYPHEN ) { if ( empty ( $ settings [ 'hyphenMinLength' ] ) || empty ( $ settings [ 'hyphenMinBefore' ] ) ) { return $ tokens ; } return $ this -> get_hyphenator ( $ settings ) -> hyphenate ( $ tokens , $ hyphen , ! empty ( $ s... | Really hyphenates given text fragment . |
50,382 | public function get_hyphenator ( Settings $ settings ) { $ lang = $ settings [ 'hyphenLanguage' ] ; $ exceptions = ( array ) $ settings [ 'hyphenationCustomExceptions' ] ; $ hyphenator = $ this -> cache -> get_hyphenator ( $ lang ) ; if ( null === $ hyphenator ) { $ hyphenator = new Hyphenator ( $ lang , $ exceptions )... | Retrieves the hyphenator instance . |
50,383 | protected function dewidow ( $ text , array $ func , $ max_pull , $ max_length , $ word_number , $ narrow_space ) { if ( $ word_number < 1 ) { return $ text ; } return \ preg_replace_callback ( self :: REGEX_START . ( $ word_number - 1 ) . self :: REGEX_END , function ( array $ widow ) use ( $ func , $ max_pull , $ max... | Dewidow a given text fragment . |
50,384 | protected static function is_narrow_space ( $ string ) { return U :: THIN_SPACE === $ string || U :: HAIR_SPACE === $ string || U :: NO_BREAK_NARROW_SPACE === $ string ; } | Is the given string one of the narrow space characters? |
50,385 | protected static function make_space_nonbreaking ( $ string , $ narrow_space , $ u ) { return \ preg_replace ( [ '/\s*' . U :: THIN_SPACE . '\s*/u' , '/\s*' . U :: NO_BREAK_NARROW_SPACE . '\s*/u' , "/\\s+/$u" , '/' . self :: MASKED_NARROW_SPACE . "/$u" , ] , [ self :: MASKED_NARROW_SPACE , self :: MASKED_NARROW_SPACE ,... | Strip zero - width space and soft hyphens from the given string . |
50,386 | private static function calc_adjacent_length ( $ current_length , $ adjacent_character , $ haystack , array $ needles , callable $ substr , callable $ strlen , $ reverse = false ) { if ( $ current_length > 0 && $ adjacent_character !== $ substr ( $ haystack , $ reverse ? - $ current_length : 0 , $ current_length ) ) { ... | Calculates the adjacent character length . |
50,387 | private function update_smart_quotes_brackets ( $ primary_open , $ primary_close , $ secondary_open , $ secondary_close ) { $ brackets = [ "['" => '[' . $ secondary_open , "{'" => '{' . $ secondary_open , "('" => '(' . $ secondary_open , "']" => $ secondary_close . ']' , "'}" => $ secondary_close . '}' , "')" => $ seco... | Update smartQuotesBrackets component after quote style change . |
50,388 | public static function get_http_response_code ( $ url ) { $ curl = curl_init ( ) ; curl_setopt_array ( $ curl , [ CURLOPT_RETURNTRANSFER => true , CURLOPT_URL => $ url , ] ) ; curl_exec ( $ curl ) ; $ response_code = curl_getinfo ( $ curl , CURLINFO_HTTP_CODE ) ; curl_close ( $ curl ) ; return $ response_code ; } | Retrieve a HTTP response code via cURL . |
50,389 | protected static function remove_adjacent_characters ( $ string , callable $ strlen , callable $ substr , $ prev_length = 0 , $ next_length = 0 ) { if ( $ prev_length > 0 ) { $ string = $ substr ( $ string , $ prev_length , $ strlen ( $ string ) ) ; } if ( $ next_length > 0 ) { $ string = $ substr ( $ string , 0 , $ st... | Remove adjacent characters from given string . |
50,390 | protected static function get_default_node_fixes ( ) { return [ self :: CHARACTERS => [ Node_Fixes \ Smart_Maths_Fix :: class => [ ] , Node_Fixes \ Smart_Diacritics_Fix :: class => [ ] , Node_Fixes \ Smart_Quotes_Fix :: class => [ 'feed' => true ] , Node_Fixes \ Smart_Dashes_Fix :: class => [ 'feed' => true ] , Node_Fi... | Returns a configuration array for the default node fixes . |
50,391 | protected static function get_default_token_fixes ( ) { return [ Token_Fixes \ Wrap_Hard_Hyphens_Fix :: class => [ ] , Token_Fixes \ Smart_Dashes_Hyphen_Fix :: class => [ ] , Token_Fixes \ Hyphenate_Compounds_Fix :: class => [ 'cache' => true ] , Token_Fixes \ Hyphenate_Fix :: class => [ 'cache' => true ] , Token_Fixes... | Returns a configuration array for the default token fixes . |
50,392 | public function set_custom_exceptions ( array $ exceptions = [ ] ) { if ( empty ( $ exceptions ) && empty ( $ this -> custom_exceptions ) ) { return ; } $ new_hash = self :: get_object_hash ( $ exceptions ) ; if ( $ this -> custom_exceptions_hash === $ new_hash ) { return ; } $ exception_keys = [ ] ; foreach ( $ except... | Sets custom word hyphenations . |
50,393 | public function hyphenate ( array $ parsed_text_tokens , $ hyphen = '-' , $ hyphenate_title_case = false , $ min_length = 2 , $ min_before = 2 , $ min_after = 2 ) { if ( empty ( $ min_length ) || empty ( $ min_before ) || ! isset ( $ this -> pattern_trie ) || ! isset ( $ this -> pattern_exceptions ) ) { return $ parsed... | Hyphenates parsed text tokens . |
50,394 | protected function hyphenate_word ( $ word , $ hyphen , $ hyphenate_title_case , $ min_length , $ min_before , $ min_after ) { $ f = Strings :: functions ( $ word ) ; if ( empty ( $ f ) ) { return $ word ; } $ word_length = $ f [ 'strlen' ] ( $ word ) ; if ( $ word_length < $ min_length ) { return $ word ; } $ the_key ... | Hyphenates a single word . |
50,395 | protected function lookup_word_pattern ( $ key , callable $ strlen , callable $ str_split ) { if ( null === $ this -> pattern_trie ) { return [ ] ; } $ search = '_' . $ key . '_' ; $ search_length = $ strlen ( $ search ) ; $ chars = $ str_split ( $ search ) ; $ word_pattern = [ ] ; for ( $ start = 0 ; $ start < $ searc... | Lookup the pattern for a word via the trie . |
50,396 | protected function merge_hyphenation_exceptions ( ) { $ exceptions = [ ] ; if ( ! empty ( $ this -> pattern_exceptions ) && ! empty ( $ this -> custom_exceptions ) ) { $ exceptions = array_merge ( $ this -> custom_exceptions , $ this -> pattern_exceptions ) ; } elseif ( ! empty ( $ this -> pattern_exceptions ) ) { $ ex... | Merges hyphenation exceptions from the language file and custom hyphenation exceptions and generates patterns for all of them . |
50,397 | protected static function convert_hyphenation_exception_to_pattern ( $ exception ) { $ f = Strings :: functions ( $ exception ) ; if ( empty ( $ f ) ) { return null ; } $ lowercase_hyphened_word_parts = $ f [ 'str_split' ] ( $ exception , 1 ) ; $ lowercase_hyphened_word_length = $ f [ 'strlen' ] ( $ exception ) ; $ wor... | Generates a hyphenation pattern from an exception . |
50,398 | public static function mb_str_split ( $ str , $ split_length = 1 ) { $ result = ( array ) \ preg_split ( '//u' , $ str , - 1 , PREG_SPLIT_NO_EMPTY ) ; if ( $ split_length > 1 ) { $ splits = [ ] ; foreach ( \ array_chunk ( $ result , $ split_length ) as $ chunk ) { $ splits [ ] = \ join ( '' , $ chunk ) ; } $ result = $... | Multibyte - safe str_split function . |
50,399 | public static function uchr ( $ codes ) { if ( \ is_scalar ( $ codes ) ) { $ codes = \ func_get_args ( ) ; } $ json = '"' ; foreach ( $ codes as $ code ) { $ json .= \ sprintf ( '\u%04x' , $ code ) ; } $ json .= '"' ; return \ json_decode ( $ json ) ; } | Converts decimal value to unicode character . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.