当前位置: 首页>>代码示例>>PHP>>正文


PHP reject函数代码示例

本文整理汇总了PHP中reject函数的典型用法代码示例。如果您正苦于以下问题:PHP reject函数的具体用法?PHP reject怎么用?PHP reject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reject

 private function reject($reason = null)
 {
     if (null !== $this->result) {
         return;
     }
     $this->settle(reject($reason));
 }
开发者ID:bangordailynews,项目名称:bdnindex,代码行数:7,代码来源:Promise.php

示例2: checkQuotaStatus

 public function checkQuotaStatus()
 {
     if ($this->user->isLimited() && $this->user->limitExpired() && !$this->user->aq_access) {
         reject("Time/Data Limit Exceeded.");
     }
     return $this;
 }
开发者ID:ithoq,项目名称:am-radius,代码行数:7,代码来源:Authenticate.php

示例3: shouldRejectARejectedPromise

 /** @test */
 public function shouldRejectARejectedPromise()
 {
     $expected = 123;
     $resolved = new RejectedPromise($expected);
     $mock = $this->createCallableMock();
     $mock->expects($this->once())->method('__invoke')->with($this->identicalTo($expected));
     reject($resolved)->then($this->expectCallableNever(), $mock);
 }
开发者ID:hexcode007,项目名称:yfcms,代码行数:9,代码来源:FunctionRejectTest.php

示例4: getAwaitable

 /**
  * @return \Icicle\Awaitable\Awaitable
  */
 protected function getAwaitable()
 {
     if (null === $this->promise) {
         $promisor = $this->promisor;
         $this->promisor = null;
         try {
             $this->promise = resolve($promisor());
         } catch (\Throwable $exception) {
             $this->promise = reject($exception);
         }
     }
     return $this->promise;
 }
开发者ID:valentinkh1,项目名称:icicle,代码行数:16,代码来源:LazyAwaitable.php

示例5: some

function some(array $promisesOrValues, $howMany)
{
    if ($howMany < 1) {
        return resolve([]);
    }
    $len = count($promisesOrValues);
    if ($len < $howMany) {
        return reject(new Exception\LengthException(sprintf('Input array must contain at least %d item%s but contains only %s item%s.', $howMany, 1 === $howMany ? '' : 's', $len, 1 === $len ? '' : 's')));
    }
    $cancellationQueue = new CancellationQueue();
    return new Promise(function ($resolve, $reject) use($len, $promisesOrValues, $howMany, $cancellationQueue) {
        $toResolve = $howMany;
        $toReject = $len - $toResolve + 1;
        $values = [];
        $reasons = [];
        foreach ($promisesOrValues as $i => $promiseOrValue) {
            $fulfiller = function ($val) use($i, &$values, &$toResolve, $toReject, $resolve) {
                if ($toResolve < 1 || $toReject < 1) {
                    return;
                }
                $values[$i] = $val;
                if (0 === --$toResolve) {
                    $resolve($values);
                }
            };
            $rejecter = function ($reason) use($i, &$reasons, &$toReject, $toResolve, $reject) {
                if ($toResolve < 1 || $toReject < 1) {
                    return;
                }
                $reasons[$i] = $reason;
                if (0 === --$toReject) {
                    $reject($reasons);
                }
            };
            $cancellationQueue->enqueue($promiseOrValue);
            resolve($promiseOrValue)->done($fulfiller, $rejecter);
        }
    }, $cancellationQueue);
}
开发者ID:reactphp,项目名称:promise,代码行数:39,代码来源:functions.php

