idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
2,500 | public function offset ( $ offset = null ) { if ( is_null ( $ offset ) ) return $ this -> discard ( 'query.offset' ) ; return $ this -> merge ( [ 'query.offset' => intval ( $ offset ) ] ) ; } | Sets rows offset |
2,501 | public function attrs ( $ attrs ) { if ( is_array ( $ attrs ) && ! empty ( $ attrs ) ) return $ this -> merge ( [ 'query.attrs' => $ attrs ] ) ; else return $ this -> merge ( [ 'query.attrs' => func_get_args ( ) ] ) ; } | Sets the attributes to fetch |
2,502 | public function findByPk ( $ pk ) { $ this -> mapper -> connect ( ) ; $ query = $ this -> mapper -> newQuery ( ) -> from ( $ this -> entityProfile -> getEntityTable ( ) ) -> select ( $ this -> getSelectColumns ( ) ) -> where ( Column :: __callstatic ( $ this -> entityProfile -> getPrimaryKey ( true ) ) -> eq ( $ pk ) )... | Obtains an entity by primary key |
2,503 | public function find ( SQLPredicate $ condition = null ) { $ this -> mapper -> connect ( ) ; $ table = $ this -> entityProfile -> getEntityTable ( ) ; $ query = $ this -> mapper -> newQuery ( $ this -> entityProfile ) -> from ( $ table , Schema :: DEFAULT_ALIAS ) -> select ( $ this -> getSelectColumns ( ) ) ; $ args = ... | Finds a list of entities by a given criteria |
2,504 | public function delete ( $ entity ) { if ( is_null ( $ entity ) ) return ; $ this -> mapper -> connect ( ) ; $ this -> mapper -> beginTransaction ( ) ; $ pk = $ this -> getPropertyValue ( $ this -> entityProfile , $ entity , $ this -> entityProfile -> getPrimaryKey ( ) ) ; foreach ( $ this -> entityProfile -> getRefere... | Removes given entity from database |
2,505 | public function deleteWhere ( SQLPredicate $ condition = null , $ cascade = false ) { $ this -> mapper -> connect ( ) ; $ this -> mapper -> beginTransaction ( ) ; if ( $ cascade ) { $ list = $ this -> find ( $ condition ) ; foreach ( $ list as $ entity ) $ this -> delete ( $ entity ) ; $ result = true ; } else { $ quer... | Removes a set of entities by a given condition |
2,506 | public function truncate ( ) { $ this -> mapper -> connect ( ) ; $ this -> mapper -> beginTransaction ( ) ; $ query = $ this -> mapper -> newQuery ( ) -> deleteFrom ( $ this -> entityProfile -> getEntityTable ( ) ) ; $ result = $ query -> exec ( ) ; $ this -> mapper -> commit ( ) ; return $ result ; } | Truncates a table |
2,507 | protected function sqlFunction ( SQLFunction $ function ) { $ this -> mapper -> connect ( ) ; $ query = $ this -> mapper -> newQuery ( $ this -> entityProfile ) -> from ( $ this -> entityProfile -> getEntityTable ( ) , Schema :: DEFAULT_ALIAS ) -> select ( $ function -> getFunctionInstance ( ) ) ; if ( $ this -> hasOpt... | Invokes an aggregate function |
2,508 | public function install ( PackageWrapper $ package , $ isDev ) { $ args = [ 'install' ] ; if ( ! $ isDev ) { $ args [ ] = '--production' ; } $ this -> execute ( 'npm' , $ args , $ this -> io , $ package -> getPath ( ) ) ; } | Run this installer for the package |
2,509 | private function validateRegex ( ) : bool { $ isValid = \ preg_match ( $ this -> options [ 'pattern' ] , $ this -> value ) ? true : false ; if ( ! $ isValid ) { $ this -> setError ( self :: VALIDATOR_ERROR_REGEX_PATTERN_NOT_MATCH ) ; } return $ isValid ; } | Checks whether string is valid against regex pattern |
2,510 | public function findBy ( array $ criteria , array $ order = null , $ limit = null , $ offset = null ) { return $ this -> getRepository ( ) -> findBy ( $ criteria , $ order , $ limit , $ offset ) ; } | Returns entities according to criteria . |
2,511 | private static function preprocessJsonPayload ( $ payload ) { $ requests = [ ] ; $ is_batch = false ; if ( is_array ( $ payload ) ) { $ is_batch = true ; foreach ( $ payload as $ request ) $ requests [ ] = self :: preprocessJsonRequest ( $ request ) ; } else { $ requests [ ] = self :: preprocessJsonRequest ( $ payload ... | Preprocess json payload |
2,512 | private static function preprocessJsonRequest ( $ request ) { if ( ! is_object ( $ request ) || ! property_exists ( $ request , 'jsonrpc' ) || ! property_exists ( $ request , 'method' ) || $ request -> jsonrpc != '2.0' || empty ( $ request -> method ) ) { return array ( 'ERROR_CODE' => - 32600 , 'ERROR_MESSAGE' => 'Inv... | Preprocess a single json request |
2,513 | private function runSingleRequest ( $ request_method , $ parameters ) { try { $ registered_method = $ this -> checkRequestSustainability ( $ request_method ) ; $ selected_signature = $ this -> checkRequestConsistence ( $ registered_method , $ parameters ) ; if ( is_array ( $ parameters ) ) $ parameters = self :: matchP... | Exec a single request |
2,514 | private static function packJsonError ( $ code , $ message , $ id ) { if ( ! is_null ( $ id ) ) { return array ( 'jsonrpc' => '2.0' , 'error' => array ( 'code' => $ code , 'message' => $ message ) , 'id' => $ id ) ; } else { return null ; } } | Pack a json error response |
2,515 | private static function checkSignatureMatch ( $ provided , $ requested ) { if ( is_object ( $ provided ) ) { foreach ( $ provided as $ parameter => $ value ) { if ( ! isset ( $ requested [ $ parameter ] ) || ! Validator :: validate ( $ value , $ requested [ $ parameter ] ) ) return false ; } } else { $ provided_paramet... | Check if call match a signature |
2,516 | public function write ( $ content = '' ) { if ( $ this -> rotate ( ) ) { if ( empty ( $ this -> file_mtime ) && file_exists ( $ this -> file_path ) ) { $ this -> file_mtime = filemtime ( $ this -> file_path ) ; } $ f = @ fopen ( $ this -> file_path , "ab" ) ; if ( $ f ) { fputs ( $ f , str_replace ( '<' , '<' , $ co... | Write a string in the file |
2,517 | public function rotate ( $ force = false ) { $ rotator = $ this -> options [ 'backup_time' ] ; if ( true === $ force || $ this -> mustRotate ( ) ) { $ dir = dirname ( $ this -> file_path ) ; $ old_file = $ this -> getFilename ( basename ( $ this -> file_path ) , $ rotator ) ; if ( file_exists ( $ dir . '/' . $ old_file... | Rotate file if so |
2,518 | public function mustRotate ( ) { if ( ! file_exists ( $ this -> file_path ) ) return false ; if ( $ this -> flag & self :: ROTATE_FILESIZE ) { $ s = @ filesize ( $ this -> file_path ) ; return ( bool ) ( @ is_readable ( $ this -> file_path ) && $ s > $ this -> options [ 'max_filesize' ] * 1024 ) ; } else { if ( empty (... | Does the current file need to be rotated |
2,519 | public function getFilename ( $ file_name , $ rotation_index = 0 ) { if ( $ rotation_index === 0 ) return $ file_name ; $ rotation_date = date ( $ this -> options [ 'date_format' ] , time ( ) - ( $ this -> options [ 'period_duration' ] * $ rotation_index ) ) ; return strtr ( sprintf ( $ this -> options [ 'filename_mask... | Get the name of a file to rotate |
2,520 | public static function lockTheme ( $ theme_name ) { update_option ( 'template' , $ theme_name ) ; update_option ( 'stylesheet' , $ theme_name ) ; update_option ( 'current_theme' , $ theme_name ) ; add_action ( 'admin_init' , function ( ) { global $ submenu ; unset ( $ submenu [ self :: MENU_THEMES ] [ 5 ] ) ; $ submenu... | Sets the theme to the provided theme name and removes the theme selection screen |
2,521 | public function run ( $ id ) { $ model = $ this -> getModel ( $ id ) ; $ model -> setScenario ( $ this -> scenario ) ; if ( $ model -> load ( Yii :: $ app -> getRequest ( ) -> post ( ) ) ) { if ( Yii :: $ app -> getRequest ( ) -> isAjax ) { Yii :: $ app -> getResponse ( ) -> format = Response :: FORMAT_JSON ; return Ac... | Updates existing record . |
2,522 | protected function getAllowedAclFields ( Model $ model , $ scenario ) { $ privilege = [ 'set' , 'set_on_' . $ scenario ] ; $ acl = app ( AclContract :: class ) ; $ modelClass = get_class ( $ model ) ; $ cacheKey = sha1 ( json_encode ( $ privilege ) . $ acl -> getContextId ( ) . $ modelClass ) ; if ( ! isset ( $ this ->... | Get and cache the field rules |
2,523 | protected function getStep ( $ step ) { $ store = $ this -> getStore ( ) ; $ formSrv = $ this -> getServiceLocator ( ) -> get ( 'Form' ) ; if ( $ step == $ this -> startStep ) { $ form = $ formSrv -> get ( 'Grid\Paragraph\CreateWizard\Start' ) ; $ model = new StartStep ( array ( 'textDomain' => 'paragraph' , ) ) ; } el... | Get step model |
2,524 | public function index ( ) { $ this -> getListingService ( ) -> setOrder ( $ this -> getOrder ( ) ) -> setPagination ( $ this -> getPagination ( ) ) -> getFilters ( ) -> add ( $ this -> getSearchFilter ( ) ) ; $ this -> set ( [ $ this -> getEntityNamePlural ( ) => $ this -> getListingService ( ) -> getList ( ) , 'pagina... | Handle the request to display a list of entities |
2,525 | protected function getPagination ( ) { if ( null == $ this -> pagination ) { $ this -> pagination = new Pagination ( [ 'rowsPerPage' => $ this -> rowsPerPage , 'request' => $ this -> getRequest ( ) ] ) ; } return $ this -> pagination ; } | Get pagination for roes per page property |
2,526 | protected function getListingService ( ) { if ( null == $ this -> listingService ) { $ this -> listingService = new EntityListingService ( $ this -> getEntityClassName ( ) ) ; } return $ this -> listingService ; } | Get the entity listing service |
2,527 | protected function getSearchFilter ( ) { $ pattern = $ this -> getRequest ( ) -> getQuery ( 'pattern' , null ) ; $ pattern = StaticFilter :: filter ( 'text' , $ pattern ) ; $ this -> set ( 'pattern' , $ pattern ) ; return new SearchFilter ( [ 'pattern' => $ pattern ] ) ; } | Get search filter |
2,528 | protected function getSearchFields ( ) { if ( null == $ this -> searchFields ) { $ field = $ this -> getEntityDescriptor ( ) -> getDisplayFiled ( ) ; $ this -> searchFields = [ $ this -> getEntityDescriptor ( ) -> getTableName ( ) . '.' . $ field -> getField ( ) ] ; } return $ this -> searchFields ; } | Get the fields list to use on search filter |
2,529 | protected function getOrder ( ) { $ repo = $ this -> getRepository ( ) ; $ table = $ repo -> getEntityDescriptor ( ) -> getTableName ( ) ; $ pmk = $ repo -> getEntityDescriptor ( ) -> getPrimaryKey ( ) -> getField ( ) ; return "{$table}.{$pmk} DESC" ; } | Returns the query order by clause |
2,530 | public function shopIsAvailable ( ) { $ open = false ; $ setting = $ this -> shopSettingsRepository -> findOneBy ( [ 'name' => \ Amulen \ ShopBundle \ Entity \ ShopSetting :: SHOP_AVAILABLE ] ) ; if ( $ setting ) { $ strValue = $ setting -> getValue ( ) ; $ value = strtolower ( trim ( $ strValue ) ) ; if ( $ value == '... | Get the shop status . |
2,531 | public function getSetting ( $ settingName ) { $ value = null ; $ setting = $ this -> shopSettingsRepository -> findOneBy ( [ 'name' => $ settingName ] ) ; if ( $ setting ) { $ value = $ setting -> getValue ( ) ; } return $ value ; } | Get s setting value . |
2,532 | public function equals ( $ role ) { return $ role -> getRole ( ) -> id == $ this -> role -> id && $ role -> getRole ( ) -> name == $ this -> role -> name ; } | checks if given role object is equal to current one |
2,533 | public function addPermissions ( $ permissions ) { foreach ( $ permissions as $ permission ) { $ per = new permission ( $ permission ) ; $ this -> role -> sharedPermissionList [ ] = $ per -> get ( ) ; } R :: store ( $ this -> role ) ; } | add permissions to role |
2,534 | public function addPermission ( $ permission ) { $ per = new permission ( $ permission ) ; $ this -> role -> sharedPermissionList [ ] = $ per -> get ( ) ; R :: store ( $ this -> role ) ; } | add a permission to role |
2,535 | public function getPermissions ( ) { $ permissions = [ ] ; foreach ( $ this -> role -> sharedPermissionList as $ permission ) { $ permissions [ ] = $ permission -> name ; } return $ permissions ; } | return all permission assigned to this role |
2,536 | public function hasPermission ( $ permissionName ) { foreach ( $ this -> role -> sharedPermissionList as $ permission ) { if ( $ permission -> name == $ permissionName ) { return true ; } } return false ; } | check if a role has a permission |
2,537 | public function addHost ( Host $ host ) { $ host_name = $ host -> getHostName ( ) ; if ( $ this -> offsetExists ( $ host_name ) ) throw new \ InvalidArgumentException ( "Duplicate host {$host_name}" ) ; foreach ( $ this -> hosts as $ h ) { if ( $ h -> isWww ( ) && ( "www." . $ h -> getHostName ( ) ) === $ host_name ) t... | Add new host item |
2,538 | public function getHost ( string $ host ) { $ host = Host :: filter ( $ host ) ; return $ this -> offsetExists ( $ host ) ? $ this -> hosts [ $ host ] : null ; } | Get host item |
2,539 | public function hasHost ( string $ host ) : bool { $ host = Host :: filter ( $ host ) ; return $ this -> offsetExists ( $ host ) ; } | Check host exists |
2,540 | public function removeHost ( string $ host ) { $ host = Host :: filter ( $ host ) ; if ( $ this -> offsetExists ( $ host ) ) unset ( $ this -> hosts [ $ host ] ) ; return $ this ; } | Remove host item |
2,541 | public static function asort ( array & $ array , int $ sort_flags = SORT_REGULAR ) : void { self :: decorateOriginalArray ( $ array ) ; uasort ( $ array , function ( $ a , $ b ) use ( $ sort_flags ) { if ( $ a [ 1 ] == $ b [ 1 ] ) return $ a [ 0 ] - $ b [ 0 ] ; $ arr = [ - 1 => $ a [ 1 ] , 1 => $ b [ 1 ] ] ; asort ( $ ... | Sort an array and maintain index association |
2,542 | public static function uasort ( array & $ array , callable $ value_compare_func ) : void { self :: decorateOriginalArray ( $ array ) ; uasort ( $ array , function ( $ a , $ b ) use ( $ value_compare_func ) { $ result = call_user_func ( $ value_compare_func , $ a [ 1 ] , $ b [ 1 ] ) ; if ( $ result == 0 ) return $ a [ 0... | Sort an array with a user - defined comparison function and maintain index association |
2,543 | protected function createConfigFolder ( $ folderName ) { $ folder = $ this -> getBaseConfigFolder ( ) . $ folderName ; if ( ! is_dir ( $ folder ) ) { $ this -> logger -> info ( "Creating folder config/{$folderName}" ) ; mkdir ( $ folder ) ; } return $ folder ; } | Create the given folder inside the base config folder . |
2,544 | protected function initAllConfigs ( ) { if ( $ this -> isInitialized ) { return ; } $ this -> logger -> info ( 'Checking and initializing config files' ) ; foreach ( $ this -> getEnvironments ( ) as $ environment ) { $ this -> initConfig ( $ environment ) ; } $ this -> isInitialized = true ; } | Refresh config files for all environments . |
2,545 | protected function stripBaseConfigFolderFromPath ( $ path ) { if ( 0 !== strpos ( $ path , $ this -> getBaseConfigFolder ( ) ) ) { throw new ConfigManipulatorException ( 'Cannot strip base path from given path: ' . $ path ) ; } return substr ( $ path , strlen ( $ this -> getBaseConfigFolder ( ) ) ) ; } | Make the given path relative to the base config folder by stripping the folder name if it matches . |
2,546 | public function checkCanCreateModuleConfig ( $ module , $ environment = '' , $ allowOverwriteEmpty = true ) { $ targetFile = $ this -> getModuleFile ( $ module , $ environment ) ; if ( file_exists ( $ targetFile ) ) { $ content = Yaml :: parse ( file_get_contents ( $ targetFile ) ) ; if ( null !== $ content || ! $ allo... | Check if the config for the given module name and environment can safely be created . |
2,547 | public function addParameter ( $ name , $ defaultValue , $ addComment = null ) { $ this -> logger -> info ( "Setting parameter $name in parameters.yml" ) ; $ this -> getYamlManipulator ( ) -> addParameterToFile ( $ this -> getBaseConfigFolder ( ) . 'parameters.yml' , $ name , $ defaultValue , false ) ; $ this -> getYam... | Add a parameter to parameters . yml and parameters . yml . dist . |
2,548 | public static function endsWith ( $ string , $ end ) { $ l = strlen ( $ end ) ; if ( $ l == 0 ) { return true ; } return substr ( $ string , - $ l ) === $ end ; } | Whether a string end with another string . |
2,549 | public function listAction ( ) { $ filterManager = $ this -> get ( 'phlexible_message.filter_manager' ) ; $ filters = [ ] ; foreach ( $ filterManager -> findBy ( [ 'userId' => $ this -> getUser ( ) -> getId ( ) ] ) as $ filter ) { $ criteria = [ ] ; foreach ( $ filter -> getCriteria ( ) as $ groupIndex => $ group ) { f... | List filters . |
2,550 | public function updateAction ( Request $ request , $ id ) { $ title = $ request -> get ( 'title' ) ; $ rawCriteria = json_decode ( $ request -> get ( 'criteria' ) , true ) ; $ filterManager = $ this -> get ( 'phlexible_message.filter_manager' ) ; $ filter = $ filterManager -> find ( $ id ) ; $ filter -> setTitle ( $ ti... | Updates a Filter . |
2,551 | public function deleteAction ( $ id ) { $ filterManager = $ this -> get ( 'phlexible_message.filter_manager' ) ; $ filter = $ filterManager -> find ( $ id ) ; $ filterManager -> deleteFilter ( $ filter ) ; return new ResultResponse ( true , 'Filter "' . $ filter -> getTitle ( ) . '" deleted.' ) ; } | Delete filter . |
2,552 | public function previewAction ( Request $ request ) { $ rawCriteria = json_decode ( $ request -> get ( 'filters' ) , true ) ; $ messageManager = $ this -> get ( 'phlexible_message.message_manager' ) ; $ criteria = new Criteria ( ) ; $ criteria -> setMode ( Criteria :: MODE_OR ) ; foreach ( $ rawCriteria as $ group ) { ... | Preview messages . |
2,553 | public function getErrors ( ) { $ errors = $ this -> handlerRegistry -> getHandler ( $ this -> key ) -> getErrors ( ) -> getErrors ( ) ; return new Response ( $ errors ) ; } | Get all errors |
2,554 | protected function connect ( ) { $ this -> _socket = @ stream_socket_client ( $ this -> hostname . ':' . $ this -> port , $ errorNumber , $ errorDescription , $ this -> timeout ? $ this -> timeout : ini_get ( "default_socket_timeout" ) ) ; if ( $ this -> _socket ) { if ( $ this -> password !== null ) $ this -> executeC... | Establishes a connection to the redis server . It does nothing if the connection has already been established . |
2,555 | public static function SingleImage ( $ name , $ title = null , SS_List $ dataList = null ) { $ field = UploadField :: create ( $ name , $ title , $ dataList ) -> setAllowedFileCategories ( 'image' ) -> setConfig ( 'allowedMaxFileNumber' , 1 ) ; return $ field ; } | Return a new UploadField instance preconfiguger to only allow one image |
2,556 | public function get ( $ uri , $ extraHeaders = array ( ) ) { $ requestData = $ this -> prepareRequest ( 'GET' , $ uri , $ extraHeaders ) ; return $ this -> performHttpRequest ( $ requestData [ 'method' ] , $ requestData [ 'url' ] , $ requestData [ 'headers' ] ) ; } | GET a URI using client object . |
2,557 | public function post ( $ data , $ uri = null , $ remainingRedirects = null , $ contentType = null , $ extraHeaders = null ) { $ requestData = $ this -> prepareRequest ( 'POST' , $ uri , $ extraHeaders , $ data , $ contentType ) ; return $ this -> performHttpRequest ( $ requestData [ 'method' ] , $ requestData [ 'url' ]... | POST data with client object |
2,558 | public function delete ( $ data , $ remainingRedirects = null ) { if ( is_string ( $ data ) ) { $ requestData = $ this -> prepareRequest ( 'DELETE' , $ data ) ; } else { $ headers = array ( ) ; $ requestData = $ this -> prepareRequest ( 'DELETE' , null , $ headers , $ data ) ; } return $ this -> performHttpRequest ( $ ... | DELETE entry with client object |
2,559 | public function insertEntry ( $ data , $ uri , $ className = 'Zend_Gdata_App_Entry' , $ extraHeaders = array ( ) ) { if ( ! class_exists ( $ className , false ) ) { require_once 'Zend/Loader.php' ; @ Zend_Loader :: loadClass ( $ className ) ; } $ response = $ this -> post ( $ data , $ uri , null , null , $ extraHeaders... | Inserts an entry to a given URI and returns the response as a fully formed Entry . |
2,560 | public function updateEntry ( $ data , $ uri = null , $ className = null , $ extraHeaders = array ( ) ) { if ( $ className === null && $ data instanceof Zend_Gdata_App_Entry ) { $ className = get_class ( $ data ) ; } elseif ( $ className === null ) { $ className = 'Zend_Gdata_App_Entry' ; } if ( ! class_exists ( $ clas... | Update an entry |
2,561 | public function retrieveAllEntriesForFeed ( $ feed ) { $ feedClass = get_class ( $ feed ) ; $ reflectionObj = new ReflectionClass ( $ feedClass ) ; $ result = $ reflectionObj -> newInstance ( ) ; do { foreach ( $ feed as $ entry ) { $ result -> addEntry ( $ entry ) ; } $ next = $ feed -> getLink ( 'next' ) ; if ( $ nex... | Retrieve all entries for a feed iterating through pages as necessary . Be aware that calling this function on a large dataset will take a significant amount of time to complete . In some cases this may cause execution to timeout without proper precautions in place . |
2,562 | public function getNextFeed ( $ feed , $ className = null ) { $ nextLink = $ feed -> getNextLink ( ) ; if ( ! $ nextLink ) { return null ; } $ nextLinkHref = $ nextLink -> getHref ( ) ; if ( $ className === null ) { $ className = get_class ( $ feed ) ; } return $ this -> getFeed ( $ nextLinkHref , $ className ) ; } | Retrieve next set of results based on a given feed . |
2,563 | public function getPreviousFeed ( $ feed , $ className = null ) { $ previousLink = $ feed -> getPreviousLink ( ) ; if ( ! $ previousLink ) { return null ; } $ previousLinkHref = $ previousLink -> getHref ( ) ; if ( $ className === null ) { $ className = get_class ( $ feed ) ; } return $ this -> getFeed ( $ previousLink... | Retrieve previous set of results based on a given feed . |
2,564 | public function generateIfMatchHeaderData ( $ data , $ allowWeek ) { $ result = '' ; if ( $ this -> _majorProtocolVersion >= 2 && $ data instanceof Zend_Gdata_App_Entry ) { $ etag = $ data -> getEtag ( ) ; if ( ( $ etag !== null ) && ( $ allowWeek || substr ( $ etag , 0 , 2 ) != 'W/' ) ) { $ result = $ data -> getEtag ... | Returns the data for an If - Match header based on the current Etag property . If Etags are not supported by the server or cannot be extracted from the data then null will be returned . |
2,565 | protected function generateToken ( $ object ) { $ token = get_class ( $ object ) ; if ( $ pos = strrpos ( $ token , "\\" ) ) { $ token = strtolower ( substr ( $ token , $ pos + 1 ) ) ; } if ( isset ( $ this -> tokens [ $ token ] ) ) { $ i = 1 ; $ tmp = $ token . $ i ; while ( isset ( $ this -> tokens [ $ tmp ] ) ) { $ ... | Generate a unique token . |
2,566 | public function isForceInitialization ( $ flag = null ) { if ( $ flag === null ) { return $ this -> forceInit ; } $ this -> forceInit = $ flag ; return $ this ; } | Gets or sets flag |
2,567 | public function url ( $ url = null , $ full = false ) { if ( CakePlugin :: loaded ( 'I18n' ) ) { $ url = Common :: url ( $ url ) ; if ( is_array ( $ url ) && ! array_key_exists ( 'lang' , $ url ) ) { $ url [ 'lang' ] = Configure :: read ( 'Config.language' ) ; } } return parent :: url ( $ url , $ full ) ; } | Url helper function |
2,568 | public function save ( AbstractEntity $ entity ) { if ( empty ( $ entity -> getId ( ) ) ) { $ this -> getEntityManager ( ) -> persist ( $ entity ) ; } $ this -> getEntityManager ( ) -> flush ( $ entity ) ; } | Persists and saves an entity to the database . |
2,569 | public function remove ( AbstractEntity $ entity ) { $ this -> getEntityManager ( ) -> remove ( $ entity ) ; $ this -> getEntityManager ( ) -> flush ( ) ; } | Removes an entity from the database . |
2,570 | public static function getClassProfile ( $ classname ) { if ( ! array_key_exists ( $ classname , self :: $ profiles ) ) self :: $ profiles [ $ classname ] = new ClassProfile ( $ classname ) ; return self :: $ profiles [ $ classname ] ; } | Obtains a ClassProfile instance for the given classname |
2,571 | public function stream_open ( string $ url , string $ mode , int $ options , ? string & $ openedPath ) : bool { $ partition = self :: getPartition ( $ url ) ; $ path = self :: getRelativePath ( $ url ) ; $ this -> filePointer = $ partition -> fileOpen ( $ path , $ mode , $ options ) ; $ result = ( bool ) $ this -> file... | Opens file or URL . This method is called immediately after the wrapper is initialized . |
2,572 | public function stream_metadata ( string $ url , int $ option , $ value ) : bool { $ partition = self :: getPartition ( $ url ) ; $ path = self :: getRelativePath ( $ url ) ; switch ( $ option ) { case STREAM_META_TOUCH : $ result = $ partition -> touch ( $ path , $ value [ 1 ] ?? null , $ value [ 2 ] ?? null ) ? true ... | Change stream metadata . |
2,573 | public static function register ( string $ protocol , string $ root = null , int $ flags = 0 ) : bool { $ wrappers = stream_get_wrappers ( ) ; if ( in_array ( $ protocol , $ wrappers ) ) { throw new Exception ( "Protocol '$protocol' has been already registered" ) ; } $ wrapper = stream_wrapper_register ( $ protocol , g... | Register stream wrapper . |
2,574 | public static function commit ( string $ protocol ) : bool { if ( isset ( self :: $ partitions [ $ protocol ] ) ) { self :: $ partitions [ $ protocol ] -> commit ( ) ; $ result = true ; } else { $ result = false ; } return $ result ; } | Commit all changes to real FS . |
2,575 | public static function unregister ( string $ protocol ) : bool { unset ( self :: $ partitions [ $ protocol ] ) ; $ wrappers = stream_get_wrappers ( ) ; if ( ! in_array ( $ protocol , $ wrappers ) ) { throw new Exception ( "Protocol '$protocol' has not been registered yet" ) ; } return stream_wrapper_unregister ( $ prot... | Unregister stream wrapper . |
2,576 | private static function getPartition ( string $ url ) : ? Partition { $ urlParts = explode ( '://' , $ url ) ; $ protocol = array_shift ( $ urlParts ) ; return self :: $ partitions [ $ protocol ] ?? null ; } | Get partition by file url . |
2,577 | public function getCustomDate ( $ language , $ fallbackLanguage = null ) { $ date = $ this -> getMappedField ( 'date' , $ language , $ fallbackLanguage ) ; return $ date ; } | Return custom date . |
2,578 | public function getMappedField ( $ field , $ language , $ fallbackLanguage = null ) { if ( $ this -> mappedFields -> containsKey ( $ language ) ) { $ mappedField = $ this -> mappedFields -> get ( $ language ) ; } elseif ( $ this -> mappedFields -> containsKey ( $ fallbackLanguage ) ) { $ mappedField = $ this -> mappedF... | Return mapped field . |
2,579 | public function singleAnnouncementAction ( ) { $ this -> checkStaticTemplateIsIncluded ( ) ; $ this -> checkSettings ( ) ; $ this -> slotExtendedAssignMultiple ( [ self :: VIEW_VARIABLE_ASSOCIATION_ID => $ this -> settings [ self :: SETTINGS_ASSOCIATION_ID ] , self :: VIEW_VARIABLE_ANNOUNCEMENT_ID => $ this -> settings... | single announcement action . |
2,580 | protected function normalizeDirArray ( ) { if ( ! isset ( $ this -> dir [ 'iterate' ] ) ) { $ this -> dir [ 'iterate' ] = self :: DEFAULT_ITERATE ; } if ( ! isset ( $ this -> dir [ 'path' ] ) ) { $ this -> dir [ 'path' ] = self :: DEFAULT_PATH ; } if ( ! isset ( $ this -> dir [ 'recursive' ] ) ) { $ this -> dir [ 'recu... | Makes sure dir array has default properties at least |
2,581 | public function getArgsMethod ( & $ class , $ method ) { $ params = [ ] ; $ method = new \ ReflectionMethod ( $ class , $ method ) ; $ parameters = $ method -> getParameters ( ) ; foreach ( $ parameters as $ parameter ) { $ object = $ parameter -> getClass ( ) ; if ( $ object != null ) { if ( array_key_exists ( $ objec... | Initialization of the application |
2,582 | public final function setContentLength ( $ length ) { if ( ! is_numeric ( $ length ) ) { throw new ehough_shortstop_api_exception_InvalidArgumentException ( "Content-Length must be an integer ($length)" ) ; } $ length = intval ( $ length ) ; if ( $ length < 0 ) { throw new ehough_shortstop_api_exception_InvalidArgument... | Sets the content length of the entity . |
2,583 | protected static function bootLaravel ( Event $ event ) { $ dir = dirname ( $ event -> getComposer ( ) -> getConfig ( ) -> get ( 'vendor-dir' ) ) ; require $ dir . '/bootstrap/autoload.php' ; self :: $ app = require_once $ dir . '/bootstrap/app.php' ; self :: $ kernel = $ app -> make ( \ Illuminate \ Contracts \ Consol... | Boots Laravel so we can use all its features . |
2,584 | protected static function instantiateConsoleInteraction ( Event $ event ) { $ consoleIO = $ event -> getIO ( ) ; self :: $ consoleInteraction = new ConsoleInteraction ( new Input ( $ consoleIO ) , new Output ( $ consoleIO ) ) ; } | Gets the console interaction object So we can use all the command line features of composer . |
2,585 | public function addInEdge ( DocumentGraphEdge $ edge ) : void { $ this -> inEdges [ $ edge -> getSource ( ) -> className ] = $ edge ; } | Adds an in edge to this node . |
2,586 | public function addOutEdge ( DocumentGraphEdge $ edge ) : void { $ this -> outEdges [ $ edge -> getDestination ( ) -> className ] = $ edge ; } | Adds an out edge from this node . |
2,587 | private function filterParent ( $ parent , MenuItemCollection $ items ) { $ filteredItems = new MenuItemCollection ( ) ; foreach ( $ items -> getItems ( ) as $ name => $ item ) { if ( $ parent === $ item -> getParent ( ) ) { $ subItems = $ this -> filterParent ( $ name , $ items ) ; if ( count ( $ subItems ) ) { $ item... | Filter handlers by parent name . |
2,588 | public function actionShow ( $ id , $ slug ) { $ model = $ this -> model -> node ( $ id ) ; if ( empty ( $ model ) || ! $ model -> is_visible || $ model -> slug != $ slug ) { throw new NotFoundHttpException ( Yii :: t ( $ this -> tcModule , 'Content not found' ) ) ; } return $ this -> actionView ( $ id , true , null , ... | Render content as a web page |
2,589 | public function getDefaultParams ( $ model , $ langCode ) { $ fmt = new Formatter ; $ params = [ 'title' => $ model -> i18n [ $ langCode ] -> title , 'slug' => $ model -> slug , 'path' => $ model :: getNodePath ( $ model ) , 'owner' => $ fmt -> asUsername ( $ model -> owner_id ) , 'created' => $ model -> create_time , ... | Get default substitution params . |
2,590 | public function setCacheDir ( $ dir ) { if ( ! is_dir ( $ dir ) ) { $ this -> createDir ( $ dir ) ; } if ( ! is_writable ( $ dir ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The cache directory "%s" is not writable.' , $ dir ) ) ; } $ this -> cacheDir = $ dir ; return $ this ; } | Sets the cache directory . |
2,591 | public function setMetadataDirs ( array $ dirs ) { foreach ( $ dirs as $ dir ) { if ( ! is_dir ( $ dir ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The directory "%s" does not exist.' , $ dir ) ) ; } } $ this -> metadataDirs = $ dirs ; return $ this ; } | Sets metadata directories . |
2,592 | public function setSchemaDirs ( array $ dirs ) { foreach ( $ dirs as $ dir ) { if ( ! is_dir ( $ dir ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The directory "%s" does not exist.' , $ dir ) ) ; } } $ this -> schemaDirs = $ dirs ; return $ this ; } | Sets the schema directories . |
2,593 | public function addSchemaDir ( $ dir ) { if ( ! is_dir ( $ dir ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The directory "%s" does not exist.' , $ dir ) ) ; } if ( in_array ( $ dir , $ this -> schemaDirs ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The directory "%s" is already configured.' , $ d... | Adds a schema directory . |
2,594 | public function build ( ) { $ annotationReader = $ this -> annotationReader ; if ( null === $ annotationReader ) { $ annotationReader = new AnnotationReader ( ) ; if ( null !== $ this -> cacheDir ) { $ this -> createDir ( $ this -> cacheDir . '/annotations' ) ; $ annotationReader = new FileCacheReader ( $ annotationRea... | Builds and return a Manager instance . |
2,595 | function getParentClass ( ) { return FALSE !== $ this -> parentClass ? $ this -> parentClass : $ this -> parentClass = $ this -> buildParentClass ( ) ; } | Gets the parent class or NULL if it does not have one . |
2,596 | public function getRoles ( ) { $ roles = [ "ROLE_USER" ] ; $ dbRoles = EQM :: query ( new Role ( ) ) -> innerJoin ( 'roles_users ru' , 'Role.id = ru.role_id' ) -> where ( 'ru.user_id = :userId' , [ 'userId' => $ this -> getId ( ) ] ) -> all ( ) ; foreach ( $ dbRoles as $ role ) { $ roles [ ] = $ role -> getRole ( ) ; }... | Returns the roles granted to the user . |
2,597 | public function setOsobaFizyczna ( \ KCH \ PCC3 \ Deklaracja \ Podmiot1AnonymousType \ OsobaFizycznaAnonymousType $ osobaFizyczna ) { $ this -> osobaFizyczna = $ osobaFizyczna ; return $ this ; } | Sets a new osobaFizyczna |
2,598 | public function execute ( ) { $ this -> cleanHistory ( ) ; $ this -> log ( ) ; $ this -> instanceManager -> update ( $ this -> instance ) ; } | Execute all steps for current instance - Clean history - Add log - Save current instance state |
2,599 | protected function cleanHistory ( ) { $ createdAt = new \ DateTime ( ) ; $ logs = $ this -> instance -> getLogs ( ) ; foreach ( $ logs as $ log ) { if ( ( $ createdAt -> getTimestamp ( ) - $ log -> getCreatedAt ( ) -> getTimestamp ( ) ) > $ this -> expiredTimestamp ) { $ this -> instance -> removeLog ( $ log ) ; } } } | Clean instance history . Delete expired logs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.