code
stringlengths
17
247k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
public function setSpcent($value) { $this->spcent = "/spcent/" . $value; }
与 scatype 搭配使用: 当 scatype 设置为1时,该有效值为[1,1000],单位为千分比 当 scatype 设置为2时,该有效值为[1,1000],单位为千分比 当 scatype 设置为3时,该有效值为[1,250],单位为千分比。 @param $value
setSpcent
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageWatermarkTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageWatermarkTemplate.php
MIT
public function setDissolve($value) { $this->dissolve = "/dissolve/" . $value; }
图片水印的透明度,取值为1 - 100,默认90(90%不透明度) @param $value
setDissolve
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageWatermarkTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageWatermarkTemplate.php
MIT
public function setBatch($value) { $this->batch = "/batch/" . $value; }
平铺水印功能,可将图片水印平铺至整张图片。值为1时,表示开启平铺水印功能 @param $value
setBatch
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageWatermarkTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageWatermarkTemplate.php
MIT
public function setDegree($value) { $this->degree = "/degree/" . $value; }
当 batch 值为1时生效。图片水印的旋转角度设置,取值范围为0 - 360,默认0 @param $value
setDegree
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageWatermarkTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageWatermarkTemplate.php
MIT
public function thumbnailByMaxWH($maxW, $maxH) { $this->tranParams[] = "/thumbnail/" . $maxW . "x" . $maxH; }
限定缩略图的宽度和高度的最大值分别为 Width 和 Height,进行等比缩放 @param $maxW @param $maxH
thumbnailByMaxWH
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function thumbnailByMinWH($minW, $minH) { $this->tranParams[] = "/thumbnail/!" . $minW . "x" . $minH . "r" ; }
限定缩略图的宽度和高度的最小值分别为 Width 和 Height,进行等比缩放 @param $minW @param $minH
thumbnailByMinWH
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function thumbnailByWH($width, $height) { $this->tranParams[] = "/thumbnail/" . $width . "x" . $height . "!"; }
忽略原图宽高比例,指定图片宽度为 Width,高度为 Height,强行缩放图片,可能导致目标图片变形 @param $width @param $height
thumbnailByWH
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function thumbnailEqualRatioReduceByWH($width, $height) { $this->tranParams[] = "/thumbnail/{$width}x{$height}>"; }
限定缩略图的宽度和高度的最大值分别为 Width 和 Height,进行等比缩小,比例值为宽缩放比和高缩放比的较小值,如果目标宽(高)都大于原图宽(高),则不变 @param $width @param $height
thumbnailEqualRatioReduceByWH
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function thumbnailEqualRatioEnlargeByWH($width, $height) { $this->tranParams[] = "/thumbnail/{$width}x{$height}<"; }
限定缩略图的宽度和高度的最大值分别为 Width 和 Height,进行等比放大,比例值为宽缩放比和高缩放比的较小值。如果目标宽(高)小于原图宽(高),则不变 @param $width @param $height
thumbnailEqualRatioEnlargeByWH
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function pad($is) { $this->tranParams[] = "/pad/{$is}"; }
将原图缩放为指定 Width 和 Height 的矩形内的最大图片,之后使用 color 参数指定的颜色居中填充空白部分;取值0或1,0代表不使用 pad 模式,1代表使用 pad 模式 @param $is
pad
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function color($rgb) { $rgb = $this->ciBase64($rgb); $this->tranParams[] = "/color/{$rgb}"; }
填充颜色,缺省为白色,需设置为十六进制 RGB 格式(如 #FF0000),详情参考 RGB 编码表,需经过 URL 安全的 Base64 编码,默认值为 #3D3D3D @param $rgb
color
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function ignoreError() { $this->tranParams[] = "/ignore-error/1"; }
当处理参数中携带此参数时,针对文件过大、参数超限等导致处理失败的场景,会直接返回原图而不报错
ignoreError
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function cropByWidth($width, $gravity = "") { $temp = "/crop/" . $width . "x"; if($gravity){ $temp .= "/gravity/" . $gravity; } $this->tranParams[] = $temp; }
指定目标图片宽度为 Width,高度不变。Width 取值范围应大于0,小于原图宽度 @param $width @param string $gravity 指定操作的起点位置
cropByWidth
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function cropByHeight($height, $gravity = "") { $temp = "/crop/x" . $height; if($gravity){ $temp .= "/gravity/" . $gravity; } $this->tranParams[] = $temp; }
指定目标图片高度为 Height,宽度不变。Height 取值范围应大于0,小于原图高度 @param $height @param string $gravity 指定操作的起点位置
cropByHeight
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function cropByWH($width, $height, $gravity = "") { $temp = "/crop/" . $width . "x" . $height; if($gravity){ $temp .= "/gravity/" . $gravity; } $this->tranParams[] = $temp; }
指定目标图片宽度为 Width,高度为 Height 。Width 和 Height 取值范围都应大于0,小于原图宽度/高度 @param $width @param $height @param string $gravity 指定操作的起点位置
cropByWH
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function iradius($radius) { $this->tranParams[] = "/iradius/" . $radius; }
内切圆裁剪功能,radius 是内切圆的半径,取值范围为大于0且小于原图最小边一半的整数。内切圆的圆心为图片的中心。图片格式为 gif 时,不支持该参数。 @param $radius
iradius
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function rradius($radius) { $this->tranParams[] = "/rradius/" . $radius; }
圆角裁剪功能,radius 为图片圆角边缘的半径,取值范围为大于0且小于原图最小边一半的整数。圆角与原图边缘相切。图片格式为 gif 时,不支持该参数。 @param $radius
rradius
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function scrop($width, $height) { $this->tranParams[] = "/scrop/" . $width . "x" . $height; }
基于图片中的人脸位置进行缩放裁剪。目标图片的宽度为 Width、高度为 Height。 @param $width @param $height
scrop
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function rotate($degree) { $this->tranParams[] = "/rotate/" . $degree; }
普通旋转:图片顺时针旋转角度,取值范围0 - 360,默认不旋转。 @param $degree
rotate
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function flip($flip) { $this->tranParams[] = "/flip/" . $flip; }
镜像翻转:flip 值为 vertical 表示垂直翻转,horizontal 表示水平翻转 @param $flip
flip
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function format($format) { $this->tranParams[] = "/format/" . $format; }
格式转换:目标缩略图的图片格式可为:jpg,bmp,gif,png,webp,yjpeg 等,其中 yjpeg 为数据万象针对 jpeg 格式进行的优化,本质为 jpg 格式;缺省为原图格式。 @param $format
format
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function gifOptimization($frameNumber) { $this->tranParams[] = "/cgif/" . $frameNumber; }
gif 格式优化:只针对原图为 gif 格式,对 gif 图片格式进行的优化,降帧降颜色。分为以下两种情况: FrameNumber=1,则按照默认帧数30处理,如果图片帧数大于该帧数则截取。 FrameNumber 取值( 1,100 ],则将图片压缩到指定帧数 (FrameNumber)。 @param $frameNumber
gifOptimization
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function jpegInterlaceMode($mode) { $this->tranParams[] = "/interlace/" . $mode; }
输出为渐进式 jpg 格式。Mode 可为0或1。0:表示不开启渐进式;1:表示开启渐进式。该参数仅在输出图片格式为 jpg 格式时有效。如果输出非 jpg 图片格式,会忽略该参数,默认值0。 @param $mode
jpegInterlaceMode
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function quality($value, $force = 0) { $temp = "/quality/" . $value; if($force){ $temp .= "!"; } $this->tranParams[] = $temp; }
图片的绝对质量,取值范围0 - 100,默认值为原图质量;取原图质量和指定质量的最小值;<Quality>后面加“!”表示强制使用指定值,例如:90!。 @param $value @param int $force
quality
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function lowestQuality($value) { $this->tranParams[] = "/lquality/" . $value; }
图片的最低质量,取值范围0 - 100,设置结果图的质量参数最小值。 例如原图质量为85,将 lquality 设置为80后,处理结果图的图片质量为85。 例如原图质量为60,将 lquality 设置为80后,处理结果图的图片质量会被提升至80。 @param $value
lowestQuality
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function relativelyQuality($value) { $this->tranParams[] = "/rquality/" . $value; }
图片的相对质量,取值范围0 - 100,数值以原图质量为标准。例如原图质量为80,将 rquality 设置为80后,得到处理结果图的图片质量为64(80x80%)。 @param $value
relativelyQuality
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function bright($value) { $this->tranParams[] = "/bright/" . $value; }
图片亮度调节功能,value 为亮度参数值,取值范围为[-100, 100]的整数。 取值<0:降低图片亮度。 取值 = 0:不调整图片亮度。 取值>0:提高图片亮度。 @param $value
bright
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function contrast($value) { $this->tranParams[] = "/contrast/" . $value; }
图片对比度调节功能,value 为对比度参数值,取值范围为[-100, 100]的整数。 取值<0:降低图片对比度。 取值 = 0:不调整图片对比度。 取值>0:提高图片对比度。 @param $value
contrast
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function sharpen($value) { $this->tranParams[] = "/sharpen/" . $value; }
图片锐化功能,value 为锐化参数值,取值范围为10 - 300间的整数(推荐使用70)。参数值越大,锐化效果越明显。 @param $value
sharpen
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function grayscale($value) { $this->tranParams[] = "/grayscale/" . $value; }
将图片设置为灰度图。 value 取值为0表示不改变图片。 value 取值为1表示将图片变为灰度图。 @param $value
grayscale
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function sizeLimit($value, $compare = 0) { $temp = "/size-limit/" . $value; if($compare){ $temp .= "!"; } $this->tranParams[] = $temp; }
限制图片转换后的大小,支持以兆字节(m)和千字节(k)为单位 1. 仅支持 JPG 格式的图片,可以用于限制处理后图片的大小 2. 若在尾部加上!,表示用处理后的图片大小与原图大小做比较,如果处理后的图片比原图小,则返回处理后的图片,否则返回原图。例如:examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/picture.jpg?imageMogr2/size-limit/15k! 3. 建议搭配strip参数使用,去除图片的一些冗余信息,会有更好的效果。例如:examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/picture.jpg?imageMogr2/strip/format/png/size-limit/15k! @param $value @param int $compare
sizeLimit
php
tencentyun/cos-php-sdk-v5
src/ImageParamTemplate/ImageMogrTemplate.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/ImageParamTemplate/ImageMogrTemplate.php
MIT
public function getExceptionType() { return $this->exceptionType; }
Get the exception type (one of client or server) @return string|null
getExceptionType
php
tencentyun/cos-php-sdk-v5
src/Exception/ServiceResponseException.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/Exception/ServiceResponseException.php
MIT
public function getRequest() { return $this->request; }
Get the associated request object @return RequestInterface|null
getRequest
php
tencentyun/cos-php-sdk-v5
src/Exception/ServiceResponseException.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/Exception/ServiceResponseException.php
MIT
public function getStatusCode() { return $this->response ? $this->response->getStatusCode() : null; }
Get the status code of the response @return int|null
getStatusCode
php
tencentyun/cos-php-sdk-v5
src/Exception/ServiceResponseException.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/Exception/ServiceResponseException.php
MIT
public function getCosRequestId() { return $this->requestId; }
Get the request ID of the error. This value is only present if a response was received, and is not present in the event of a networking error. Same as `getRequestId()` method, but matches the interface for SDKv3. @return string|null Returns null if no response was received
getCosRequestId
php
tencentyun/cos-php-sdk-v5
src/Exception/ServiceResponseException.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/Exception/ServiceResponseException.php
MIT
public function getCosErrorType() { return $this->exceptionType; }
Get the Cos error type. Same as `getExceptionType()` method, but matches the interface for SDKv3. @return string|null Returns null if no response was received
getCosErrorType
php
tencentyun/cos-php-sdk-v5
src/Exception/ServiceResponseException.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/Exception/ServiceResponseException.php
MIT
public function getCosErrorCode() { return $this->exceptionCode; }
Get the Cos error code. Same as `getExceptionCode()` method, but matches the interface for SDKv3. @return string|null Returns null if no response was received
getCosErrorCode
php
tencentyun/cos-php-sdk-v5
src/Exception/ServiceResponseException.php
https://github.com/tencentyun/cos-php-sdk-v5/blob/master/src/Exception/ServiceResponseException.php
MIT
public function isConnect() { return $this->bbb->isConnectionWorking(); }
check url and secret is working. @return bool
isConnect
php
joisarjignesh/bigbluebutton
src/Bbb.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Bbb.php
MIT
public function create($meeting) { if (! $meeting instanceof CreateMeetingParameters) { $meeting = $this->initCreateMeeting($meeting); } $this->response = $this->bbb->createMeeting($meeting); if ($this->response->failed()) { return $this->response->getMessage(); } else { return collect(XmlToArray($this->response->getRawXml())); } }
$meeting. @param $meeting required fields meetingID meetingName @return mixed
create
php
joisarjignesh/bigbluebutton
src/Bbb.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Bbb.php
MIT
public function join($meeting) { if (! $meeting instanceof JoinMeetingParameters) { $meeting = $this->initJoinMeeting($meeting); } if ($meeting->isRedirect()) { return $this->bbb->getJoinMeetingURL($meeting); } return $this->bbb->joinMeeting($meeting)->getUrl(); }
Join meeting. @param $meeting required fields meetingID userName join by name password which role want to join @return string
join
php
joisarjignesh/bigbluebutton
src/Bbb.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Bbb.php
MIT
public function getMeetingInfo($meeting) { if (! $meeting instanceof GetMeetingInfoParameters) { $meeting = $this->initGetMeetingInfo($meeting); } $this->response = $this->bbb->getMeetingInfo($meeting); if ($this->response->success()) { return collect(XmlToArray($this->response->getRawXml())); } return collect([]); }
Returns information about the meeting. @param $meeting required fields meetingID moderatorPW must be there moderator password @return \Illuminate\Support\Collection
getMeetingInfo
php
joisarjignesh/bigbluebutton
src/Bbb.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Bbb.php
MIT
public function start($parameters) { return $this->initStart($parameters); }
@param $parameters required fields meetingID meetingName userName attendeePW moderatorPW @return mixed
start
php
joisarjignesh/bigbluebutton
src/Bbb.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Bbb.php
MIT
public function close($meeting) { if (! $meeting instanceof EndMeetingParameters) { $meeting = $this->initCloseMeeting($meeting); } $this->response = $this->bbb->endMeeting($meeting); if ($this->response->success()) { return true; } return false; }
Close meeting. @param $meeting required fields: meetingID moderatorPW close meeting must be there moderator password @return bool
close
php
joisarjignesh/bigbluebutton
src/Bbb.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Bbb.php
MIT
public function publishRecordings($recording) { if (! $recording instanceof PublishRecordingsParameters) { $recording = $this->initPublishRecordings($recording); } $this->response = $this->bbb->publishRecordings($recording); if ($this->response->success()) { $response = XmlToArray($this->response->getRawXml()); if (isset($response['published']) && $response['published'] == 'true') { return true; } } return false; }
@param $recording recordID as string(separated by comma) publish as bool @return bool
publishRecordings
php
joisarjignesh/bigbluebutton
src/Bbb.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Bbb.php
MIT
public function __construct($bbbServerBaseUrl, $securitySecret, $transport = null) { $this->bbbServerBaseUrl = Str::finish(trim($bbbServerBaseUrl), '/'); $this->securitySecret = trim($securitySecret); $this->urlBuilder = new UrlBuilder($this->securitySecret, $this->bbbServerBaseUrl, config('bigbluebutton.hash_algorithm', 'sha1')); $this->transport = $transport ?? CurlTransport::createWithDefaultOptions(); }
Bigbluebutton constructor. Allows to set url and secret as parameter, otherwise use values in env. @param $bbbServerBaseUrl API Base Url @param $securitySecret API Server secret @param TransportInterface|null $transport
__construct
php
joisarjignesh/bigbluebutton
src/Bigbluebutton.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Bigbluebutton.php
MIT
public function initCloseMeeting(array $parameters) { $request = Fluent($parameters); return new EndMeetingParameters($request->meetingID, $request->moderatorPW); }
@param array $parameters required fields: meetingID moderatorPW close meeting must be there moderator password @return EndMeetingParameters
initCloseMeeting
php
joisarjignesh/bigbluebutton
src/Services/InitMeeting.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Services/InitMeeting.php
MIT
public function initGetMeetingInfo($parameters) { $request = Fluent($parameters); return new GetMeetingInfoParameters($request->meetingID, $request->moderatorPW); }
@param $parameters required fields meetingID moderatorPW must be there moderator password @return GetMeetingInfoParameters
initGetMeetingInfo
php
joisarjignesh/bigbluebutton
src/Services/InitMeeting.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Services/InitMeeting.php
MIT
public function initStart(array $parameters) { if ($this->getMeetingInfo($parameters)->isEmpty()) { $object = $this->create($parameters); if (method_exists($object, 'isEmpty') && ! $object->isEmpty()) { return $this->join($this->makeJoinMeetingArray($object, $parameters)); } } else { if (isset($parameters['moderatorPW'])) { $parameters['password'] = trim($parameters['moderatorPW']); } return $this->join($parameters); } }
@param array $parameters required fields meetingID meetingName userName attendeePW moderatorPW @return mixed
initStart
php
joisarjignesh/bigbluebutton
src/Services/InitMeeting.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Services/InitMeeting.php
MIT
public function initGetRecordings($parameters) { $request = Fluent($parameters); $recordings = new GetRecordingsParameters(); $recordings->setMeetingID(implode(',', (array) $request->get('meetingID'))); $recordings->setRecordID(implode(',', (array) $request->get('recordID'))); $recordings->setState($request->get('state', config('bigbluebutton.getRecordings.state'))); return $recordings; }
@param mixed $parameters optional fields meetingID recordID state @return GetRecordingsParameters
initGetRecordings
php
joisarjignesh/bigbluebutton
src/Services/InitRecordings.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Services/InitRecordings.php
MIT
public function initHooksCreate(array $parameters) { $parameters = Fluent($parameters); $hooksCreate = new HooksCreateParameters($parameters->get('callbackURL')); if (! empty($parameters->get('meetingID'))) { $hooksCreate->setMeetingID($parameters->meetingID); } $hooksCreate->setGetRaw($parameters->get('getRaw', false)); return $hooksCreate; }
@param array $parameters require fields callbackURL optional fields meetingID getRaw @return HooksCreateParameters
initHooksCreate
php
joisarjignesh/bigbluebutton
src/Services/InitHooks.php
https://github.com/joisarjignesh/bigbluebutton/blob/master/src/Services/InitHooks.php
MIT
public function getNameAttribute($value) { return ucwords($value); }
Mutate name attribute into upper-case. @return string
getNameAttribute
php
Astrotomic/laravel-translatable
tests/Eloquent/Person.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/Eloquent/Person.php
MIT
public function runCommand($command, ?OutputInterface $output = null) { $input = new StringInput($command); $command = $this->find($this->getCommandName($input)); return $command->run($input, $output ?: new NullOutput()); }
Helper to run a sub-command from a command. @param string $command Command that should be run. @param OutputInterface|null $output The output to use. If not provided, the output will be silenced. @return int 0 if everything went fine, or an error code
runCommand
php
mnapoli/silly
src/Application.php
https://github.com/mnapoli/silly/blob/master/src/Application.php
MIT
public function getContainer() { return $this->container; }
Returns the container that has been configured, or null. @return ContainerInterface|null
getContainer
php
mnapoli/silly
src/Application.php
https://github.com/mnapoli/silly/blob/master/src/Application.php
MIT
private function isStaticCallToNonStaticMethod($callable) { if (is_array($callable) && is_string($callable[0])) { list($class, $method) = $callable; $reflection = new \ReflectionMethod($class, $method); return ! $reflection->isStatic(); } return false; }
Check if the callable represents a static call to a non-static method. @param mixed $callable @return bool
isStaticCallToNonStaticMethod
php
mnapoli/silly
src/Application.php
https://github.com/mnapoli/silly/blob/master/src/Application.php
MIT
public function descriptions($description, array $argumentAndOptionDescriptions = []) { $definition = $this->getDefinition(); $this->setDescription($description); foreach ($argumentAndOptionDescriptions as $name => $value) { if (strpos($name, '--') === 0) { $name = substr($name, 2); $this->setOptionDescription($definition, $name, $value); } else { $this->setArgumentDescription($definition, $name, $value); } } return $this; }
Define descriptions for the command and it's arguments/options. @param string $description Description of the command. @param array $argumentAndOptionDescriptions Descriptions of the arguments and options. @return $this @api
descriptions
php
mnapoli/silly
src/Command/Command.php
https://github.com/mnapoli/silly/blob/master/src/Command/Command.php
MIT
public function supportsClass($class) { return true; }
You can override this method when writing a voter for a specific domain class. @param string $class The class name @return bool
supportsClass
php
symfony/security-acl
Voter/AclVoter.php
https://github.com/symfony/security-acl/blob/master/Voter/AclVoter.php
MIT
public static function getRealClass($object) { $class = \is_object($object) ? \get_class($object) : $object; if (class_exists(DoctrineClassUtils::class)) { return DoctrineClassUtils::getRealClass($class); } // fallback in case doctrine common is not installed if (false === $pos = strrpos($class, '\\'.self::MARKER.'\\')) { return $class; } return substr($class, $pos + self::MARKER_LENGTH + 2); }
Gets the real class name of a class name that could be a proxy. @param string|object $object @return string
getRealClass
php
symfony/security-acl
Util/ClassUtils.php
https://github.com/symfony/security-acl/blob/master/Util/ClassUtils.php
MIT
public function deleteSecurityIdentity(SecurityIdentityInterface $sid) { $this->connection->executeStatement($this->getDeleteSecurityIdentityIdSql($sid)); }
Deletes the security identity from the database. ACL entries have the CASCADE option on their foreign key so they will also get deleted. @throws \InvalidArgumentException
deleteSecurityIdentity
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
public function propertyChanged($sender, $propertyName, $oldValue, $newValue) { if (!$sender instanceof MutableAclInterface && !$sender instanceof EntryInterface) { throw new \InvalidArgumentException('$sender must be an instance of MutableAclInterface, or EntryInterface.'); } if ($sender instanceof EntryInterface) { if (null === $sender->getId()) { return; } $ace = $sender; $sender = $ace->getAcl(); } else { $ace = null; } if (false === $this->propertyChanges->contains($sender)) { throw new \InvalidArgumentException('$sender is not being tracked by this provider.'); } $propertyChanges = $this->propertyChanges->offsetGet($sender); if (null === $ace) { if (isset($propertyChanges[$propertyName])) { $oldValue = $propertyChanges[$propertyName][0]; if ($oldValue === $newValue) { unset($propertyChanges[$propertyName]); } else { $propertyChanges[$propertyName] = [$oldValue, $newValue]; } } else { $propertyChanges[$propertyName] = [$oldValue, $newValue]; } } else { if (!isset($propertyChanges['aces'])) { $propertyChanges['aces'] = new \SplObjectStorage(); } $acePropertyChanges = $propertyChanges['aces']->contains($ace) ? $propertyChanges['aces']->offsetGet($ace) : []; if (isset($acePropertyChanges[$propertyName])) { $oldValue = $acePropertyChanges[$propertyName][0]; if ($oldValue === $newValue) { unset($acePropertyChanges[$propertyName]); } else { $acePropertyChanges[$propertyName] = [$oldValue, $newValue]; } } else { $acePropertyChanges[$propertyName] = [$oldValue, $newValue]; } if (\count($acePropertyChanges) > 0) { $propertyChanges['aces']->offsetSet($ace, $acePropertyChanges); } else { $propertyChanges['aces']->offsetUnset($ace); if (0 === \count($propertyChanges['aces'])) { unset($propertyChanges['aces']); } } } $this->propertyChanges->offsetSet($sender, $propertyChanges); }
Implementation of PropertyChangedListener. This allows us to keep track of which values have been changed, so we don't have to do a full introspection when ->updateAcl() is called. @param mixed $sender @param string $propertyName @param mixed $oldValue @param mixed $newValue @return void @throws \InvalidArgumentException
propertyChanged
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
public function updateUserSecurityIdentity(UserSecurityIdentity $usid, $oldUsername) { $this->connection->executeStatement($this->getUpdateUserSecurityIdentitySql($usid, $oldUsername)); }
Updates a user security identity when the user's username changes. @param string $oldUsername
updateUserSecurityIdentity
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getDeleteAccessControlEntriesSql($oidPK) { return sprintf( 'DELETE FROM %s WHERE object_identity_id = %d', $this->options['entry_table_name'], $oidPK ); }
Constructs the SQL for deleting access control entries. @param int $oidPK @return string
getDeleteAccessControlEntriesSql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getDeleteAccessControlEntrySql($acePK) { return sprintf( 'DELETE FROM %s WHERE id = %d', $this->options['entry_table_name'], $acePK ); }
Constructs the SQL for deleting a specific ACE. @param int $acePK @return string
getDeleteAccessControlEntrySql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getDeleteObjectIdentitySql($pk) { return sprintf( 'DELETE FROM %s WHERE id = %d', $this->options['oid_table_name'], $pk ); }
Constructs the SQL for deleting an object identity. @param int $pk @return string
getDeleteObjectIdentitySql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getDeleteObjectIdentityRelationsSql($pk) { return sprintf( 'DELETE FROM %s WHERE object_identity_id = %d', $this->options['oid_ancestors_table_name'], $pk ); }
Constructs the SQL for deleting relation entries. @param int $pk @return string
getDeleteObjectIdentityRelationsSql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getInsertAccessControlEntrySql($classId, $objectIdentityId, $field, $aceOrder, $securityIdentityId, $strategy, $mask, $granting, $auditSuccess, $auditFailure) { $query = <<<QUERY INSERT INTO %s ( class_id, object_identity_id, field_name, ace_order, security_identity_id, mask, granting, granting_strategy, audit_success, audit_failure ) VALUES (%d, %s, %s, %d, %d, %d, %s, %s, %s, %s) QUERY; return sprintf( $query, $this->options['entry_table_name'], $classId, null === $objectIdentityId ? 'NULL' : (int) $objectIdentityId, null === $field ? 'NULL' : $this->connection->quote($field), $aceOrder, $securityIdentityId, $mask, $this->connection->getDatabasePlatform()->convertBooleans($granting), $this->connection->quote($strategy), $this->connection->getDatabasePlatform()->convertBooleans($auditSuccess), $this->connection->getDatabasePlatform()->convertBooleans($auditFailure) ); }
Constructs the SQL for inserting an ACE. @param int $classId @param int|null $objectIdentityId @param string|null $field @param int $aceOrder @param int $securityIdentityId @param string $strategy @param int $mask @param bool $granting @param bool $auditSuccess @param bool $auditFailure @return string
getInsertAccessControlEntrySql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getInsertClassSql($classType) { return sprintf( 'INSERT INTO %s (class_type) VALUES (%s)', $this->options['class_table_name'], $this->connection->quote($classType) ); }
Constructs the SQL for inserting a new class type. @param string $classType @return string
getInsertClassSql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getInsertObjectIdentityRelationSql($objectIdentityId, $ancestorId) { return sprintf( 'INSERT INTO %s (object_identity_id, ancestor_id) VALUES (%d, %d)', $this->options['oid_ancestors_table_name'], $objectIdentityId, $ancestorId ); }
Constructs the SQL for inserting a relation entry. @param int $objectIdentityId @param int $ancestorId @return string
getInsertObjectIdentityRelationSql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getInsertObjectIdentitySql($identifier, $classId, $entriesInheriting) { $query = <<<QUERY INSERT INTO %s (class_id, object_identifier, entries_inheriting) VALUES (%d, %s, %s) QUERY; return sprintf( $query, $this->options['oid_table_name'], $classId, $this->connection->quote($identifier), $this->connection->getDatabasePlatform()->convertBooleans($entriesInheriting) ); }
Constructs the SQL for inserting an object identity. @param string $identifier @param int $classId @param bool $entriesInheriting @return string
getInsertObjectIdentitySql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getSelectClassIdSql($classType) { return sprintf( 'SELECT id FROM %s WHERE class_type = %s', $this->options['class_table_name'], $this->connection->quote($classType) ); }
Constructs the SQL for selecting the primary key associated with the passed class type. @param string $classType @return string
getSelectClassIdSql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getDeleteSecurityIdentityIdSql(SecurityIdentityInterface $sid) { $select = $this->getSelectSecurityIdentityIdSql($sid); $delete = preg_replace('/^SELECT id FROM/', 'DELETE FROM', $select); return $delete; }
Constructs the SQL to delete a security identity. @return string @throws \InvalidArgumentException
getDeleteSecurityIdentityIdSql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getUpdateObjectIdentitySql($pk, array $changes) { if (0 === \count($changes)) { throw new \InvalidArgumentException('There are no changes.'); } return sprintf( 'UPDATE %s SET %s WHERE id = %d', $this->options['oid_table_name'], implode(', ', $changes), $pk ); }
Constructs the SQL for updating an object identity. @param int $pk @return string @throws \InvalidArgumentException
getUpdateObjectIdentitySql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getUpdateUserSecurityIdentitySql(UserSecurityIdentity $usid, $oldUsername) { if ($usid->getUsername() == $oldUsername) { throw new \InvalidArgumentException('There are no changes.'); } $oldIdentifier = $usid->getClass().'-'.$oldUsername; $newIdentifier = $usid->getClass().'-'.$usid->getUsername(); return sprintf( 'UPDATE %s SET identifier = %s WHERE identifier = %s AND username = %s', $this->options['sid_table_name'], $this->connection->quote($newIdentifier), $this->connection->quote($oldIdentifier), $this->connection->getDatabasePlatform()->convertBooleans(true) ); }
Constructs the SQL for updating a user security identity. @param string $oldUsername @return string
getUpdateUserSecurityIdentitySql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getUpdateAccessControlEntrySql($pk, array $sets) { if (0 === \count($sets)) { throw new \InvalidArgumentException('There are no changes.'); } return sprintf( 'UPDATE %s SET %s WHERE id = %d', $this->options['entry_table_name'], implode(', ', $sets), $pk ); }
Constructs the SQL for updating an ACE. @param int $pk @return string @throws \InvalidArgumentException
getUpdateAccessControlEntrySql
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function createObjectIdentity(ObjectIdentityInterface $oid) { $classId = $this->createOrRetrieveClassId($oid->getType()); $this->connection->executeStatement($this->getInsertObjectIdentitySql($oid->getIdentifier(), $classId, true)); }
Creates the ACL for the passed object identity.
createObjectIdentity
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function createOrRetrieveClassId($classType) { if (false !== $id = $this->connection->executeQuery($this->getSelectClassIdSql($classType))->fetchOne()) { return $id; } $this->connection->executeStatement($this->getInsertClassSql($classType)); return $this->connection->executeQuery($this->getSelectClassIdSql($classType))->fetchOne(); }
Returns the primary key for the passed class type. If the type does not yet exist in the database, it will be created. @param string $classType @return int
createOrRetrieveClassId
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function createOrRetrieveSecurityIdentityId(SecurityIdentityInterface $sid) { if (false !== $id = $this->connection->executeQuery($this->getSelectSecurityIdentityIdSql($sid))->fetchOne()) { return $id; } $this->connection->executeStatement($this->getInsertSecurityIdentitySql($sid)); return $this->connection->executeQuery($this->getSelectSecurityIdentityIdSql($sid))->fetchOne(); }
Returns the primary key for the passed security identity. If the security identity does not yet exist in the database, it will be created. @return int
createOrRetrieveSecurityIdentityId
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function deleteAccessControlEntries($oidPK) { $this->connection->executeStatement($this->getDeleteAccessControlEntriesSql($oidPK)); }
Deletes all ACEs for the given object identity primary key. @param int $oidPK
deleteAccessControlEntries
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function deleteObjectIdentity($pk) { $this->connection->executeStatement($this->getDeleteObjectIdentitySql($pk)); }
Deletes the object identity from the database. @param int $pk
deleteObjectIdentity
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function deleteObjectIdentityRelations($pk) { $this->connection->executeStatement($this->getDeleteObjectIdentityRelationsSql($pk)); }
Deletes all entries from the relations table from the database. @param int $pk
deleteObjectIdentityRelations
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function regenerateAncestorRelations(AclInterface $acl) { $pk = $acl->getId(); $this->connection->executeStatement($this->getDeleteObjectIdentityRelationsSql($pk)); $this->connection->executeStatement($this->getInsertObjectIdentityRelationSql($pk, $pk)); $parentAcl = $acl->getParentAcl(); while (null !== $parentAcl) { $this->connection->executeStatement($this->getInsertObjectIdentityRelationSql($pk, $parentAcl->getId())); $parentAcl = $parentAcl->getParentAcl(); } }
This regenerates the ancestor table which is used for fast read access.
regenerateAncestorRelations
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function updateNewFieldAceProperty($name, array $changes) { $sids = new \SplObjectStorage(); $classIds = new \SplObjectStorage(); foreach ($changes[1] as $field => $new) { for ($i = 0, $c = \count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null === $ace->getId()) { if ($sids->contains($ace->getSecurityIdentity())) { $sid = $sids->offsetGet($ace->getSecurityIdentity()); } else { $sid = $this->createOrRetrieveSecurityIdentityId($ace->getSecurityIdentity()); } $oid = $ace->getAcl()->getObjectIdentity(); if ($classIds->contains($oid)) { $classId = $classIds->offsetGet($oid); } else { $classId = $this->createOrRetrieveClassId($oid->getType()); } $objectIdentityId = 'classFieldAces' === $name ? null : $ace->getAcl()->getId(); $this->connection->executeStatement($this->getInsertAccessControlEntrySql($classId, $objectIdentityId, $field, $i, $sid, $ace->getStrategy(), $ace->getMask(), $ace->isGranting(), $ace->isAuditSuccess(), $ace->isAuditFailure())); $aceId = $this->connection->executeQuery($this->getSelectAccessControlEntryIdSql($classId, $objectIdentityId, $field, $i))->fetchOne(); $this->loadedAces[$aceId] = $ace; $aceIdProperty = new \ReflectionProperty(Entry::class, 'id'); $aceIdProperty->setAccessible(true); $aceIdProperty->setValue($ace, (int) $aceId); } } } }
This processes new entries changes on an ACE related property (classFieldAces, or objectFieldAces). @param string $name
updateNewFieldAceProperty
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function updateOldFieldAceProperty($name, array $changes) { $currentIds = []; foreach ($changes[1] as $field => $new) { for ($i = 0, $c = \count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null !== $ace->getId()) { $currentIds[$ace->getId()] = true; } } } foreach ($changes[0] as $old) { for ($i = 0, $c = \count($old); $i < $c; ++$i) { $ace = $old[$i]; if (!isset($currentIds[$ace->getId()])) { $this->connection->executeStatement($this->getDeleteAccessControlEntrySql($ace->getId())); unset($this->loadedAces[$ace->getId()]); } } } }
This processes old entries changes on an ACE related property (classFieldAces, or objectFieldAces). @param string $name
updateOldFieldAceProperty
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function updateNewAceProperty($name, array $changes) { [$old, $new] = $changes; $sids = new \SplObjectStorage(); $classIds = new \SplObjectStorage(); for ($i = 0, $c = \count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null === $ace->getId()) { if ($sids->contains($ace->getSecurityIdentity())) { $sid = $sids->offsetGet($ace->getSecurityIdentity()); } else { $sid = $this->createOrRetrieveSecurityIdentityId($ace->getSecurityIdentity()); } $oid = $ace->getAcl()->getObjectIdentity(); if ($classIds->contains($oid)) { $classId = $classIds->offsetGet($oid); } else { $classId = $this->createOrRetrieveClassId($oid->getType()); } $objectIdentityId = 'classAces' === $name ? null : $ace->getAcl()->getId(); $this->connection->executeStatement($this->getInsertAccessControlEntrySql($classId, $objectIdentityId, null, $i, $sid, $ace->getStrategy(), $ace->getMask(), $ace->isGranting(), $ace->isAuditSuccess(), $ace->isAuditFailure())); $aceId = $this->connection->executeQuery($this->getSelectAccessControlEntryIdSql($classId, $objectIdentityId, null, $i))->fetchOne(); $this->loadedAces[$aceId] = $ace; $aceIdProperty = new \ReflectionProperty($ace, 'id'); $aceIdProperty->setAccessible(true); $aceIdProperty->setValue($ace, (int) $aceId); } } }
This processes new entries changes on an ACE related property (classAces, or objectAces). @param string $name
updateNewAceProperty
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
private function updateOldAceProperty($name, array $changes) { [$old, $new] = $changes; $currentIds = []; for ($i = 0, $c = \count($new); $i < $c; ++$i) { $ace = $new[$i]; if (null !== $ace->getId()) { $currentIds[$ace->getId()] = true; } } for ($i = 0, $c = \count($old); $i < $c; ++$i) { $ace = $old[$i]; if (!isset($currentIds[$ace->getId()])) { $this->connection->executeStatement($this->getDeleteAccessControlEntrySql($ace->getId())); unset($this->loadedAces[$ace->getId()]); } } }
This processes old entries changes on an ACE related property (classAces, or objectAces). @param string $name
updateOldAceProperty
php
symfony/security-acl
Dbal/MutableAclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/MutableAclProvider.php
MIT
protected function getLookupSql(array $ancestorIds) { // FIXME: add support for filtering by sids (right now we select all sids) $sql = <<<SELECTCLAUSE SELECT o.id as acl_id, o.object_identifier, o.parent_object_identity_id, o.entries_inheriting, c.class_type, e.id as ace_id, e.object_identity_id, e.field_name, e.ace_order, e.mask, e.granting, e.granting_strategy, e.audit_success, e.audit_failure, s.username, s.identifier as security_identifier FROM {$this->options['oid_table_name']} o INNER JOIN {$this->options['class_table_name']} c ON c.id = o.class_id LEFT JOIN {$this->options['entry_table_name']} e ON ( e.class_id = o.class_id AND (e.object_identity_id = o.id OR e.object_identity_id IS NULL) ) LEFT JOIN {$this->options['sid_table_name']} s ON ( s.id = e.security_identity_id ) WHERE (o.id = SELECTCLAUSE; $sql .= implode(' OR o.id = ', $ancestorIds).')'; return $sql; }
Constructs the query used for looking up object identities and associated ACEs, and security identities. @return string
getLookupSql
php
symfony/security-acl
Dbal/AclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/AclProvider.php
MIT
protected function getFindChildrenSql(ObjectIdentityInterface $oid, $directChildrenOnly) { if (false === $directChildrenOnly) { $query = <<<FINDCHILDREN SELECT o.object_identifier, c.class_type FROM {$this->options['oid_table_name']} o INNER JOIN {$this->options['class_table_name']} c ON c.id = o.class_id INNER JOIN {$this->options['oid_ancestors_table_name']} a ON a.object_identity_id = o.id WHERE a.ancestor_id = %d AND a.object_identity_id != a.ancestor_id FINDCHILDREN; } else { $query = <<<FINDCHILDREN SELECT o.object_identifier, c.class_type FROM {$this->options['oid_table_name']} o INNER JOIN {$this->options['class_table_name']} c ON c.id = o.class_id WHERE o.parent_object_identity_id = %d FINDCHILDREN; } return sprintf($query, $this->retrieveObjectIdentityPrimaryKey($oid)); }
Constructs the SQL for retrieving child object identities for the given object identities. @param bool $directChildrenOnly @return string
getFindChildrenSql
php
symfony/security-acl
Dbal/AclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/AclProvider.php
MIT
protected function getSelectObjectIdentityIdSql(ObjectIdentityInterface $oid) { $query = <<<QUERY SELECT o.id FROM %s o INNER JOIN %s c ON c.id = o.class_id WHERE o.object_identifier = %s AND c.class_type = %s QUERY; return sprintf( $query, $this->options['oid_table_name'], $this->options['class_table_name'], $this->connection->quote((string) $oid->getIdentifier()), $this->connection->quote((string) $oid->getType()) ); }
Constructs the SQL for retrieving the primary key of the given object identity. @return string
getSelectObjectIdentityIdSql
php
symfony/security-acl
Dbal/AclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/AclProvider.php
MIT
private function doUpdateAceIdentityMap(array &$aces) { foreach ($aces as $index => $ace) { if (isset($this->loadedAces[$ace->getId()])) { $aces[$index] = $this->loadedAces[$ace->getId()]; } else { $this->loadedAces[$ace->getId()] = $ace; } } }
Does either overwrite the passed ACE, or saves it in the global identity map to ensure every ACE only gets instantiated once.
doUpdateAceIdentityMap
php
symfony/security-acl
Dbal/AclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/AclProvider.php
MIT
private function lookupObjectIdentities(array $batch, array $sids, array $oidLookup) { $ancestorIds = $this->getAncestorIds($batch); if (!$ancestorIds) { throw new AclNotFoundException('There is no ACL for the given object identity.'); } $sql = $this->getLookupSql($ancestorIds); $stmt = $this->connection->executeQuery($sql); return $this->hydrateObjectIdentities($stmt, $oidLookup, $sids); }
This method is called for object identities which could not be retrieved from the cache, and for which thus a database query is required. @return \SplObjectStorage<ObjectIdentityInterface,AclInterface> mapping object identities to ACL instances @throws AclNotFoundException
lookupObjectIdentities
php
symfony/security-acl
Dbal/AclProvider.php
https://github.com/symfony/security-acl/blob/master/Dbal/AclProvider.php
MIT
public function getPattern() { $pattern = self::ALL_OFF; $length = \strlen($pattern); $bitmask = str_pad(decbin($this->mask), $length, '0', \STR_PAD_LEFT); for ($i = $length - 1; $i >= 0; --$i) { if ('1' === $bitmask[$i]) { try { $pattern[$i] = self::getCode(1 << ($length - $i - 1)); } catch (\Exception $e) { $pattern[$i] = self::ON; } } } return $pattern; }
Returns a human-readable representation of the permission. @return string
getPattern
php
symfony/security-acl
Permission/MaskBuilder.php
https://github.com/symfony/security-acl/blob/master/Permission/MaskBuilder.php
MIT
public function resolveMask($code) { if (\is_string($code)) { if (!\defined($name = sprintf('static::MASK_%s', strtoupper($code)))) { throw new \InvalidArgumentException(sprintf('The code "%s" is not supported', $code)); } return \constant($name); } if (!\is_int($code)) { throw new \InvalidArgumentException('$code must be an integer.'); } return $code; }
Returns the mask for the passed code. @param mixed $code @return int @throws \InvalidArgumentException
resolveMask
php
symfony/security-acl
Permission/MaskBuilder.php
https://github.com/symfony/security-acl/blob/master/Permission/MaskBuilder.php
MIT
public function __toString() { return sprintf('RoleSecurityIdentity(%s)', $this->role); }
Returns a textual representation of this security identity. This is solely used for debugging purposes, not to make an equality decision. @return string
__toString
php
symfony/security-acl
Domain/RoleSecurityIdentity.php
https://github.com/symfony/security-acl/blob/master/Domain/RoleSecurityIdentity.php
MIT
public function __toString() { return sprintf('ObjectIdentity(%s, %s)', $this->identifier, $this->type); }
Returns a textual representation of this object identity. @return string
__toString
php
symfony/security-acl
Domain/ObjectIdentity.php
https://github.com/symfony/security-acl/blob/master/Domain/ObjectIdentity.php
MIT
public function addPropertyChangedListener(PropertyChangedListener $listener) { $this->listeners[] = $listener; }
Adds a property changed listener. @return void
addPropertyChangedListener
php
symfony/security-acl
Domain/Acl.php
https://github.com/symfony/security-acl/blob/master/Domain/Acl.php
MIT
public function setAuditFailure($boolean) { $this->auditFailure = $boolean; }
Turns on/off auditing on permissions denials. Do never call this method directly. Use the respective methods on the AclInterface instead. @param bool $boolean
setAuditFailure
php
symfony/security-acl
Domain/Entry.php
https://github.com/symfony/security-acl/blob/master/Domain/Entry.php
MIT
public function setAuditSuccess($boolean) { $this->auditSuccess = $boolean; }
Turns on/off auditing on permission grants. Do never call this method directly. Use the respective methods on the AclInterface instead. @param bool $boolean
setAuditSuccess
php
symfony/security-acl
Domain/Entry.php
https://github.com/symfony/security-acl/blob/master/Domain/Entry.php
MIT
public function setMask($mask) { $this->mask = $mask; }
Sets the permission mask. Do never call this method directly. Use the respective methods on the AclInterface instead. @param int $mask
setMask
php
symfony/security-acl
Domain/Entry.php
https://github.com/symfony/security-acl/blob/master/Domain/Entry.php
MIT
public function setStrategy($strategy) { $this->strategy = $strategy; }
Sets the mask comparison strategy. Do never call this method directly. Use the respective methods on the AclInterface instead. @param string $strategy
setStrategy
php
symfony/security-acl
Domain/Entry.php
https://github.com/symfony/security-acl/blob/master/Domain/Entry.php
MIT
public static function fromAccount(UserInterface $user) { return new self(method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(), ClassUtils::getRealClass($user)); }
Creates a user security identity from a UserInterface. @return UserSecurityIdentity
fromAccount
php
symfony/security-acl
Domain/UserSecurityIdentity.php
https://github.com/symfony/security-acl/blob/master/Domain/UserSecurityIdentity.php
MIT
public static function fromToken(TokenInterface $token) { $user = $token->getUser(); if ($user instanceof UserInterface) { return self::fromAccount($user); } return new self((string) $user, \is_object($user) ? ClassUtils::getRealClass($user) : ClassUtils::getRealClass($token)); }
Creates a user security identity from a TokenInterface. @return UserSecurityIdentity
fromToken
php
symfony/security-acl
Domain/UserSecurityIdentity.php
https://github.com/symfony/security-acl/blob/master/Domain/UserSecurityIdentity.php
MIT