idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
37,500
public function versionHasNoConflictAction ( int $ contentId , int $ versionNo , string $ languageCode ) : Response { $ versionInfo = $ this -> contentService -> loadVersionInfoById ( $ contentId , $ versionNo ) ; if ( ! $ versionInfo -> isDraft ( ) ) { throw new BadStateException ( 'Version status' , 'status is not dr...
Checks if Version has conflict with another published Version .
37,501
public function goToTab ( string $ tabName ) : void { $ this -> context -> getElementByText ( $ tabName , $ this -> fields [ 'menuButton' ] ) -> click ( ) ; }
Clicks on top menu for example Content tab .
37,502
public function bulkDeleteAction ( Request $ request ) : Response { $ this -> denyAccessUnlessGranted ( new Attribute ( 'class' , 'delete' ) ) ; $ form = $ this -> formFactory -> deleteContentTypeGroups ( new ContentTypeGroupsDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { ...
Handles removing content type groups based on submitted form .
37,503
private function isMethodCall ( Node \ Node $ node , string $ objectName , string $ methodName ) : bool { if ( $ node instanceof Node \ CallExpression ) { $ callee = $ node -> getCallee ( ) ; if ( $ callee instanceof Node \ MemberExpression ) { $ object = $ callee -> getObject ( ) ; $ property = $ callee -> getProperty...
Returns true if node is a method call .
37,504
private function extractDesc ( array $ arguments ) : ? string { if ( ! empty ( $ arguments ) ) { foreach ( $ arguments [ self :: ID_ARG ] -> getLeadingComments ( ) as $ comment ) { $ annotations = $ this -> docParser -> parse ( $ comment -> getText ( ) ) ; if ( ! empty ( $ annotations ) ) { return $ annotations [ 0 ] -...
Extracts a message description from the translator call .
37,505
private function supports ( SplFileInfo $ file ) : bool { return '.js' === substr ( $ file -> getRealPath ( ) , - 3 ) && '.min.js' !== substr ( $ file -> getRealPath ( ) , - 7 ) ; }
Returns true if file is supported by extractor .
37,506
public function bulkDeleteAction ( Request $ request , ContentTypeGroup $ group ) : Response { $ this -> denyAccessUnlessGranted ( new Attribute ( 'class' , 'delete' ) ) ; $ form = $ this -> formFactory -> deleteContentTypes ( new ContentTypesDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isS...
Handles removing content types based on submitted form .
37,507
public function transform ( $ value ) : ? int { if ( null === $ value ) { return null ; } if ( ! $ value instanceof TrashItem ) { throw new TransformationFailedException ( 'Expected a ' . TrashItem :: class . ' object.' ) ; } return $ value -> id ; }
Transforms a domain specific Trash Item object into a Trash Item s identifier .
37,508
public function reverseTransform ( $ value ) : ? TrashItem { if ( empty ( $ value ) ) { return null ; } try { return $ this -> trashService -> loadTrashItem ( $ value ) ; } catch ( NotFoundException $ e ) { throw new TransformationFailedException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
Transforms a Trash Item s ID into a domain specific Trash Item object .
37,509
private function getSortOrder ( ) { return [ $ this -> translator -> trans ( 'content_type.sort_field.ascending' , [ ] , 'content_type' ) => Location :: SORT_ORDER_ASC , $ this -> translator -> trans ( 'content_type.sort_field.descending' , [ ] , 'content_type' ) => Location :: SORT_ORDER_DESC , ] ; }
Get available sort order values .
37,510
public function verifyListIsEmpty ( string $ tabName ) : void { if ( $ this -> adminList -> table -> getItemCount ( ) > 0 ) { throw new \ Exception ( sprintf ( '%s list is not empty.' , $ tabName ) ) ; } }
Verifies if lists from given tab is empty .
37,511
public function map ( ValueObject $ value ) : RoleUpdateData { if ( ! $ value instanceof RoleUpdateStruct ) { throw new InvalidArgumentException ( 'value' , 'must be an instance of ' . RoleUpdateStruct :: class ) ; } $ data = new RoleUpdateData ( ) ; $ data -> setIdentifier ( $ value -> identifier ) ; return $ data ; }
Maps given RoleUpdateStruct object to a RoleUpdateData object .
37,512
public function reverseMap ( $ data ) : RoleUpdateStruct { if ( ! $ data instanceof RoleUpdateData ) { throw new InvalidArgumentException ( 'data' , 'must be an instance of ' . RoleUpdateData :: class ) ; } return new RoleUpdateStruct ( [ 'identifier' => $ data -> getIdentifier ( ) , ] ) ; }
Maps given RoleUpdateData object to a RoleUpdateStruct object .
37,513
private function flattenArrayOfLimitationsForCurrentUser ( array $ hasAccess ) : array { $ currentUserId = $ this -> permissionResolver -> getCurrentUserReference ( ) -> getUserId ( ) ; if ( \ is_array ( $ this -> flattenArrayOfLimitations [ $ currentUserId ] ) ) { return $ this -> flattenArrayOfLimitations [ $ current...
This method should only be used for very specific use cases . It should be used in a content cases where assignment limitations are not relevant .
37,514
public function getCellValue ( int $ row , int $ column ) : string { $ cell = $ this -> context -> findElement ( sprintf ( $ this -> fields [ 'tableCell' ] , $ row , $ column ) ) ; if ( $ cell !== null ) { if ( strpos ( $ cell -> getHtml ( ) , 'type="checkbox"' ) !== false ) { return strpos ( $ cell -> getHtml ( ) , 'c...
Get value of cell with given coordinates .
37,515
public function isElementInTable ( string $ name ) : bool { return $ this -> context -> getElementByText ( $ name , $ this -> fields [ 'listElement' ] ) !== null ; }
Check if list contains list element with given name .
37,516
public function verifyElements ( ) : void { $ this -> context -> waitUntilElementIsVisible ( $ this -> fields [ 'meSection' ] ) ; $ this -> navLinkTabs -> verifyVisibility ( ) ; $ this -> dashboardTable -> verifyVisibility ( ) ; }
Verifies that the Dashboard has the Me section .
37,517
public function verifyElements ( ) : void { $ this -> navLinkTabs -> verifyVisibility ( ) ; $ this -> adminLists [ 'Policies' ] -> verifyVisibility ( ) ; $ this -> navLinkTabs -> goToTab ( 'Assignments' ) ; $ this -> adminLists [ 'Assignments' ] -> verifyVisibility ( ) ; }
Verifies that all necessary elements are visible .
37,518
public function verifyListIsEmpty ( string $ tabName ) : void { $ this -> navLinkTabs -> goToTab ( $ tabName ) ; if ( $ this -> adminLists [ $ tabName ] -> table -> getItemCount ( ) > 0 ) { throw new \ Exception ( sprintf ( '"%s" list is not empty.' , $ tabName ) ) ; } }
Verifies if list from given tab is empty .
37,519
public function isRoleWithLimitationPresent ( string $ listName , string $ moduleAndFunction , string $ limitation ) : bool { $ policyExists = false ; $ this -> navLinkTabs -> goToTab ( $ listName ) ; $ adminList = $ this -> adminLists [ $ listName ] ; $ actualPoliciesList = $ adminList -> table -> getTableHash ( ) ; $...
Verifies if Role with Limitation from given list is present .
37,520
public function loadPathLocations ( Location $ location ) { $ locationQuery = new LocationQuery ( [ 'filter' => new Ancestor ( $ location -> pathString ) , 'sortClauses' => [ new Path ( ) ] , ] ) ; $ searchResult = $ this -> searchService -> findLocations ( $ locationQuery ) ; return array_map ( function ( SearchHit $ ...
Load path locations .
37,521
public function evaluate ( array $ parameters ) : bool { if ( false === $ this -> permissionResolver -> canUser ( 'role' , 'read' , $ parameters [ 'content' ] ) ) { return false ; } $ contentType = $ parameters [ 'contentType' ] ; $ isUser = new ContentTypeIsUser ( $ this -> userContentTypeIdentifier ) ; $ isUserGroup ...
Get information about tab presence .
37,522
public function transform ( $ value ) : ? int { if ( null === $ value ) { return null ; } if ( ! $ value instanceof Content ) { throw new TransformationFailedException ( 'Expected a ' . Content :: class . ' object.' ) ; } return $ value -> id ; }
Transforms a domain specific Content object into a Content s ID .
37,523
public function reverseTransform ( $ value ) : ? Content { if ( empty ( $ value ) ) { return null ; } if ( ! filter_var ( $ value , FILTER_VALIDATE_INT ) ) { throw new TransformationFailedException ( 'Expected a numeric string.' ) ; } try { return $ this -> contentService -> loadContent ( $ value ) ; } catch ( NotFound...
Transforms a Content s ID integer into a domain specific Content object .
37,524
public static function createElement ( UtilityContext $ context , string $ elementName , ? string ... $ parameters ) { if ( self :: $ factory === null ) { self :: $ factory = self :: getFactory ( self :: $ installType ) ; } return self :: $ factory :: createElement ( $ context , $ elementName , ... $ parameters ) ; }
Creates a Element object based on given Element Name .
37,525
public function map ( ValueObject $ value ) : RoleCreateData { if ( ! $ value instanceof RoleCreateStruct ) { throw new InvalidArgumentException ( 'value' , 'must be an instance of ' . RoleCreateStruct :: class ) ; } $ data = new RoleCreateData ( ) ; $ data -> setIdentifier ( $ value -> identifier ) ; return $ data ; }
Maps given RoleCreateStruct object to a RoleCreateData object .
37,526
public function reverseMap ( $ data ) : RoleCreateStruct { if ( ! $ data instanceof RoleCreateData ) { throw new InvalidArgumentException ( 'data' , 'must be an instance of ' . RoleCreateData :: class ) ; } return new RoleCreateStruct ( [ 'identifier' => $ data -> getIdentifier ( ) , ] ) ; }
Maps given RoleCreateData object to a RoleCreateStruct object .
37,527
public function restoreDatabase ( ) : void { $ currentDirectory = getcwd ( ) ; $ installer = $ this -> getInstallerService ( ) ; $ this -> findDirectoryToRunScripts ( ) ; $ installer -> setOutput ( new NullOutput ( ) ) ; $ installer -> importSchema ( ) ; $ installer -> importData ( ) ; chdir ( $ currentDirectory ) ; }
Detects installation type and restores the database using parameters from parameters . yml .
37,528
private function areExpectedDirectoriesPresent ( ) : bool { $ actualDirectories = scandir ( getcwd ( ) , 0 ) ; $ presentExpectedDirectories = array_intersect ( $ this -> expectedDirectories , $ actualDirectories ) ; sort ( $ this -> expectedDirectories ) ; sort ( $ presentExpectedDirectories ) ; return $ this -> expect...
Verifies whether the current folder contains the expected directories .
37,529
private function getInstallerService ( ) : Installer { switch ( $ this -> getInstallType ( ) ) { case InstallType :: ENTERPRISE_DEMO : return $ this -> serviceContainer -> get ( $ this -> installerServices [ 'platform-ee-demo' ] ) ; case InstallType :: ENTERPRISE : return $ this -> serviceContainer -> get ( $ this -> i...
Returns installer service depending on current install type .
37,530
public function bulkDeleteAction ( Request $ request , Role $ role ) : Response { $ this -> denyAccessUnlessGranted ( new Attribute ( 'role' , 'update' ) ) ; $ form = $ this -> formFactory -> deletePolicies ( new PoliciesDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ res...
Handles removing policies based on submitted form .
37,531
public function waitUntilElementIsVisible ( string $ cssSelector , int $ timeout = 5 , TraversableElement $ baseElement = null ) : void { $ baseElement = $ baseElement ?? $ this -> getSession ( ) -> getPage ( ) ; try { $ this -> waitUntil ( $ timeout , function ( ) use ( $ cssSelector , $ baseElement ) { $ element = $ ...
Waits until element is visible . If it does not appear throws exception .
37,532
public function getElementByText ( string $ text , string $ selector , string $ textSelector = null , TraversableElement $ baseElement = null ) : ? NodeElement { $ baseElement = $ baseElement ?? $ this -> getSession ( ) -> getPage ( ) ; $ elements = $ this -> findAllElements ( $ selector , $ baseElement ) ; foreach ( $...
Finds an HTML element by class and the text value and returns it . Search can be narrowed to children of baseElement .
37,533
public function getElementByTextFragment ( string $ textFragment , string $ selector , string $ textSelector = null , TraversableElement $ baseElement = null ) : ? NodeElement { $ baseElement = $ baseElement ?? $ this -> getSession ( ) -> getPage ( ) ; $ elements = $ this -> findAllElements ( $ selector , $ baseElement...
Finds an HTML element by class and the fragment of text value and returns it . Search can be narrowed to children of baseElement .
37,534
public function getElementPositionByText ( string $ text , string $ selector , string $ textSelector = null , TraversableElement $ baseElement = null ) : int { $ baseElement = $ baseElement ?? $ this -> getSession ( ) -> getPage ( ) ; $ counter = 0 ; $ elements = $ this -> findAllElements ( $ selector , $ baseElement )...
Finds an HTML element by class and the text value and returns it s position in order . Search can be narrowed to children of baseElement .
37,535
public function waitUntil ( int $ timeoutSeconds , callable $ callback , bool $ throwOnFailure = true ) { if ( ! is_callable ( $ callback ) ) { throw new \ InvalidArgumentException ( 'Given callback is not a valid callable' ) ; } $ start = time ( ) ; $ end = $ start + $ timeoutSeconds ; $ lastInternalExceptionMessage =...
Waits no longer than specified timeout for the given condition to be true .
37,536
public function findElement ( string $ selector , int $ timeout = 5 , TraversableElement $ baseElement = null ) : NodeElement { $ baseElement = $ baseElement ?? $ this -> getSession ( ) -> getPage ( ) ; try { return $ this -> waitUntil ( $ timeout , function ( ) use ( $ selector , $ baseElement ) { return $ baseElement...
Adopted Mink find function to find one element that might still be loading .
37,537
public function isElementVisible ( string $ locator , int $ timeout = 5 ) : bool { try { $ element = $ this -> findElement ( $ locator , $ timeout ) ; return isset ( $ element ) && $ element -> isVisible ( ) ; } catch ( ElementNotFoundException $ e ) { return false ; } }
Checks the visibility of a HTML element found by class .
37,538
public function uploadFileToRemoteSpace ( string $ localFileName ) : string { if ( ! preg_match ( '#[\w\\\/\.]*\.zip$#' , $ localFileName ) ) { throw new \ InvalidArgumentException ( 'Zip archive required to upload to remote browser machine.' ) ; } $ localFile = sprintf ( '%s%s' , $ this -> getMinkParameter ( 'files_pa...
Uploads file from location stored in files_path to the disc on remote browser machine . Mink require uploaded file to be zip archive .
37,539
public static function createPage ( UtilityContext $ context , string $ pageName , ? string ... $ parameters ) { if ( self :: $ factory === null ) { self :: $ factory = self :: getFactory ( self :: $ installType ) ; } return self :: $ factory :: createPage ( $ context , $ pageName , ... $ parameters ) ; }
Creates a Page object based on given Page Name .
37,540
public function map ( ValueObject $ value ) : SectionCreateData { if ( ! $ value instanceof SectionCreateStruct ) { throw new InvalidArgumentException ( 'value' , 'must be an instance of ' . SectionCreateStruct :: class ) ; } return new SectionCreateData ( $ value -> identifier , $ value -> name ) ; }
Maps given SectionCreateStruct object to a SectionCreateData object .
37,541
public function reverseMap ( $ data ) : SectionCreateStruct { if ( ! $ data instanceof SectionCreateData ) { throw new InvalidArgumentException ( 'data' , 'must be an instance of ' . SectionCreateData :: class ) ; } return new SectionCreateStruct ( [ 'name' => $ data -> getName ( ) , 'identifier' => $ data -> getIdenti...
Maps given SectionCreateData object to a SectionCreateStruct object .
37,542
public function verifyListIsEmpty ( ) : void { $ firstRowValue = $ this -> adminLists [ 'Content items' ] -> table -> getCellValue ( 1 , 1 ) ; if ( ! ( $ this -> adminLists [ 'Content items' ] -> table -> getItemCount ( ) === 1 && strpos ( $ firstRowValue , 'No content items.' ) !== false ) ) { throw new \ Exception ( ...
Verifies if list of Content items is empty .
37,543
public function open ( bool $ verifyIfLoaded = true ) : void { $ this -> context -> visit ( $ this -> route ) ; if ( $ verifyIfLoaded ) { $ this -> verifyIsLoaded ( ) ; } }
Opens the page in Browser .
37,544
public function verifyRoute ( ) : void { $ this -> context -> waitUntil ( $ this -> defaultTimeout , function ( ) { return false !== strpos ( $ this -> context -> getSession ( ) -> getCurrentUrl ( ) , $ this -> route ) ; } ) ; }
Verifies that Page is available under correct route .
37,545
private function loadLocation ( int $ locationId , array $ languages = null ) : Location { return $ this -> repository -> getLocationService ( ) -> loadLocation ( $ locationId , $ languages ) ; }
Loads a visible Location .
37,546
public function transform ( $ value ) : ? string { if ( null === $ value ) { return null ; } if ( ! is_array ( $ value ) || array_diff ( [ 'id' , 'module' , 'function' ] , array_keys ( $ value ) ) ) { throw new TransformationFailedException ( 'Expected a valid array of data.' ) ; } return implode ( ':' , [ $ value [ 'i...
Transforms a domain specific Policy object into a Policy string .
37,547
public function reverseTransform ( $ value ) : ? array { if ( null === $ value ) { return null ; } if ( ! is_string ( $ value ) ) { throw new TransformationFailedException ( 'Expected a string.' ) ; } $ parts = explode ( ':' , $ value ) ; if ( count ( $ parts ) < 3 ) { throw new TransformationFailedException ( 'Policy ...
Transforms a Policy string into a domain specific Policy array .
37,548
public function startCreatingContent ( string $ contentType ) : ContentUpdateItemPage { $ this -> rightMenu -> clickButton ( 'Create' ) ; $ contentTypePicker = ElementFactory :: createElement ( $ this -> context , ContentTypePicker :: ELEMENT_NAME ) ; $ contentTypePicker -> select ( $ contentType ) ; $ contentUpdatePag...
Clicks Create and selects Content Type in displayed search .
37,549
public function login ( string $ username , string $ password ) : void { $ this -> fillUsername ( $ username ) ; $ this -> fillPassword ( $ password ) ; $ this -> clickLogin ( ) ; }
Performs login action .
37,550
protected function fillUsername ( string $ username ) : void { $ this -> context -> findElement ( $ this -> fields [ 'username' ] , $ this -> defaultTimeout ) -> setValue ( $ username ) ; }
Fills username field .
37,551
protected function fillPassword ( string $ password ) : void { $ this -> context -> findElement ( $ this -> fields [ 'password' ] , $ this -> defaultTimeout ) -> setValue ( $ password ) ; }
Fills password field .
37,552
public function verifyElements ( ) : void { $ this -> context -> waitUntilElementIsVisible ( $ this -> fields [ 'username' ] ) ; $ this -> context -> waitUntilElementIsVisible ( $ this -> fields [ 'password' ] ) ; $ this -> context -> waitUntil ( 5 , function ( ) { return '' == $ this -> context -> findElement ( $ this...
Verifies that username and password fields are available .
37,553
public function map ( ValueObject $ value ) : LanguageCreateData { if ( ! $ value instanceof LanguageCreateStruct ) { throw new InvalidArgumentException ( 'value' , 'must be an instance of ' . LanguageCreateStruct :: class ) ; } $ data = new LanguageCreateData ( ) ; $ data -> setName ( $ value -> name ) ; $ data -> set...
Maps given LanguageCreateStruct object to a LanguageCreateData object .
37,554
public function reverseMap ( $ data ) : LanguageCreateStruct { if ( ! $ data instanceof LanguageCreateData ) { throw new InvalidArgumentException ( 'data' , 'must be an instance of ' . LanguageCreateData :: class ) ; } return new LanguageCreateStruct ( [ 'languageCode' => $ data -> getLanguageCode ( ) , 'name' => $ dat...
Maps given LanguageCreateData object to a LanguageCreateStruct object .
37,555
public function map ( ValueObject $ value ) : ContentMainLocationUpdateData { if ( ! $ value instanceof ContentMetadataUpdateStruct ) { throw new InvalidArgumentException ( 'value' , 'must be an instance of ' . ContentMetadataUpdateStruct :: class ) ; } $ data = new ContentMainLocationUpdateData ( ) ; $ data -> setLoca...
Maps given ContentMetadataUpdateStruct object to a ContentMainLocationUpdateData object .
37,556
public function reverseMap ( $ data ) : ContentMetadataUpdateStruct { if ( ! $ data instanceof ContentMainLocationUpdateData ) { throw new InvalidArgumentException ( 'data' , 'must be an instance of ' . ContentMainLocationUpdateData :: class ) ; } return new ContentMetadataUpdateStruct ( [ 'mainLocationId' => $ data ->...
Maps given ContentMainLocationUpdateData object to a ContentMetadataUpdateStruct object .
37,557
public function GetLastVoucher ( $ sales_point , $ type ) { $ req = array ( 'PtoVta' => $ sales_point , 'CbteTipo' => $ type ) ; return $ this -> ExecuteRequest ( 'FECompUltimoAutorizado' , $ req ) -> CbteNro ; }
Gets last voucher number
37,558
public function CreateVoucher ( $ data , $ return_response = FALSE ) { $ req = array ( 'FeCAEReq' => array ( 'FeCabReq' => array ( 'CantReg' => $ data [ 'CbteHasta' ] - $ data [ 'CbteDesde' ] + 1 , 'PtoVta' => $ data [ 'PtoVta' ] , 'CbteTipo' => $ data [ 'CbteTipo' ] ) , 'FeDetReq' => array ( 'FECAEDetRequest' => & $ d...
Create a voucher from AFIP
37,559
public function CreateNextVoucher ( $ data ) { $ last_voucher = $ this -> GetLastVoucher ( $ data [ 'PtoVta' ] , $ data [ 'CbteTipo' ] ) ; $ voucher_number = $ last_voucher + 1 ; $ data [ 'CbteDesde' ] = $ voucher_number ; $ data [ 'CbteHasta' ] = $ voucher_number ; $ res = $ this -> CreateVoucher ( $ data ) ; $ res [ ...
Create next voucher from AFIP
37,560
public function GetVoucherInfo ( $ number , $ sales_point , $ type ) { $ req = array ( 'FeCompConsReq' => array ( 'CbteNro' => $ number , 'PtoVta' => $ sales_point , 'CbteTipo' => $ type ) ) ; try { $ result = $ this -> ExecuteRequest ( 'FECompConsultar' , $ req ) ; } catch ( Exception $ e ) { if ( $ e -> getCode ( ) =...
Get complete voucher information
37,561
private function GetWSInitialRequest ( $ operation ) { if ( $ operation == 'FEDummy' ) { return array ( ) ; } $ ta = $ this -> afip -> GetServiceTA ( 'wsfe' ) ; return array ( 'Auth' => array ( 'Token' => $ ta -> token , 'Sign' => $ ta -> sign , 'Cuit' => $ this -> afip -> CUIT ) ) ; }
Make default request parameters for most of the operations
37,562
public function GetServiceTA ( $ service , $ continue = TRUE ) { if ( file_exists ( $ this -> TA_FOLDER . 'TA-' . $ this -> options [ 'CUIT' ] . '-' . $ service . '.xml' ) ) { $ TA = new SimpleXMLElement ( file_get_contents ( $ this -> TA_FOLDER . 'TA-' . $ this -> options [ 'CUIT' ] . '-' . $ service . '.xml' ) ) ; $ ...
Gets token authorization for an AFIP Web Service
37,563
private function CreateServiceTA ( $ service ) { $ TRA = new SimpleXMLElement ( '<?xml version="1.0" encoding="UTF-8"?>' . '<loginTicketRequest version="1.0">' . '</loginTicketRequest>' ) ; $ TRA -> addChild ( 'header' ) ; $ TRA -> header -> addChild ( 'uniqueId' , date ( 'U' ) ) ; $ TRA -> header -> addChild ( 'genera...
Create an TA from WSAA
37,564
public function log ( $ entry , $ level = LOG_LEVEL_INFO ) { if ( ! is_array ( $ entry ) ) { $ entry = array ( 'comment' => $ entry , 'level' => $ level ) ; } $ this -> _log -> addEntry ( $ entry ) ; return $ this ; }
Logs an entry .
37,565
protected function _checkAttribute ( $ attrSubSet ) { $ attrSubSet [ 0 ] = strtolower ( $ attrSubSet [ 0 ] ) ; $ attrSubSet [ 1 ] = strtolower ( $ attrSubSet [ 1 ] ) ; return ( ( ( strpos ( $ attrSubSet [ 1 ] , 'expression' ) !== false ) && ( $ attrSubSet [ 0 ] ) == 'style' ) || ( strpos ( $ attrSubSet [ 1 ] , 'javascr...
Function to determine if contents of an attribute is safe
37,566
public function addListCommands ( ) { $ story = $ this -> getController ( ) -> getItem ( ) ; if ( $ story -> authorize ( 'vote' ) ) { $ this -> getController ( ) -> setItem ( $ story -> object ) ; $ this -> addCommand ( 'vote' ) ; $ this -> getController ( ) -> setItem ( $ story ) ; } if ( $ story -> authorize ( 'add.c...
Set the list commands .
37,567
protected function _commandView ( $ command ) { $ entity = $ this -> getController ( ) -> getItem ( ) ; $ label = sprintf ( AnTranslator :: _ ( 'COM-STORIES-VIEW-ALL-COMMENTS' ) , $ entity -> getNumOfComments ( ) ) ; $ command -> append ( array ( 'label' => $ label ) ) ; $ command -> href ( route ( $ entity -> getURL (...
View Stories .
37,568
protected function _commandDelete ( $ command ) { $ entity = $ this -> getController ( ) -> getItem ( ) ; $ link = 'option=com_stories&view=story' ; foreach ( $ entity -> getIds ( ) as $ id ) { $ link .= '&id[]=' . $ id ; } $ command -> append ( array ( 'label' => AnTranslator :: _ ( 'LIB-AN-ACTION-DELETE' ) ) ) -> hre...
Delete Command for a story .
37,569
public static function applyFilters ( $ query , $ filters ) { foreach ( $ filters as $ filter => $ value ) { $ method = AnInflector :: variablize ( $ filter ) ; $ value = AnConfig :: unbox ( $ value ) ; if ( ! is_array ( $ value ) || ! is_numeric ( key ( $ value ) ) ) { $ args = array ( $ value ) ; } else { $ args = $ ...
Applies an array of fiters to query by calling each filter as method on the query .
37,570
public static function parseColumn ( $ query , $ column ) { $ repository = $ query -> getRepository ( ) ; $ description = $ repository -> getDescription ( ) ; $ parts = explode ( '.' , $ column , 2 ) ; $ attribute = isset ( $ parts [ 1 ] ) ? $ parts [ 1 ] : null ; $ result = array ( 'columns' => null , 'property' => nu...
Return a property object from a key value .
37,571
public static function addRelationship ( $ query , $ relationship ) { $ property = $ query -> getRepository ( ) -> getDescription ( ) -> getProperty ( $ relationship ) ; switch ( true ) { case $ property -> isManyToOne ( ) : return self :: _parseManyToOne ( $ query , $ property ) ; case $ property -> isManyToMany ( ) :...
Adds a relationship to query .
37,572
public function set ( $ property , $ value = null ) { if ( is_object ( $ property ) ) { $ property = get_object_vars ( $ property ) ; } if ( is_array ( $ property ) ) { foreach ( $ property as $ k => $ v ) { $ this -> set ( $ k , $ v ) ; } } else { if ( '_' == substr ( $ property , 0 , 1 ) ) { throw new AnObjectExcepti...
Set the object properties
37,573
public function get ( $ property = null , $ default = null ) { $ result = $ default ; if ( is_null ( $ property ) ) { $ result = get_object_vars ( $ this ) ; foreach ( $ result as $ key => $ value ) { if ( '_' == substr ( $ key , 0 , 1 ) ) { unset ( $ result [ $ key ] ) ; } } } else { if ( isset ( $ this -> $ property ...
Get the object properties
37,574
final public function getService ( $ identifier = null , array $ config = array ( ) ) { if ( ! isset ( $ this -> __service_container ) ) { throw new AnObjectException ( "Failed to call " . get_class ( $ this ) . "::getService(). No service_container object defined." ) ; } if ( ! isset ( $ identifier ) ) { $ result = $ ...
Get an instance of a class based on a class identifier only creating it if it does not exist yet .
37,575
protected function _renderScript ( $ script , $ link , $ attribs = array ( ) ) { $ attribs = AnHelperArray :: toString ( $ attribs ) ; if ( ! $ link ) { $ html = '<script type="text/javascript" ' . $ attribs . '>' . "\n" ; $ html .= trim ( $ script ) ; $ html .= '</script>' . "\n" ; } else { $ html = '<script type="tex...
Render script information
37,576
protected function _actionEnable ( $ context ) { $ context -> response -> status = AnHttpResponse :: RESET_CONTENT ; $ this -> getItem ( ) -> enable ( ) ; return ; }
Enable Entity .
37,577
protected function _actionDisable ( $ context ) { $ context -> response -> status = AnHttpResponse :: RESET_CONTENT ; $ this -> getItem ( ) -> disable ( ) ; return ; }
Disable Entity .
37,578
protected function _layoutDefault ( ) { $ context = new AnCommandContext ( ) ; $ context -> gadgets = new LibBaseTemplateObjectContainer ( ) ; $ context -> actor = $ this -> _state -> getItem ( ) ; $ context -> composers = new LibBaseTemplateObjectContainer ( ) ; $ context -> commands = $ this -> getTemplate ( ) -> ren...
Default layout .
37,579
protected function _layoutBadge ( ) { $ context -> commands = $ this -> getTemplate ( ) -> renderHelper ( 'toolbar.commands' , 'toolbar' ) ; $ this -> set ( array ( 'commands' => $ context -> commands , ) ) ; }
Default Badge .
37,580
protected function _renderStyle ( $ style , $ link , $ attribs = array ( ) ) { $ attribs = AnHelperArray :: toString ( $ attribs ) ; if ( ! $ link ) { $ html = '<style type="text/css" ' . $ attribs . '>' . "\n" ; $ html .= trim ( $ style [ 'data' ] ) ; $ html .= '</style>' . "\n" ; } else { $ html = '<link type="text/c...
Render style information
37,581
public function select ( $ columns = '*' ) { settype ( $ columns , 'array' ) ; $ this -> columns = array_unique ( array_merge ( $ this -> columns , $ columns ) ) ; return $ this ; }
Built a select query
37,582
public function from ( $ tables ) { settype ( $ tables , 'array' ) ; $ needle = $ this -> _adapter -> getTableNeedle ( ) ; foreach ( $ tables as & $ table ) { if ( strpos ( $ table , $ needle ) !== 0 ) { $ table = $ needle . $ table ; } } $ this -> from = array_unique ( array_merge ( $ this -> from , $ tables ) ) ; ret...
Built the from clause of the query
37,583
public function join ( $ type , $ table , $ condition ) { settype ( $ condition , 'array' ) ; $ needle = $ this -> _adapter -> getTableNeedle ( ) ; if ( strpos ( $ table , $ needle ) !== 0 ) { $ table = $ needle . $ table ; } $ this -> join [ ] = array ( 'type' => strtoupper ( $ type ) , 'table' => $ table , 'condition...
Built the join clause of the query
37,584
public function where ( $ property , $ constraint = null , $ value = null , $ condition = 'AND' ) { if ( ! empty ( $ property ) ) { $ where = array ( ) ; $ where [ 'property' ] = $ property ; if ( isset ( $ constraint ) ) { $ constraint = strtoupper ( $ constraint ) ; $ condition = strtoupper ( $ condition ) ; $ where ...
Built the where clause of the query
37,585
public function group ( $ columns ) { settype ( $ columns , 'array' ) ; $ this -> group = array_unique ( array_merge ( $ this -> group , $ columns ) ) ; return $ this ; }
Built the group clause of the query
37,586
public function having ( $ columns ) { settype ( $ columns , 'array' ) ; $ this -> having = array_unique ( array_merge ( $ this -> having , $ columns ) ) ; return $ this ; }
Built the having clause of the query
37,587
public function addToolbar ( $ toolbar , $ config = array ( ) , $ priority = AnEvent :: PRIORITY_NORMAL ) { if ( ! ( $ toolbar instanceof AnControllerToolbarInterface ) ) { $ toolbar = $ this -> _mixer -> getToolbar ( $ toolbar , $ config ) ; } $ this -> _toolbars [ $ toolbar -> getIdentifier ( ) -> name ] = $ toolbar ...
Add one or more toolbars
37,588
public function getToolbar ( $ toolbar , $ config = array ( ) ) { $ identifier = $ toolbar ; if ( ! ( $ toolbar instanceof AnServiceIdentifier ) ) { if ( is_string ( $ toolbar ) && strpos ( $ toolbar , '.' ) === false ) { $ identifier = clone $ this -> getIdentifier ( ) ; $ identifier -> path = array ( 'controller' , '...
Get a toolbar by identifier
37,589
public function setDate ( $ date , $ format = DATE_FORMAT_ISO ) { $ regex = '/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?(Z|[\+\-]\d{2}:?\d{2})?)?$/i' ; if ( preg_match ( $ regex , $ date , $ regs ) && $ format != DATE_FORMAT_UNIXTIME ) { $ this -> year = $ regs [ 1 ] ; $ this -> month = $ regs [...
Set the fields of a Date object based on the input date and format
37,590
public function copy ( $ date ) { $ this -> year = $ date -> year ; $ this -> month = $ date -> month ; $ this -> day = $ date -> day ; $ this -> hour = $ date -> hour ; $ this -> minute = $ date -> minute ; $ this -> second = $ date -> second ; }
Copy values from another Date object
37,591
public function format ( $ format ) { $ timestamp = mktime ( $ this -> hour , $ this -> minute , $ this -> second , $ this -> month , $ this -> day , $ this -> year ) ; return strftime ( $ format , $ timestamp ) ; }
Formats the date
37,592
public function year ( $ value = null ) { if ( $ value !== null ) { if ( $ value < 0 || $ value > 9999 ) { $ this -> year = 0 ; } else { $ this -> year = $ value ; } } return $ this -> year ; }
Set the year field of the date object
37,593
public function month ( $ value = null ) { if ( $ value !== null ) { if ( $ value < 1 || $ value > 12 ) { $ this -> month = 1 ; } else { $ this -> month = $ value ; } } return $ this -> month ; }
Set the month field of the date object
37,594
public function day ( $ value = null ) { if ( $ value !== null ) { if ( $ value > 31 || $ value < 1 ) { $ this -> day = 1 ; } else { $ this -> day = $ value ; } } return $ this -> day ; }
Set the day field of the date object
37,595
public function hour ( $ value = null ) { if ( $ value !== null ) { if ( $ value > 23 || $ value < 0 ) { $ this -> hour = 0 ; } else { $ this -> hour = $ value ; } } return $ this -> hour ; }
Set the hour field of the date object
37,596
public function minute ( $ value = null ) { if ( $ value !== null ) { if ( $ value > 59 || $ value < 0 ) { $ this -> minute = 0 ; } else { $ this -> minute = $ value ; } } return $ this -> minute ; }
Set the minute field of the date object
37,597
public function second ( $ value = null ) { if ( $ value !== null ) { if ( $ value > 59 || $ value < 0 ) { $ this -> second = 0 ; } else { $ this -> second = $ value ; } } return $ this -> second ; }
Set the second field of the date object
37,598
public function toDays ( AnDate $ date = null ) { $ year = isset ( $ date ) ? $ date -> year : $ this -> year ; $ month = isset ( $ date ) ? $ date -> month : $ this -> month ; $ day = isset ( $ date ) ? $ date -> day : $ this -> day ; $ century = ( int ) substr ( $ year , 0 , 2 ) ; $ year = ( int ) substr ( $ year , 2...
Converts a date to number of days since a distant unspecified epoch
37,599
public static function getWeekdayFullname ( $ day = null ) { if ( $ day === null ) { $ day = new AnDate ( ) ; } if ( $ day instanceof AnDate ) { $ weekday = self :: getDayOfWeek ( $ day ) ; } elseif ( is_int ( $ day ) ) { $ weekday = $ day ; } $ names = self :: getWeekDays ( ) ; return $ names [ $ weekday ] ; }
Returns the full weekday name for the given date