idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
46,900
public function configure ( array $ data ) { $ this -> checkData ( $ data ) ; $ body = new MimeMessage ( ) ; $ body -> addPart ( $ this -> getPart ( $ data ) ) ; $ this -> setBody ( $ body ) ; $ this -> addTo ( $ data [ 'to' ] ) ; $ this -> setSubject ( utf8_decode ( $ this -> subject ) ) ; return $ this ; }
Configure amil message with passed data
46,901
public function execute ( Request $ request ) : Response { $ host = $ request -> getHost ( ) ; $ socket = new ClientSocket ( $ host , 80 ) ; $ socket -> connect ( ) ; $ communicator = $ socket -> getCommunicator ( ) ; $ communicator -> write ( $ request ) ; $ communicator -> writeLine ( '' ) ; $ communicator -> writeLi...
Executes a http request on success a Response object will be returned
46,902
public function hasNext ( ) { if ( parent :: hasNext ( ) && ( $ this -> getItemPosition ( ) < ( $ this -> getItemOffset ( ) + $ this -> getItemCount ( ) ) - 1 ) ) { return true ; } return false ; }
return true if iterator has a next items
46,903
public function valid ( ) { if ( $ this -> getItemPosition ( ) >= $ this -> getItemOffset ( ) && $ this -> getItemPosition ( ) < ( $ this -> getItemOffset ( ) + $ this -> getItemCount ( ) ) ) { return parent :: valid ( ) ; } return false ; }
return true if current item is valid
46,904
public function count ( ) { $ countItems = $ this -> countItems ( ) - $ this -> getItemOffset ( ) ; if ( $ countItems >= $ this -> getItemCount ( ) ) { $ countItems = $ this -> getItemCount ( ) ; } return $ countItems ; }
return the number of items in the subset
46,905
public function loadHeaders ( ) { $ this -> headers = array ( ) ; foreach ( $ this -> pluginPaths as $ pluginPath ) { if ( ! file_exists ( $ pluginPath ) || ! is_dir ( $ pluginPath ) ) { continue ; } $ pluginPathContents = array_diff ( scandir ( $ pluginPath ) , array ( '..' , '.' ) ) ; foreach ( $ pluginPathContents a...
Load the header files of all plugins .
46,906
public function removePluginPath ( $ directory ) { if ( ( $ key = array_search ( $ directory , $ this -> pluginPaths ) ) !== false ) { unset ( $ this -> pluginPaths [ $ key ] ) ; } }
Remove a path where plugins can be found
46,907
static public function create ( ServiceLocator $ serviceLocator , $ requestedClass , array $ options = null ) { if ( class_exists ( $ requestedClass ) ) { $ reflection = new \ ReflectionClass ( $ requestedClass ) ; $ arguments = [ ] ; $ constructor = $ reflection -> getConstructor ( ) ; if ( $ constructor ) { $ constru...
Attempts to create a new class based on constructor typehints and parameter names
46,908
public function findAllByGroupQuery ( GroupInterface $ group , bool $ active = true ) : Query { $ qb = $ this -> createQueryBuilder ( 'r' ) ; return $ qb -> join ( 'r.groups' , 'g' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'g' , ':group' ) ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'r.active' , ':active' ) ) -> setParamet...
Get the query to find all resources by group .
46,909
protected function file ( string $ namespace ) : FileInterface { $ meta = $ this -> getNamespace ( $ namespace ) ; return $ this -> path -> get ( $ namespace . '.' . $ meta [ 'format' ] ) ; }
Get storage file for the given namespace
46,910
public static function register ( ) { Container :: extensionMethod ( 'addDate' , function ( $ container , $ name , $ label = NULL ) { $ picker = $ container [ $ name ] = new DatePicker ( $ label ) ; return $ picker ; } ) ; }
Registers this control
46,911
public function check ( $ name ) { if ( array_key_exists ( $ name , static :: $ marks ) ) { return number_format ( ( microtime ( true ) - static :: $ marks [ $ name ] ) * 1000 , 2 ) ; } return 0.0 ; }
Gets elapsed time in milliseconds for given benchmark .
46,912
public static function valueToString ( $ value ) { if ( null === $ value ) { return 'null' ; } if ( true === $ value ) { return 'true' ; } if ( false === $ value ) { return 'false' ; } if ( is_array ( $ value ) ) { return 'array(' . count ( $ value ) . ')' ; } if ( is_object ( $ value ) ) { return get_class ( $ value )...
Transform a value into a user friendly string .
46,913
public function checkType ( $ value ) { if ( isset ( $ this -> name ) && null !== $ this -> name ) { $ fn = 'is_' . $ this -> name ; return $ fn ( $ value ) ; } throw new \ Exception ( 'Invalid name or name not defined for primitive type.' ) ; }
Is the value type the same of this object?
46,914
public function get_prop_width ( $ resized_height ) { $ width = intval ( ( $ this -> width * $ resized_height ) / $ this -> height ) ; if ( ! $ width ) $ width = 1 ; return $ width ; }
Returns calculated proportional width from the given height
46,915
public function get_prop_height ( $ resized_width ) { $ height = intval ( ( $ this -> height * $ resized_width ) / $ this -> width ) ; if ( ! $ height ) $ height = 1 ; return $ height ; }
Returns calculated proportional height from the given width
46,916
public function resize ( $ width , $ height ) { if ( ! $ width ) $ width = 1 ; if ( ! $ height ) $ height = 1 ; return ( ( false !== ( $ img = new gd ( array ( $ width , $ height ) ) ) ) && $ img -> imagecopyresampled ( $ this ) && ( false !== ( $ this -> image = $ img -> get_image ( ) ) ) && ( false !== ( $ this -> wi...
Resize image . Returns TRUE on success or FALSE on failure
46,917
public function resize_fit ( $ width , $ height ) { if ( ( ! $ width && ! $ height ) || ( ( $ width == $ this -> width ) && ( $ height == $ this -> height ) ) ) return true ; if ( ! $ width || ( ( $ height / $ width ) < ( $ this -> height / $ this -> width ) ) ) $ width = intval ( ( $ this -> width * $ height ) / $ thi...
Resize image to fit in given resolution . Returns TRUE on success or FALSE on failure
46,918
public function useCookies ( ) { if ( ! headers_sent ( ) ) { if ( count ( $ this -> getCookies ( ) ) ) { foreach ( $ this -> getCookies ( ) as $ cookie ) { header ( $ cookie ) ; } } return $ this ; } else { throw new HeadersAlreadySendedException ( ' Başlıklarınız zaten gönderilmiş, cookie kullanılamaz....
Cookie leri header olarak atar
46,919
public static function createDetachedEntity ( string $ objectName , array $ data ) { $ detachedEntity = new $ objectName ; self :: updateEntityFromArray ( $ detachedEntity , $ data ) ; return $ detachedEntity ; }
Creates new entity based on object name sets object parameter from data
46,920
public static function updateEntityFromArray ( $ entity , array $ data ) { foreach ( $ data as $ field => $ value ) { $ method = 'set' . self :: formatStringToMethodName ( $ field ) ; if ( method_exists ( $ entity , $ method ) ) { $ entity -> $ method ( $ value ) ; } } return $ entity ; }
Updates Entity from data calling setters based on data keys
46,921
public static function formatStringToMethodName ( string $ input ) : string { $ methodName = implode ( '' , array_map ( 'ucfirst' , explode ( '_' , strtolower ( $ input ) ) ) ) ; return $ methodName ; }
Generates camel - case method names from string
46,922
public function dump ( array $ options = array ( ) ) { $ this -> document = new \ DOMDocument ( '1.0' , 'utf-8' ) ; $ this -> document -> formatOutput = true ; $ container = $ this -> document -> createElementNS ( 'http://symfony.com/schema/dic/services' , 'container' ) ; $ container -> setAttribute ( 'xmlns:xsi' , 'ht...
Dumps the service container as an XML string .
46,923
private function escape ( array $ arguments ) { $ args = array ( ) ; foreach ( $ arguments as $ k => $ v ) { if ( is_array ( $ v ) ) { $ args [ $ k ] = $ this -> escape ( $ v ) ; } elseif ( is_string ( $ v ) ) { $ args [ $ k ] = str_replace ( '%' , '%%' , $ v ) ; } else { $ args [ $ k ] = $ v ; } } return $ args ; }
Escapes arguments .
46,924
public static function phpToXml ( $ value ) { switch ( true ) { case null === $ value : return 'null' ; case true === $ value : return 'true' ; case false === $ value : return 'false' ; case $ value instanceof Parameter : return '%' . $ value . '%' ; case is_object ( $ value ) || is_resource ( $ value ) : throw new Run...
Converts php types to xml types .
46,925
public function primeReferences ( ClassMetadata $ class , $ documents , $ attributeName , $ refresh , $ readOnly , $ primer = null ) { $ data = $ this -> parseDotSyntaxForPrimer ( $ attributeName , $ class , $ documents ) ; $ mapping = $ data [ 'mapping' ] ; $ attributeName = $ data [ 'attributeName' ] ; $ class = $ da...
Prime references within a mapped attribute of one or more documents .
46,926
public function sum ( ) : Segment { return AlKashi :: side ( $ this -> firstSegment , $ this -> degree , $ this -> secondSegment ) ; }
It sums the segments like we would sum vectors except here we don t use vectors as it would need a plan to express a direction
46,927
public function transform ( $ entity ) { if ( null === $ entity ) { return '' ; } if ( ! is_subclass_of ( $ entity , $ this -> entityClass ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unsupported entity "%s" into "%s" loader.' , get_class ( $ entity ) , __CLASS__ ) ) ; } return $ entity -> getId ( ) ; }
Model - > View
46,928
public function reverseTransform ( $ id ) { if ( ! $ id ) { return null ; } if ( ! $ entity = $ this -> retrieve ( $ id ) ) { throw new TransformationFailedException ( sprintf ( '%s#%s cannot be found.' , $ this -> entityClass , $ id ) ) ; } return $ entity ; }
View - > Model
46,929
protected function execute ( \ Symfony \ Component \ Console \ Input \ InputInterface $ input , \ Symfony \ Component \ Console \ Output \ OutputInterface $ output ) { $ this -> setOut ( $ output ) ; $ this -> logInfo ( "Command '" . $ this -> getName ( ) . "' is started." ) ; try { $ req = new ARequest ( ) ; $ this ->...
Override execute method to prevent DDL statements are not allowed in transactions error .
46,930
public function toArray ( ) { return [ $ this -> id , $ this -> filterName , $ this -> operator , serialize ( $ this -> value ) , ] ; }
Returns the array representation of the active filter .
46,931
static public function createFromArray ( array $ data ) { if ( 4 != count ( $ data ) ) { throw new InvalidArgumentException ( "Expected data as a 4 length array." ) ; } $ filter = new static ( $ data [ 0 ] , $ data [ 1 ] ) ; $ filter -> setOperator ( $ data [ 2 ] ) ; $ filter -> setValue ( unserialize ( $ data [ 3 ] ) ...
Creates the active filter from the given data array .
46,932
public function getFromPath ( $ path , $ depth = 0 , $ withParents = false ) { if ( isset ( $ this -> fs [ $ path ] ) ) { return $ this -> fs [ $ path ] ; } }
Get a file object by the given path
46,933
public function getById ( $ id , $ depth = 0 , $ withParents = false ) { foreach ( $ this -> fs as $ file ) { if ( $ file -> getId ( ) == $ id ) { return $ file ; } } }
Get a file by its unique id . In normal filesystems its unique id is the path . In Database driven filesystems its easier to work with primary keys etc .
46,934
public function getByHash ( $ hash ) { foreach ( $ this -> fs as $ file ) { if ( $ file -> getHash ( ) == $ hash ) { return $ file ; } } }
Get a file by its hash
46,935
public function delete ( FileInterface $ file ) { if ( isset ( $ this -> fs [ $ file -> getPath ( ) ] ) ) { unset ( $ this -> fs [ $ file -> getPath ( ) ] ) ; } if ( $ dir = $ file -> getDir ( ) ) { $ dir -> removeChild ( $ file ) ; } return $ this ; }
Delete the file . If it is a directory recursively delete it
46,936
public function beforeDeleteById ( \ Magento \ Customer \ Api \ CustomerRepositoryInterface $ subject , $ customerId ) { $ this -> deleteSnaps ( $ customerId ) ; $ this -> deleteChange ( $ customerId ) ; $ result = [ $ customerId ] ; return $ result ; }
Remove customer related data from Downline on customer delete from adminhtml .
46,937
static function sendXmlHttpResponseHeaders ( $ contenttype = "application/json" , $ charset = 'utf-8' ) { if ( is_null ( $ charset ) ) $ charset = mb_internal_encoding ( ) ; header ( "Content-Type: $contenttype; charset=$charset" ) ; header ( "Expires: Sat, 1 Jan 2005 00:00:00 GMT" ) ; header ( "Last-Modified: " . gmda...
Output http headers suitable for xmlhttp
46,938
static function appendToUrl ( $ url , $ append ) { if ( $ append ) { $ regs = [ ] ; if ( preg_match ( '|^(.+?)(?:\?(.*?))?(#.*)?$|' , $ url , $ regs ) ) { $ u = $ regs [ 1 ] ; $ q = $ regs [ 2 ] ; $ a = $ regs [ 3 ] ; if ( $ q ) $ q = $ q . "&" . $ append ; else $ q = $ append ; return $ u . '?' . $ q . $ a ; } else re...
Append a parameter to an url
46,939
public function getFilters ( ) { if ( $ this -> progressive ) { $ fc = new FilterChain ( ) ; $ fc -> add ( new Interlace ( ImageInterface :: INTERLACE_PLANE ) ) ; return $ fc ; } else { return null ; } }
Return a FilterChain with Filters for postprocessing the image
46,940
public function getExecutionTimeProportion ( ) { if ( $ this -> getExecutionTime ( ) && $ this -> getProcess ( ) -> getAvgExecutionTime ( ) ) { return round ( $ this -> getExecutionTime ( ) / $ this -> getProcess ( ) -> getAvgExecutionTime ( ) , 2 ) ; } elseif ( $ this -> getExecutionTime ( ) ) { return $ this -> getEx...
Returns proportion between execution time and avg execution time
46,941
public function countErrorsForProcess ( LifecycleEventArgs $ event ) { $ entityManager = $ event -> getEntityManager ( ) ; $ repository = $ entityManager -> getRepository ( get_class ( $ this ) ) ; $ repository -> countByProcessIdAndStatus ( $ this -> getProcess ( ) , [ self :: STATUS_FAILED , self :: STATUS_ABORTED ] ...
Gets triggered only after update
46,942
private function buildRenderer ( $ render = 'foil' , array $ renderingInfo = [ ] ) { switch ( $ render ) { case "raw" : $ renderer = new RawRenderer ( ) ; $ renderInfo = [ ] ; break ; case "json" : $ renderer = new JsonRenderer ( ) ; $ renderInfo = [ ] ; break ; case "foil" : default : $ renderer = new FoilRenderer ( )...
Build setup and return renderer
46,943
function Insert ( $ item , $ parent = null , $ previous = null ) { if ( $ previous ) { $ parent = $ this -> provider -> ParentOf ( $ previous ) ; } $ oldNext = $ this -> provider -> NextOf ( $ item ) ; $ oldPrev = $ this -> provider -> PreviousOf ( $ item ) ; $ oldFirst = $ this -> provider -> FirstChildOf ( $ parent )...
Inserts the item
46,944
function Remove ( $ item ) { $ prev = $ this -> provider -> PreviousOf ( $ item ) ; $ next = $ this -> provider -> NextOf ( $ item ) ; if ( $ next ) { $ this -> provider -> SetPrevious ( $ next , $ prev ) ; } $ this -> provider -> Delete ( $ item ) ; if ( $ next ) { $ this -> provider -> Save ( $ next ) ; } }
Removes the item
46,945
public function getPhoto ( $ attributes = [ ] , $ type = 'original' , $ onlyUrl = false , $ modelSlug = null , $ relation = null ) { $ this -> setAttributes ( $ modelSlug , 'photo' ) ; $ photo = $ this -> getFile ( ) ; if ( ! is_null ( $ photo ) ) { $ src = $ this -> getFileSrc ( $ photo , $ relation , $ type ) ; } els...
get the html photo element
46,946
public function getDocument ( $ attributes = [ ] , $ onlyUrl = false , $ modelSlug = null , $ relation = null ) { $ this -> setAttributes ( $ modelSlug , 'file' ) ; $ file = $ this -> getFile ( ) ; if ( is_null ( $ file ) ) { return '' ; } $ src = $ this -> getFileDownloadSrc ( $ file , $ relation ) ; $ attr = $ this -...
get the html document element
46,947
private function setAttributes ( $ modelSlug , $ type ) { $ this -> module = getModule ( get_class ( $ this ) ) ; $ this -> modelSlug = is_null ( $ modelSlug ) ? getModelSlug ( $ this ) : $ modelSlug ; $ this -> options = config ( "{$this->module}.{$this->modelSlug}.uploads.{$type}" ) ; $ this -> column = $ this -> opt...
set the model specific attribute
46,948
private function getFileSrc ( $ file , $ relation , $ type = null ) { $ id = is_null ( $ relation ) ? $ this -> id : $ this -> $ relation ; $ src = $ this -> options [ 'path' ] . "/{$id}/" ; if ( is_null ( $ type ) ) { return $ src . $ file ; } $ src .= $ type === 'original' ? "original/{$file}" : "thumbnails/{$type}_{...
get the file src
46,949
private function getFileDownloadSrc ( $ file , $ relation ) { $ id = is_null ( $ relation ) ? $ this -> id : $ this -> $ relation ; return route ( 'download.document' , [ 'id' => $ id ] ) ; }
get the file download src
46,950
private function getHTMLAttributes ( $ attributes ) { $ attr = '' ; foreach ( $ attributes as $ key => $ value ) { $ attr .= $ key . '="' . $ value . '" ' ; } return $ attr ; }
get html attribute for file
46,951
public function scopeExtrasWithValues ( $ query , $ model ) { $ modelSlug = $ model ? getModelSlug ( $ model ) : false ; return $ query -> with ( [ 'extras' => function ( $ query ) use ( $ model , $ modelSlug ) { if ( ! $ model ) return $ query ; return $ query -> with ( [ "{$modelSlug}s" => function ( $ query ) use ( ...
get extra column datas with model values
46,952
public function setSlugAttribute ( $ slug ) { if ( ! $ slug ) { $ title = is_null ( $ this -> name ) ? $ this -> title : $ this -> name ; $ slug = str_slug ( $ title , '-' ) ; } $ this -> attributes [ 'slug' ] = $ slug ; }
Set slug encrypted
46,953
public function setIsActiveAttribute ( $ value ) { $ this -> attributes [ 'is_active' ] = $ value == 1 || $ value === 'true' || $ value === true ? true : false ; }
Set the is_active attribute .
46,954
public function setIsPublishAttribute ( $ is_publish ) { $ this -> attributes [ 'is_publish' ] = $ is_publish == 1 || $ is_publish === 'true' || $ is_publish === true ? true : false ; }
Set the is_publish attribute .
46,955
public function getCreatedAtAttribute ( $ date ) { $ module = getModule ( get_class ( ) ) ; return Carbon :: parse ( $ date ) -> format ( config ( "{$module}.date_format" ) ) ; }
Get the created_at attribute .
46,956
public function getAspectRatioAttribute ( ) { if ( $ this -> photo_width == 0 || $ this -> photo_height == 0 ) { return null ; } return $ this -> photo_width / $ this -> photo_height ; }
get the aspect ration with photo width and photo height
46,957
public function setModel ( Model $ model , $ capsule ) { $ this -> _model = $ model ; $ this -> _capsule = $ capsule ; return $ this ; }
Sets the model instance for the Pagination class .
46,958
public function paginate ( ) { $ count = count ( $ this -> _model -> all ( ) ) ; $ this -> _totalPages = ceil ( $ count / $ this -> _limit ) ; $ page_at_offset = floor ( $ this -> _page + 1 / $ this -> _limit ) ; $ this -> _offset = ( $ page_at_offset - 1 ) * $ this -> _limit ; $ this -> _results = $ this -> _model -> ...
Handles the pagination .
46,959
public function render ( $ path = 'basic' , $ views = null ) { $ view = new View ( ) ; if ( is_null ( $ views ) ) { $ views = __DIR__ . '/views/' ; } $ view -> createBlade ( $ views , $ this -> _config -> get ( 'cache' ) ) ; return $ view -> with ( 'pagination' , [ 'currentPage' => $ this -> _page , 'totalPages' => $ t...
Renders pagination links .
46,960
public function set ( $ key , $ value = null , $ group = '' ) { $ this -> checkLoaded ( ) ; $ this -> modified = true ; if ( is_array ( $ key ) ) { foreach ( $ key as $ k => $ v ) { SettingsUtilities :: set ( $ this -> storage , $ k , $ v ) ; } } else { SettingsUtilities :: set ( $ this -> storage , $ key , $ value ) ;...
Store an item in the configuration for a given number of minutes .
46,961
public function add ( Request $ request ) { $ this -> stack = array_slice ( $ this -> stack , 0 , $ this -> position + 1 ) ; $ this -> stack [ ] = clone $ request ; $ this -> position = count ( $ this -> stack ) - 1 ; }
Adds a Request to the history .
46,962
public function forward ( ) { if ( $ this -> position > count ( $ this -> stack ) - 2 ) { throw new \ LogicException ( 'You are already on the last page.' ) ; } return clone $ this -> stack [ ++ $ this -> position ] ; }
Goes forward in the history .
46,963
public function fetchAllEntities ( ) { $ select = $ this -> tableGateway -> getSql ( ) -> select ( ) ; return $ this -> tableGateway -> fetchCollection ( $ select ) ; }
Fetch all entities
46,964
public function fetchEntityById ( $ id ) { $ select = $ this -> tableGateway -> getSql ( ) -> select ( ) ; $ select -> where -> equalTo ( $ this -> tableGateway -> getPrimaryKey ( ) , $ id ) ; return $ this -> tableGateway -> fetchEntity ( $ select ) ; }
Fetch entity by id
46,965
public static function htmlArrayFlatten ( $ array_to_flatten , $ parents = array ( ) ) { $ flattened = array ( ) ; foreach ( $ array_to_flatten as $ key => $ value ) { if ( is_array ( $ value ) ) { $ parent_with_child = $ parents ; $ parent_with_child [ ] = $ key ; $ flattened = array_merge ( $ flattened , self :: html...
Returns an array that has been flattened suitable for use in html forms .
46,966
public static function arrayMultiMergeKeys ( ) { $ args = func_get_args ( ) ; $ result = array ( ) ; foreach ( $ args as $ array ) { foreach ( $ array as $ key => $ row ) { foreach ( $ row as $ name => $ value ) { $ result [ $ key ] [ $ name ] = $ value ; } } } return $ result ; }
Performs a recursive array_merge . Keys with the same value will be over - written with the later value
46,967
public static function arrayKeyAssoc ( $ array_map , $ value ) { if ( is_string ( $ value ) ) { if ( ( $ val = array_search ( $ value , $ array_map ) ) === false ) throw new Exception ( 'Value string undefined: ' . $ value ) ; return $ val ; } else if ( is_int ( $ value ) ) { if ( ! array_key_exists ( '' . $ value , $ ...
Returns the associated value from the array based on the type of value given
46,968
public static function arraySortUsingKeys ( $ arrayToSort , $ arrayKeysInOrder ) { $ result = array ( ) ; foreach ( $ arrayKeysInOrder as $ key ) if ( array_key_exists ( $ key , $ arrayToSort ) ) $ result [ ] = $ arrayToSort [ $ key ] ; return $ result ; }
Sorts an array using another array as a guide for key order
46,969
public static function getList ( ) { $ calledClass = get_called_class ( ) ; if ( ! isset ( static :: $ list [ $ calledClass ] ) ) { $ refClass = new \ ReflectionClass ( $ calledClass ) ; $ labels = static :: getLabels ( ) ; foreach ( $ refClass -> getConstants ( ) as $ constName => $ constValue ) { if ( isset ( $ label...
Get list constants
46,970
function ReadTranslations ( ) { $ lang = PhpTranslator :: Singleton ( ) -> GetLanguage ( ) ; \ RequireOnceIfExists ( PathUtil :: BundleTranslationsFile ( $ this , $ lang ) ) ; \ RequireOnceIfExists ( PathUtil :: ModuleTranslationsFile ( $ this , $ lang ) ) ; }
Reads the translation files
46,971
static function MyBundle ( ) { $ className = \ get_class ( new static ( ) ) ; $ endPos = strpos ( $ className , '\\Modules\\' ) ; $ bundleNS = Str :: Start ( $ className , $ endPos ) ; $ startPos = strrpos ( $ bundleNS , '\\' ) ; return Str :: Part ( $ bundleNS , $ startPos + 1 ) ; }
The bundle name
46,972
final function Render ( ) { $ this -> output = '' ; $ this -> ReadTranslations ( ) ; if ( $ this -> BeforeInit ( ) ) { return $ this -> output ; } if ( $ this -> Init ( ) ) { return $ this -> output ; } if ( $ this -> BeforeGather ( ) ) { return $ this -> output ; } $ this -> GatherOutput ( ) ; $ this -> AfterGather ( ...
Gets the desired output
46,973
private function constructInternalRegularExpression ( $ path , $ routePattern ) { if ( empty ( $ routePattern ) ) return false ; $ fullRoute = $ path ; if ( substr ( $ fullRoute , - 1 ) == '/' ) { $ fullRoute = substr ( $ fullRoute , 0 , - 1 ) ; } $ fullRoute .= $ routePattern ; $ patternSegments = $ this -> urlSegment...
Construct the internal pattern to test the urls against
46,974
public static function merge ( RecordInterface $ left , RecordInterface $ right ) { return Record :: fromArray ( array_merge ( $ left -> getProperties ( ) , $ right -> getProperties ( ) ) , $ right -> getDisplayName ( ) ) ; }
Merges data from two records into a new record . The right record overwrites values from the left record
46,975
public function addSdkOption ( $ key , $ value ) { if ( $ key === 'version' && $ value !== self :: REQUIRED_DYNAMODB_API_VERSION ) { throw ODMException :: dynamodbApiInvalidVersion ( self :: REQUIRED_DYNAMODB_API_VERSION ) ; } $ this -> sdkOptions [ $ key ] = $ value ; }
Set an AWS SDK configuration option .
46,976
public function getPersistentCollectionGenerator ( ) { if ( ! isset ( $ this -> odmOptions [ 'persistentCollectionGenerator' ] ) ) { $ this -> odmOptions [ 'persistentCollectionGenerator' ] = new DefaultPersistentCollectionGenerator ( $ this -> getPersistentCollectionDir ( ) , $ this -> getPersistentCollectionNamespace...
Get the persistent collection generator .
46,977
public function insertSystemVersion ( $ details = null , $ backtrace = null ) { if ( is_null ( $ this -> cfVersion ) ) return false ; $ db = $ this -> getConnection ( ) ; $ version = $ db -> insertRecord ( 'sysversion' , array ( 'CFVersion' => $ this -> cfVersion , 'CreationDate' => $ this -> DateFactory -> newStorageD...
Increments the current system version
46,978
public function getMetaValue ( $ metaKey ) { $ metas = $ this -> getMeta ( ) ; foreach ( $ metas as $ meta ) { if ( $ meta -> getMetaKey ( ) == $ metaKey ) { return ( $ meta -> getMetaValue ( ) ) ; } } return '' ; }
Get meta value of a given meta key
46,979
public function getAvailableMenu ( ) { $ availableMenus = array ( ) ; $ menus = $ this -> getMenu ( ) ; if ( ! $ menus ) { return ( NULL ) ; } foreach ( $ menus as $ menu ) { $ availableMenus [ ] = $ menu -> getLabel ( ) ; } return ( $ availableMenus ) ; }
Get available menu
46,980
private function getURL ( $ array , $ key ) { $ countArray = $ this -> array_depth ( $ array ) - 1 ; switch ( $ countArray ) { case 1 : $ url = $ array [ 'geen' ] [ 'url' ] ; $ id = $ array [ 'geen' ] [ 'id' ] ; $ class = $ array [ 'geen' ] [ 'class' ] ; $ attrib = $ array [ 'geen' ] [ 'attrib' ] ; return [ $ url , $ i...
Private function to get the URL linked with the menu item
46,981
public function createMenu ( $ idNav = '' , $ classNav = '' , $ attributesNav = '' , $ idList = '' , $ classList = '' , $ attributesList = '' ) { $ this -> openNav ( $ idNav , $ classNav , $ attributesNav ) ; $ this -> createList ( '' , $ idList , $ classList , $ attributesList ) ; $ this -> closeNav ( ) ; return $ thi...
To return the created menu
46,982
public function addMenu ( $ url , $ id , $ class , $ attributes , $ menu1 , $ menu2 = 'geen' , $ menu3 = 'geen' , $ menu4 = 'geen' , $ menu5 = 'geen' , $ menu6 = 'geen' ) { $ this -> dataMenu [ $ menu1 ] [ $ menu2 ] [ $ menu3 ] [ $ menu4 ] [ $ menu5 ] [ $ menu6 ] [ 'url' ] = $ url ; $ this -> dataMenu [ $ menu1 ] [ $ m...
Adding a menu item
46,983
public function array_depth ( $ array ) { $ max_depth = 1 ; foreach ( $ array as $ value ) { if ( is_array ( $ value ) ) { $ depth = $ this -> array_depth ( $ value ) + 1 ; if ( $ depth > $ max_depth ) { $ max_depth = $ depth ; } } } return $ max_depth ; }
This returns the depth of an array
46,984
public function injectSubject ( \ PHPCraft \ Subject \ Subject $ subject ) { $ this -> subjects [ $ subject -> name ] = $ subject ; }
Injects another subject
46,985
protected function getUsedTraits ( ) { $ reflection = new \ ReflectionClass ( $ this ) ; $ properties = $ reflection -> getProperties ( ) ; $ traits = [ ] ; foreach ( $ properties as $ property ) { $ name = $ property -> getName ( ) ; if ( substr ( $ name , 0 , 3 ) == 'has' ) { $ traits [ ] = substr ( $ name , 3 ) ; } ...
Gets traits used by class
46,986
protected function checkTraitsDependencies ( ) { $ traits = $ this -> getUsedTraits ( ) ; $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ traits as $ trait ) { $ methodName = 'setTraitDependencies' . $ trait ; if ( $ reflection -> hasMethod ( $ methodName ) ) { $ this -> $ methodName ( ) ; $ this -> check...
Loads traits dependencies from other traits
46,987
protected function checkTraitDependencies ( $ traitName ) { if ( isset ( $ this -> traitsDependencies [ $ traitName ] ) ) { $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ this -> traitsDependencies [ $ traitName ] as $ requiredTrait ) { $ propertyName = 'has' . $ requiredTrait ; if ( ! $ reflection -> ha...
Checks whether traits required by another trait are used
46,988
protected function processConfiguration ( $ configuration ) { if ( isset ( $ configuration [ 'subjects' ] [ $ this -> name ] [ 'locale' ] ) && $ configuration [ 'subjects' ] [ $ this -> name ] [ 'locale' ] ) { $ this -> loadApplicationTranslations ( $ this -> name , $ configuration [ 'subjects' ] [ $ this -> name ] [ '...
Processes configuration checks for mandatory parameters extracts found parameters
46,989
protected function buildPathToArea ( $ language = false ) { $ path = [ ] ; if ( $ language ) { $ path [ ] = $ language ; } elseif ( isset ( $ this -> route [ 'parameters' ] [ 'language' ] ) ) { $ path [ ] = $ this -> route [ 'parameters' ] [ 'language' ] ; } if ( isset ( $ this -> route [ 'parameters' ] [ 'area' ] ) ) ...
builds path to area from route
46,990
protected function buildPathToSubject ( $ language = false ) { $ path = $ this -> buildPathToArea ( $ language ) ; foreach ( ( array ) $ this -> ancestors as $ ancestor => $ primaryKeyValues ) { $ path [ ] = $ ancestor ; $ path [ ] = implode ( '|' , array_values ( $ primaryKeyValues ) ) ; } if ( isset ( $ this -> route...
builds path to subject from route
46,991
protected function buildPathToAncestor ( $ lastAncestor ) { $ path = $ this -> buildPathToArea ( ) ; foreach ( ( array ) $ this -> ancestors as $ ancestor => $ primaryKeyValues ) { $ path [ ] = $ ancestor ; if ( $ ancestor != $ lastAncestor ) { $ path [ ] = implode ( '|' , array_values ( $ primaryKeyValues ) ) ; } else...
builds path to an ancestor
46,992
protected function checkTraitsInjections ( ) { $ traits = $ this -> getUsedTraits ( ) ; $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ traits as $ trait ) { $ methodName = 'setTraitInjections' . $ trait ; if ( $ reflection -> hasMethod ( $ methodName ) ) { $ this -> $ methodName ( ) ; $ this -> checkTrai...
Checks that injections needed by traits have been performed
46,993
protected function checkTraitInjections ( $ traitName ) { if ( isset ( $ this -> traitsInjections [ $ traitName ] ) ) { $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ this -> traitsInjections [ $ traitName ] as $ propertyName ) { if ( ! $ reflection -> hasProperty ( $ propertyName ) || ! $ this -> $ prop...
Checks whether required objects for a trais have been injected
46,994
protected function traitsInit ( ) { $ traits = $ this -> getUsedTraits ( ) ; $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ traits as $ trait ) { $ methodName = 'initTrait' . $ trait ; if ( $ reflection -> hasMethod ( $ methodName ) ) { $ this -> $ methodName ( ) ; } } }
Performs initialization tasks needed by traits calling the optional initTraitTrait - name method
46,995
public function loadTranslations ( $ key , $ pathToIniFile ) { $ path = $ pathToIniFile ; if ( ! is_file ( $ path ) ) { throw new \ InvalidArgumentException ( sprintf ( "Translation file not found into path %s" , $ path ) ) ; } else { $ this -> translations [ $ key ] = parse_ini_file ( $ path , true ) ; } }
adds a translations ini file content to subject translations
46,996
public function execAction ( ) { if ( ! $ this -> action ) { throw new \ Exception ( sprintf ( 'no action defined for subject %s' , $ this -> name ) ) ; } try { $ this -> checkTraitsInjections ( ) ; $ this -> traitsInit ( ) ; $ this -> { 'exec' . $ this -> sanitizeAction ( $ this -> action ) } ( ) ; } catch ( Exception...
tries to exec current action
46,997
public static function replace ( array $ words , $ replacement , $ text ) { $ replace = ( mb_strlen ( $ replacement ) > 1 ) ? $ replacement : static :: transformReplacement ( $ words , $ replacement ) ; return str_replace ( $ words , $ replace , $ text ) ; }
Replace the text with replacement according to the given words .
46,998
protected static function transformReplacement ( array $ words , $ replace ) { return array_map ( function ( $ value ) use ( $ replace ) { return str_repeat ( $ replace , mb_strlen ( $ value ) ) ; } , $ words ) ; }
Get words replacement .
46,999
protected function initNavigation ( ) { Yii :: $ app -> params [ 'nav' ] [ 'wavecms_form' ] = [ 'label' => FontAwesome :: icon ( 'paper-plane' ) . Yii :: t ( 'wavecms_form/main' , 'Forms' ) , 'url' => 'javascript: ;' , 'options' => [ 'class' => 'drop-down' ] , 'permission' => 'wavecms-form' , 'position' => 5000 , 'item...
Init left navigation