Creates a ticket
@param TicketObject $ticket
@return TicketObject
@throws \OK\Model\Network\Exception\NetworkException
544161
public function create(TicketObject $ticket) {
        $response = $this->client->post('tickets', array('ticket' => $ticket));
        return new TicketObject($response);
    }
140172
public function add()
    {
        $ticket = $this->Tickets->newEntity();
        if ($this->request->is('post')) {
            $ticket = $this->Tickets->patchEntity($ticket, $this->request->data);
            if ($this->Tickets->save($ticket)) {
                $this->Flash->success(__('The ticket has been saved.'));

                return $this->redirect(['action' => 'index']);
            }
            $this->Flash->error(__('The ticket could not be saved. Please, try again.'));
        }
        $this->set(compact('ticket'));
        $this->set('_serialize', ['ticket']);
    }
567195
function sendDownloadConfirmation($ticket) {
		$sendDownloadConfirmationRequest = new sendDownloadConfirmation ();
		
		$sendDownloadConfirmationRequest->targetId = $ticket;
		
		return $this->targetService->sendDownloadConfirmation ( $sendDownloadConfirmationRequest )->return;
	}
916421
def ticket_form_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/ticket_forms.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
630791
public function basicGet($options)
    {
        $args = new Writer();
        $args->writeShort($options['ticket'])
            ->writeShortStr($options['queue'])
            ->writeBit($options['no_ack']);
        return $args;
    }
317224
public function showqrcode_url($ticket = '')
    {
        if (!is_string($ticket) || $ticket == '') {
            $this->setError('参数错误');

            return false;
        }

        $url = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $ticket;

        return $url;
    }
1080923
public function create($pageObjectClass)
    {
        if (is_subclass_of($pageObjectClass, 'SensioLabs\Behat\PageObjectExtension\PageObject\Page')) {
            return $this->instantiatePage($pageObjectClass);
        } elseif (is_subclass_of($pageObjectClass, 'SensioLabs\Behat\PageObjectExtension\PageObject\Element')) {
            return $this->instantiateElement($pageObjectClass);
        }

        throw new \InvalidArgumentException(sprintf('Not a page object class: %s', $pageObjectClass));
    }
550210
def create(self, ticket, payload=None, expires=None):
        '''
        
        '''
        if not payload:
            payload = True
        self._client.set(str(ticket), payload, expires)
1071017
public function getStatus($ticket)
    {
        $sender = new ExtService();
        $sender->setClient($this->wsClient);

        return $sender->getStatus($ticket);
    }
25398
def create_ticket(subject, tags, ticket_body, requester_email=None,
                  custom_fields=[]):
    

    payload = {'ticket': {
        'subject': subject,
        'comment': {
            'body': ticket_body
        },
        'group_id': settings.ZENDESK_GROUP_ID,
        'tags': tags,
        'custom_fields': custom_fields
    }}

    if requester_email:
        payload['ticket']['requester'] = {
            'name': 'Sender: %s' % requester_email.split('@')[0],
            'email': requester_email,
        }
    else:
        payload['ticket']['requester_id'] = settings.ZENDESK_REQUESTER_ID

    requests.post(
        get_ticket_endpoint(),
        data=json.dumps(payload),
        auth=zendesk_auth(),
        headers={'content-type': 'application/json'}).raise_for_status()
1154391
public function createMessage(TicketInterface $ticket = null)
    {
        /* @var TicketMessageInterface $message */
        $message = new $this->ticketMessageClass();

        if ($ticket) {
            $message->setPriority($ticket->getPriority());
            $message->setStatus($ticket->getStatus());
            $message->setTicket($ticket);
        } else {
            $message->setStatus(TicketMessage::STATUS_OPEN);
        }

        return $message;
    }
909722
public function getTicketSubject4Admin($ticketId)
    {
        $query = $this->createQueryBuilder('p')
            ->select('p')
            ->where('p.id = :subjectTicketId')
            ->setParameter('subjectTicketId', $ticketId)
            ->getQuery();

        return $query->getOneOrNullResult();
    }
1257943
public function newAction()
    {
        $ticketManager = $this->get('hackzilla_ticket.ticket_manager');
        $entity        = $ticketManager->createTicket();

        $form = $this->createForm(TicketType::class, $entity);

        return $this->render(
            $this->container->getParameter('hackzilla_ticket.templates')['new'],
            [
                'entity' => $entity,
                'form'   => $form->createView(),
            ]
        );
    }
