idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
44,900
protected function setOverrides ( ) { $ config = $ this -> app [ 'config' ] -> get ( 'cartalyst.sentinel' ) ; $ users = $ config [ 'users' ] [ 'model' ] ; $ roles = $ config [ 'roles' ] [ 'model' ] ; $ persistences = $ config [ 'persistences' ] [ 'model' ] ; if ( class_exists ( $ users ) ) { if ( method_exists ( $ user...
Performs the necessary overrides .
44,901
protected function checkThrottling ( $ action , UserInterface $ user = null ) { if ( $ action === 'login' ) { $ globalDelay = $ this -> throttle -> globalDelay ( ) ; if ( $ globalDelay > 0 ) { $ this -> throwException ( "Too many unsuccessful attempts have been made globally, logins are locked for another [{$globalDela...
Checks the throttling status of the given user .
44,902
protected function throwException ( $ message , $ type , $ delay ) { $ exception = new ThrottlingException ( $ message ) ; $ exception -> setDelay ( $ delay ) ; $ exception -> setType ( $ type ) ; throw $ exception ; }
Throws a throttling exception .
44,903
protected function getSession ( ) { if ( isset ( $ _SESSION [ $ this -> key ] ) ) { $ value = $ _SESSION [ $ this -> key ] ; if ( $ value ) { return unserialize ( $ value ) ; } } }
Unserializes a value from the session and returns it .
44,904
protected function createPersistence ( ) { $ session = $ this -> createSession ( ) ; $ cookie = $ this -> createCookie ( ) ; $ model = $ this -> config [ 'persistences' ] [ 'model' ] ; $ single = $ this -> config [ 'persistences' ] [ 'single' ] ; return new IlluminatePersistenceRepository ( $ session , $ cookie , $ mod...
Creates a persistences repository .
44,905
protected function createUsers ( ) { $ hasher = $ this -> createHasher ( ) ; $ model = $ this -> config [ 'users' ] [ 'model' ] ; $ roles = $ this -> config [ 'roles' ] [ 'model' ] ; $ persistences = $ this -> config [ 'persistences' ] [ 'model' ] ; if ( class_exists ( $ roles ) && method_exists ( $ roles , 'setUsersMo...
Creates a user repository .
44,906
protected function createRoles ( ) { $ model = $ this -> config [ 'roles' ] [ 'model' ] ; $ users = $ this -> config [ 'users' ] [ 'model' ] ; if ( class_exists ( $ users ) && method_exists ( $ users , 'setRolesModel' ) ) { forward_static_call_array ( [ $ users , 'setRolesModel' ] , [ $ model ] ) ; } return new Illumin...
Creates a role repository .
44,907
protected function createActivations ( ) { $ model = $ this -> config [ 'activations' ] [ 'model' ] ; $ expires = $ this -> config [ 'activations' ] [ 'expires' ] ; return new IlluminateActivationRepository ( $ model , $ expires ) ; }
Creates an activation repository .
44,908
protected function createCheckpoints ( IlluminateActivationRepository $ activations , IlluminateThrottleRepository $ throttle , $ ipAddress ) { $ activeCheckpoints = $ this -> config [ 'checkpoints' ] ; $ activation = $ this -> createActivationCheckpoint ( $ activations ) ; $ throttle = $ this -> createThrottleCheckpoi...
Create activation and throttling checkpoints .
44,909
protected function createThrottling ( ) { $ model = $ this -> config [ 'throttling' ] [ 'model' ] ; foreach ( [ 'global' , 'ip' , 'user' ] as $ type ) { $ { "{$type}Interval" } = $ this -> config [ 'throttling' ] [ $ type ] [ 'interval' ] ; $ { "{$type}Thresholds" } = $ this -> config [ 'throttling' ] [ $ type ] [ 'thr...
Create a throttling repository .
44,910
protected function createReminders ( IlluminateUserRepository $ users ) { $ model = $ this -> config [ 'reminders' ] [ 'model' ] ; $ expires = $ this -> config [ 'reminders' ] [ 'expires' ] ; return new IlluminateReminderRepository ( $ users , $ model , $ expires ) ; }
Create a reminder repository .
44,911
protected function getCookie ( ) { if ( isset ( $ _COOKIE [ $ this -> options [ 'name' ] ] ) ) { $ value = $ _COOKIE [ $ this -> options [ 'name' ] ] ; if ( $ value ) { return json_decode ( $ value ) ; } } }
Returns a PHP cookie .
44,912
protected function setCookie ( $ value , $ lifetime , $ path = null , $ domain = null , $ secure = null , $ httpOnly = null ) { setcookie ( $ this -> options [ 'name' ] , json_encode ( $ value ) , $ lifetime , $ path ? : $ this -> options [ 'path' ] , $ domain ? : $ this -> options [ 'domain' ] , $ secure ? : $ this ->...
Sets a PHP cookie .
44,913
protected function delay ( $ type , $ argument = null ) { $ method = 'get' . studly_case ( $ type ) . 'Throttles' ; $ thresholds = $ type . 'Thresholds' ; $ throttles = $ this -> { $ method } ( $ argument ) ; if ( ! $ throttles -> count ( ) ) { return 0 ; } if ( is_array ( $ this -> $ thresholds ) ) { $ last = $ thrott...
Returns a delay for the given type .
44,914
protected function getGlobalThrottles ( ) { if ( $ this -> globalThrottles === null ) { $ this -> globalThrottles = $ this -> loadGlobalThrottles ( ) ; } return $ this -> globalThrottles ; }
Returns the global throttles collection .
44,915
protected function createSalt ( ) { $ pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./' ; $ max = strlen ( $ pool ) - 1 ; $ salt = '' ; for ( $ i = 0 ; $ i < $ this -> saltLength ; ++ $ i ) { $ salt .= $ pool [ random_int ( 0 , $ max ) ] ; } return $ salt ; }
Create a random string for a salt .
44,916
protected function parseCredentials ( array $ credentials , array $ loginNames ) { if ( isset ( $ credentials [ 'password' ] ) ) { $ password = $ credentials [ 'password' ] ; unset ( $ credentials [ 'password' ] ) ; } else { $ password = null ; } $ passedNames = array_intersect_key ( $ credentials , array_flip ( $ logi...
Parses the given credentials to return logins password and others .
44,917
protected function validateUser ( array $ credentials , $ id = null ) { $ instance = $ this -> createModel ( ) ; $ loginNames = $ instance -> getLoginNames ( ) ; list ( $ logins , $ password , $ credentials ) = $ this -> parseCredentials ( $ credentials , $ loginNames ) ; if ( $ id === null ) { if ( empty ( $ logins ) ...
Validates the user .
44,918
public function fill ( UserInterface $ user , array $ credentials ) { $ this -> fireEvent ( 'sentinel.user.filling' , compact ( 'user' , 'credentials' ) ) ; $ loginNames = $ user -> getLoginNames ( ) ; list ( $ logins , $ password , $ attributes ) = $ this -> parseCredentials ( $ credentials , $ loginNames ) ; if ( is_...
Fills a user with the given credentials intelligently .
44,919
protected function getPreparedPermissions ( ) { if ( $ this -> preparedPermissions === null ) { $ this -> preparedPermissions = $ this -> createPreparedPermissions ( ) ; } return $ this -> preparedPermissions ; }
Lazily grab the prepared permissions .
44,920
protected function preparePermissions ( array & $ prepared , array $ permissions ) { foreach ( $ permissions as $ keys => $ value ) { foreach ( $ this -> extractClassPermissions ( $ keys ) as $ key ) { if ( ! array_key_exists ( $ key , $ prepared ) ) { $ prepared [ $ key ] = $ value ; continue ; } if ( $ value === fals...
Does the heavy lifting of preparing permissions .
44,921
protected function checkPermission ( array $ prepared , $ permission ) { if ( array_key_exists ( $ permission , $ prepared ) && $ prepared [ $ permission ] === true ) { return true ; } $ permission = ( string ) $ permission ; foreach ( $ prepared as $ key => $ value ) { $ key = ( string ) $ key ; if ( ( str_is ( $ perm...
Checks a permission in the prepared array including wildcard checks and permissions .
44,922
protected function createPermissions ( ) { $ userPermissions = $ this -> permissions ; $ rolePermissions = [ ] ; foreach ( $ this -> roles as $ role ) { $ rolePermissions [ ] = $ role -> permissions ; } return new static :: $ permissionsClass ( $ userPermissions , $ rolePermissions ) ; }
Creates a permissions object .
44,923
public function getFriendsCount ( $ groupSlug = '' ) { $ friendsCount = $ this -> findFriendships ( Status :: ACCEPTED , $ groupSlug ) -> count ( ) ; return $ friendsCount ; }
Get the number of friends
44,924
public function index ( NovaRequest $ request ) { return response ( ) -> json ( [ 'actions' => $ request -> newResource ( ) -> availableActions ( $ request ) , 'pivotActions' => [ 'name' => $ request -> pivotName ( ) , 'actions' => $ request -> newResource ( ) -> availablePivotActions ( $ request ) , ] , ] ) ; }
List the actions for the given resource .
44,925
public function validateFields ( ) { $ availableFields = [ ] ; foreach ( $ this -> action ( ) -> fields ( ) as $ field ) { if ( $ field instanceof NovaDependencyContainer ) { $ availableFields [ ] = $ field ; $ this -> extractChildFields ( $ field -> meta [ 'fields' ] ) ; } else { $ availableFields [ ] = $ field ; } } ...
Validate action fields Overridden using ActionController & ActionRequest by modifying routes
44,926
protected function renderDropdown ( ) { $ config = $ this -> dropdown ; $ config [ 'clientOptions' ] = false ; $ config [ 'view' ] = $ this -> getView ( ) ; $ dropdownClass = $ this -> dropdownClass ; return $ dropdownClass :: widget ( $ config ) ; }
Generates the dropdown menu .
44,927
public function renderIndicators ( ) { if ( $ this -> showIndicators === false ) { return '' ; } $ indicators = [ ] ; for ( $ i = 0 , $ count = count ( $ this -> items ) ; $ i < $ count ; $ i ++ ) { $ options = [ 'data-target' => '#' . $ this -> options [ 'id' ] , 'data-slide-to' => $ i ] ; if ( $ i === 0 ) { Html :: a...
Renders carousel indicators .
44,928
public function renderItem ( $ item , $ index ) { if ( is_string ( $ item ) ) { $ content = $ item ; $ caption = null ; $ options = [ ] ; } elseif ( isset ( $ item [ 'content' ] ) ) { $ content = $ item [ 'content' ] ; $ caption = ArrayHelper :: getValue ( $ item , 'caption' ) ; if ( $ caption !== null ) { $ captionOpt...
Renders a single carousel item
44,929
protected function renderProgress ( ) { $ out = Html :: beginTag ( 'div' , $ this -> options ) . "\n" ; if ( empty ( $ this -> bars ) ) { $ this -> bars = [ [ 'label' => $ this -> label , 'percent' => $ this -> percent , 'options' => [ ] ] ] ; } $ bars = [ ] ; foreach ( $ this -> bars as $ bar ) { $ label = ArrayHelper...
Renders the progress .
44,930
protected function activateFirstVisibleTab ( ) { foreach ( $ this -> items as $ i => $ item ) { $ active = ArrayHelper :: getValue ( $ item , 'active' , null ) ; $ visible = ArrayHelper :: getValue ( $ item , 'visible' , true ) ; if ( $ visible && $ active !== false ) { $ this -> items [ $ i ] [ 'active' ] = true ; ret...
Sets the first visible tab as active .
44,931
public function renderPanes ( $ panes ) { return $ this -> renderTabContent ? "\n" . Html :: tag ( 'div' , implode ( "\n" , $ panes ) , $ this -> tabContentOptions ) : '' ; }
Renders tab panes .
44,932
public static function activeStaticControl ( $ model , $ attribute , $ options = [ ] ) { if ( isset ( $ options [ 'value' ] ) ) { $ value = $ options [ 'value' ] ; unset ( $ options [ 'value' ] ) ; } else { $ value = static :: getAttributeValue ( $ model , $ attribute ) ; } return static :: staticControl ( $ value , $ ...
Generates a Bootstrap static form control for the given model attribute .
44,933
public function login ( $ username = 'anonymous' , $ password = '' ) { $ result = $ this -> ftp -> login ( $ username , $ password ) ; if ( $ result === false ) { throw new FtpException ( 'Login incorrect' ) ; } return $ this ; }
Logs in to an FTP connection .
44,934
public function cleanDir ( $ directory ) { if ( ! $ files = $ this -> nlist ( $ directory ) ) { return $ this -> isEmpty ( $ directory ) ; } foreach ( $ files as $ file ) { $ this -> remove ( $ file , true ) ; } return $ this -> isEmpty ( $ directory ) ; }
Empty directory .
44,935
public function remove ( $ path , $ recursive = false ) { try { if ( @ $ this -> ftp -> delete ( $ path ) or ( $ this -> isDir ( $ path ) and $ this -> rmdir ( $ path , $ recursive ) ) ) { return true ; } return false ; } catch ( \ Exception $ e ) { return false ; } }
Remove a file or a directory .
44,936
public function isDir ( $ directory ) { $ pwd = $ this -> ftp -> pwd ( ) ; if ( $ pwd === false ) { throw new FtpException ( 'Unable to resolve the current directory' ) ; } if ( @ $ this -> ftp -> chdir ( $ directory ) ) { $ this -> ftp -> chdir ( $ pwd ) ; return true ; } $ this -> ftp -> chdir ( $ pwd ) ; return fals...
Check if a directory exist .
44,937
public function scanDir ( $ directory = '.' , $ recursive = false ) { return $ this -> parseRawList ( $ this -> rawlist ( $ directory , $ recursive ) ) ; }
Scan a directory and returns the details of each item .
44,938
public function dirSize ( $ directory = '.' , $ recursive = true ) { $ items = $ this -> scanDir ( $ directory , $ recursive ) ; $ size = 0 ; foreach ( $ items as $ item ) { $ size += ( int ) $ item [ 'size' ] ; } return $ size ; }
Returns the total size of the given directory in bytes .
44,939
public function getContent ( $ remote_file , $ mode = FTP_BINARY , $ resumepos = 0 ) { $ handle = fopen ( 'php://temp' , 'r+' ) ; if ( $ this -> fget ( $ handle , $ remote_file , $ mode , $ resumepos ) ) { rewind ( $ handle ) ; return stream_get_contents ( $ handle ) ; } return null ; }
Downloads a file from the FTP server into a string
44,940
public function putFromString ( $ remote_file , $ content ) { $ handle = fopen ( 'php://temp' , 'w' ) ; fwrite ( $ handle , $ content ) ; rewind ( $ handle ) ; if ( $ this -> ftp -> fput ( $ remote_file , $ handle , FTP_BINARY ) ) { return $ this ; } throw new FtpException ( 'Unable to put the file "' . $ remote_file ....
Uploads a file to the server from a string .
44,941
public function putFromPath ( $ local_file ) { $ remote_file = basename ( $ local_file ) ; $ handle = fopen ( $ local_file , 'r' ) ; if ( $ this -> ftp -> fput ( $ remote_file , $ handle , FTP_BINARY ) ) { rewind ( $ handle ) ; return $ this ; } throw new FtpException ( 'Unable to put the remote file from the local fil...
Uploads a file to the server .
44,942
public function getAll ( $ source_directory , $ target_directory , $ mode = FTP_BINARY ) { if ( $ source_directory != "." ) { if ( $ this -> ftp -> chdir ( $ source_directory ) == false ) { throw new FtpException ( "Unable to change directory: " . $ source_directory ) ; } if ( ! ( is_dir ( $ source_directory ) ) ) { mk...
Downloads all files from remote FTP directory
44,943
public function tryIt ( $ pinId , $ comment , $ pathToImage = null ) { $ data = $ this -> makeRequest ( $ pinId , $ comment , $ pathToImage ) ; $ this -> post ( UrlBuilder :: RESOURCE_TRY_PIN_CREATE , $ data ) ; return $ this -> getResponse ( ) -> getResponseData ( ) ; }
Makes a DidIt activity record .
44,944
public function tried ( $ pinId , $ limit = Pagination :: DEFAULT_LIMIT ) { $ data = [ 'field_set_key' => 'did_it' , 'show_did_it_feed' => true , ] ; return $ this -> getAggregatedActivity ( $ pinId , $ data , $ limit ) ; }
Get the pinners who have tied this pin
44,945
public function send ( $ entityId , $ text , $ userIds , $ emails ) { $ messageData = $ this -> buildMessageData ( $ text , $ entityId ) ; return $ this -> callSendMessage ( $ userIds , $ emails , $ messageData ) ; }
Send item with message or by email .
44,946
public function recommendedFor ( $ query ) { $ requestOptions = [ 'scope' => 'pins' , 'query' => $ query , ] ; $ result = $ this -> get ( UrlBuilder :: RESOURCE_SEARCH , $ requestOptions ) ; return empty ( $ result ) ? [ ] : $ this -> getKeywordsFromRequest ( $ result ) ; }
Get recommendations for query word .
44,947
public function forUser ( $ username ) { $ options = [ 'username' => $ username , 'field_set_key' => 'detailed' , ] ; $ result = $ this -> get ( UrlBuilder :: RESOURCE_GET_BOARDS , $ options ) ; return $ result ? : [ ] ; }
Get boards for user by username .
44,948
public function info ( $ username , $ board ) { $ requestOptions = [ 'slug' => $ this -> formatBoardName ( $ board ) , 'username' => $ username , 'field_set_key' => 'detailed' , ] ; return $ this -> get ( UrlBuilder :: RESOURCE_GET_BOARD , $ requestOptions ) ; }
Get info about user s board .
44,949
public function pins ( $ boardId , $ limit = Pagination :: DEFAULT_LIMIT ) { return $ this -> paginate ( UrlBuilder :: RESOURCE_GET_BOARD_FEED , [ 'board_id' => $ boardId ] , $ limit ) ; }
Get pins from board by boardId .
44,950
public function create ( $ name , $ description , $ privacy = self :: BOARD_PRIVACY_PUBLIC ) { $ requestOptions = [ 'name' => $ name , 'description' => $ description , 'privacy' => $ privacy , ] ; return $ this -> post ( UrlBuilder :: RESOURCE_CREATE_BOARD , $ requestOptions ) ; }
Create a new board .
44,951
public function create ( $ imageUrl , $ boardId , $ description = '' , $ link = '' , $ title = '' , $ sectionId = null ) { if ( file_exists ( $ imageUrl ) ) { $ imageUrl = $ this -> upload ( $ imageUrl ) ; } $ requestOptions = [ 'method' => 'scraped' , 'description' => $ description , 'link' => $ link , 'image_url' => ...
Create a pin . Returns created pin info .
44,952
public function edit ( $ pindId , $ description = '' , $ link = '' , $ boardId = null , $ title = '' , $ sectionId = null ) { $ requestOptions = [ 'id' => $ pindId ] ; if ( ! empty ( $ description ) ) { $ requestOptions [ 'description' ] = $ description ; } if ( ! empty ( $ link ) ) { $ requestOptions [ 'link' ] = stri...
Edit pin by ID . You can move pin to a new board by setting this board id .
44,953
public function repin ( $ repinId , $ boardId , $ description = '' ) { $ requestOptions = [ 'board_id' => $ boardId , 'description' => stripslashes ( $ description ) , 'link' => '' , 'is_video' => null , 'pin_id' => $ repinId , ] ; $ this -> post ( UrlBuilder :: RESOURCE_REPIN , $ requestOptions ) ; return $ this -> re...
Make a repin .
44,954
public function saveOriginalImage ( $ pinId , $ path ) { $ pinInfo = $ this -> info ( $ pinId ) ; if ( ! isset ( $ pinInfo [ 'images' ] [ 'orig' ] [ 'url' ] ) ) { return false ; } $ originalUrl = $ pinInfo [ 'images' ] [ 'orig' ] [ 'url' ] ; $ destination = $ path . DIRECTORY_SEPARATOR . basename ( $ originalUrl ) ; Fi...
Saves the pin original image to the specified path . On success returns full path to saved image . Otherwise returns false .
44,955
public function analytics ( $ pinId ) { $ pinId = ( string ) $ pinId ; return $ this -> get ( UrlBuilder :: RESOURCE_PIN_ANALYTICS , [ 'pin_id' => $ pinId ] ) ; }
Get pin analytics like numbers of clicks views and repins
44,956
public function login ( $ username , $ password , $ autoLogin = true ) { if ( $ this -> isLoggedIn ( ) ) { return true ; } $ this -> checkCredentials ( $ username , $ password ) ; if ( $ autoLogin && $ this -> processAutoLogin ( $ username ) ) { return true ; } return $ this -> processLogin ( $ username , $ password ) ...
Login as pinner .
44,957
public function registerBusiness ( $ registrationForm , $ password = null , $ name = null , $ website = '' ) { $ registration = $ this -> register ( $ registrationForm , $ password , $ name ) ; if ( ! $ registration ) { return false ; } $ website = ( $ registrationForm instanceof Registration ) ? $ registrationForm -> ...
Register a new business account . At first we register a basic type account . Then convert it to a business one . This is done to receive a confirmation email after registration .
44,958
public function convertToBusiness ( $ businessName , $ websiteUrl = '' ) { $ data = [ 'business_name' => $ businessName , 'website_url' => $ websiteUrl , 'account_type' => 'other' , ] ; return $ this -> post ( UrlBuilder :: RESOURCE_CONVERT_TO_BUSINESS , $ data ) ; }
Convert your account to a business one .
44,959
public function invites ( ) { $ data = [ 'current_user' => true , 'field_set_key' => 'news' , ] ; $ invites = $ this -> get ( UrlBuilder :: RESOURCE_BOARDS_INVITES , $ data ) ; return ! $ invites ? [ ] : $ invites ; }
Get boards invites
44,960
public function invitesFor ( $ boardId , $ limit = Pagination :: DEFAULT_LIMIT ) { return $ this -> paginate ( UrlBuilder :: RESOURCE_BOARDS_INVITES , [ 'board_id' => ( string ) $ boardId ] , $ limit ) ; }
Get invites for a specified board
44,961
public function exec ( $ resourceUrl , $ postString = '' ) { $ url = UrlBuilder :: buildApiUrl ( $ resourceUrl ) ; $ headers = $ this -> getHttpHeaders ( ) ; $ postString = $ this -> filePathToUpload ? $ this -> postFileData : $ postString ; $ result = $ this -> httpClient -> execute ( $ url , $ postString , $ headers ...
Executes request to Pinterest API .
44,962
public function autoLogin ( $ username ) { $ this -> loadCookiesFor ( $ username ) ; if ( ! $ this -> httpClient -> cookie ( '_auth' ) ) { return false ; } $ this -> login ( ) ; return true ; }
Load cookies for this username and check if it was logged in .
44,963
public function login ( ) { $ this -> setTokenFromCookies ( ) ; if ( ! empty ( $ this -> csrfToken ) ) { $ this -> loggedIn = true ; } return $ this ; }
Mark client as logged .
44,964
public function createQuery ( array $ data = [ ] , array $ bookmarks = [ ] ) { $ data = empty ( $ data ) ? [ ] : $ data ; $ request = $ this -> createRequestData ( [ 'options' => $ data ] , $ bookmarks ) ; return UrlBuilder :: buildRequestString ( $ request ) ; }
Create request string .
44,965
public function deactivate ( $ reason = 'other' , $ explanation = '' ) { $ userId = $ this -> id ( ) ; if ( $ userId === null ) { return false ; } $ request = [ 'user_id' => $ userId , 'reason' => $ reason , 'explanation' => $ explanation , ] ; return $ this -> post ( UrlBuilder :: RESOURCE_DEACTIVATE_ACCOUNT , $ reque...
Deactivates your account .
44,966
public static function create ( ) { $ request = self :: makeRequest ( ) ; $ response = self :: makeResponse ( ) ; return self :: buildProvidersContainer ( $ request , $ response ) ; }
Initializes Bot instance and all its dependencies .
44,967
public function following ( $ username , $ type = UrlBuilder :: FOLLOWING_PEOPLE , $ limit = Pagination :: DEFAULT_LIMIT ) { $ followingUrl = UrlBuilder :: getFollowingUrlByType ( $ type ) ; if ( $ followingUrl === null ) { throw new WrongFollowingType ( "No following results for $type" ) ; } return $ this -> paginateB...
Get following info for pinner .
44,968
public function followingPeople ( $ username , $ limit = Pagination :: DEFAULT_LIMIT ) { return $ this -> following ( $ username , UrlBuilder :: FOLLOWING_PEOPLE , $ limit ) ; }
Get following people for pinner .
44,969
public function followingBoards ( $ username , $ limit = Pagination :: DEFAULT_LIMIT ) { return $ this -> following ( $ username , UrlBuilder :: FOLLOWING_BOARDS , $ limit ) ; }
Get following boards for pinner .
44,970
public function followingInterests ( $ username , $ limit = Pagination :: DEFAULT_LIMIT ) { return $ this -> following ( $ username , UrlBuilder :: FOLLOWING_INTERESTS , $ limit ) ; }
Get following interests for pinner .
44,971
public function pins ( $ username , $ limit = Pagination :: DEFAULT_LIMIT ) { return $ this -> paginateByUsername ( $ username , UrlBuilder :: RESOURCE_USER_PINS , $ limit ) ; }
Get pinner pins .
44,972
public function likes ( $ username , $ limit = Pagination :: DEFAULT_LIMIT ) { return $ this -> paginateByUsername ( $ username , UrlBuilder :: RESOURCE_USER_LIKES , $ limit ) ; }
Get pins that user likes .
44,973
public function followers ( $ username = '' , $ limit = Pagination :: DEFAULT_LIMIT ) { $ username = empty ( $ username ) ? $ this -> resolveCurrentUsername ( ) : $ username ; if ( ! $ username ) { return new Pagination ( ) ; } return parent :: followers ( $ username , $ limit ) ; }
Returns current user s followers when used without arguments .
44,974
public function execute ( $ url , $ postString = '' , array $ headers = [ ] ) { return $ this -> init ( $ url , $ postString , $ headers ) -> callCurl ( ) ; }
Executes curl request .
44,975
protected function init ( $ url , $ postString , $ headers ) { $ this -> headers = $ headers ; $ this -> curl = curl_init ( $ url ) ; if ( empty ( $ this -> cookieJar ) ) { $ this -> loadCookies ( ) ; } curl_setopt_array ( $ this -> curl , $ this -> makeHttpOptions ( $ postString ) ) ; return $ this ; }
Initializes curl resource with options .
44,976
protected function makeHttpOptions ( $ postString = '' ) { $ options = array_replace ( $ this -> options , $ this -> getDefaultHttpOptions ( ) ) ; if ( ! empty ( $ postString ) ) { $ options [ CURLOPT_POST ] = true ; $ options [ CURLOPT_POSTFIELDS ] = $ postString ; } return $ options ; }
Adds necessary curl options for query .
44,977
protected function initCookieFile ( $ username ) { $ cookieName = self :: COOKIE_PREFIX . $ username ; $ cookieFilePath = $ this -> getCookiesPath ( ) . DIRECTORY_SEPARATOR . $ cookieName ; if ( ! file_exists ( $ cookieFilePath ) ) { touch ( $ cookieFilePath ) ; } return $ cookieFilePath ; }
Returns cookie file name according to the provided username .
44,978
public function post ( $ resourceUrl , array $ requestOptions = [ ] , $ returnData = false ) { $ postString = $ this -> request -> createQuery ( $ requestOptions ) ; $ this -> initTokenIfRequired ( ) ; $ this -> execute ( $ resourceUrl , $ postString ) ; return $ returnData ? $ this -> response -> getResponseData ( ) :...
Executes a POST request to Pinterest API .
44,979
protected function get ( $ resourceUrl = '' , array $ requestOptions = [ ] ) { $ this -> execute ( $ resourceUrl . $ this -> makeQueryString ( $ requestOptions ) ) ; return $ this -> response -> getResponseData ( ) ; }
Executes a GET request to Pinterest API .
44,980
protected function paginateCustom ( callable $ callback , $ limit = Pagination :: DEFAULT_LIMIT ) { $ this -> response -> clear ( ) ; return ( new Pagination ) -> paginateOver ( $ callback ) -> take ( $ limit ) ; }
Accepts callback which should return PaginatedResponse object .
44,981
public function create ( $ pinId , $ text ) { $ requestOptions = [ 'objectId' => $ this -> getAggregatedPinId ( $ pinId ) , 'pinId' => $ pinId , 'text' => $ text , ] ; return $ this -> post ( UrlBuilder :: RESOURCE_COMMENT_PIN , $ requestOptions , true ) ; }
Write a comment for a pin with current id .
44,982
public function delete ( $ pinId , $ commentId ) { $ requestOptions = [ 'commentId' => $ commentId ] ; return $ this -> post ( UrlBuilder :: RESOURCE_COMMENT_DELETE_PIN , $ requestOptions ) ; }
Delete a comment for a pin with current id .
44,983
public function sendMessage ( $ userIds , $ text , $ pinId = null ) { return $ this -> send ( $ pinId , $ text , $ userIds , [ ] ) ; }
Send message to a user .
44,984
protected function checkMethodForLoginRequired ( $ method ) { $ isLoggedIn = $ this -> provider -> isLoggedIn ( ) ; $ methodRequiresLogin = $ this -> provider -> checkMethodRequiresLogin ( $ method ) ; if ( $ methodRequiresLogin && ! $ isLoggedIn ) { $ errorMessage = $ this -> getErrorMethodCallMessage ( $ method , 'Yo...
Checks if method requires login and if true checks logged in status .
44,985
protected function execSearchRequest ( $ query , $ scope ) { $ url = $ this -> getResponse ( ) -> hasBookmarks ( ) ? UrlBuilder :: RESOURCE_SEARCH_WITH_PAGINATION : UrlBuilder :: RESOURCE_SEARCH ; $ requestOptions = [ 'scope' => $ scope , 'query' => $ query , ] ; $ this -> get ( $ url , $ requestOptions ) ; return new ...
Executes search to API . Query - search string .
44,986
public function search ( $ query , $ limit = Pagination :: DEFAULT_LIMIT ) { return $ this -> paginateCustom ( function ( ) use ( $ query ) { return $ this -> execSearchRequest ( $ query , $ this -> getSearchScope ( ) ) ; } ) -> take ( $ limit ) ; }
Search entities by search query .
44,987
public function reset ( $ link , $ newPassword ) { $ this -> get ( $ link ) ; $ this -> request -> dropCookies ( ) ; $ urlData = $ this -> parseCurrentUrl ( ) ; $ isValidUrlData = isset ( $ urlData [ 'query' ] , $ urlData [ 'path' ] ) ; if ( ! $ isValidUrlData ) { return false ; } $ username = trim ( str_replace ( '/pw...
Set a new password by link from reset password email
44,988
public function followers ( $ for , $ limit = Pagination :: DEFAULT_LIMIT ) { return $ this -> paginate ( $ this -> getFollowersUrl ( ) , [ $ this -> getFollowersFor ( ) => $ for ] , $ limit ) ; }
Get followers .
44,989
public function getProvider ( $ provider ) { if ( ! isset ( $ this -> providers [ $ provider ] ) ) { $ this -> addProvider ( $ provider ) ; } return $ this -> providers [ $ provider ] ; }
Gets provider object by name . If there is no such provider in providers array it will try to create it then save it and then return .
44,990
protected function addProvider ( $ provider ) { $ className = $ this -> resolveProviderClass ( $ provider ) ; $ this -> providers [ $ provider ] = $ this -> buildProvider ( $ className ) ; }
Creates provider by class name and if success saves it to providers array . Provider class must exist in PROVIDERS_NAMESPACE .
44,991
public function getBySession ( SessionEntity $ session ) { $ result = $ this -> getConnection ( ) -> table ( 'oauth_clients' ) -> select ( 'oauth_clients.id as id' , 'oauth_clients.secret as secret' , 'oauth_clients.name as name' ) -> join ( 'oauth_sessions' , 'oauth_sessions.client_id' , '=' , 'oauth_clients.id' ) -> ...
Get the client associated with a session .
44,992
public function create ( $ name , $ id , $ secret ) { return $ this -> getConnection ( ) -> table ( 'oauth_clients' ) -> insertGetId ( [ 'id' => $ id , 'name' => $ name , 'secret' => $ secret , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) , ] ) ; }
Create a new client .
44,993
protected function hydrateEntity ( $ result ) { $ client = new ClientEntity ( $ this -> getServer ( ) ) ; $ client -> hydrate ( [ 'id' => $ result -> id , 'name' => $ result -> name , 'secret' => $ result -> secret , 'redirectUri' => ( isset ( $ result -> redirect_uri ) ? $ result -> redirect_uri : null ) , ] ) ; retur...
Hydrate the entity .
44,994
public function registerStorageBindings ( Application $ app ) { $ provider = $ this ; $ app -> singleton ( FluentAccessToken :: class , function ( ) use ( $ provider ) { $ storage = new FluentAccessToken ( $ provider -> app [ 'db' ] ) ; $ storage -> setConnectionName ( $ provider -> getConnectionName ( ) ) ; return $ s...
Bind the storage implementations to the IoC container .
44,995
public function registerInterfaceBindings ( Application $ app ) { $ app -> bind ( ClientInterface :: class , FluentClient :: class ) ; $ app -> bind ( ScopeInterface :: class , FluentScope :: class ) ; $ app -> bind ( SessionInterface :: class , FluentSession :: class ) ; $ app -> bind ( AuthCodeInterface :: class , Fl...
Bind the interfaces to their implementations .
44,996
public function validateScopes ( $ scopes ) { if ( ! empty ( $ scopes ) && ! $ this -> authorizer -> hasScope ( $ scopes ) ) { throw new InvalidScopeException ( implode ( ',' , $ scopes ) ) ; } }
Validate the scopes .
44,997
public function get ( $ code ) { $ result = $ this -> getConnection ( ) -> table ( 'oauth_auth_codes' ) -> where ( 'oauth_auth_codes.id' , $ code ) -> where ( 'oauth_auth_codes.expire_time' , '>=' , time ( ) ) -> first ( ) ; if ( is_null ( $ result ) ) { return ; } return ( new AuthCodeEntity ( $ this -> getServer ( ) ...
Get the auth code .
44,998
public function associateScope ( AuthCodeEntity $ token , ScopeEntity $ scope ) { $ this -> getConnection ( ) -> table ( 'oauth_auth_code_scopes' ) -> insert ( [ 'auth_code_id' => $ token -> getId ( ) , 'scope_id' => $ scope -> getId ( ) , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) , ] ) ; }
Associate a scope with an access token .
44,999
public function get ( $ sessionId ) { $ result = $ this -> getConnection ( ) -> table ( 'oauth_sessions' ) -> where ( 'oauth_sessions.id' , $ sessionId ) -> first ( ) ; if ( is_null ( $ result ) ) { return ; } return ( new SessionEntity ( $ this -> getServer ( ) ) ) -> setId ( $ result -> id ) -> setOwner ( $ result ->...
Get a session from it s identifier .