Protected Member Functions | |
setCanCreateSubreddit (bool $canCreateSubreddit) | |
setCoins (int $coins) | |
setFeatures (array $features) | |
setForcePasswordReset (bool $forcePasswordReset) | |
setGoldCreddits (int $goldCreddits) | |
setGoldExpiration (float $goldExpiration=null) | |
setHasAndroidSubscription (bool $hasAndroidSubscription) | |
setHasExternalAccount (bool $hasExternalAccount) | |
setHasGoldSubscription (bool $hasGoldSubscription) | |
setHasIosSubscription (bool $hasIosSubscription) | |
setHasMail (bool $hasMail) | |
setHasModMail (bool $hasModMail) | |
setHasPaypalSubscription (bool $hasPaypalSubscription) | |
setHasStripeSubscription (bool $hasStripeSubscription) | |
setHasSubscribedToPremium (bool $hasSubscribedToPremium) | |
setHasVisitedNewProfile (bool $hasVisitedNewProfile) | |
setInBeta (bool $inBeta) | |
setInboxCount (int $inboxCount) | |
setInChat (bool $inChat) | |
setInRedesignBeta (bool $inRedesignBeta) | |
setIsSponsor (bool $isSponsor) | |
setIsSuspended (bool $isSuspended) | |
setNewModmailExists (bool $newModmailExists=null) | |
setNumFriends (int $numFriends) | |
setOauthClientId (string $oauthClientId) | |
setOver18 (bool $over18) | |
setPrefAutoplay (bool $prefAutoplay) | |
setPrefClickgadget (int $prefClickgadget) | |
setPrefGeopopular (string $prefGeopopular) | |
setPrefNightmode (bool $prefNightmode) | |
setPrefNoProfanity (bool $prefNoProfanity) | |
setPrefShowTrending (bool $prefShowTrending) | |
setPrefShowTwitter (bool $prefShowTwitter) | |
setPrefTopKarmaSubreddits (bool $prefTopKarmaSubreddits) | |
setPrefVideoAutoplay (bool $prefVideoAutoplay) | |
setSeenLayoutSwitch (bool $seenLayoutSwitch) | |
setSeenPremiumAdblockModal (bool $seenPremiumAdblockModal) | |
setSeenRedesignModal (bool $seenRedesignModal) | |
setSeenSubredditChatFtux (bool $seenSubredditChatFtux) | |
setSuspensionExpirationUtc (float $suspensionExpirationUtc=null) | |
![]() | |
setCommentKarma (int $commentKarma) | |
setHasSubscribed (bool $hasSubscribed) | |
setHasVerifiedEmail (bool $hasVerifiedEmail) | |
setHideFromRobots (bool $hideFromRobots) | |
setIconImg (string $iconImg) | |
setIsEmployee (bool $isEmployee) | |
setIsGold (bool $isGold) | |
setIsMod (bool $isMod) | |
setLinkKarma (int $linkKarma) | |
setName (string $name) | |
setPrefShowSnoovatar (bool $prefShowSnoovatar) | |
setSubreddit (array $subreddit=null) | |
setVerified (bool $verified) | |
![]() | |
setId (string $id) | |
setKind (string $kind) | |
setCreated (float $created) | |
setCreatedUtc (float $createdUtc) | |
getPropertyTranslationMap () | |
![]() | |
debug (string $message, bool $echo=false) | |
info (string $message, bool $echo=false) | |
warning (string $message, bool $echo=false) | |
error (string $message, bool $echo=false) | |
Protected Attributes | |
$canCreateSubreddit = false | |
$coins = 0 | |
$features = [] | |
$forcePasswordReset = false | |
$goldCreddits = 0 | |
$goldExpiration = null | |
$hasAndroidSubscription = false | |
$hasExternalAccount = false | |
$hasGoldSubscription = false | |
$hasIosSubscription = false | |
$hasMail = false | |
$hasModMail = false | |
$hasPaypalSubscription = false | |
$hasStripeSubscription = false | |
$hasSubscribedToPremium = false | |
$hasVisitedNewProfile = false | |
$inboxCount = 0 | |
$inBeta = false | |
$inChat = false | |
$inRedesignBeta = false | |
$isSponsor = false | |
$isSuspended = false | |
$newModmailExists = null | |
$numFriends = 0 | |
$oauthClientId = '' | |
$over18 = false | |
$prefAutoplay = false | |
$prefClickgadget = 0 | |
$prefGeopopular = '' | |
$prefNightmode = false | |
$prefNoProfanity = false | |
$prefShowTrending = false | |
$prefShowTwitter = false | |
$prefTopKarmaSubreddits = true | |
$prefVideoAutoplay = false | |
$seenLayoutSwitch = false | |
$seenPremiumAdblockModal = false | |
$seenRedesignModal = false | |
$seenSubredditChatFtux = false | |
$suspensionExpirationUtc = null | |
![]() | |
$id = null | |
$commentKarma = 0 | |
$hasSubscribed = true | |
$hasVerifiedEmail = false | |
$hideFromRobots = false | |
$iconImg = '' | |
$isEmployee = false | |
$isGold = false | |
$isMod = false | |
$linkKarma = 1 | |
$name = '' | |
$prefShowSnoovatar = false | |
$subreddit = null | |
$verified = false | |
![]() | |
$_kind = null | |
$_propertyNames = [] | |
$_propertyTranslationRegex = '|([a-z])([A-Z0-9])|' | |
$_sourceJson = '' | |
$id = null | |
$created = 0.0 | |
$createdUtc = 0.0 | |
![]() | |
$_snuzeId = null | |
$_snuzeClass = null | |
Additional Inherited Members | |
![]() | |
static | getValidKinds () |
![]() | |
const | REGEX_VALID_NAME = '|^[a-z0-9_\-]{3,20}$|i' |
![]() | |
const | KIND_COMMENT = 't1' |
const | KIND_ACCOUNT = 't2' |
const | KIND_LINK = 't3' |
const | KIND_MESSAGE = 't4' |
const | KIND_SUBREDDIT = 't5' |
const | KIND_AWARD = 't6' |
const | REGEX_VALID_ID = '|^[a-z0-9]{1,13}$|i' |
The MyAccount class represents the data exposed about the authenticated user's own account. This is a significant superset of the common properties in the parent Account class.
An attempt has been made to map all fields supplied by the API, regardless of their utility (or lack thereof).
Implementation warning: The $subreddit array is currently populated as-is, without any further processing. Calling getSubreddit() will return an array of key/value pairs defining the user's /u/username profile subreddit, or null if one doesn't exist. This is subject to change in a future major version, such that a Subreddit object may be returned instead.
Implementation warning: The $features array is currently populated as-is, without any further processing. Calling getFeatures() will return an array of key/value pairs defining the user's settings for various Reddit features, tests, and experiments. This is subject to change in a future major version, such that some other value(s) may be returned instead.
This file is part of Snuze, a PHP client for the Reddit API. Copyright 2019 Shaun Cummiskey shaun @sha unc.c omhttps://shaunc.com/ Repository: https://github.com/snuze/snuze/ Documentation: https://snuze.shaunc.com/
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
snuze\Reddit\Thing\Account\MyAccount::__construct | ( | ) |
Constructor.
References snuze\Reddit\Thing\Thing\KIND_ACCOUNT.
snuze\Reddit\Thing\Account\MyAccount::fromJson | ( | string | $json | ) |
Overrides parent to perform specialized data handling. Reddit doesn't return the typical "thing" data structure in response to this type of request. Here, the response is massaged into the expected format so it can be treated just like any other Account.
Accepts a JSON-formatted string, uses it to build an Account object, and returns that object. This satisfies a promise made in the Jsonable interface.
string | $json |
Implements snuze\Interfaces\Jsonable.
snuze\Reddit\Thing\Account\MyAccount::getCanCreateSubreddit | ( | ) |
Get whether or not this account is allowed to create a subreddit
snuze\Reddit\Thing\Account\MyAccount::getCoins | ( | ) |
Get the number of Reddit Premium coins this account has available
snuze\Reddit\Thing\Account\MyAccount::getFeatures | ( | ) |
Get the array of key/value pairs defining the account's settings for various Reddit features, tests, and experiments
snuze\Reddit\Thing\Account\MyAccount::getForcePasswordReset | ( | ) |
Get whether or not this account is required to change its password for security purposes
snuze\Reddit\Thing\Account\MyAccount::getGoldCreddits | ( | ) |
Get the number of Reddit Gold creddits this account has available
snuze\Reddit\Thing\Account\MyAccount::getGoldExpiration | ( | ) |
Get the epoch time at which this account's Reddit Gold/Premium expires, or null if there's no subscription.
snuze\Reddit\Thing\Account\MyAccount::getHasAndroidSubscription | ( | ) |
Get whether or not this account is subscribed to Reddit Premium via the Android application
snuze\Reddit\Thing\Account\MyAccount::getHasExternalAccount | ( | ) |
Get whether or not this account has a third-party social media account linked to it
snuze\Reddit\Thing\Account\MyAccount::getHasGoldSubscription | ( | ) |
Get whether or not this account has an active Reddit Gold subscription
snuze\Reddit\Thing\Account\MyAccount::getHasIosSubscription | ( | ) |
Get whether or not this account is subscribed to Reddit Premium via the Apple iOS application
snuze\Reddit\Thing\Account\MyAccount::getHasMail | ( | ) |
Get whether or not this account has unread direct messages
snuze\Reddit\Thing\Account\MyAccount::getHasModMail | ( | ) |
Get whether or not this account has unread modmail messages
snuze\Reddit\Thing\Account\MyAccount::getHasPaypalSubscription | ( | ) |
Get whether or not this account is subscribed to Reddit Premium via PayPal
snuze\Reddit\Thing\Account\MyAccount::getHasStripeSubscription | ( | ) |
Get whether or not this account is subscribed to Reddit Premium via Stripe
snuze\Reddit\Thing\Account\MyAccount::getHasSubscribedToPremium | ( | ) |
Get whether or not this account has ever had new-style Reddit Premium
snuze\Reddit\Thing\Account\MyAccount::getHasVisitedNewProfile | ( | ) |
Get whether or not this account has visited its redesign-style profile
snuze\Reddit\Thing\Account\MyAccount::getInBeta | ( | ) |
Get whether or not this account has opted in to beta participation
snuze\Reddit\Thing\Account\MyAccount::getInboxCount | ( | ) |
Get the number of unread direct messages this account has
snuze\Reddit\Thing\Account\MyAccount::getInChat | ( | ) |
Get whether or not this account is eligible to receive chat messages
snuze\Reddit\Thing\Account\MyAccount::getInRedesignBeta | ( | ) |
Get whether or not this account has opted in to beta test Digg 5.0
snuze\Reddit\Thing\Account\MyAccount::getIsSponsor | ( | ) |
Get whether or not this account is a Reddit advertiser
snuze\Reddit\Thing\Account\MyAccount::getIsSuspended | ( | ) |
Get whether or not this account is suspended for rule violations
snuze\Reddit\Thing\Account\MyAccount::getNewModmailExists | ( | ) |
Get whether or not this account is enrolled in the new modmail system
snuze\Reddit\Thing\Account\MyAccount::getNumFriends | ( | ) |
Get the number of other users this account has friended
snuze\Reddit\Thing\Account\MyAccount::getOauthClientId | ( | ) |
Get the OAuth client ID this account is currently authenticated with (this will correspond to the currently-running script application)
snuze\Reddit\Thing\Account\MyAccount::getOver18 | ( | ) |
Get whether or not this account has enabled the "I am over eighteen years old and willing to view adult content" preference
snuze\Reddit\Thing\Account\MyAccount::getPrefAutoplay | ( | ) |
Get whether or not this account has enabled the auto-play preference
snuze\Reddit\Thing\Account\MyAccount::getPrefClickgadget | ( | ) |
Get whether or not this account has enabled the "show me links I've recently viewed" preference. Reddit supplies this one as an integer instead of a boolean.
snuze\Reddit\Thing\Account\MyAccount::getPrefGeopopular | ( | ) |
Get the locality code, if any, that Reddit is using as a hint to build a geographically-oriented "/r/popular" list for this account
snuze\Reddit\Thing\Account\MyAccount::getPrefNightmode | ( | ) |
Get whether or not this account has enabled the night mode theme
snuze\Reddit\Thing\Account\MyAccount::getPrefNoProfanity | ( | ) |
Get whether or not this account has enabled the "hide images for NSFW/18+ content" preference
snuze\Reddit\Thing\Account\MyAccount::getPrefShowTrending | ( | ) |
Get whether or not this account has enabled the "show trending subreddits on the home feed" preference
snuze\Reddit\Thing\Account\MyAccount::getPrefShowTwitter | ( | ) |
Get whether or not this account displays a linked Twitter account on its profile
snuze\Reddit\Thing\Account\MyAccount::getPrefTopKarmaSubreddits | ( | ) |
Get whether this account has some preference or another enabled
snuze\Reddit\Thing\Account\MyAccount::getPrefVideoAutoplay | ( | ) |
Get whether or not this account has the "Autoplay Reddit videos on the desktop comments page" preference enabled
snuze\Reddit\Thing\Account\MyAccount::getSeenLayoutSwitch | ( | ) |
Get whether or not this account has been shown a layout switch interface
snuze\Reddit\Thing\Account\MyAccount::getSeenPremiumAdblockModal | ( | ) |
Get whether or not this account has been shown a "buying Reddit Premium lets you disable (some) ads" dialog
snuze\Reddit\Thing\Account\MyAccount::getSeenRedesignModal | ( | ) |
Get whether or not this account has been shown a dialog about the redesign
snuze\Reddit\Thing\Account\MyAccount::getSeenSubredditChatFtux | ( | ) |
Get whether or not this account has been shown a first-time user interface about the subreddit chat feature
snuze\Reddit\Thing\Account\MyAccount::getSuspensionExpirationUtc | ( | ) |
If this account is suspended for rule violations and is eligible to be reinstated, get the unix epoch at which time that will occur
|
protected |
Set whether or not this account is allowed to create a subreddit
bool | $canCreateSubreddit |
|
protected |
Set the number of Reddit Premium coins this account has available
int | $coins |
|
protected |
Set the array of key/value pairs defining the account's settings for various Reddit features, tests, and experiments
array | $features |
|
protected |
Set whether or not this account is required to change its password for security purposes
bool | $forcePasswordReset |
|
protected |
Set the number of Reddit Gold creddits this account has available
int | $goldCreddits |
|
protected |
Set the epoch time at which this account's Reddit Gold/Premium expires, or null if there's no subscription.
float | $goldExpiration | A unix epoch timestamp, as a float; or null |
|
protected |
Set whether or not this account is subscribed to Reddit Premium via the Android application
bool | $hasAndroidSubscription |
|
protected |
Set whether or not this account has a third-party social media account linked to it
bool | $hasExternalAccount |
|
protected |
Set whether or not this account has an active Reddit Gold subscription
bool | $hasGoldSubscription |
|
protected |
Set whether or not this account is subscribed to Reddit Premium via the Apple iOS application
bool | $hasIosSubscription |
|
protected |
Set whether or not this account has unread direct messages
bool | $hasMail |
|
protected |
Set whether or not this account has unread modmail messages
bool | $hasModMail |
|
protected |
Set whether or not this account is subscribed to Reddit Premium via PayPal
bool | $hasPaypalSubscription |
|
protected |
Set whether or not this account is subscribed to Reddit Premium via Stripe
bool | $hasStripeSubscription |
|
protected |
Set whether or not this account has ever had new-style Reddit Premium
bool | $hasSubscribedToPremium |
|
protected |
Set whether or not this account has visited its redesign style profile
bool | $hasVisitedNewProfile |
|
protected |
Set whether or not this account has opted in to beta participation
bool | $inBeta |
|
protected |
Set the number of unread direct messages this account has
int | $inboxCount |
|
protected |
Set whether or not this account is eligible to receive chat messages
bool | $inChat |
|
protected |
Set whether or not this account has opted in to beta test Digg 5.0
bool | $inRedesignBeta |
|
protected |
Set whether or not this account is a Reddit advertiser
bool | $isSponsor |
|
protected |
Set whether or not this account is suspended for rule violations
bool | $isSuspended |
|
protected |
Set whether or not this account is enrolled in the new modmail system
bool | $newModmailExists |
|
protected |
Set the number of other users this account has friended
int | $numFriends |
|
protected |
Set the OAuth client ID this account is currently authenticated with
string | $oauthClientId |
|
protected |
Set whether or not this account has enabled the "I am over eighteen years old and willing to view adult content" preference
bool | $over18 |
|
protected |
Set whether or not this account has enabled the auto-play preference
bool | $prefAutoplay |
|
protected |
Set whether or not this account has enabled the "show me links I've recently viewed" preference. Reddit supplies this one as an integer instead of a boolean.
int | $prefClickgadget |
|
protected |
Set the locality code, if any, that Reddit is using as a hint to build a geographically-oriented "/r/popular" list for this account
string | $prefGeopopular |
|
protected |
Set whether or not this account has enabled the night mode theme
bool | $prefNightmode |
|
protected |
Set whether or not this account has enabled the "hide images for NSFW/18+ content" preference
bool | $prefNoProfanity |
|
protected |
Set whether or not this account has enabled the "show trending subreddits on the home feed" preference
bool | $prefShowTrending |
|
protected |
Set whether or not this account displays a linked Twitter account on its profile
bool | $prefShowTwitter |
|
protected |
Set whether this account has some preference or another enabled
bool | $prefTopKarmaSubreddits |
|
protected |
Set whether or not this account has the "Autoplay Reddit videos on the desktop comments page" preference enabled
bool | $prefVideoAutoplay |
|
protected |
Set whether or not this account has been shown a layout switch interface
bool | $seenLayoutSwitch |
|
protected |
Set whether or not this account has been shown a "buying Reddit Premium lets you disable (some) ads" dialog
bool | $seenPremiumAdblockModal |
|
protected |
Set whether or not this account has been shown a dialog about the redesign
bool | $seenRedesignModal |
|
protected |
Set whether or not this account has been shown a first-time user interface about the subreddit chat feature
bool | $seenSubredditChatFtux |
|
protected |
If this account is suspended for rule violations and is eligible to be reinstated, set the unix epoch at which time that will occur
float | $suspensionExpirationUtc | A unix epoch timestamp, as a float; or null |
snuze\Reddit\Thing\Account\MyAccount::toJson | ( | ) |
Overrides parent to perform specialized data handling. Reddit doesn't return the typical "thing" data structure in response to this type of request. Here, the JSON is massaged back into the original format.
Returns a JSON-formatted string representing this Thing's properties.
Implements snuze\Interfaces\Jsonable.
References snuze\Reddit\Thing\Thing\getPropertyTranslationMap().