1258839
public function user(string $ticket, bool $needPoi = false)
    {
        $params = [
            'ticket' => $ticket,
        ];

        if ($needPoi) {
            $params['need_poi'] = 1;
        }

        return $this->httpPostJson('shakearound/user/getshakeinfo', $params);
    }
775509
private function addIodefObject($ticket, $token, $ashUrl)
    {
        // Add report type, origin and date
        $incident = new Iodef\Elements\Incident();
        $incident->setAttributes(
            [
                'purpose' => 'reporting'
            ]
        );

        // Add ASH Link
        $ashlink = new Iodef\Elements\AdditionalData;
        $ashlink->setAttributes(
            [
                'dtype'       => 'string',
                'meaning'     => 'ASH Link',
                'restriction' => 'private',
            ]
        );
        $ashlink->value = $ashUrl . $token;
        $incident->addChild($ashlink);

        // Add ASH Token seperatly
        $ashtoken = new Iodef\Elements\AdditionalData;
        $ashtoken->setAttributes(
            [
                'dtype'       => 'string',
                'meaning'     => 'ASH Token',
                'restriction' => 'private',
            ]
        );
        $ashtoken->value = $token;
        $incident->addChild($ashtoken);

        // Add AbuseDesk Status seperatly
        $ticketStatus = new Iodef\Elements\AdditionalData;
        $ticketStatus->setAttributes(
            [
                'dtype'       => 'string',
                'meaning'     => 'Ticket status',
                'restriction' => 'private',
            ]
        );

        $ticketStatus->value = $ticket->status_id;
        $incident->addChild($ticketStatus);

        // Add Contact Status seperatly
        $contactStatus = new Iodef\Elements\AdditionalData;
        $contactStatus->setAttributes(
            [
                'dtype'       => 'string',
                'meaning'     => 'Contact status',
                'restriction' => 'private',
            ]
        );
        $contactStatus->value = $ticket->contact_status_id;
        $incident->addChild($contactStatus);

        // Add SourceID seperatly
        $sourceID = new Iodef\Elements\AdditionalData;
        $sourceID->setAttributes(
            [
                'dtype'       => 'string',
                'meaning'     => 'SourceID',
                'restriction' => 'private',
            ]
        );
        $sourceID->value = config('app.id');
        $incident->addChild($sourceID);

        // Add Incident data
        $incidentID = new Iodef\Elements\IncidentID();
        $incidentID->setAttributes(
            [
                'name'        => 'https://myhost.isp.local/api/',
                'restriction' => 'need-to-know',
            ]
        );
        $incidentID->value($ticket->id);
        $incident->addChild($incidentID);

        $reportTime = new Iodef\Elements\ReportTime();
        $reportTime->value(date('Y-m-d\TH:i:sP'));
        $incident->addChild($reportTime);

        // Add ticket abuse classification and type
        $assessment = new Iodef\Elements\Assessment();
        $impact = new Iodef\Elements\Impact();
        $severity = [
            'INFO'       => 'low',
            'ABUSE'      => 'medium',
            'ESCALATION' => 'high',
        ];
        echo $ticket->class;
        $impact->setAttributes(
            [
                'type'     => 'ext-value',
                'ext-type' => $ticket->class_id,
                'severity' => $severity[$ticket->type_id],
            ]
        );
        $assessment->addChild($impact);
        $incident->addChild($assessment);

        // Add Origin/Creator contact information for this ticket
        $contact = new Iodef\Elements\Contact();
        $contact->setAttributes(
            [
                'role'        => 'creator',
                'type'        => 'ext-value',
                'ext-type'    => 'Software',
                'restriction' => 'need-to-know',
            ]
        );

        $contactName = new Iodef\Elements\ContactName();
        $contactName->value('AbuseIO downstream provider');
        $contact->addChild($contactName);

        $email = new Iodef\Elements\Email();
        $email->value('notifier@abuse.io');
        $contact->addChild($email);

        $incident->addChild($contact);

        // Add Abusedesk contact information for this ticket
        $contact = new Iodef\Elements\Contact();
        $contact->setAttributes(
            [
                'role'        => 'irt',
                'type'        => 'organization',
                'restriction' => 'need-to-know',
            ]
        );

        $contactName = new Iodef\Elements\ContactName();
        $contactName->value(config('main.notifications.from_name'));
        $contact->addChild($contactName);

        $email = new Iodef\Elements\Email();
        $email->value(config('main.notifications.from_address'));
        $contact->addChild($email);

        $incident->addChild($contact);

        // Add ticket events as records
        if ($ticket->events->count() >= 1) {
            foreach ($ticket->events as $event) {
                $eventData = new Iodef\Elements\EventData();

                // Add the IP and Domain data to each record
                $flow = new Iodef\Elements\Flow;

                $system = new Iodef\Elements\System;
                $system->setAttributes(
                    [
                        'category' => 'source',
                        'spoofed'  => 'no'
                    ]
                );

                $node = new Iodef\Elements\Node;

                if (!empty($ticket->ip)) {
                    $address = new Iodef\Elements\Address;
                    $category = [];
                    if (filter_var($ticket->ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
                        $category['category'] = 'ipv4-addr';
                    } elseif (filter_var($ticket->ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
                        $category['category'] = 'ipv6-addr';
                    } else {
                        $category['category']     = 'ext-value';
                        $category['ext-category'] = 'unknown';

                    }

                    $address->setAttributes($category);
                    $address->value = $ticket->ip;

                    $node->addChild($address);

                }

                if (!empty($ticket->domain)) {
                    $domain = new Iodef\Elements\NodeName;
                    $domain->value = $ticket->domain;

                    $node->addChild($domain);
                }

                $system->addChild($node);
                $flow->addChild($system);
                $eventData->addChild($flow);


                // Now actually add event data
                $record = new Iodef\Elements\Record;
                $record->setAttributes(['restriction' => 'need-to-know']);

                $recordData = new Iodef\Elements\RecordData;

                $recordDateTime = new Iodef\Elements\DateTime;
                $recordDateTime->value = date('Y-m-d\TH:i:sP', $event->timestamp);
                $recordData->addChild($recordDateTime);

                $recordDescription = new Iodef\Elements\Description;
                $recordDescription->value = "Source:{$event->source}";
                $recordData->addChild($recordDescription);

                $recordItem = new Iodef\Elements\RecordItem;
                $recordItem->setAttributes(
                    [
                        'dtype'     => 'ext-value',
                        'ext-dtype' => 'json',
                    ]
                );
                $recordItem->value = $event->information;
                $recordData->addChild($recordItem);

                $record->addChild($recordData);

                $eventData->addChild($record);

                $incident->addChild($eventData);
            }
        }

        // Add ticket notes as history items
        if ($ticket->notes->count() >= 1) {
            $history = new Iodef\Elements\History;

            $elementCounter = 0;
            foreach ($ticket->notes as $note) {
                if ($note->hidden == true) {
                    continue;
                }

                $historyItem = new Iodef\Elements\HistoryItem;
                $historyItem->setAttributes(
                    [
                        'action'      => 'status-new-info',
                        'restriction' => 'need-to-know'
                    ]
                );

                $historyDateTime = new Iodef\Elements\DateTime;
                $historyDateTime->value = date('Y-m-d\TH:i:sP', strtotime($note->created_at));
                $historyItem->addChild($historyDateTime);

                $historySubmitter = new Iodef\Elements\AdditionalData;
                $historySubmitter->setAttributes(
                    [
                        'meaning' => 'submitter',
                    ]
                );
                $historySubmitter->value = "{$note->submitter}";
                $historyItem->addChild($historySubmitter);

                $historyNote = new Iodef\Elements\AdditionalData;
                $historyNote->setAttributes(
                    [
                        'meaning' => 'text',
                    ]
                );

                if(empty(trim($note->text))) {
                    $historyNote->value = false;
                } else {
                    $historyNote->value = "{$note->text}";
                }
                $historyItem->addChild($historyNote);

                $history->addChild($historyItem);
            }

            if($elementCounter >= 1) {
                $incident->addChild($history);
            }
        }

        // Add incident to the document
        $this->iodefDocument->addChild($incident);
    }
441436
public function confirmDestroy(Ticket $ticket)
    {
        $this->authorize('delete', $ticket);

        return view('laralum::pages.confirmation', [
            'method'  => 'DELETE',
            'message' => __('laralum_tickets::general.sure_del_ticket', ['id' => $ticket->id]),
            'action'  => route('laralum::tickets.destroy', ['ticket' => $ticket->id]),
        ]);
    }
233462
public function publicView($user, Ticket $ticket)
    {
        if ($ticket->user_id == $user->id) {
            return User::findOrFail($user->id)->hasPermission('laralum::tickets.view-public');
        }

        return false;
    }