idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
15,900 | public function getData ( ) { if ( $ this -> data instanceof Arrayable ) { $ this -> data = $ this -> data -> toArray ( ) ; } if ( ! is_array ( $ this -> data ) ) { $ this -> data = null ; } return $ this -> data ; } | Get exception data |
15,901 | public static function format ( array $ record ) { $ seconds = ( int ) $ record [ 'time' ] ; $ millis = floor ( ( $ record [ 'time' ] - $ seconds ) * 1000 ) ; $ timestamp = date ( 'Y-m-d H:i:s' , $ seconds ) ; $ timestamp .= sprintf ( '.%03d ' , $ millis ) ; $ timestamp .= date ( 'P' ) ; $ level = '[' . $ record [ 'lev... | Format a log message for a log file . |
15,902 | public static function select ( ) { $ result = null ; switch ( static :: getDriver ( ) ) { case self :: DRIVER_MYSQL : $ result = new \ pwf \ components \ querybuilder \ adapters \ MySQL \ SelectBuilder ( ) ; break ; case self :: DRIVER_PG : $ result = new \ pwf \ components \ querybuilder \ adapters \ PostgreSQL \ Sel... | Get query builder |
15,903 | public static function insert ( ) { $ result = null ; switch ( static :: getDriver ( ) ) { case self :: DRIVER_MYSQL : $ result = new \ pwf \ components \ querybuilder \ adapters \ MySQL \ InsertBuilder ( ) ; break ; case self :: DRIVER_PG : $ result = new \ pwf \ components \ querybuilder \ adapters \ PostgreSQL \ Ins... | Get insert builder |
15,904 | public static function update ( ) { $ result = null ; switch ( static :: getDriver ( ) ) { case self :: DRIVER_MYSQL : $ result = new \ pwf \ components \ querybuilder \ adapters \ MySQL \ UpdateBuilder ( ) ; break ; case self :: DRIVER_PG : $ result = new \ pwf \ components \ querybuilder \ adapters \ PostgreSQL \ Upd... | Get update builder |
15,905 | public static function delete ( ) { $ result = null ; switch ( static :: getDriver ( ) ) { case self :: DRIVER_MYSQL : $ result = new \ pwf \ components \ querybuilder \ adapters \ MySQL \ DeleteBuilder ( ) ; break ; case self :: DRIVER_PG : $ result = new \ pwf \ components \ querybuilder \ adapters \ PostgreSQL \ Del... | Get delete builder |
15,906 | public static function getConditionBuilder ( ) { $ result = null ; switch ( static :: getDriver ( ) ) { default : $ result = new \ pwf \ components \ querybuilder \ adapters \ SQL \ ConditionBuilder ( ) ; } return $ result ; } | Get condition builder |
15,907 | public function primaryKey ( $ tableName ) { if ( ! isset ( $ this -> primaryKeys [ $ tableName ] ) ) { $ sql = "SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu ON tc.CONSTRAINT_NAME = ccu.Constraint_name WHERE tc.CONSTRAINT_TYPE = 'P... | primaryKey function . |
15,908 | public function isEmpty ( $ key = null ) { if ( $ key === null ) { return empty ( $ this -> data ) ; } return empty ( $ this -> data [ $ key ] ) ; } | is empty will return if the specified key is empty if no key provided it will check itself . |
15,909 | public function merge ( $ arr = [ ] ) { $ newData = array_merge ( $ this -> toArray ( ) , $ arr ) ; return $ this -> reset ( $ newData ) ; } | array then rebuilds the data array . Returns itself |
15,910 | public function resetAllInvoiceOptions ( ) : Client { $ this -> sendInvoiceByPost = null ; $ this -> invoiceMaturityDays = null ; $ this -> stopServiceDue = null ; $ this -> stopServiceDueDays = null ; return $ this ; } | Resets all Invoice Options for this Client . |
15,911 | public static function createResidential ( string $ firstName , string $ lastName ) : Client { $ organization = Organization :: getByDefault ( ) ; $ client = new Client ( [ "clientType" => Client :: CLIENT_TYPE_RESIDENTIAL , "isLead" => false , "invoiceAddressSameAsContact" => true , "organizationId" => $ organization ... | Creates the minimal Residential Client to be used as a starting point for a new Client . |
15,912 | public static function createCommercial ( string $ companyName ) : Client { $ organization = Organization :: getByDefault ( ) ; $ client = new Client ( [ "clientType" => Client :: CLIENT_TYPE_COMMERCIAL , "isLead" => false , "invoiceAddressSameAsContact" => true , "organizationId" => $ organization -> getId ( ) , "regi... | Creates the minimal Commericial Client to be used as a starting point for a new Client . |
15,913 | public static function getByUserIdent ( string $ userIdent ) : ? Client { $ client = Client :: get ( "" , [ ] , [ "userIdent" => $ userIdent ] ) -> first ( ) ; return $ client ; } | Sends an HTTP GET Request using the calling class s annotated information for an object given the Custom ID . |
15,914 | public static function getByCustomAttribute ( string $ key , string $ value ) : ClientCollection { $ key = lcfirst ( $ key ) ; $ clients = Client :: get ( "" , [ ] , [ "customAttributeKey" => $ key , "customAttributeValue" => $ value ] ) ; return new ClientCollection ( $ clients -> elements ( ) ) ; } | Sends an HTTP GET Request using the calling class s annotated information for objects given an Attribute pair . |
15,915 | public function joinSlugs ( array $ urlParts ) { $ urlParts = array_map ( function ( $ urlPart ) { return trim ( $ urlPart , '/' ) ; } , $ urlParts ) ; return implode ( '/' , $ urlParts ) ; } | Join URL parts without double slashes |
15,916 | public function getAssociation ( $ name , $ autoLoad = true ) { if ( isset ( $ this -> loadedAssociations [ $ name ] ) ) { return $ this -> loadedAssociations [ $ name ] ; } elseif ( $ autoLoad && $ this -> getAssociations ( ) -> exists ( $ name ) ) { $ this -> loadedAssociations [ $ name ] = $ this -> getAssociations ... | If the association isn t yet loaded it is loaded and returned . If the association doesn t exist null is returned . Note that unset one - to - one associations return false . |
15,917 | public function setAssociation ( $ name , $ value , $ raw = false ) { if ( $ raw ) { $ this -> loadedAssociations [ $ name ] = $ value ; } else { return ( new Setter ( ) ) -> set ( $ this , $ name , $ value ) ; } } | Associates an object to a one - to - one association . Other associations are done in CollectionProxy . |
15,918 | public function make ( $ key ) { if ( ! isset ( $ this -> keys [ $ key ] ) ) { throw new \ InvalidArgumentException ( 'Identifier "' . $ key . '" is not defined.' ) ; } if ( ! is_object ( $ this -> raw [ $ key ] ) || ! method_exists ( $ this -> raw [ $ key ] , '__invoke' ) ) { return $ this -> raw [ $ key ] ; } if ( $ ... | Get something from the container |
15,919 | public function addVisitAction ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitAction $ visitAction ) { $ this -> visitAction [ ] = $ visitAction ; return $ this ; } | Add visitAction . |
15,920 | public function removeVisitAction ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitAction $ visitAction ) { return $ this -> visitAction -> removeElement ( $ visitAction ) ; } | Remove visitAction . |
15,921 | public function setVisitor ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitor $ visitor = null ) { $ this -> visitor = $ visitor ; return $ this ; } | Set visitor . |
15,922 | public function setSearchEngine ( \ BlackForest \ PiwikBundle \ Entity \ PiwikSearchEngine $ searchEngine = null ) { $ this -> searchEngine = $ searchEngine ; return $ this ; } | Set searchEngine . |
15,923 | public function setDevice ( \ BlackForest \ PiwikBundle \ Entity \ PiwikDevice $ device = null ) { $ this -> device = $ device ; return $ this ; } | Set device . |
15,924 | public function setOperatingSystem ( \ BlackForest \ PiwikBundle \ Entity \ PiwikOperatingSystem $ operatingSystem = null ) { $ this -> operatingSystem = $ operatingSystem ; return $ this ; } | Set operatingSystem . |
15,925 | public function setBrowser ( \ BlackForest \ PiwikBundle \ Entity \ PiwikBrowser $ browser = null ) { $ this -> browser = $ browser ; return $ this ; } | Set browser . |
15,926 | public function setLocation ( \ BlackForest \ PiwikBundle \ Entity \ PiwikLocation $ location = null ) { $ this -> location = $ location ; return $ this ; } | Set location . |
15,927 | public function setResolution ( \ BlackForest \ PiwikBundle \ Entity \ PiwikResolution $ resolution = null ) { $ this -> resolution = $ resolution ; return $ this ; } | Set resolution . |
15,928 | public function setPlugin ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitPlugin $ plugin = null ) { $ this -> plugin = $ plugin ; return $ this ; } | Set plugin . |
15,929 | public function setOptions ( AbstractOptions $ options ) { $ optionsClass = Conversion :: getOptionsFullQualifiedClassName ( $ this ) ; $ inputOptionsClass = get_class ( $ options ) ; if ( $ inputOptionsClass !== $ optionsClass ) { throw new Exception \ DomainException ( sprintf ( '"%s" expects that options set are an ... | Set the adapter options instance |
15,930 | public function getOptions ( ) { if ( ! $ this -> options ) { throw new Exception \ RuntimeException ( sprintf ( 'No options instance set for the adapter "%s"' , get_class ( $ this ) ) ) ; } return $ this -> options ; } | Retrieve the adapter options instance |
15,931 | public function setMiddleParagraphLayoutId ( $ layoutParagraphId = null ) { $ middleLayout = $ this -> middleLayoutModel -> findMiddleParagraphLayoutById ( $ layoutParagraphId ) ; if ( ! empty ( $ middleLayout ) ) { $ controller = $ this -> getController ( ) ; if ( ! method_exists ( $ controller , 'plugin' ) ) { throw ... | Set middle - layout for paragraph - layout |
15,932 | protected function _setTransition ( $ transition ) { if ( $ transition !== null && ! is_string ( $ transition ) && ! ( $ transition instanceof Stringable ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Argument is not a valid transition' ) , null , null , $ transition ) ; } $ this -> transition ... | Sets the transition for this instance . |
15,933 | public static function getDBO ( ) { if ( ! empty ( self :: $ db ) ) { return self :: $ db ; } BLog :: addToLog ( '[BFactory] Connecting to the database "' . MYSQL_DB_HOST . '"...' ) ; self :: $ db = BMySQL :: getInstanceAndConnect ( ) ; if ( empty ( self :: $ db ) ) { BLog :: addToLog ( '[BFactory] Could not connect to... | Get BMySQL instance |
15,934 | public static function getTempFn ( ) { $ tempFileName = BROOTPATH . 'temp' . DIRECTORY_SEPARATOR ; $ characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ; $ charactersLength = strlen ( $ characters ) ; for ( $ i = 0 ; $ i < 15 ; $ i ++ ) { $ tempFileName .= $ characters [ rand ( 0 , $ characte... | Get temporary filename |
15,935 | public static function getInstance ( ) { if ( is_null ( self :: $ _oInstance ) ) { $ c = __CLASS__ ; self :: $ _oInstance = new $ c ; } return self :: $ _oInstance ; } | get a valid instance of this class |
15,936 | protected function addViolation ( $ value , Constraint $ constraint ) { $ this -> context -> addViolation ( $ constraint -> message , [ '{{ id_field }}' => $ constraint -> getIdField ( ) , '{{ value }}' => $ value ] , $ value ) ; } | Add violation with error message |
15,937 | public function addSources ( array $ sources ) { foreach ( $ sources as $ s ) { if ( ! file_exists ( $ s ) ) { throw new \ Exception ( sprintf ( 'Unable to compress %s because the destination doesn\'t exist.' , $ s ) ) ; } $ this -> sources [ ] = $ s ; } } | Add one or more file or folders to the archive . |
15,938 | protected function getLayoutId ( ) { $ paragraph = $ this -> findParagraph ( ) ; if ( empty ( $ paragraph ) ) { $ structure = $ this -> getServiceLocator ( ) -> get ( 'Grid\Core\Model\SubDomain\Model' ) -> findActual ( ) ; return $ structure -> defaultLayoutId ; } else { return $ paragraph -> layoutId ; } } | Get actual layout ID |
15,939 | public function localAction ( ) { $ success = null ; $ request = $ this -> getRequest ( ) ; $ data = $ request -> getPost ( ) ; $ form = $ this -> getServiceLocator ( ) -> get ( 'Form' ) -> create ( 'Grid\Paragraph\ChangeLayout\Local' , array ( 'returnUri' => $ request -> getQuery ( 'returnUri' ) , ) ) ; $ form -> setA... | Change to local layout |
15,940 | public function importAction ( ) { $ success = null ; $ request = $ this -> getRequest ( ) ; $ data = $ request -> getPost ( ) ; $ form = $ this -> getServiceLocator ( ) -> get ( 'Form' ) -> create ( 'Grid\Paragraph\ChangeLayout\Import' , array ( 'returnUri' => $ request -> getQuery ( 'returnUri' ) , ) ) ; $ form -> se... | Import layout & change to it |
15,941 | public function actorlistJsonAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ actor = $ em -> getRepository ( 'CoreBundle:Actor' ) -> find ( $ id ) ; if ( ! $ actor ) { throw $ this -> createNotFoundException ( 'Unable to find Actor entity.' ) ; } $ jsonList = $ this -> get ( 'json_list' ) ; $ j... | Returns a list of Brand entities in JSON format . |
15,942 | public function createAction ( Request $ request ) { $ entity = new Contract ( ) ; $ form = $ this -> createCreateForm ( $ entity ) ; $ planForm = $ this -> createForm ( new PlanType ( ) , new Plan ( ) , array ( 'action' => $ this -> generateUrl ( 'ecommerce_plan_new' ) , 'method' => 'POST' , ) ) ; $ form -> handleRequ... | Creates a new Contract entity . |
15,943 | private function createCreateForm ( Contract $ entity ) { $ form = $ this -> createForm ( new ContractType ( ) , $ entity , array ( 'action' => $ this -> generateUrl ( 'ecommerce_contract_create' ) , 'method' => 'POST' , ) ) ; return $ form ; } | Creates a form to create a Contract entity . |
15,944 | public function newAction ( ) { $ entity = new Contract ( ) ; $ form = $ this -> createCreateForm ( $ entity ) ; $ planForm = $ this -> createForm ( new PlanType ( ) , new Plan ( ) , array ( 'action' => $ this -> generateUrl ( 'ecommerce_plan_new' ) , 'method' => 'POST' , ) ) ; return array ( 'entity' => $ entity , 'fo... | Displays a form to create a new Contract entity . |
15,945 | public function showAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( 'EcommerceBundle:Contract' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Contract entity.' ) ; } $ deleteForm = $ this -> createDeleteForm ( ... | Finds and displays a Contract entity . |
15,946 | private function createEditForm ( Contract $ entity ) { $ form = $ this -> createForm ( new ContractType ( ) , $ entity , array ( 'action' => $ this -> generateUrl ( 'ecommerce_contract_update' , array ( 'id' => $ entity -> getId ( ) ) ) , 'method' => 'PUT' , ) ) ; return $ form ; } | Creates a form to edit a Contract entity . |
15,947 | public function offsetGet ( $ offset ) { if ( ! array_key_exists ( $ offset , $ this -> _data ) ) { return false ; } return $ this -> _data [ $ offset ] ; } | Returns the value at specified offset or false if not exists . |
15,948 | public function set ( $ collection , $ value = null ) { if ( func_num_args ( ) === 1 ) { return parent :: merge ( $ collection , true ) ; } $ this -> _data [ $ collection ] = $ value ; return $ this ; } | Sets an array of variables . |
15,949 | public static function normalize ( $ env ) { $ env += [ 'PHP_SAPI' => PHP_SAPI ] ; if ( isset ( $ env [ 'SCRIPT_URI' ] ) ) { $ env [ 'HTTPS' ] = strpos ( $ env [ 'SCRIPT_URI' ] , 'https://' ) === 0 ; } elseif ( isset ( $ env [ 'HTTPS' ] ) ) { $ env [ 'HTTPS' ] = ( ! empty ( $ env [ 'HTTPS' ] ) && $ env [ 'HTTPS' ] !== ... | Normalizes a couple of well known PHP environment variables . |
15,950 | final public function to_a ( ) { foreach ( $ this -> attributes as & $ value ) { if ( $ value instanceof \ DateTime ) $ value = $ value -> format ( self :: $ DATETIME_FORMAT ) ; } return $ this -> attributes ; } | Returns the attributes array . |
15,951 | public function tabBuilder ( \ samsoncms \ app \ material \ form \ Form & $ form ) { if ( count ( $ form -> navigationIDs ) ) { $ galleryFields = $ this -> query -> entity ( \ samsoncms \ api \ Field :: class ) -> where ( 'Type' , 9 ) -> join ( 'structurefield' ) -> where ( 'structurefield_StructureID' , $ form -> navi... | Render all gallery additional fields as material form tabs |
15,952 | public function __async_getCount ( $ materialFieldId ) { $ response = array ( 'status' => 1 ) ; $ response [ 'count' ] = $ this -> query -> entity ( CMS :: MATERIAL_IMAGES_RELATION_ENTITY ) -> where ( MaterialField :: F_PRIMARY , $ materialFieldId ) -> count ( ) ; return $ response ; } | Controller for getting quantity image in gallery . |
15,953 | public function __async_updateAlt ( $ imageId ) { $ result = array ( 'status' => false ) ; $ image = null ; $ data = json_decode ( file_get_contents ( 'php://input' ) , true ) ; $ value = trim ( $ data [ 'value' ] ) ; if ( $ this -> query -> entity ( CMS :: MATERIAL_IMAGES_RELATION_ENTITY ) -> where ( 'PhotoID' , $ ima... | Controller for update material image properties alt from gallery . |
15,954 | private function verifyExtensionFile ( ) { $ supported_image = array ( 'gif' , 'jpg' , 'jpeg' , 'png' ) ; $ fileName = $ _SERVER [ 'HTTP_X_FILE_NAME' ] ; $ ext = strtolower ( pathinfo ( $ fileName , PATHINFO_EXTENSION ) ) ; if ( in_array ( $ ext , $ supported_image ) ) { return true ; } return false ; } | method for verify extension file |
15,955 | public function __async_priority ( ) { $ result = array ( 'status' => true ) ; if ( isset ( $ _POST [ 'ids' ] ) ) { for ( $ i = 0 ; $ i < count ( $ _POST [ 'ids' ] ) ; $ i ++ ) { $ photo = null ; if ( $ this -> query -> entity ( CMS :: MATERIAL_IMAGES_RELATION_ENTITY ) -> where ( 'PhotoID' , $ _POST [ 'ids' ] [ $ i ] )... | Function to save image priority |
15,956 | public function __async_show_edit ( $ imageId ) { $ result = array ( 'status' => false ) ; $ image = null ; if ( $ this -> query -> entity ( CMS :: MATERIAL_IMAGES_RELATION_ENTITY ) -> where ( 'PhotoID' , $ imageId ) -> first ( $ image ) ) { $ path = $ this -> formImagePath ( $ image -> Path , $ image -> Src ) ; if ( $... | Asynchronous function to get image editor |
15,957 | public function __async_edit ( $ imageId ) { $ result = array ( 'status' => false ) ; $ image = null ; $ imageResource = null ; $ croppedImage = null ; if ( $ this -> query -> entity ( CMS :: MATERIAL_IMAGES_RELATION_ENTITY ) -> where ( 'PhotoID' , $ imageId ) -> first ( $ image ) ) { $ path = $ this -> formImagePath (... | Applies all changes with the image and save it |
15,958 | public function getHTML ( $ materialFieldId ) { $ items_html = '' ; $ images = null ; if ( $ this -> query -> entity ( CMS :: MATERIAL_IMAGES_RELATION_ENTITY ) -> where ( 'materialFieldId' , $ materialFieldId ) -> orderBy ( 'priority' ) -> exec ( $ images ) ) { foreach ( $ images as $ image ) { $ size = ', ' ; $ path =... | Render gallery images list |
15,959 | public function humanFileSize ( $ bytes , $ decimals = 2 ) { $ sizeLetters = 'BKBMBGBTBPB' ; $ factor = ( int ) ( floor ( ( strlen ( $ bytes ) - 1 ) / 3 ) ) ; $ sizeLetter = ( $ factor <= 0 ) ? substr ( $ sizeLetters , 0 , 1 ) : substr ( $ sizeLetters , $ factor * 2 - 1 , 2 ) ; return sprintf ( "%.{$decimals}f" , $ byt... | Function to form image size |
15,960 | private function imageExists ( $ imagePath , $ imageSrc = null ) { if ( isset ( $ imageSrc ) ) { $ imageFullPath = $ this -> formImagePath ( $ imagePath , $ imageSrc ) ; } else { $ imageFullPath = $ imagePath ; } return $ this -> fs -> exists ( $ imageFullPath ) ; } | Checks if image exists supports old database structure |
15,961 | private function formImagePath ( $ imagePath , $ imageSrc ) { if ( empty ( $ imagePath ) ) { $ path = $ imageSrc ; } else { $ path = $ imagePath . $ imageSrc ; } $ dir = quotemeta ( __SAMSON_BASE__ ) ; if ( strpos ( $ path , 'http://' ) === false ) { if ( $ dir == '/' ) { return substr ( $ path , 1 ) ; } else { return ... | Function to form image path correctly also supports old database structure |
15,962 | public function get ( $ name , $ default = null ) { if ( isset ( $ this -> dataContainer [ $ name ] ) ) { return $ this -> dataContainer [ $ name ] ; } return $ default ; } | Get value by key . If value does not exists then return default value |
15,963 | public function handle ( ServerRequestInterface $ request ) : ResponseInterface { $ path = realpath ( __DIR__ . '/../../templates' ) ; $ engine = new Engine ( $ path ) ; $ contents = $ engine -> render ( 'simple' ) ; $ response = $ this -> factory -> createResponse ( 500 ) -> withHeader ( 'Content-type' , 'text/html' )... | Return a simple html response for the exception . |
15,964 | public static function version ( $ version = null , $ name = 'default' , $ type = 'app' , $ all = false ) { $ all or $ current = \ Config :: get ( 'migrations.version.' . $ type . '.' . $ name ) ; if ( ! empty ( $ current ) ) { if ( preg_match ( '/^(.*?)_(.*)$/' , end ( $ current ) , $ match ) ) { $ direction = ( is_nu... | migrate to a specific version range of versions or all |
15,965 | public static function current ( $ name = 'default' , $ type = 'app' ) { $ current = \ Config :: get ( 'migrations.version.' . $ type . '.' . $ name ) ; if ( ! empty ( $ current ) ) { if ( preg_match ( '/^(.*?)_(.*)$/' , end ( $ current ) , $ match ) ) { return static :: run ( static :: find_migrations ( $ name , $ typ... | migrate to the version defined in the config file |
15,966 | public static function up ( $ version = null , $ name = 'default' , $ type = 'app' ) { $ current = \ Config :: get ( 'migrations.version.' . $ type . '.' . $ name ) ; $ current = empty ( $ current ) ? null : end ( $ current ) ; $ migrations = static :: find_migrations ( $ name , $ type , $ current , $ version ) ; if ( ... | migrate up to the next version |
15,967 | protected static function run ( $ migrations , $ name , $ type , $ method = 'up' ) { $ done = array ( ) ; static :: $ connection === null or \ DBUtil :: set_connection ( static :: $ connection ) ; foreach ( $ migrations as $ ver => $ migration ) { logger ( Fuel :: L_INFO , 'Migrating to version: ' . $ ver ) ; $ result ... | run the action migrations found |
15,968 | protected static function write_install ( $ name , $ type , $ file ) { \ DB :: insert ( static :: $ table ) -> set ( array ( 'name' => $ name , 'type' => $ type , 'migration' => $ file , ) ) -> execute ( static :: $ connection ) ; static :: $ migrations [ $ type ] [ $ name ] [ ] = $ file ; sort ( static :: $ migrations... | add an installed migration to the database |
15,969 | protected static function write_revert ( $ name , $ type , $ file ) { \ DB :: delete ( static :: $ table ) -> where ( 'name' , $ name ) -> where ( 'type' , $ type ) -> where ( 'migration' , $ file ) -> execute ( static :: $ connection ) ; if ( ( $ key = array_search ( $ file , static :: $ migrations [ $ type ] [ $ name... | remove a reverted migration from the database |
15,970 | protected static function _find_app ( $ name = null ) { $ found = array ( ) ; $ files = new \ GlobIterator ( APPPATH . \ Config :: get ( 'migrations.folder' ) . '*_*.php' ) ; foreach ( $ files as $ file ) { $ found [ ] = $ file -> getPathname ( ) ; } return $ found ; } | finds migrations for the given app |
15,971 | protected static function table_version_check ( ) { static :: $ connection === null or \ DBUtil :: set_connection ( static :: $ connection ) ; if ( ! \ DBUtil :: table_exists ( static :: $ table ) ) { \ DBUtil :: create_table ( static :: $ table , static :: $ table_definition ) ; } elseif ( ! \ DBUtil :: field_exists (... | installs or upgrades the migration table to the current schema |
15,972 | protected function getName ( $ name ) { $ renames = $ this -> getRenames ( ) ; if ( isset ( $ renames [ $ name ] ) ) { return $ renames [ $ name ] ; } return $ name ; } | Return property name |
15,973 | public function save ( ) { if ( $ this -> _isSaved ) { $ this -> update ( $ this -> id ) ; } else { $ this -> id = $ this -> insert ( ) ; $ this -> _isSaved = true ; } } | Saves this record . |
15,974 | public function validate ( $ subject ) : bool { if ( \ is_numeric ( $ this -> schema [ 'exclusiveMinimum' ] ) ) { if ( $ subject <= $ this -> schema [ 'exclusiveMinimum' ] ) { return false ; } } return true ; } | Validates subject against exclusiveMinimum |
15,975 | public function getAllLanguages ( ) { if ( is_array ( $ this -> alllanguages ) ) { return $ this -> alllanguages ; } $ langfile = $ this -> localespath . 'languages.txt' ; if ( ! file_exists ( $ langfile ) ) { $ langfile = dirname ( __FILE__ ) . '/languages.txt' ; } if ( ! file_exists ( $ langfile ) ) { if ( $ this -> ... | Returns all languages with all attributes installed on the system |
15,976 | public function getLanguagesFromList ( $ list ) { $ alllanguages = $ this -> getAllLanguages ( ) ; $ languages = array ( ) ; foreach ( $ alllanguages as $ code => $ lang ) { if ( in_array ( $ code , $ list ) ) { $ languages [ $ code ] = $ lang ; } } return $ languages ; } | Return languages listed in the argument array . Is used for case when it is needed to get list of specified languages |
15,977 | public function getHTMLSelect ( $ attributes = '' , $ currentlang = '' , $ orignames = false ) { $ html = '<select ' . $ attributes . '>' ; foreach ( $ this -> getUsedLanguages ( ) as $ code => $ lang ) { $ html .= '<option value="' . $ code . '" ' ; if ( $ currentlang == $ code ) { $ html .= 'selected' ; } $ html .= '... | Build HTML select consruction with used languages Can be used on a web site to show a Language change dropbox |
15,978 | public function or_on ( $ c1 , $ op , $ c2 ) { $ this -> _on [ ] = array ( $ c1 , $ op , $ c2 , 'OR' ) ; return $ this ; } | Adds a new OR condition for joining . |
15,979 | public function on ( $ c1 , $ op , $ c2 ) { $ this -> _on [ ] = array ( $ c1 , $ op , $ c2 , 'AND' ) ; return $ this ; } | Adds a new AND condition for joining . |
15,980 | public function compile ( $ db = null ) { if ( ! $ db instanceof \ Database_Connection ) { $ db = \ Database_Connection :: instance ( $ db ) ; } if ( $ this -> _type ) { $ sql = strtoupper ( $ this -> _type ) . ' JOIN' ; } else { $ sql = 'JOIN' ; } $ sql .= ' ' . $ db -> quote_table ( $ this -> _table ) ; $ conditions ... | Compile the SQL partial for a JOIN statement and return it . |
15,981 | function send_to ( $ mail ) { $ mail [ 'subject' ] .= ' [' . $ mail [ 'to' ] . ']' ; if ( 'staging' == WP_ENV ) $ mail [ 'to' ] = get_option ( 'admin_email' ) ; else if ( defined ( 'TP_DEV_MAIL' ) ) $ mail [ 'to' ] = TP_DEV_MAIL ; else $ mail [ 'to' ] = '' ; return $ mail ; } | Don t send e - mails in development and staging environments |
15,982 | public static function illegal ( object $ collection , string $ key ) : CannotDeserialize { return new IllegalInputKey ( withMessage ( 'Invalid collection deserialization input: Unexpected key `%s` for the `%s` class.' , $ key , classOfThe ( $ collection ) ) ) ; } | Produces a deserialization exception to throw when a collection input key is not considered valid . |
15,983 | protected function sortByScore ( $ a , $ b ) { if ( $ a -> score == $ b -> score ) { return 0 ; } return ( $ a -> score > $ b -> score ) ? - 1 : 1 ; } | Sorting function uses the score of a object to determine the order of the array |
15,984 | protected function registerTraslator ( ) { $ this -> app -> singleton ( 'translator' , function ( $ app ) { $ loader = $ app [ 'translation.loader' ] ; $ locale = $ app [ 'config' ] [ 'app.locale' ] ; $ trans = new Translator ( $ loader , $ locale ) ; $ trans -> setFallback ( $ app [ 'config' ] [ 'app.fallback_locale' ... | Register translator . |
15,985 | public static function keyval_to_assoc ( $ array , $ key_field , $ val_field ) { if ( ! is_array ( $ array ) and ! $ array instanceof \ Iterator ) { throw new \ InvalidArgumentException ( 'The first parameter must be an array.' ) ; } $ output = array ( ) ; foreach ( $ array as $ key => $ value ) { $ output [ ] = array ... | Converts an array of key = > values into a multi - dimensional associative array with the provided field names |
15,986 | public static function is_assoc ( $ arr ) { if ( ! is_array ( $ arr ) ) { throw new \ InvalidArgumentException ( 'The parameter must be an array.' ) ; } $ counter = 0 ; foreach ( $ arr as $ key => $ unused ) { if ( ! is_int ( $ key ) or $ key !== $ counter ++ ) { return true ; } } return false ; } | Checks if the given array is an assoc array . |
15,987 | public static function multisort ( $ array , $ conditions , $ ignore_case = false ) { $ temp = array ( ) ; $ keys = array_keys ( $ conditions ) ; foreach ( $ keys as $ key ) { $ temp [ $ key ] = static :: pluck ( $ array , $ key , true ) ; is_array ( $ conditions [ $ key ] ) or $ conditions [ $ key ] = array ( $ condit... | Sorts an array on multitiple values with deep sorting support . |
15,988 | protected function setBreadcrumbEditUpload ( ) { $ breadcrumbs = array ( ) ; $ breadcrumbs [ ] = array ( 'text' => $ this -> text ( 'Dashboard' ) , 'url' => $ this -> url ( 'admin' ) ) ; $ breadcrumbs [ ] = array ( 'text' => $ this -> text ( 'Modules' ) , 'url' => $ this -> url ( 'admin/module/list' ) ) ; $ this -> set... | Set breadcrumbs on the module upload page |
15,989 | protected function validateUpload ( ) { $ file = $ this -> request -> file ( 'file' ) ; if ( empty ( $ file ) ) { $ this -> setError ( 'file' , $ this -> text ( 'Nothing to install' ) ) ; return false ; } $ result = $ this -> file_transfer -> upload ( $ file , 'zip' , gplcart_file_private_module ( 'installer' ) ) ; if ... | Validate a submitted data |
15,990 | protected function installModuleUpload ( ) { $ this -> controlAccess ( 'file_upload' ) ; $ this -> controlAccess ( 'module_installer_upload' ) ; $ file = $ this -> getSubmitted ( 'file' ) ; $ result = $ this -> install -> fromZip ( $ file ) ; if ( $ result !== true ) { $ this -> redirect ( '' , $ result , 'warning' ) ;... | Install uploaded module |
15,991 | public function getVersion ( $ version_key ) { if ( is_null ( $ this -> version ) ) { $ headers = \ getallheaders ( ) ; if ( isset ( $ headers [ $ version_key ] ) && is_numeric ( $ headers [ $ version_key ] ) && in_array ( $ headers [ $ version_key ] , $ this -> api_versions ) ) { $ version = 'V' . str_replace ( '.' , ... | Creates the version of the API we re expected to use |
15,992 | protected function init ( ) { $ uri = $ this -> token ; if ( ( $ pos = strpos ( $ uri , ':' ) ) !== false ) { $ this -> scheme = substr ( $ uri , 0 , $ pos ) ; $ rest = substr ( $ uri , $ pos + 1 ) ; } else { $ rest = $ uri ; } if ( ( $ pos = strrpos ( $ rest , '#' ) ) !== false ) { $ this -> fragment = substr ( $ rest... | Constructs a URI by parsing the given string . |
15,993 | public function resolve ( Uri $ uri ) { static $ resolve = array ( ) ; return ( isset ( $ resolve [ $ hash = $ this -> hashCode ( ) . $ uri -> hashCode ( ) ] ) ) ? $ resolve [ $ hash ] : ( $ resolve [ $ hash ] = $ this -> createResolve ( $ uri ) ) ; } | Resolves the given URI against this URI . |
15,994 | public function normalize ( ) { if ( $ this -> isOpaque ( ) || ! $ this -> path ) { return clone $ this ; } else { $ uri = clone $ this ; $ uri -> path = self :: normalizePath ( $ this -> path ) ; return $ uri ; } } | Normalizes this URI s path . |
15,995 | protected function buildStr ( ) { $ uri = ( $ this -> scheme != null ) ? ( $ this -> scheme . ':' ) : '' ; if ( $ this -> isOpaque ( ) ) { $ uri .= $ this -> schemeSpecificPart ; } else { $ uri .= $ this -> buildAuthorityStr ( ) ; if ( $ this -> path !== null ) { $ uri .= $ this -> path ; } if ( ! empty ( $ this -> que... | Returns the content of this URI as a string . |
15,996 | protected function setAuthority ( $ authority ) { $ aparts = [ ] ; if ( preg_match ( '/^(([^\@]+)\@)?(.*?)(\:(.+))?$/S' , $ authority , $ aparts ) ) { $ this -> authority = $ authority ; $ this -> hash = null ; if ( isset ( $ aparts [ 2 ] ) && $ aparts [ 2 ] ) { $ this -> userInfo = $ aparts [ 2 ] ; } if ( isset ( $ ap... | Set authority component of this URI . |
15,997 | public function getRelated ( Uri $ baseUri ) { $ path = $ baseUri -> getPath ( ) ; if ( substr ( $ this -> getPath ( ) , 0 , strlen ( $ path ) ) == $ path ) { $ class = get_called_class ( ) ; $ uri = new $ class ( '' ) ; $ uri -> fragment = $ this -> fragment ; $ uri -> path = substr ( $ this -> getPath ( ) , strlen ( ... | Get new uri instance related to provided base |
15,998 | protected function buildAuthorityStr ( ) { if ( $ this -> host != null ) { $ authority = '//' ; if ( $ this -> userInfo != null ) { $ authority .= $ this -> userInfo . '@' ; } $ flag = ( strpos ( $ this -> host , ':' ) !== false ) && ! ( substr ( $ this -> host , 0 , 1 ) == '[' ) && ! ( substr ( $ this -> host , - 1 ) ... | Returns the authority parts string of url |
15,999 | public function withHost ( $ host ) { $ url = clone $ this ; $ url -> host = $ host ; $ url -> hash = null ; return $ url ; } | Create a new instance with the specified host . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.