示例6: fetchAccount

 public function fetchAccount($acctsessionid = NULL, $acctuniqueid = NULL)
 {
     $q = Capsule::table('user_accounts as u')->select('u.uname', 'u.status', 'u.clear_pword', 'u.id', 'r.time_limit', 'r.data_limit', 'r.expiration', 'r.aq_invocked', 'v.plan_type', 'v.policy_type', 'v.policy_id', 'v.sim_sessions', 'v.interim_updates', 'l.limit_type', 'l.aq_access', 'l.aq_policy')->leftJoin('user_recharges as r', 'r.user_id', '=', 'u.id')->leftJoin('prepaid_vouchers as v', 'v.id', '=', 'r.voucher_id')->leftJoin('voucher_limits as l', 'l.id', '=', 'v.limit_id')->where('u.uname', $this->uname);
     if ($acctsessionid == NULL && $acctuniqueid == NULL) {
         $settings = Capsule::table('general_settings as s')->select('s.idle_timeout')->first();
         if ($settings->idle_timeout != 0) {
             $this->user->idleTimeout = $settings->idle_timeout;
         }
     }
     if ($acctsessionid != NULL and $acctuniqueid != NULL) {
         $q->join('radacct as a', 'u.uname', '=', 'a.username')->where('a.')->addSelect('a.acctinputoctets', 'a.acctoutputoctets', 'a.acctsessiontime', 'r.active_tpl');
     }
     $this->user = $q->first();
     if ($this->user == NULL) {
         reject("No such user: {$this->uname}");
     }
     $this->status['isActive'] = $this->user->status;
     $this->status['isLimited'] = $this->user->plan_type;
     $this->status['isUnlimited'] = !$this->user->plan_type;
     $this->status['haveAQAccess'] = $this->user->aq_access ? TRUE : FALSE;
     return $this;
 }
开发者ID:ithoq,项目名称:am-radius,代码行数:22,代码来源:User.php

示例7: shouldRejectIfAnyInputPromiseRejectsBeforeDesiredNumberOfInputsAreResolved

 /** @test */
 public function shouldRejectIfAnyInputPromiseRejectsBeforeDesiredNumberOfInputsAreResolved()
 {
     $mock = $this->createCallableMock();
     $mock->expects($this->once())->method('__invoke')->with($this->identicalTo([1 => 2, 2 => 3]));
     some([resolve(1), reject(2), reject(3)], 2)->then($this->expectCallableNever(), $mock);
 }
开发者ID:hexcode007,项目名称:yfcms,代码行数:7,代码来源:FunctionSomeTest.php

示例8: contentStream

 /**
  * Get the message content as a stream.
  *
  * @see IncomingMessage::content() to get the content as a string.
  *
  * @see IncomingMessage::contentUnbuffered() to get the message content as
  *      it becomes available.
  *
  * Closing the stream discards any remaining content.
  *
  * If the message does not contain any content, the stream will be closed
  * before it is returned, and no stream events will be emitted.
  *
  * @see ReadableStreamInterface::isReadable() to check if a stream can be read from.
  *
  * @return ReadableStreamInterface A stream containing the message content.
  * @throws LogicException          The message content has already been consumed or discarded.
  */
 public function contentStream()
 {
     if ($this->contentHandled) {
         return reject(new LogicException('The message content has already been consumed or discarded.'));
     }
     $this->contentHandled = true;
     $stream = new MemoryStream();
     $stream->on('close', $this->cancelContentListener);
     if (0 === $this->headerFrame->contentLength) {
         $stream->close();
     } else {
         $this->onBodyFrame = function ($exception, $frame, $final) use($stream) {
             if ($exception) {
                 $stream->close($exception);
             } elseif ($final) {
                 $stream->end($frame->content);
             } else {
                 $stream->write($frame->content);
             }
         };
     }
     return $stream;
 }
开发者ID:recoilphp,项目名称:amqp,代码行数:41,代码来源:Amqp091IncomingMessage.php

示例9: reject

    reject('ltrim', TRUE)->equals('');
    reject('Dotink\\Lab\\Calculator::$seed', TRUE)->measures(23);
}, 'Contains Rejections' => function ($data) {
    reject('This is a test string')->contains('foo');
    reject('This is a test string')->contains('FOO', FALSE);
    assert(function () {
        reject('This is a test string')->contains('test');
    })->throws('Dotink\\Lab\\FailedTestException');
    assert(function () {
        reject('This is a test string')->contains('TEST', FALSE);
    })->throws('Dotink\\Lab\\FailedTestException');
    assert(function () {
        reject('This is a test string')->contains('test', TRUE);
    })->throws('Dotink\\Lab\\FailedTestException');
    reject(['a' => 'foo', 'b' => 'bar'])->contains('hello');
    reject(function () {
        reject(['a' => 'foo', 'b' => 'bar'])->contains('foobar');
    })->throws('Dotink\\Lab\\FailedTestException');
    reject(['a' => 'foo', 'b' => 'bar'])->has('b', 'c');
    assert(function () {
        reject(['a' => 'foo', 'b' => 'bar'])->has('b');
    })->throws('Dotink\\Lab\\FailedTestException');
}, 'Ends and Begins Rejections' => function ($data) {
    reject('I have a merry band of brothers')->begins('I have the')->ends('group of brothers');
    assert(function () {
        reject('I have a merry band of brothers')->begins('I have');
    })->throws('Dotink\\Lab\\FailedTestException');
    assert(function () {
        reject('I have a merry band of brothers')->ends('band of brothers');
    })->throws('Dotink\\Lab\\FailedTestException');
}]];
开发者ID:dotink,项目名称:lab,代码行数:31,代码来源:Rejection+Tests.php

示例10: shouldRejectIfAnyInputPromiseRejects

 /** @test */
 public function shouldRejectIfAnyInputPromiseRejects()
 {
     $mock = $this->createCallableMock();
     $mock->expects($this->once())->method('__invoke')->with($this->identicalTo(2));
     all([resolve(1), reject(2), resolve(3)])->then($this->expectCallableNever(), $mock);
 }
开发者ID:hazaveh,项目名称:mySQLtoes,代码行数:7,代码来源:FunctionAllTest.php

示例11: shouldResolveWhenFirstInputPromiseResolves

 /** @test */
 public function shouldResolveWhenFirstInputPromiseResolves()
 {
     $mock = $this->createCallableMock();
     $mock->expects($this->once())->method('__invoke')->with($this->identicalTo(1));
     any([resolve(1), reject(2), reject(3)])->then($mock);
 }
开发者ID:453111208,项目名称:bbc,代码行数:7,代码来源:FunctionAnyTest.php

示例12: test_reject

 public function test_reject()
 {
     assert_equal(array(1, 3), reject(array(1, 2, 3, 4), function ($v) {
         return $v % 2 == 0;
     }));
 }
开发者ID:jaz303,项目名称:php-helpers,代码行数:6,代码来源:functional_test.php

示例13: array

    //            array('confirm' => 'Are you sure you want to delete this conference?', "visible" => $ismoderator, 'role' => "button", "class" => "btn btn-danger")
    //        );
    if ($model->status != "cancelled") {
        $html .= CHtml::ajaxLink('Cancel', Yii::app()->createAbsoluteUrl('videoConference/cancel/' . $model->id), array('type' => 'post', 'data' => array('id' => $model->id, 'type' => 'post'), 'update' => 'message', 'success' => 'function(response) {
                                $(".message").html(response);
                                location.reload();
                                }'), array('confirm' => 'Are you sure you want to cancel this conference?', "visible" => $ismoderator, 'role' => "button", "class" => "btn btn-warning"));
    }
} else {
    $invitation = VCInvitation::model()->findByAttributes(array('videoconference_id' => $model->id, 'invitee_id' => $user->id));
    if ($invitation->status == "Unknown") {
        $html .= accept($model->id);
        $html .= reject($model->id);
    } else {
        if ($invitation->status == "Accepted") {
            $html .= reject($model->id);
        } else {
            $html .= accept($model->id);
        }
    }
}
$html .= "</div>";
$html = str_replace("%SUBJECT%", $model->subject, $html);
$html = str_replace("%MSTATUS%", $model->status, $html);
if ($model->status == "cancelled") {
    $html = str_replace("%STATUS%", "<p style='font-weight: bold'>Status: Cancelled</p>", $html);
} else {
    $html = str_replace("%STATUS%", "", $html);
}
$html = str_replace("%SUBJECT%", $model->subject, $html);
$html = str_replace("%DATE%", $user_friendly_date, $html);
开发者ID:acuba001,项目名称:Collaborative-Platform,代码行数:31,代码来源:view.php

示例14: last

 /**
  * Perform a GET request against the link's "last" relation
  *
  * @return ExtendedPromiseInterface
  */
 function last() : ExtendedPromiseInterface
 {
     if ($this->links() && ($last = $this->links()->getLast())) {
         return $this->withUrl($last)->get();
     }
     return reject($this->links());
 }
开发者ID:m6w6,项目名称:seekat,代码行数:12,代码来源:API.php

示例15: shouldRejectWhenInputPromiseRejects

 /** @test */
 public function shouldRejectWhenInputPromiseRejects()
 {
     $mock = $this->createCallableMock();
     $mock->expects($this->once())->method('__invoke')->with($this->identicalTo(null));
     reduce(reject(), $this->plus(), 1)->then($this->expectCallableNever(), $mock);
 }
开发者ID:lewishealey,项目名称:confetti,代码行数:7,代码来源:FunctionReduceTest.php


注:本文中的reject函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。