composer.phar 1.5 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. Phar::mapPhar('composer.phar');
  22. define('COMPOSER_DEV_WARNING_TIME', 1461527641);
  23. require 'phar://composer.phar/bin/composer';
  24. __HALT_COMPILER(); ?>
  25. \y��ž������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.phpS��Y
  26. ÎVS��,,a¶������+���src/Composer/Autoload/ClassMapGenerator.phpS��Y
  27. ÎVS��1 aÕ¶���������src/Composer/Cache.php…��Y
  28. ÎV…���”&¶������%���src/Composer/Command/AboutCommand.phpÀ��Y
  29. ÎVÀ��ÄiWR¶������'���src/Composer/Command/ArchiveCommand.phpá��Y
  30. ÎVá��ØpÊ ¶������$���src/Composer/Command/BaseCommand.phpz��Y
  31. ÎVz��D\䦶������.���src/Composer/Command/BaseDependencyCommand.php¯��Y
  32. ÎV¯��9‚˜R¶������*���src/Composer/Command/ClearCacheCommand.php^��Y
  33. ÎV^��ƒ÷�¶������&���src/Composer/Command/ConfigCommand.php£:��Y
  34. ÎV£:��äy¶������-���src/Composer/Command/CreateProjectCommand.php‘4��Y
  35. ÎV‘4��<b¢"¶������'���src/Composer/Command/DependsCommand.php¶��Y
  36. ÎV¶��á0¶������(���src/Composer/Command/DiagnoseCommand.phpùC��Y
  37. ÎVùC���¿�¿¶������,���src/Composer/Command/DumpAutoloadCommand.phpß��Y
  38. ÎVß��¬xxK¶������&���src/Composer/Command/GlobalCommand.php��Y
  39. ÎV��ñç2¶������$���src/Composer/Command/HomeCommand.phpq ��Y
  40. ÎVq ��5�„�¶������$���src/Composer/Command/InitCommand.php8��Y
  41. ÎV8��2™4¶������'���src/Composer/Command/InstallCommand.php��Y
  42. ÎV��žß U¶������(���src/Composer/Command/LicensesCommand.php"��Y
  43. ÎV"��L8}'¶������)���src/Composer/Command/ProhibitsCommand.phpÊ��Y
  44. ÎVÊ��—ÕÓ€¶������&���src/Composer/Command/RemoveCommand.phpî��Y
  45. ÎVî��§hÁ¶������'���src/Composer/Command/RequireCommand.phpO��Y
  46. ÎVO��(ʨ“¶������)���src/Composer/Command/RunScriptCommand.phpg ��Y
  47. ÎVg ��^�ý4¶������+���src/Composer/Command/ScriptAliasCommand.php��Y
  48. ÎV��®%þ›¶������&���src/Composer/Command/SearchCommand.phpe ��Y
  49. ÎVe ��;e=¶������*���src/Composer/Command/SelfUpdateCommand.php ,��Y
  50. ÎV ,��Ô�\Ó¶������$���src/Composer/Command/ShowCommand.phpN@��Y
  51. ÎVN@��W@c²¶������&���src/Composer/Command/StatusCommand.php  ��Y
  52. ÎV  ��ïí�‹¶������(���src/Composer/Command/SuggestsCommand.php��Y
  53. ÎV��2ZÉa¶������&���src/Composer/Command/UpdateCommand.php‡ ��Y
  54. ÎV‡ ��í\1“¶������(���src/Composer/Command/ValidateCommand.php9��Y
  55. ÎV9��äø>®¶���������src/Composer/Composer.php) ��Y
  56. ÎV) ��ò§f¥¶���������src/Composer/Config.phpí��Y
  57. ÎVí��çmžK¶������-���src/Composer/Config/ConfigSourceInterface.php®��Y
  58. ÎV®��6J[ª¶������(���src/Composer/Config/JsonConfigSource.phpø ��Y
  59. ÎVø ��ïÓIP¶������$���src/Composer/Console/Application.phpw#��Y
  60. ÎVw#��åÕ'¶������,���src/Composer/Console/HtmlOutputFormatter.php3��Y
  61. ÎV3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.phpQ��Y
  62. ÎVQ��?˜¬$¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��Y
  63. ÎV��õÝv¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��Y
  64. ÎVC��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��Y
  65. ÎV÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��Y
  66. ÎVý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���Y
  67. ÎVÓ���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��Y
  68. ÎV¹��&¢e
  69. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��Y
  70. ÎVI��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��Y
  71. ÎVh��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php”��Y
  72. ÎV”��°�­¶������(���src/Composer/DependencyResolver/Pool.php³!��Y
  73. ÎV³!��Td¥¶������+���src/Composer/DependencyResolver/Problem.phpí��Y
  74. ÎVí��nû…¶������+���src/Composer/DependencyResolver/Request.php€��Y
  75. ÎV€��Ðwƒ¶������(���src/Composer/DependencyResolver/Rule.phpã��Y
  76. ÎVã��,¤Y¬¶������+���src/Composer/DependencyResolver/RuleSet.php
  77. ��Y
  78. ÎV
  79. ��:Z�E¶������4���src/Composer/DependencyResolver/RuleSetGenerator.php]��Y
  80. ÎV]��4“Ñ9¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��Y
  81. ÎV��}õÇù¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��Y
  82. ÎVi��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpÜ��Y
  83. ÎVÜ��‰8¶������1���src/Composer/DependencyResolver/RuleWatchNode.phpç��Y
  84. ÎVç��—Þȶ������*���src/Composer/DependencyResolver/Solver.php7��Y
  85. ÎV7��@ÿ¶������6���src/Composer/DependencyResolver/SolverBugException.php˜��Y
  86. ÎV˜��"qN¶������;���src/Composer/DependencyResolver/SolverProblemsException.php[��Y
  87. ÎV[��bQgJ¶������/���src/Composer/DependencyResolver/Transaction.phpÔ��Y
  88. ÎVÔ�� 3ô¶������-���src/Composer/Downloader/ArchiveDownloader.php¢��Y
  89. ÎV¢��vmtO¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���Y
  90. ÎVÌ���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.phpÈ��Y
  91. ÎVÈ��Wõ8C¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��Y
  92. ÎVÊ��gs!l¶������*���src/Composer/Downloader/FileDownloader.php´��Y
  93. ÎV´��àïL“¶������/���src/Composer/Downloader/FilesystemException.php
  94. ��Y
  95. ÎV
  96. ��.-‹¶������)���src/Composer/Downloader/GitDownloader.php&��Y
  97. ÎV&��@§Ðw¶������*���src/Composer/Downloader/GzipDownloader.phpé��Y
  98. ÎVé��ÃïÞ÷¶������(���src/Composer/Downloader/HgDownloader.phpÊ��Y
  99. ÎVÊ��sG6÷¶������*���src/Composer/Downloader/PathDownloader.php ��Y
  100. ÎV ��+àý¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��Y
  101. ÎVu��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.php¾��Y
  102. ÎV¾��›lƒ“¶������*���src/Composer/Downloader/PharDownloader.phpå���Y
  103. ÎVå���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.php%��Y
  104. ÎV%��û¥ .¶������)���src/Composer/Downloader/SvnDownloader.phpH��Y
  105. ÎVH��Tp¥¶������)���src/Composer/Downloader/TarDownloader.phpã���Y
  106. ÎVã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��Y
  107. ÎV=��ZÎÈÞ¶������)���src/Composer/Downloader/VcsDownloader.php®��Y
  108. ÎV®��v6¡þ¶������(���src/Composer/Downloader/XzDownloader.php§��Y
  109. ÎV§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.php£ ��Y
  110. ÎV£ ��GYš¶������&���src/Composer/EventDispatcher/Event.php ��Y
  111. ÎV ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.phpE"��Y
  112. ÎVE"��f0Ǧ¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���Y
  113. ÎV©���h·0¶���������src/Composer/Factory.phpr@��Y
  114. ÎVr@��=$”P¶���������src/Composer/IO/BaseIO.php'��Y
  115. ÎV'��=DΧ¶���������src/Composer/IO/BufferIO.php,��Y
  116. ÎV,��§Y~¶���������src/Composer/IO/ConsoleIO.php[��Y
  117. ÎV[��<ÇÅÿ¶���������src/Composer/IO/IOInterface.phpU��Y
  118. ÎVU��@Èö���������src/Composer/IO/NullIO.php��Y
  119. ÎV��ôvA�¶���������src/Composer/Installer.phpÈ‚��Y
  120. ÎVÈ‚��Šå颶������.���src/Composer/Installer/InstallationManager.php��Y
  121. ÎV��ÓýÇÛ¶������)���src/Composer/Installer/InstallerEvent.php��Y
  122. ÎV��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���Y
  123. ÎVÞ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��Y
  124. ÎVã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.phpÆ!��Y
  125. ÎVÆ!��
  126. sµ¶������/���src/Composer/Installer/MetapackageInstaller.phpœ��Y
  127. ÎVœ��ÆÅ!¶������(���src/Composer/Installer/NoopInstaller.php+��Y
  128. ÎV+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��Y
  129. ÎVe��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��Y
  130. ÎV¸��dbØs¶������(���src/Composer/Installer/PearInstaller.php_��Y
  131. ÎV_��/G3á¶������*���src/Composer/Installer/PluginInstaller.php
  132. ��Y
  133. ÎV
  134. ��6À¢�¶������+���src/Composer/Installer/ProjectInstaller.php��Y
  135. ÎV��*0@P¶���������src/Composer/Json/JsonFile.php¯��Y
  136. ÎV¯��°«#\¶������#���src/Composer/Json/JsonFormatter.php��Y
  137. ÎV��Ðqu¶������%���src/Composer/Json/JsonManipulator.php*��Y
  138. ÎV*��r% ¶������-���src/Composer/Json/JsonValidationException.php\��Y
  139. ÎV\��.Xóܶ������%���src/Composer/Package/AliasPackage.php��Y
  140. ÎV��PÈa£¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.php¾��Y
  141. ÎV¾��„Œõɶ������0���src/Composer/Package/Archiver/ArchiveManager.phpz ��Y
  142. ÎVz ��!sK™¶������3���src/Composer/Package/Archiver/ArchiverInterface.phpï���Y
  143. ÎVï���<ʸ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php‘��Y
  144. ÎV‘��[ÿ0=¶������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��Y
  145. ÎV��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpw��Y
  146. ÎVw��LgU»¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php��Y
  147. ÎV��~”¸¶������.���src/Composer/Package/Archiver/PharArchiver.php¶��Y
  148. ÎV¶��øD½Ô¶������-���src/Composer/Package/Archiver/ZipArchiver.phpÿ��Y
  149. ÎVÿ��¼| ¶������$���src/Composer/Package/BasePackage.php= ��Y
  150. ÎV= ��Î�ç¶������(���src/Composer/Package/CompletePackage.phpÿ��Y
  151. ÎVÿ��o+ã ¶������1���src/Composer/Package/CompletePackageInterface.phpõ��Y
  152. ÎVõ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpì ��Y
  153. ÎVì ��ª–æ¶���������src/Composer/Package/Link.phpˆ��Y
  154. ÎVˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��Y
  155. ÎV‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��Y
  156. ÎVd��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��Y
  157. ÎV‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��Y
  158. ÎVi��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��Y
  159. ÎVX��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.php0��Y
  160. ÎV0��F±­¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��Y
  161. ÎVE��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��Y
  162. ÎVù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���Y
  163. ÎV²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.php��Y
  164. ÎV��³PE^¶������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpò/��Y
  165. ÎVò/��?Ðþ˜¶���������src/Composer/Package/Locker.php�!��Y
  166. ÎV�!��=-w’¶������ ���src/Composer/Package/Package.phpÉ��Y
  167. ÎVÉ��cÃ�h¶������)���src/Composer/Package/PackageInterface.php ��Y
  168. ÎV ��ûÇ^ƶ������)���src/Composer/Package/RootAliasPackage.php×��Y
  169. ÎV×�� ζ������$���src/Composer/Package/RootPackage.phpn��Y
  170. ÎVn��áACO¶������-���src/Composer/Package/RootPackageInterface.php–��Y
  171. ÎV–��ÿfÆg¶������/���src/Composer/Package/Version/VersionGuesser.phpû��Y
  172. ÎVû��9¼Ò¶������.���src/Composer/Package/Version/VersionParser.phpø��Y
  173. ÎVø��¾3l¶������0���src/Composer/Package/Version/VersionSelector.phpè ��Y
  174. ÎVè ��5j8׶������-���src/Composer/Plugin/Capability/Capability.phpW���Y
  175. ÎVW���æ_¨1¶���������src/Composer/Plugin/Capable.php���Y
  176. ÎV���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��Y
  177. ÎVâ��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.php¤���Y
  178. ÎV¤���0ïÞX¶������'���src/Composer/Plugin/PluginInterface.phpô���Y
  179. ÎVô��� 1‰%¶������%���src/Composer/Plugin/PluginManager.php­ ��Y
  180. ÎV­ ��R k3¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��Y
  181. ÎV`���9-ζ������+���src/Composer/Repository/ArrayRepository.php} ��Y
  182. ÎV} ��ç>Š¶������.���src/Composer/Repository/ArtifactRepository.phpÿ ��Y
  183. ÎVÿ ��[Ú�¶������*���src/Composer/Repository/BaseRepository.phpí��Y
  184. ÎVí��Í›} ¶������.���src/Composer/Repository/ComposerRepository.php!K��Y
  185. ÎV!K��„ lâ¶������/���src/Composer/Repository/CompositeRepository.php&��Y
  186. ÎV&��Á'f¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���Y
  187. ÎV…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.phpÀ��Y
  188. ÎVÀ��&xb£¶������4���src/Composer/Repository/InstalledArrayRepository.php£���Y
  189. ÎV£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���Y
  190. ÎV£���V
  191. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���Y
  192. ÎV‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���Y
  193. ÎVn���à“똶������-���src/Composer/Repository/PackageRepository.phpG��Y
  194. ÎVG��í:k¶������*���src/Composer/Repository/PathRepository.phpK��Y
  195. ÎVK�� yÐ˶������2���src/Composer/Repository/Pear/BaseChannelReader.php6��Y
  196. ÎV6��.fi!¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��Y
  197. ÎVÄ��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpn��Y
  198. ÎVn��š8¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.phpÁ ��Y
  199. ÎVÁ ��O€ë¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��Y
  200. ÎV& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��Y
  201. ÎVq��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��Y
  202. ÎVq��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php%��Y
  203. ÎV%��j?“¶������,���src/Composer/Repository/Pear/PackageInfo.php°��Y
  204. ÎV°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��Y
  205. ÎV’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.php“��Y
  206. ÎV“��¾©IJ¶������.���src/Composer/Repository/PlatformRepository.phpG��Y
  207. ÎVG��}ýÙ¶������/���src/Composer/Repository/RepositoryInterface.phpÚ��Y
  208. ÎVÚ��7@€¶������-���src/Composer/Repository/RepositoryManager.php# ��Y
  209. ÎV# ���Ê>¶������7���src/Composer/Repository/RepositorySecurityException.phpo���Y
  210. ÎVo���pÕ«ª¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.php¥��Y
  211. ÎV¥�� ý¶������)���src/Composer/Repository/Vcs/GitDriver.php��Y
  212. ÎV��\îï¶������,���src/Composer/Repository/Vcs/GitHubDriver.phpã'��Y
  213. ÎVã'��ØŸô¶������,���src/Composer/Repository/Vcs/GitLabDriver.phpx��Y
  214. ÎVx��Tù‰¶������1���src/Composer/Repository/Vcs/HgBitbucketDriver.php­��Y
  215. ÎV­��š÷ÖT¶������(���src/Composer/Repository/Vcs/HgDriver.phpà��Y
  216. ÎVà��ñ‘綶������.���src/Composer/Repository/Vcs/PerforceDriver.php"
  217. ��Y
  218. ÎV"
  219. ��°`ìE¶������)���src/Composer/Repository/Vcs/SvnDriver.php²��Y
  220. ÎV²��Ë W¶������)���src/Composer/Repository/Vcs/VcsDriver.phpÿ��Y
  221. ÎVÿ��*ßÙ¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.phpˆ��Y
  222. ÎVˆ��ŽP©Î¶������)���src/Composer/Repository/VcsRepository.php£��Y
  223. ÎV£���Žg¶������3���src/Composer/Repository/WritableArrayRepository.php��Y
  224. ÎV��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��Y
  225. ÎV‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���Y
  226. ÎVW���£VZt¶���������src/Composer/Script/Event.phpµ��Y
  227. ÎVµ��lt¦M¶������$���src/Composer/Script/PackageEvent.phpœ���Y
  228. ÎVœ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��Y
  229. ÎVP��‡�¶¶������ ���src/Composer/Util/AuthHelper.phpË��Y
  230. ÎVË��>zx–¶������$���src/Composer/Util/ComposerMirror.php±��Y
  231. ÎV±��­½øض������%���src/Composer/Util/ConfigValidator.php&��Y
  232. ÎV&��î:äü¶������"���src/Composer/Util/ErrorHandler.php‡��Y
  233. ÎV‡��He"¶������ ���src/Composer/Util/Filesystem.phpƒ,��Y
  234. ÎVƒ,��“H_·¶���������src/Composer/Util/Git.php-��Y
  235. ÎV-��˜,…¬¶���������src/Composer/Util/GitHub.php¯
  236. ��Y
  237. ÎV¯
  238. ��àÏ ¶���������src/Composer/Util/GitLab.php³ ��Y
  239. ÎV³ ��4‚õ¶���������src/Composer/Util/Keys.php—��Y
  240. ÎV—��eƒd³¶������$���src/Composer/Util/NoProxyPattern.php¾��Y
  241. ÎV¾��Z+°m¶���������src/Composer/Util/Perforce.phpÅ2��Y
  242. ÎVÅ2��ì»^¶���������src/Composer/Util/Platform.php™���Y
  243. ÎV™���ù$5¶������%���src/Composer/Util/ProcessExecutor.phpÞ��Y
  244. ÎVÞ��Þíж������&���src/Composer/Util/RemoteFilesystem.phpBY��Y
  245. ÎVBY��Æÿ²œ¶���������src/Composer/Util/Silencer.phpñ��Y
  246. ÎVñ��mvý¶������!���src/Composer/Util/SpdxLicense.php��Y
  247. ÎV��¾7
  248. �����*���src/Composer/Util/StreamContextFactory.php�Y
  249. ÎVä��ÂB‰©¶���������src/Composer/Util/Svn.php†��Y
  250. ÎV†��e@î¶���������src/Composer/Util/TlsHelper.phpå��Y
  251. ÎVå���ÞŠ¶���������src/bootstrap.php¹��Y
  252. ÎV¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.php²0��Y
  253. ÎV²0��ú�Ý]¶���������res/composer-schema.json¶_��Y
  254. ÎV¶_��r§¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json¥��Y
  255. ÎV¥��vd�Š¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonK_��Y
  256. ÎVK_��€q ¾¶������*���vendor/seld/cli-prompt/res/hiddeninput.exe�$��Y
  257. ÎV�$��•�¥v¶������&���vendor/symfony/console/Application.phpºU��Y
  258. ÎVºU��µ×Æb¶������*���vendor/symfony/console/Command/Command.phpO ��Y
  259. ÎVO ��æ¾(¶������.���vendor/symfony/console/Command/HelpCommand.phpÝ��Y
  260. ÎVÝ��.Ø™u¶������.���vendor/symfony/console/Command/ListCommand.phpZ��Y
  261. ÎVZ��É£ ¶������(���vendor/symfony/console/ConsoleEvents.phpï���Y
  262. ÎVï��� ÕH¸¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpß��Y
  263. ÎVß��µŒ°7¶������0���vendor/symfony/console/Descriptor/Descriptor.php���Y
  264. ÎV���;~Ķ������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���Y
  265. ÎVü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpš ��Y
  266. ÎVš ��l¬¶������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php��Y
  267. ÎV��?wn¶������4���vendor/symfony/console/Descriptor/TextDescriptor.phpå��Y
  268. ÎVå��¯cŶ������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��Y
  269. ÎV��‹P$¶������4���vendor/symfony/console/Event/ConsoleCommandEvent.php²��Y
  270. ÎV²��Zk‰2¶������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��Y
  271. ÎVÅ��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��Y
  272. ÎV��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��Y
  273. ÎVz��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��Y
  274. ÎVÔ��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���Y
  275. ÎVf���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���Y
  276. ÎV¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���Y
  277. ÎV¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���Y
  278. ÎV’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���Y
  279. ÎV–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php³ ��Y
  280. ÎV³ ��(¯o¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŠ��Y
  281. ÎVŠ��:߶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpL��Y
  282. ÎVL��Š�8<¶������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php†��Y
  283. ÎV†��ÝRÚ­¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.phpL��Y
  284. ÎVL��.=b¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpx��Y
  285. ÎVx��N©Ø¼¶������2���vendor/symfony/console/Helper/DescriptorHelper.phpz��Y
  286. ÎVz��fÉÚý¶������.���vendor/symfony/console/Helper/DialogHelper.phpY��Y
  287. ÎVY��þkl»¶������1���vendor/symfony/console/Helper/FormatterHelper.phpc��Y
  288. ÎVc��“ý«N¶������(���vendor/symfony/console/Helper/Helper.php©��Y
  289. ÎV©��zɶ������1���vendor/symfony/console/Helper/HelperInterface.phpç���Y
  290. ÎVç��� Çã¶������+���vendor/symfony/console/Helper/HelperSet.phpÊ��Y
  291. ÎVÊ��f!6>¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��Y
  292. ÎVc��ñø�|¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÑ ��Y
  293. ÎVÑ ��@±ã�¶������-���vendor/symfony/console/Helper/ProgressBar.php;'��Y
  294. ÎV;'��Äڂ˶������0���vendor/symfony/console/Helper/ProgressHelper.phpÚ��Y
  295. ÎVÚ��ÙþñT¶������3���vendor/symfony/console/Helper/ProgressIndicator.php¶��Y
  296. ÎV¶��eØ¡¶������0���vendor/symfony/console/Helper/QuestionHelper.php ��Y
  297. ÎV ��䢜B¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.phpl��Y
  298. ÎVl��C�æo¶������'���vendor/symfony/console/Helper/Table.php{)��Y
  299. ÎV{)���Ÿ|j¶������+���vendor/symfony/console/Helper/TableCell.php:��Y
  300. ÎV:��7®�¶������-���vendor/symfony/console/Helper/TableHelper.php ��Y
  301. ÎV ��¦pm‡¶������0���vendor/symfony/console/Helper/TableSeparator.phpÎ���Y
  302. ÎVÎ���<f;£¶������,���vendor/symfony/console/Helper/TableStyle.php
  303. ��Y
  304. ÎV
  305. ��PÞµ¦¶������*���vendor/symfony/console/Input/ArgvInput.php��Y
  306. ÎV��ä�~å¶������+���vendor/symfony/console/Input/ArrayInput.phpp
  307. ��Y
  308. ÎVp
  309. ��Õ¤¾¶������&���vendor/symfony/console/Input/Input.phpÔ ��Y
  310. ÎVÔ ��ä ñ¶������.���vendor/symfony/console/Input/InputArgument.php��Y
  311. ÎV��ÁÜ�¶������4���vendor/symfony/console/Input/InputAwareInterface.phpš���Y
  312. ÎVš���‡jTŸ¶������0���vendor/symfony/console/Input/InputDefinition.php“��Y
  313. ÎV“��Éÿÿã¶������/���vendor/symfony/console/Input/InputInterface.php ��Y
  314. ÎV ��9”øǶ������,���vendor/symfony/console/Input/InputOption.php ��Y
  315. ÎV ��‡¹§¶������,���vendor/symfony/console/Input/StringInput.php˜��Y
  316. ÎV˜�� Ú¤¶���������vendor/symfony/console/LICENSE)��Y
  317. ÎV)��¹ô¶������/���vendor/symfony/console/Logger/ConsoleLogger.php< ��Y
  318. ÎV< ��:âÇl¶������0���vendor/symfony/console/Output/BufferedOutput.php_��Y
  319. ÎV_��ûBÍ·¶������/���vendor/symfony/console/Output/ConsoleOutput.phpµ��Y
  320. ÎVµ��
  321. ¢S\¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpå���Y
  322. ÎVå���rNô�¶������,���vendor/symfony/console/Output/NullOutput.phpÃ��Y
  323. ÎVÃ��ZÅl¶������(���vendor/symfony/console/Output/Output.phpŽ ��Y
  324. ÎVŽ ��x:l¥¶������1���vendor/symfony/console/Output/OutputInterface.php��Y
  325. ÎV��ÓÚ>¶������.���vendor/symfony/console/Output/StreamOutput.php7��Y
  326. ÎV7��iCœ¶������2���vendor/symfony/console/Question/ChoiceQuestion.phpÝ ��Y
  327. ÎVÝ ��°§Â¶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpé��Y
  328. ÎVé��ƒQ@¶������,���vendor/symfony/console/Question/Question.php
  329. ��Y
  330. ÎV
  331. ���{¶������ ���vendor/symfony/console/Shell.phpé��Y
  332. ÎVé��½fü‘¶������,���vendor/symfony/console/Style/OutputStyle.php_��Y
  333. ÎV_��ûµ¶������/���vendor/symfony/console/Style/StyleInterface.phpÔ��Y
  334. ÎVÔ�� ßÊj¶������-���vendor/symfony/console/Style/SymfonyStyle.phpE��Y
  335. ÎVE���72¶������3���vendor/symfony/console/Tester/ApplicationTester.phpÔ��Y
  336. ÎVÔ��¬ì¤d¶������/���vendor/symfony/console/Tester/CommandTester.php®��Y
  337. ÎV®��EÙš|¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���Y
  338. ÎVi���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��Y
  339. ÎV¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��Y
  340. ÎV‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���Y
  341. ÎV¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.php@+��Y
  342. ÎV@+��­»ç¶������!���vendor/symfony/filesystem/LICENSE)��Y
  343. ÎV)��¹ô¶������)���vendor/symfony/filesystem/LockHandler.php���Y
  344. ÎV���f÷#ƒ¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��Y
  345. ÎV\ ��Æ“É€¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php™��Y
  346. ÎV™��p\Z3¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php±��Y
  347. ÎV±��ä»Ê&¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php2��Y
  348. ÎV2��Q/ÇC¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��Y
  349. ÎV�� ¡¾¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��Y
  350. ÎVô��:?¶������/���vendor/symfony/finder/Comparator/Comparator.phpŒ��Y
  351. ÎVŒ��wþT¶������3���vendor/symfony/finder/Comparator/DateComparator.php%��Y
  352. ÎV%��L¿EǶ������5���vendor/symfony/finder/Comparator/NumberComparator.php~��Y
  353. ÎV~��”‡ x¶������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���Y
  354. ÎV„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¯��Y
  355. ÎV¯��œôÔÁ¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���Y
  356. ÎV„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��Y
  357. ÎV)��ìcj=¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpÂ��Y
  358. ÎVÂ��v‚ȶ������/���vendor/symfony/finder/Expression/Expression.php��Y
  359. ÎV��µoÔ¶������)���vendor/symfony/finder/Expression/Glob.phpi��Y
  360. ÎVi��@Šº¶������*���vendor/symfony/finder/Expression/Regex.php��Y
  361. ÎV��p8�\¶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��Y
  362. ÎVÍ��²~øb¶������ ���vendor/symfony/finder/Finder.phpÂ-��Y
  363. ÎVÂ-��˜f´¶���������vendor/symfony/finder/Glob.php4��Y
  364. ÎV4��°Ba³¶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��Y
  365. ÎV]��tà±µ¶������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpz��Y
  366. ÎVz��}¢¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpð��Y
  367. ÎVð��ß0™¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpÊ��Y
  368. ÎVÊ���96†¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php ��Y
  369. ÎV ��fQCe¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.php\��Y
  370. ÎV\��p‘'˜¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��Y
  371. ÎV5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��Y
  372. ÎVr��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.php†��Y
  373. ÎV†��0£¾Ô¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php/��Y
  374. ÎV/��»ÇY¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÏ��Y
  375. ÎVÏ��ºªÇ¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.phpw��Y
  376. ÎVw��op›¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpg��Y
  377. ÎVg��!Ô—é¶������3���vendor/symfony/finder/Iterator/SortableIterator.phpØ��Y
  378. ÎVØ��`‹>c¶���������vendor/symfony/finder/LICENSE)��Y
  379. ÎV)��¹ô¶������'���vendor/symfony/finder/Shell/Command.phpS ��Y
  380. ÎVS ��cC…™¶������%���vendor/symfony/finder/Shell/Shell.phpp��Y
  381. ÎVp��Ó}g¶������%���vendor/symfony/finder/SplFileInfo.phpû��Y
  382. ÎVû��‘†6¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��Y
  383. ÎV)��î*L¶������-���vendor/symfony/polyfill-mbstring/Mbstring.php50��Y
  384. ÎV50��ŠA�º¶������.���vendor/symfony/polyfill-mbstring/bootstrap.phpo��Y
  385. ÎVo��c×5¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���Y
  386. ÎVf���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���Y
  387. ÎV¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���Y
  388. ÎV”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��Y
  389. ÎVx��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��Y
  390. ÎV��. Ãá¶������5���vendor/symfony/process/Exception/RuntimeException.php˜���Y
  391. ÎV˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php���Y
  392. ÎV���ò)åܶ���������vendor/symfony/process/LICENSE)��Y
  393. ÎV)��¹ô¶������.���vendor/symfony/process/PhpExecutableFinder.phpg��Y
  394. ÎVg���絶������%���vendor/symfony/process/PhpProcess.phpü��Y
  395. ÎVü��_—9¶������.���vendor/symfony/process/Pipes/AbstractPipes.php���Y
  396. ÎV���˜|¥¾¶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��Y
  397. ÎVD��vØ������*���vendor/symfony/process/Pipes/UnixPipes.php¤ ��Y
  398. ÎV¤ ��øUt¶������-���vendor/symfony/process/Pipes/WindowsPipes.php���Y
  399. ÎV���–)¾n¶������"���vendor/symfony/process/Process.phpQ��Y
  400. ÎVQ��Z¬˶������)���vendor/symfony/process/ProcessBuilder.php ��Y
  401. ÎV ��„8<²¶������'���vendor/symfony/process/ProcessUtils.php��Y
  402. ÎV��^ܲ"¶���������vendor/seld/jsonlint/LICENSE"��Y
  403. ÎV"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��Y
  404. ÎV*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php“1��Y
  405. ÎV“1���P¦¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��Y
  406. ÎV��‰„m!¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��Y
  407. ÎV��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���Y
  408. ÎV>���ÿqŸŸ¶���������vendor/seld/cli-prompt/LICENSE"��Y
  409. ÎV"��ˆñ?e¶������&���vendor/seld/cli-prompt/res/example.php'��Y
  410. ÎV'��I£¶������(���vendor/seld/cli-prompt/src/CliPrompt.php��Y
  411. ÎV��­é™v¶������(���vendor/justinrainbow/json-schema/LICENSE÷��Y
  412. ÎV÷��xÞxt¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.phpù ��Y
  413. ÎVù ��ð&•Ø¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php›��Y
  414. ÎV›��˜‘(c¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.phpr��Y
  415. ÎVr��ã{s6¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.phpx��Y
  416. ÎVx��ÒÙ‘¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php€��Y
  417. ÎV€��£C¯¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php—��Y
  418. ÎV—��rÙ‚¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php�
  419. ��Y
  420. ÎV�
  421. ��½K¸‰¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÙ ��Y
  422. ÎVÙ ��ÆA€r¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php ��Y
  423. ÎV ��ÈÌÕâ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.phpQ��Y
  424. ÎVQ��xÐø¼¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.phpÆ��Y
  425. ÎVÆ��ÜòÚŠ¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpç��Y
  426. ÎVç��^�gÓ¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.phpv���Y
  427. ÎVv���¬ «"¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpv���Y
  428. ÎVv���ŠCÓ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���Y
  429. ÎVw���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��Y
  430. ÎVÞ��†¾©‘¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���Y
  431. ÎVo���Æ$"Ŷ������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���Y
  432. ÎVj���SÓdz¶������?���vendor/justinrainbow/json-schema/src/JsonSchema/RefResolver.phpÒ ��Y
  433. ÎVÒ ��K$ ¤¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpÜ���Y
  434. ÎVÜ���]j¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.phpt��Y
  435. ÎVt��I·ý�¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.phpb��Y
  436. ÎVb��WýÁ¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php*��Y
  437. ÎV*��-3ÿ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php©���Y
  438. ÎV©���CO¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.phpR ��Y
  439. ÎVR ��pÿi1¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpa��Y
  440. ÎVa��¾,Η¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpÛ��Y
  441. ÎVÛ�� zD4¶������%���vendor/composer/spdx-licenses/LICENSE��Y
  442. ÎV��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpå��Y
  443. ÎVå��=Ø7¶���������vendor/composer/semver/LICENSE��Y
  444. ÎV��Bhí¶������)���vendor/composer/semver/src/Comparator.php��Y
  445. ÎV��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.php×��Y
  446. ÎV×��õî>Ž¶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��Y
  447. ÎVª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���Y
  448. ÎVß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��Y
  449. ÎVé��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.phpf��Y
  450. ÎVf��Dðì>¶������%���vendor/composer/semver/src/Semver.phpv��Y
  451. ÎVv��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php<(��Y
  452. ÎV<(��ˆ‰Sx¶���������vendor/autoload.php‡���Y
  453. ÎV‡���ÎÅhp¶������'���vendor/composer/autoload_namespaces.phpd���Y
  454. ÎVd���Z¡¦H¶������!���vendor/composer/autoload_psr4.phpÐ��Y
  455. ÎVÐ�� ÿ®Œ¶������%���vendor/composer/autoload_classmap.phpd���Y
  456. ÎVd���Z¡¦H¶������"���vendor/composer/autoload_files.phpÃ���Y
  457. ÎVÃ���ÒÂür¶������!���vendor/composer/autoload_real.php€��Y
  458. ÎV€��Àº,´¶���������vendor/composer/ClassLoader.phpB��Y
  459. ÎVB��é”í¶���������res/cacert.pemé�Y
  460. ÎVé�íŠÀ¶������ ���bin/composerl��Y
  461. ÎVl��Ԛà ¶���������LICENSE3��Y
  462. ÎV3��fýÞX¶������<?php
  463. namespace Composer\Autoload;
  464. use Composer\Config;
  465. use Composer\EventDispatcher\EventDispatcher;
  466. use Composer\Installer\InstallationManager;
  467. use Composer\IO\IOInterface;
  468. use Composer\Package\AliasPackage;
  469. use Composer\Package\PackageInterface;
  470. use Composer\Repository\InstalledRepositoryInterface;
  471. use Composer\Util\Filesystem;
  472. use Composer\Script\ScriptEvents;
  473. class AutoloadGenerator
  474. {
  475. private $eventDispatcher;
  476. private $io;
  477. private $devMode = false;
  478. private $classMapAuthoritative = false;
  479. private $runScripts = false;
  480. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  481. {
  482. $this->eventDispatcher = $eventDispatcher;
  483. $this->io = $io;
  484. }
  485. public function setDevMode($devMode = true)
  486. {
  487. $this->devMode = (boolean) $devMode;
  488. }
  489. public function setClassMapAuthoritative($classMapAuthoritative)
  490. {
  491. $this->classMapAuthoritative = (boolean) $classMapAuthoritative;
  492. }
  493. public function setRunScripts($runScripts = true)
  494. {
  495. $this->runScripts = (boolean) $runScripts;
  496. }
  497. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  498. {
  499. if ($this->classMapAuthoritative) {
  500. $scanPsr0Packages = true;
  501. }
  502. if ($this->runScripts) {
  503. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  504. 'optimize' => (bool) $scanPsr0Packages,
  505. ));
  506. }
  507. $filesystem = new Filesystem();
  508. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  509. $basePath = $filesystem->normalizePath(realpath(getcwd()));
  510. $vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir')));
  511. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  512. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  513. $targetDir = $vendorPath.'/'.$targetDir;
  514. $filesystem->ensureDirectoryExists($targetDir);
  515. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  516. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  517. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  518. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  519. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  520. $namespacesFile = <<<EOF
  521. <?php
  522. // autoload_namespaces.php @generated by Composer
  523. \$vendorDir = $vendorPathCode52;
  524. \$baseDir = $appBaseDirCode;
  525. return array(
  526. EOF;
  527. $psr4File = <<<EOF
  528. <?php
  529. // autoload_psr4.php @generated by Composer
  530. \$vendorDir = $vendorPathCode52;
  531. \$baseDir = $appBaseDirCode;
  532. return array(
  533. EOF;
  534. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  535. $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
  536. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  537. $exportedPaths = array();
  538. foreach ($paths as $path) {
  539. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  540. }
  541. $exportedPrefix = var_export($namespace, true);
  542. $namespacesFile .= " $exportedPrefix => ";
  543. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  544. }
  545. $namespacesFile .= ");\n";
  546. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  547. $exportedPaths = array();
  548. foreach ($paths as $path) {
  549. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  550. }
  551. $exportedPrefix = var_export($namespace, true);
  552. $psr4File .= " $exportedPrefix => ";
  553. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  554. }
  555. $psr4File .= ");\n";
  556. $classmapFile = <<<EOF
  557. <?php
  558. // autoload_classmap.php @generated by Composer
  559. \$vendorDir = $vendorPathCode52;
  560. \$baseDir = $appBaseDirCode;
  561. return array(
  562. EOF;
  563. $targetDirLoader = null;
  564. $mainAutoload = $mainPackage->getAutoload();
  565. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  566. $levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
  567. $prefixes = implode(', ', array_map(function ($prefix) {
  568. return var_export($prefix, true);
  569. }, array_keys($mainAutoload['psr-0'])));
  570. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  571. $targetDirLoader = <<<EOF
  572. public static function autoload(\$class)
  573. {
  574. \$dir = $baseDirFromTargetDirCode . '/';
  575. \$prefixes = array($prefixes);
  576. foreach (\$prefixes as \$prefix) {
  577. if (0 !== strpos(\$class, \$prefix)) {
  578. continue;
  579. }
  580. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  581. if (!\$path = stream_resolve_include_path(\$path)) {
  582. return false;
  583. }
  584. require \$path;
  585. return true;
  586. }
  587. }
  588. EOF;
  589. }
  590. $blacklist = null;
  591. if (!empty($autoloads['exclude-from-classmap'])) {
  592. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  593. }
  594. $classMap = array();
  595. if ($scanPsr0Packages) {
  596. $namespacesToScan = array();
  597. foreach (array('psr-0', 'psr-4') as $psrType) {
  598. foreach ($autoloads[$psrType] as $namespace => $paths) {
  599. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  600. }
  601. }
  602. krsort($namespacesToScan);
  603. foreach ($namespacesToScan as $namespace => $groups) {
  604. foreach ($groups as $group) {
  605. $psrType = $group['type'];
  606. foreach ($group['paths'] as $dir) {
  607. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  608. if (!is_dir($dir)) {
  609. continue;
  610. }
  611. $namespaceFilter = $namespace === '' ? null : $namespace;
  612. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  613. }
  614. }
  615. }
  616. }
  617. foreach ($autoloads['classmap'] as $dir) {
  618. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  619. }
  620. ksort($classMap);
  621. foreach ($classMap as $class => $code) {
  622. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  623. }
  624. $classmapFile .= ");\n";
  625. if (!$suffix) {
  626. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  627. $content = file_get_contents($vendorPath.'/autoload.php');
  628. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  629. $suffix = $match[1];
  630. }
  631. }
  632. if (!$suffix) {
  633. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  634. }
  635. }
  636. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  637. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  638. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  639. $includePathFilePath = $targetDir.'/include_paths.php';
  640. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  641. file_put_contents($includePathFilePath, $includePathFileContents);
  642. } elseif (file_exists($includePathFilePath)) {
  643. unlink($includePathFilePath);
  644. }
  645. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  646. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  647. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  648. } elseif (file_exists($includeFilesFilePath)) {
  649. unlink($includeFilesFilePath);
  650. }
  651. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  652. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader));
  653. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  654. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  655. if ($this->runScripts) {
  656. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  657. 'optimize' => (bool) $scanPsr0Packages,
  658. ));
  659. }
  660. }
  661. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  662. {
  663. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  664. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  665. if (!isset($classMap[$class])) {
  666. $classMap[$class] = $pathCode;
  667. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  668. $this->io->writeError(
  669. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  670. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  671. );
  672. }
  673. }
  674. return $classMap;
  675. }
  676. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  677. {
  678. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  679. }
  680. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  681. {
  682. $packageMap = array(array($mainPackage, ''));
  683. foreach ($packages as $package) {
  684. if ($package instanceof AliasPackage) {
  685. continue;
  686. }
  687. $this->validatePackage($package);
  688. $packageMap[] = array(
  689. $package,
  690. $installationManager->getInstallPath($package),
  691. );
  692. }
  693. return $packageMap;
  694. }
  695. protected function validatePackage(PackageInterface $package)
  696. {
  697. $autoload = $package->getAutoload();
  698. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  699. $name = $package->getName();
  700. $package->getTargetDir();
  701. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  702. }
  703. if (!empty($autoload['psr-4'])) {
  704. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  705. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  706. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  707. }
  708. }
  709. }
  710. }
  711. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage)
  712. {
  713. $mainPackageMap = array_shift($packageMap);
  714. $sortedPackageMap = $this->sortPackageMap($packageMap);
  715. $sortedPackageMap[] = $mainPackageMap;
  716. array_unshift($packageMap, $mainPackageMap);
  717. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  718. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  719. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  720. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  721. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  722. krsort($psr0);
  723. krsort($psr4);
  724. return array(
  725. 'psr-0' => $psr0,
  726. 'psr-4' => $psr4,
  727. 'classmap' => $classmap,
  728. 'files' => $files,
  729. 'exclude-from-classmap' => $exclude,
  730. );
  731. }
  732. public function createLoader(array $autoloads)
  733. {
  734. $loader = new ClassLoader();
  735. if (isset($autoloads['psr-0'])) {
  736. foreach ($autoloads['psr-0'] as $namespace => $path) {
  737. $loader->add($namespace, $path);
  738. }
  739. }
  740. if (isset($autoloads['psr-4'])) {
  741. foreach ($autoloads['psr-4'] as $namespace => $path) {
  742. $loader->addPsr4($namespace, $path);
  743. }
  744. }
  745. if (isset($autoloads['classmap'])) {
  746. foreach ($autoloads['classmap'] as $dir) {
  747. try {
  748. $loader->addClassMap($this->generateClassMap($dir, null, null, false));
  749. } catch (\RuntimeException $e) {
  750. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  751. }
  752. }
  753. }
  754. return $loader;
  755. }
  756. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  757. {
  758. $includePaths = array();
  759. foreach ($packageMap as $item) {
  760. list($package, $installPath) = $item;
  761. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  762. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  763. }
  764. foreach ($package->getIncludePaths() as $includePath) {
  765. $includePath = trim($includePath, '/');
  766. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  767. }
  768. }
  769. if (!$includePaths) {
  770. return;
  771. }
  772. $includePathsCode = '';
  773. foreach ($includePaths as $path) {
  774. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  775. }
  776. return <<<EOF
  777. <?php
  778. // include_paths.php @generated by Composer
  779. \$vendorDir = $vendorPathCode;
  780. \$baseDir = $appBaseDirCode;
  781. return array(
  782. $includePathsCode);
  783. EOF;
  784. }
  785. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  786. {
  787. $filesCode = '';
  788. foreach ($files as $fileIdentifier => $functionFile) {
  789. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  790. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  791. }
  792. if (!$filesCode) {
  793. return false;
  794. }
  795. return <<<EOF
  796. <?php
  797. // autoload_files.php @generated by Composer
  798. \$vendorDir = $vendorPathCode;
  799. \$baseDir = $appBaseDirCode;
  800. return array(
  801. $filesCode);
  802. EOF;
  803. }
  804. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  805. {
  806. if (!$filesystem->isAbsolutePath($path)) {
  807. $path = $basePath . '/' . $path;
  808. }
  809. $path = $filesystem->normalizePath($path);
  810. $baseDir = '';
  811. if (strpos($path.'/', $vendorPath.'/') === 0) {
  812. $path = substr($path, strlen($vendorPath));
  813. $baseDir = '$vendorDir';
  814. if ($path !== false) {
  815. $baseDir .= " . ";
  816. }
  817. } else {
  818. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  819. if (!$filesystem->isAbsolutePath($path)) {
  820. $baseDir = '$baseDir . ';
  821. $path = '/' . $path;
  822. }
  823. }
  824. if (preg_match('/\.phar$/', $path)) {
  825. $baseDir = "'phar://' . " . $baseDir;
  826. }
  827. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  828. }
  829. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  830. {
  831. return <<<AUTOLOAD
  832. <?php
  833. // autoload.php @generated by Composer
  834. require_once $vendorPathToTargetDirCode . '/autoload_real.php';
  835. return ComposerAutoloaderInit$suffix::getLoader();
  836. AUTOLOAD;
  837. }
  838. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader)
  839. {
  840. $file = <<<HEADER
  841. <?php
  842. // autoload_real.php @generated by Composer
  843. class ComposerAutoloaderInit$suffix
  844. {
  845. private static \$loader;
  846. public static function loadClassLoader(\$class)
  847. {
  848. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  849. require __DIR__ . '/ClassLoader.php';
  850. }
  851. }
  852. public static function getLoader()
  853. {
  854. if (null !== self::\$loader) {
  855. return self::\$loader;
  856. }
  857. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  858. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  859. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  860. HEADER;
  861. if ($useIncludePath) {
  862. $file .= <<<'INCLUDE_PATH'
  863. $includePaths = require __DIR__ . '/include_paths.php';
  864. array_push($includePaths, get_include_path());
  865. set_include_path(join(PATH_SEPARATOR, $includePaths));
  866. INCLUDE_PATH;
  867. }
  868. if (!$this->classMapAuthoritative) {
  869. $file .= <<<'PSR04'
  870. $map = require __DIR__ . '/autoload_namespaces.php';
  871. foreach ($map as $namespace => $path) {
  872. $loader->set($namespace, $path);
  873. }
  874. $map = require __DIR__ . '/autoload_psr4.php';
  875. foreach ($map as $namespace => $path) {
  876. $loader->setPsr4($namespace, $path);
  877. }
  878. PSR04;
  879. }
  880. if ($useClassMap) {
  881. $file .= <<<'CLASSMAP'
  882. $classMap = require __DIR__ . '/autoload_classmap.php';
  883. if ($classMap) {
  884. $loader->addClassMap($classMap);
  885. }
  886. CLASSMAP;
  887. }
  888. if ($this->classMapAuthoritative) {
  889. $file .= <<<'CLASSMAPAUTHORITATIVE'
  890. $loader->setClassMapAuthoritative(true);
  891. CLASSMAPAUTHORITATIVE;
  892. }
  893. if ($useGlobalIncludePath) {
  894. $file .= <<<'INCLUDEPATH'
  895. $loader->setUseIncludePath(true);
  896. INCLUDEPATH;
  897. }
  898. if ($targetDirLoader) {
  899. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  900. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  901. REGISTER_TARGET_DIR_AUTOLOAD;
  902. }
  903. $file .= <<<REGISTER_LOADER
  904. \$loader->register($prependAutoloader);
  905. REGISTER_LOADER;
  906. if ($useIncludeFiles) {
  907. $file .= <<<INCLUDE_FILES
  908. \$includeFiles = require __DIR__ . '/autoload_files.php';
  909. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  910. composerRequire$suffix(\$fileIdentifier, \$file);
  911. }
  912. INCLUDE_FILES;
  913. }
  914. $file .= <<<METHOD_FOOTER
  915. return \$loader;
  916. }
  917. METHOD_FOOTER;
  918. $file .= $targetDirLoader;
  919. if ($useIncludeFiles) {
  920. return $file . <<<FOOTER
  921. }
  922. function composerRequire$suffix(\$fileIdentifier, \$file)
  923. {
  924. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  925. require \$file;
  926. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  927. }
  928. }
  929. FOOTER;
  930. }
  931. return $file . <<<FOOTER
  932. }
  933. FOOTER;
  934. }
  935. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  936. {
  937. $autoloads = array();
  938. foreach ($packageMap as $item) {
  939. list($package, $installPath) = $item;
  940. $autoload = $package->getAutoload();
  941. if ($this->devMode && $package === $mainPackage) {
  942. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  943. }
  944. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  945. continue;
  946. }
  947. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  948. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  949. }
  950. foreach ($autoload[$type] as $namespace => $paths) {
  951. foreach ((array) $paths as $path) {
  952. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  953. if ($package === $mainPackage) {
  954. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  955. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  956. } else {
  957. $path = $package->getTargetDir() . '/' . $path;
  958. }
  959. }
  960. if ($type === 'exclude-from-classmap') {
  961. $path = preg_quote(trim(strtr($path, '\\', '/'), '/'));
  962. $path = str_replace('\\*\\*', '.+?', $path);
  963. $path = str_replace('\\*', '[^/]+?', $path);
  964. $updir = null;
  965. $path = preg_replace_callback(
  966. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  967. function ($matches) use (&$updir) {
  968. if (isset($matches[1])) {
  969. $updir = str_replace('\\.', '.', $matches[1]);
  970. }
  971. return '';
  972. },
  973. $path
  974. );
  975. if (empty($installPath)) {
  976. $installPath = strtr(getcwd(), '\\', '/');
  977. }
  978. $resolvedPath = realpath($installPath . '/' . $updir);
  979. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  980. continue;
  981. }
  982. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  983. if ($type === 'files') {
  984. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  985. continue;
  986. } elseif ($type === 'classmap') {
  987. $autoloads[] = $relativePath;
  988. continue;
  989. }
  990. $autoloads[$namespace][] = $relativePath;
  991. }
  992. }
  993. }
  994. return $autoloads;
  995. }
  996. protected function getFileIdentifier(PackageInterface $package, $path)
  997. {
  998. return md5($package->getName() . ':' . $path);
  999. }
  1000. protected function sortPackageMap(array $packageMap)
  1001. {
  1002. $packages = array();
  1003. $paths = array();
  1004. $usageList = array();
  1005. foreach ($packageMap as $item) {
  1006. list($package, $path) = $item;
  1007. $name = $package->getName();
  1008. $packages[$name] = $package;
  1009. $paths[$name] = $path;
  1010. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  1011. $target = $link->getTarget();
  1012. $usageList[$target][] = $name;
  1013. }
  1014. }
  1015. $computing = array();
  1016. $computed = array();
  1017. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  1018. if (isset($computed[$name])) {
  1019. return $computed[$name];
  1020. }
  1021. if (isset($computing[$name])) {
  1022. return 0;
  1023. }
  1024. $computing[$name] = true;
  1025. $weight = 0;
  1026. if (isset($usageList[$name])) {
  1027. foreach ($usageList[$name] as $user) {
  1028. $weight -= 1 - $computeImportance($user);
  1029. }
  1030. }
  1031. unset($computing[$name]);
  1032. $computed[$name] = $weight;
  1033. return $weight;
  1034. };
  1035. $weightList = array();
  1036. foreach ($packages as $name => $package) {
  1037. $weight = $computeImportance($name);
  1038. $weightList[$name] = $weight;
  1039. }
  1040. $stable_sort = function (&$array) {
  1041. static $transform, $restore;
  1042. $i = 0;
  1043. if (!$transform) {
  1044. $transform = function (&$v, $k) use (&$i) {
  1045. $v = array($v, ++$i, $k, $v);
  1046. };
  1047. $restore = function (&$v, $k) {
  1048. $v = $v[3];
  1049. };
  1050. }
  1051. array_walk($array, $transform);
  1052. asort($array);
  1053. array_walk($array, $restore);
  1054. };
  1055. $stable_sort($weightList);
  1056. $sortedPackageMap = array();
  1057. foreach (array_keys($weightList) as $name) {
  1058. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  1059. }
  1060. return $sortedPackageMap;
  1061. }
  1062. protected function safeCopy($source, $target)
  1063. {
  1064. $source = fopen($source, 'r');
  1065. $target = fopen($target, 'w+');
  1066. stream_copy_to_stream($source, $target);
  1067. fclose($source);
  1068. fclose($target);
  1069. }
  1070. }
  1071. <?php
  1072. namespace Composer\Autoload;
  1073. use Composer\Util\Silencer;
  1074. use Symfony\Component\Finder\Finder;
  1075. use Composer\IO\IOInterface;
  1076. class ClassMapGenerator
  1077. {
  1078. public static function dump($dirs, $file)
  1079. {
  1080. $maps = array();
  1081. foreach ($dirs as $dir) {
  1082. $maps = array_merge($maps, static::createMap($dir));
  1083. }
  1084. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  1085. }
  1086. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  1087. {
  1088. if (is_string($path)) {
  1089. if (is_file($path)) {
  1090. $path = array(new \SplFileInfo($path));
  1091. } elseif (is_dir($path)) {
  1092. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  1093. } else {
  1094. throw new \RuntimeException(
  1095. 'Could not scan for classes inside "'.$path.
  1096. '" which does not appear to be a file nor a folder'
  1097. );
  1098. }
  1099. }
  1100. $map = array();
  1101. foreach ($path as $file) {
  1102. $filePath = $file->getRealPath();
  1103. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  1104. continue;
  1105. }
  1106. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  1107. continue;
  1108. }
  1109. $classes = self::findClasses($filePath);
  1110. foreach ($classes as $class) {
  1111. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  1112. continue;
  1113. }
  1114. if (!isset($map[$class])) {
  1115. $map[$class] = $filePath;
  1116. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  1117. $io->writeError(
  1118. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  1119. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  1120. );
  1121. }
  1122. }
  1123. }
  1124. return $map;
  1125. }
  1126. private static function findClasses($path)
  1127. {
  1128. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  1129. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  1130. $extraTypes .= '|enum';
  1131. }
  1132. $contents = @php_strip_whitespace($path);
  1133. if (!$contents) {
  1134. if (!file_exists($path)) {
  1135. $message = 'File at "%s" does not exist, check your classmap definitions';
  1136. } elseif (!is_readable($path)) {
  1137. $message = 'File at "%s" is not readable, check its permissions';
  1138. } elseif ('' === trim(file_get_contents($path))) {
  1139. return array();
  1140. } else {
  1141. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  1142. }
  1143. $error = error_get_last();
  1144. if (isset($error['message'])) {
  1145. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  1146. }
  1147. throw new \RuntimeException(sprintf($message, $path));
  1148. }
  1149. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  1150. return array();
  1151. }
  1152. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  1153. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  1154. if (substr($contents, 0, 2) !== '<?') {
  1155. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  1156. if ($replacements === 0) {
  1157. return array();
  1158. }
  1159. }
  1160. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  1161. $pos = strrpos($contents, '?>');
  1162. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  1163. $contents = substr($contents, 0, $pos);
  1164. }
  1165. preg_match_all('{
  1166. (?:
  1167. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  1168. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  1169. )
  1170. }ix', $contents, $matches);
  1171. $classes = array();
  1172. $namespace = '';
  1173. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  1174. if (!empty($matches['ns'][$i])) {
  1175. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  1176. } else {
  1177. $name = $matches['name'][$i];
  1178. if ($name[0] === ':') {
  1179. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  1180. } elseif ($matches['type'][$i] === 'enum') {
  1181. $name = rtrim($name, ':');
  1182. }
  1183. $classes[] = ltrim($namespace . $name, '\\');
  1184. }
  1185. }
  1186. return $classes;
  1187. }
  1188. }
  1189. <?php
  1190. namespace Composer;
  1191. use Composer\IO\IOInterface;
  1192. use Composer\Util\Filesystem;
  1193. use Composer\Util\Silencer;
  1194. use Symfony\Component\Finder\Finder;
  1195. class Cache
  1196. {
  1197. private static $cacheCollected = false;
  1198. private $io;
  1199. private $root;
  1200. private $enabled = true;
  1201. private $whitelist;
  1202. private $filesystem;
  1203. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  1204. {
  1205. $this->io = $io;
  1206. $this->root = rtrim($cacheDir, '/\\') . '/';
  1207. $this->whitelist = $whitelist;
  1208. $this->filesystem = $filesystem ?: new Filesystem();
  1209. if (
  1210. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  1211. || !is_writable($this->root)
  1212. ) {
  1213. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  1214. $this->enabled = false;
  1215. }
  1216. }
  1217. public function isEnabled()
  1218. {
  1219. return $this->enabled;
  1220. }
  1221. public function getRoot()
  1222. {
  1223. return $this->root;
  1224. }
  1225. public function read($file)
  1226. {
  1227. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1228. if ($this->enabled && file_exists($this->root . $file)) {
  1229. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1230. return file_get_contents($this->root . $file);
  1231. }
  1232. return false;
  1233. }
  1234. public function write($file, $contents)
  1235. {
  1236. if ($this->enabled) {
  1237. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1238. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  1239. try {
  1240. return file_put_contents($this->root . $file, $contents);
  1241. } catch (\ErrorException $e) {
  1242. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  1243. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  1244. unlink($this->root . $file);
  1245. $message = sprintf(
  1246. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  1247. $this->root . $file,
  1248. $m[1],
  1249. $m[2],
  1250. @disk_free_space($this->root . dirname($file))
  1251. );
  1252. $this->io->writeError($message);
  1253. return false;
  1254. }
  1255. throw $e;
  1256. }
  1257. }
  1258. return false;
  1259. }
  1260. public function copyFrom($file, $source)
  1261. {
  1262. if ($this->enabled) {
  1263. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1264. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1265. if (!file_exists($source)) {
  1266. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1267. } elseif ($this->io->isDebug()) {
  1268. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1269. }
  1270. return copy($source, $this->root . $file);
  1271. }
  1272. return false;
  1273. }
  1274. public function copyTo($file, $target)
  1275. {
  1276. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1277. if ($this->enabled && file_exists($this->root . $file)) {
  1278. try {
  1279. touch($this->root . $file, filemtime($this->root . $file), time());
  1280. } catch (\ErrorException $e) {
  1281. Silencer::call('touch', $this->root . $file);
  1282. }
  1283. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1284. return copy($this->root . $file, $target);
  1285. }
  1286. return false;
  1287. }
  1288. public function gcIsNecessary()
  1289. {
  1290. return (!self::$cacheCollected && !mt_rand(0, 50));
  1291. }
  1292. public function remove($file)
  1293. {
  1294. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1295. if ($this->enabled && file_exists($this->root . $file)) {
  1296. return $this->filesystem->unlink($this->root . $file);
  1297. }
  1298. return false;
  1299. }
  1300. public function gc($ttl, $maxSize)
  1301. {
  1302. if ($this->enabled) {
  1303. $expire = new \DateTime();
  1304. $expire->modify('-'.$ttl.' seconds');
  1305. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1306. foreach ($finder as $file) {
  1307. $this->filesystem->unlink($file->getPathname());
  1308. }
  1309. $totalSize = $this->filesystem->size($this->root);
  1310. if ($totalSize > $maxSize) {
  1311. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1312. while ($totalSize > $maxSize && $iterator->valid()) {
  1313. $filepath = $iterator->current()->getPathname();
  1314. $totalSize -= $this->filesystem->size($filepath);
  1315. $this->filesystem->unlink($filepath);
  1316. $iterator->next();
  1317. }
  1318. }
  1319. self::$cacheCollected = true;
  1320. return true;
  1321. }
  1322. return false;
  1323. }
  1324. public function sha1($file)
  1325. {
  1326. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1327. if ($this->enabled && file_exists($this->root . $file)) {
  1328. return sha1_file($this->root . $file);
  1329. }
  1330. return false;
  1331. }
  1332. public function sha256($file)
  1333. {
  1334. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1335. if ($this->enabled && file_exists($this->root . $file)) {
  1336. return hash_file('sha256', $this->root . $file);
  1337. }
  1338. return false;
  1339. }
  1340. protected function getFinder()
  1341. {
  1342. return Finder::create()->in($this->root)->files();
  1343. }
  1344. }
  1345. <?php
  1346. namespace Composer\Command;
  1347. use Symfony\Component\Console\Input\InputInterface;
  1348. use Symfony\Component\Console\Output\OutputInterface;
  1349. class AboutCommand extends BaseCommand
  1350. {
  1351. protected function configure()
  1352. {
  1353. $this
  1354. ->setName('about')
  1355. ->setDescription('Short information about Composer')
  1356. ->setHelp(<<<EOT
  1357. <info>php composer.phar about</info>
  1358. EOT
  1359. )
  1360. ;
  1361. }
  1362. protected function execute(InputInterface $input, OutputInterface $output)
  1363. {
  1364. $this->getIO()->write(<<<EOT
  1365. <info>Composer - Package Management for PHP</info>
  1366. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1367. See https://getcomposer.org/ for more information.</comment>
  1368. EOT
  1369. );
  1370. }
  1371. }
  1372. <?php
  1373. namespace Composer\Command;
  1374. use Composer\Factory;
  1375. use Composer\IO\IOInterface;
  1376. use Composer\Config;
  1377. use Composer\Repository\CompositeRepository;
  1378. use Composer\Script\ScriptEvents;
  1379. use Composer\Plugin\CommandEvent;
  1380. use Composer\Plugin\PluginEvents;
  1381. use Composer\Util\Filesystem;
  1382. use Symfony\Component\Console\Input\InputArgument;
  1383. use Symfony\Component\Console\Input\InputInterface;
  1384. use Symfony\Component\Console\Input\InputOption;
  1385. use Symfony\Component\Console\Output\OutputInterface;
  1386. class ArchiveCommand extends BaseCommand
  1387. {
  1388. protected function configure()
  1389. {
  1390. $this
  1391. ->setName('archive')
  1392. ->setDescription('Create an archive of this composer package')
  1393. ->setDefinition(array(
  1394. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1395. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1396. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1397. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1398. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1399. .' Note that the format will be appended.'),
  1400. ))
  1401. ->setHelp(<<<EOT
  1402. The <info>archive</info> command creates an archive of the specified format
  1403. containing the files and directories of the Composer project or the specified
  1404. package in the specified version and writes it to the specified directory.
  1405. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1406. EOT
  1407. )
  1408. ;
  1409. }
  1410. protected function execute(InputInterface $input, OutputInterface $output)
  1411. {
  1412. $config = Factory::createConfig();
  1413. $composer = $this->getComposer(false);
  1414. if ($composer) {
  1415. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1416. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1417. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1418. }
  1419. if (null === $input->getOption('format')) {
  1420. $input->setOption('format', $config->get('archive-format'));
  1421. }
  1422. if (null === $input->getOption('dir')) {
  1423. $input->setOption('dir', $config->get('archive-dir'));
  1424. }
  1425. $returnCode = $this->archive(
  1426. $this->getIO(),
  1427. $config,
  1428. $input->getArgument('package'),
  1429. $input->getArgument('version'),
  1430. $input->getOption('format'),
  1431. $input->getOption('dir'),
  1432. $input->getOption('file')
  1433. );
  1434. if (0 === $returnCode && $composer) {
  1435. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1436. }
  1437. return $returnCode;
  1438. }
  1439. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null)
  1440. {
  1441. $factory = new Factory;
  1442. $downloadManager = $factory->createDownloadManager($io, $config);
  1443. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1444. if ($packageName) {
  1445. $package = $this->selectPackage($io, $packageName, $version);
  1446. if (!$package) {
  1447. return 1;
  1448. }
  1449. } else {
  1450. $package = $this->getComposer()->getPackage();
  1451. }
  1452. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1453. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName);
  1454. $fs = new Filesystem;
  1455. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1456. $io->writeError('Created: ', false);
  1457. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1458. return 0;
  1459. }
  1460. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1461. {
  1462. $io->writeError('<info>Searching for the specified package.</info>');
  1463. if ($composer = $this->getComposer(false)) {
  1464. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1465. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1466. } else {
  1467. $defaultRepos = Factory::createDefaultRepositories($this->getIO());
  1468. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1469. $repo = new CompositeRepository($defaultRepos);
  1470. }
  1471. $packages = $repo->findPackages($packageName, $version);
  1472. if (count($packages) > 1) {
  1473. $package = reset($packages);
  1474. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1475. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) { return $p->getPrettyString(); }, $packages)).'.');
  1476. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1477. } elseif ($packages) {
  1478. $package = reset($packages);
  1479. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1480. } else {
  1481. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1482. return false;
  1483. }
  1484. return $package;
  1485. }
  1486. }
  1487. <?php
  1488. namespace Composer\Command;
  1489. use Composer\Composer;
  1490. use Composer\Console\Application;
  1491. use Composer\IO\IOInterface;
  1492. use Composer\IO\NullIO;
  1493. use Symfony\Component\Console\Input\InputInterface;
  1494. use Symfony\Component\Console\Output\OutputInterface;
  1495. use Symfony\Component\Console\Command\Command;
  1496. abstract class BaseCommand extends Command
  1497. {
  1498. private $composer;
  1499. private $io;
  1500. public function getComposer($required = true, $disablePlugins = false)
  1501. {
  1502. if (null === $this->composer) {
  1503. $application = $this->getApplication();
  1504. if ($application instanceof Application) {
  1505. $this->composer = $application->getComposer($required, $disablePlugins);
  1506. } elseif ($required) {
  1507. throw new \RuntimeException(
  1508. 'Could not create a Composer\Composer instance, you must inject '.
  1509. 'one if this command is not used with a Composer\Console\Application instance'
  1510. );
  1511. }
  1512. }
  1513. return $this->composer;
  1514. }
  1515. public function setComposer(Composer $composer)
  1516. {
  1517. $this->composer = $composer;
  1518. }
  1519. public function resetComposer()
  1520. {
  1521. $this->composer = null;
  1522. $this->getApplication()->resetComposer();
  1523. }
  1524. public function getIO()
  1525. {
  1526. if (null === $this->io) {
  1527. $application = $this->getApplication();
  1528. if ($application instanceof Application) {
  1529. $this->io = $application->getIO();
  1530. } else {
  1531. $this->io = new NullIO();
  1532. }
  1533. }
  1534. return $this->io;
  1535. }
  1536. public function setIO(IOInterface $io)
  1537. {
  1538. $this->io = $io;
  1539. }
  1540. protected function initialize(InputInterface $input, OutputInterface $output)
  1541. {
  1542. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1543. $input->setOption('no-progress', true);
  1544. }
  1545. parent::initialize($input, $output);
  1546. }
  1547. }
  1548. <?php
  1549. namespace Composer\Command;
  1550. use Composer\DependencyResolver\Pool;
  1551. use Composer\Package\Link;
  1552. use Composer\Package\PackageInterface;
  1553. use Composer\Repository\ArrayRepository;
  1554. use Composer\Repository\CompositeRepository;
  1555. use Composer\Repository\PlatformRepository;
  1556. use Composer\Plugin\CommandEvent;
  1557. use Composer\Plugin\PluginEvents;
  1558. use Composer\Package\Version\VersionParser;
  1559. use Symfony\Component\Console\Helper\Table;
  1560. use Symfony\Component\Console\Input\InputArgument;
  1561. use Symfony\Component\Console\Input\InputInterface;
  1562. use Symfony\Component\Console\Input\InputOption;
  1563. use Symfony\Component\Console\Output\OutputInterface;
  1564. class BaseDependencyCommand extends BaseCommand
  1565. {
  1566. const ARGUMENT_PACKAGE = 'package';
  1567. const ARGUMENT_CONSTRAINT = 'constraint';
  1568. const OPTION_RECURSIVE = 'recursive';
  1569. const OPTION_TREE = 'tree';
  1570. protected function configure()
  1571. {
  1572. $this->setDefinition(array(
  1573. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1574. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1575. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1576. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1577. ));
  1578. }
  1579. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1580. {
  1581. $composer = $this->getComposer();
  1582. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1583. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1584. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1585. $repository = new CompositeRepository(array(
  1586. new ArrayRepository(array($composer->getPackage())),
  1587. $composer->getRepositoryManager()->getLocalRepository(),
  1588. new PlatformRepository(array(), $platformOverrides),
  1589. ));
  1590. $pool = new Pool();
  1591. $pool->addRepository($repository);
  1592. list($needle, $textConstraint) = array_pad(
  1593. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1594. 2,
  1595. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1596. );
  1597. $packages = $pool->whatProvides($needle);
  1598. if (empty($packages)) {
  1599. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1600. }
  1601. $needles = array($needle);
  1602. if ($inverted) {
  1603. foreach ($packages as $package) {
  1604. $needles = array_merge($needles, array_map(function (Link $link) {
  1605. return $link->getTarget();
  1606. }, $package->getReplaces()));
  1607. }
  1608. }
  1609. if ('*' !== $textConstraint) {
  1610. $versionParser = new VersionParser();
  1611. $constraint = $versionParser->parseConstraints($textConstraint);
  1612. } else {
  1613. $constraint = null;
  1614. }
  1615. $renderTree = $input->getOption(self::OPTION_TREE);
  1616. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1617. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1618. if (empty($results)) {
  1619. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1620. $this->getIO()->writeError(sprintf('<info>There is no installed package depending on "%s"%s</info>',
  1621. $needle, $extra));
  1622. } elseif ($renderTree) {
  1623. $root = $packages[0];
  1624. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1625. $this->printTree($results);
  1626. } else {
  1627. $this->printTable($output, $results);
  1628. }
  1629. return 0;
  1630. }
  1631. protected function printTable(OutputInterface $output, $results)
  1632. {
  1633. $table = array();
  1634. $doubles = array();
  1635. do {
  1636. $queue = array();
  1637. $rows = array();
  1638. foreach($results as $result) {
  1639. list($package, $link, $children) = $result;
  1640. $unique = (string)$link;
  1641. if (isset($doubles[$unique])) {
  1642. continue;
  1643. }
  1644. $doubles[$unique] = true;
  1645. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1646. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1647. $queue = array_merge($queue, $children);
  1648. }
  1649. $results = $queue;
  1650. $table = array_merge($rows, $table);
  1651. } while(!empty($results));
  1652. $renderer = new Table($output);
  1653. $renderer->setStyle('compact');
  1654. $renderer->getStyle()->setVerticalBorderChar('');
  1655. $renderer->getStyle()->setCellRowContentFormat('%s ');
  1656. $renderer->setRows($table)->render();
  1657. }
  1658. protected function printTree($results, $prefix = '')
  1659. {
  1660. $count = count($results);
  1661. $idx = 0;
  1662. foreach($results as $key => $result) {
  1663. list($package, $link, $children) = $result;
  1664. $isLast = (++$idx == $count);
  1665. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1666. $packageText = rtrim(sprintf('%s %s', $package->getPrettyName(), $versionText));
  1667. $linkText = implode(' ', array($link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()));
  1668. $this->writeTreeLine(sprintf("%s%s%s (%s)", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText));
  1669. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '));
  1670. }
  1671. }
  1672. private function writeTreeLine($line)
  1673. {
  1674. $io = $this->getIO();
  1675. if (!$io->isDecorated()) {
  1676. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1677. }
  1678. $io->write($line);
  1679. }
  1680. }
  1681. <?php
  1682. namespace Composer\Command;
  1683. use Composer\Cache;
  1684. use Composer\Factory;
  1685. use Symfony\Component\Console\Input\InputInterface;
  1686. use Symfony\Component\Console\Output\OutputInterface;
  1687. class ClearCacheCommand extends BaseCommand
  1688. {
  1689. protected function configure()
  1690. {
  1691. $this
  1692. ->setName('clear-cache')
  1693. ->setAliases(array('clearcache'))
  1694. ->setDescription('Clears composer\'s internal package cache.')
  1695. ->setHelp(<<<EOT
  1696. The <info>clear-cache</info> deletes all cached packages from composer's
  1697. cache directory.
  1698. EOT
  1699. )
  1700. ;
  1701. }
  1702. protected function execute(InputInterface $input, OutputInterface $output)
  1703. {
  1704. $config = Factory::createConfig();
  1705. $io = $this->getIO();
  1706. $cachePaths = array(
  1707. 'cache-dir' => $config->get('cache-dir'),
  1708. 'cache-files-dir' => $config->get('cache-files-dir'),
  1709. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1710. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1711. );
  1712. foreach ($cachePaths as $key => $cachePath) {
  1713. $cachePath = realpath($cachePath);
  1714. if (!$cachePath) {
  1715. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1716. continue;
  1717. }
  1718. $cache = new Cache($io, $cachePath);
  1719. if (!$cache->isEnabled()) {
  1720. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1721. continue;
  1722. }
  1723. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1724. $cache->gc(0, 0);
  1725. }
  1726. $io->writeError('<info>All caches cleared.</info>');
  1727. }
  1728. }
  1729. <?php
  1730. namespace Composer\Command;
  1731. use Composer\Util\Platform;
  1732. use Composer\Util\Silencer;
  1733. use Symfony\Component\Console\Input\InputInterface;
  1734. use Symfony\Component\Console\Input\InputArgument;
  1735. use Symfony\Component\Console\Input\InputOption;
  1736. use Symfony\Component\Console\Output\OutputInterface;
  1737. use Composer\Config;
  1738. use Composer\Config\JsonConfigSource;
  1739. use Composer\Factory;
  1740. use Composer\Json\JsonFile;
  1741. class ConfigCommand extends BaseCommand
  1742. {
  1743. protected $config;
  1744. protected $configFile;
  1745. protected $configSource;
  1746. protected $authConfigFile;
  1747. protected $authConfigSource;
  1748. protected function configure()
  1749. {
  1750. $this
  1751. ->setName('config')
  1752. ->setDescription('Set config options')
  1753. ->setDefinition(array(
  1754. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1755. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1756. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1757. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1758. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1759. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1760. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1761. new InputArgument('setting-key', null, 'Setting key'),
  1762. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1763. ))
  1764. ->setHelp(<<<EOT
  1765. This command allows you to edit some basic composer settings in either the
  1766. local composer.json file or the global config.json file.
  1767. To set a config setting:
  1768. <comment>%command.full_name% bin-dir bin/</comment>
  1769. To read a config setting:
  1770. <comment>%command.full_name% bin-dir</comment>
  1771. Outputs: <info>bin</info>
  1772. To edit the global config.json file:
  1773. <comment>%command.full_name% --global</comment>
  1774. To add a repository:
  1775. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1776. To remove a repository (repo is a short alias for repositories):
  1777. <comment>%command.full_name% --unset repo.foo</comment>
  1778. To disable packagist:
  1779. <comment>%command.full_name% repo.packagist false</comment>
  1780. You can alter repositories in the global config.json file by passing in the
  1781. <info>--global</info> option.
  1782. To edit the file in an external editor:
  1783. <comment>%command.full_name% --editor</comment>
  1784. To choose your editor you can set the "EDITOR" env variable.
  1785. To get a list of configuration values in the file:
  1786. <comment>%command.full_name% --list</comment>
  1787. You can always pass more than one option. As an example, if you want to edit the
  1788. global config.json file.
  1789. <comment>%command.full_name% --editor --global</comment>
  1790. EOT
  1791. )
  1792. ;
  1793. }
  1794. protected function initialize(InputInterface $input, OutputInterface $output)
  1795. {
  1796. parent::initialize($input, $output);
  1797. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1798. throw new \RuntimeException('--file and --global can not be combined');
  1799. }
  1800. $io = $this->getIO();
  1801. $this->config = Factory::createConfig($io);
  1802. $configFile = $input->getOption('global')
  1803. ? ($this->config->get('home') . '/config.json')
  1804. : ($input->getOption('file') ?: trim(getenv('COMPOSER')) ?: 'composer.json');
  1805. if ($configFile === 'composer.json' && !file_exists($configFile) && realpath(getcwd()) === realpath($this->config->get('home'))) {
  1806. file_put_contents($configFile, "{\n}\n");
  1807. }
  1808. $this->configFile = new JsonFile($configFile, null, $io);
  1809. $this->configSource = new JsonConfigSource($this->configFile);
  1810. $authConfigFile = $input->getOption('global')
  1811. ? ($this->config->get('home') . '/auth.json')
  1812. : dirname(realpath($configFile)) . '/auth.json';
  1813. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1814. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1815. if ($input->getOption('global') && !$this->configFile->exists()) {
  1816. touch($this->configFile->getPath());
  1817. $this->configFile->write(array('config' => new \ArrayObject));
  1818. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1819. }
  1820. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1821. touch($this->authConfigFile->getPath());
  1822. $this->authConfigFile->write(array('http-basic' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject));
  1823. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1824. }
  1825. if (!$this->configFile->exists()) {
  1826. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1827. }
  1828. }
  1829. protected function execute(InputInterface $input, OutputInterface $output)
  1830. {
  1831. if ($input->getOption('editor')) {
  1832. $editor = escapeshellcmd(getenv('EDITOR'));
  1833. if (!$editor) {
  1834. if (Platform::isWindows()) {
  1835. $editor = 'notepad';
  1836. } else {
  1837. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1838. if (exec('which '.$candidate)) {
  1839. $editor = $candidate;
  1840. break;
  1841. }
  1842. }
  1843. }
  1844. }
  1845. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1846. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1847. return 0;
  1848. }
  1849. if (!$input->getOption('global')) {
  1850. $this->config->merge($this->configFile->read());
  1851. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1852. }
  1853. if ($input->getOption('list')) {
  1854. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1855. return 0;
  1856. }
  1857. $settingKey = $input->getArgument('setting-key');
  1858. if (!$settingKey) {
  1859. return 0;
  1860. }
  1861. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1862. throw new \RuntimeException('You can not combine a setting value with --unset');
  1863. }
  1864. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1865. $data = $this->config->all();
  1866. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1867. if (empty($matches[1])) {
  1868. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1869. } else {
  1870. if (!isset($data['repositories'][$matches[1]])) {
  1871. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1872. }
  1873. $value = $data['repositories'][$matches[1]];
  1874. }
  1875. } elseif (strpos($settingKey, '.')) {
  1876. $bits = explode('.', $settingKey);
  1877. $data = $data['config'];
  1878. $match = false;
  1879. foreach ($bits as $bit) {
  1880. $key = isset($key) ? $key.'.'.$bit : $bit;
  1881. $match = false;
  1882. if (isset($data[$key])) {
  1883. $match = true;
  1884. $data = $data[$key];
  1885. unset($key);
  1886. }
  1887. }
  1888. if (!$match) {
  1889. throw new \RuntimeException($settingKey.' is not defined.');
  1890. }
  1891. $value = $data;
  1892. } elseif (isset($data['config'][$settingKey])) {
  1893. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1894. } else {
  1895. throw new \RuntimeException($settingKey.' is not defined');
  1896. }
  1897. if (is_array($value)) {
  1898. $value = json_encode($value);
  1899. }
  1900. $this->getIO()->write($value);
  1901. return 0;
  1902. }
  1903. $values = $input->getArgument('setting-value');
  1904. $booleanValidator = function ($val) { return in_array($val, array('true', 'false', '1', '0'), true); };
  1905. $booleanNormalizer = function ($val) { return $val !== 'false' && (bool) $val; };
  1906. $uniqueConfigValues = array(
  1907. 'process-timeout' => array('is_numeric', 'intval'),
  1908. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1909. 'preferred-install' => array(
  1910. function ($val) { return in_array($val, array('auto', 'source', 'dist'), true); },
  1911. function ($val) { return $val; },
  1912. ),
  1913. 'store-auths' => array(
  1914. function ($val) { return in_array($val, array('true', 'false', 'prompt'), true); },
  1915. function ($val) {
  1916. if ('prompt' === $val) {
  1917. return 'prompt';
  1918. }
  1919. return $val !== 'false' && (bool) $val;
  1920. },
  1921. ),
  1922. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1923. 'vendor-dir' => array('is_string', function ($val) { return $val; }),
  1924. 'bin-dir' => array('is_string', function ($val) { return $val; }),
  1925. 'archive-dir' => array('is_string', function ($val) { return $val; }),
  1926. 'archive-format' => array('is_string', function ($val) { return $val; }),
  1927. 'data-dir' => array('is_string', function ($val) { return $val; }),
  1928. 'cache-dir' => array('is_string', function ($val) { return $val; }),
  1929. 'cache-files-dir' => array('is_string', function ($val) { return $val; }),
  1930. 'cache-repo-dir' => array('is_string', function ($val) { return $val; }),
  1931. 'cache-vcs-dir' => array('is_string', function ($val) { return $val; }),
  1932. 'cache-ttl' => array('is_numeric', 'intval'),
  1933. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1934. 'cache-files-maxsize' => array(
  1935. function ($val) { return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0; },
  1936. function ($val) { return $val; },
  1937. ),
  1938. 'bin-compat' => array(
  1939. function ($val) { return in_array($val, array('auto', 'full')); },
  1940. function ($val) { return $val; },
  1941. ),
  1942. 'discard-changes' => array(
  1943. function ($val) { return in_array($val, array('stash', 'true', 'false', '1', '0'), true); },
  1944. function ($val) {
  1945. if ('stash' === $val) {
  1946. return 'stash';
  1947. }
  1948. return $val !== 'false' && (bool) $val;
  1949. },
  1950. ),
  1951. 'autoloader-suffix' => array('is_string', function ($val) { return $val === 'null' ? null : $val; }),
  1952. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1953. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1954. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1955. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1956. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1957. 'cafile' => array(
  1958. function ($val) { return file_exists($val) && is_readable($val); },
  1959. function ($val) { return $val === 'null' ? null : $val; },
  1960. ),
  1961. 'capath' => array(
  1962. function ($val) { return is_dir($val) && is_readable($val); },
  1963. function ($val) { return $val === 'null' ? null : $val; },
  1964. ),
  1965. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1966. );
  1967. $multiConfigValues = array(
  1968. 'github-protocols' => array(
  1969. function ($vals) {
  1970. if (!is_array($vals)) {
  1971. return 'array expected';
  1972. }
  1973. foreach ($vals as $val) {
  1974. if (!in_array($val, array('git', 'https', 'ssh'))) {
  1975. return 'valid protocols include: git, https, ssh';
  1976. }
  1977. }
  1978. return true;
  1979. },
  1980. function ($vals) {
  1981. return $vals;
  1982. },
  1983. ),
  1984. 'github-domains' => array(
  1985. function ($vals) {
  1986. if (!is_array($vals)) {
  1987. return 'array expected';
  1988. }
  1989. return true;
  1990. },
  1991. function ($vals) {
  1992. return $vals;
  1993. },
  1994. ),
  1995. 'gitlab-domains' => array(
  1996. function ($vals) {
  1997. if (!is_array($vals)) {
  1998. return 'array expected';
  1999. }
  2000. return true;
  2001. },
  2002. function ($vals) {
  2003. return $vals;
  2004. },
  2005. ),
  2006. );
  2007. foreach ($uniqueConfigValues as $name => $callbacks) {
  2008. if ($settingKey === $name) {
  2009. if ($input->getOption('unset')) {
  2010. return $this->configSource->removeConfigSetting($settingKey);
  2011. }
  2012. list($validator, $normalizer) = $callbacks;
  2013. if (1 !== count($values)) {
  2014. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2015. }
  2016. if (true !== $validation = $validator($values[0])) {
  2017. throw new \RuntimeException(sprintf(
  2018. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2019. $values[0]
  2020. ));
  2021. }
  2022. return $this->configSource->addConfigSetting($settingKey, $normalizer($values[0]));
  2023. }
  2024. }
  2025. foreach ($multiConfigValues as $name => $callbacks) {
  2026. if ($settingKey === $name) {
  2027. if ($input->getOption('unset')) {
  2028. return $this->configSource->removeConfigSetting($settingKey);
  2029. }
  2030. list($validator, $normalizer) = $callbacks;
  2031. if (true !== $validation = $validator($values)) {
  2032. throw new \RuntimeException(sprintf(
  2033. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2034. json_encode($values)
  2035. ));
  2036. }
  2037. return $this->configSource->addConfigSetting($settingKey, $normalizer($values));
  2038. }
  2039. }
  2040. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2041. if ($input->getOption('unset')) {
  2042. return $this->configSource->removeRepository($matches[1]);
  2043. }
  2044. if (2 === count($values)) {
  2045. return $this->configSource->addRepository($matches[1], array(
  2046. 'type' => $values[0],
  2047. 'url' => $values[1],
  2048. ));
  2049. }
  2050. if (1 === count($values)) {
  2051. $value = strtolower($values[0]);
  2052. if (true === $booleanValidator($value)) {
  2053. if (false === $booleanNormalizer($value)) {
  2054. return $this->configSource->addRepository($matches[1], false);
  2055. }
  2056. } else {
  2057. $value = json_decode($values[0], true);
  2058. if (JSON_ERROR_NONE !== json_last_error()) {
  2059. throw new \InvalidArgumentException(sprintf('%s is not valid JSON.', $values[0]));
  2060. }
  2061. return $this->configSource->addRepository($matches[1], $value);
  2062. }
  2063. }
  2064. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2065. }
  2066. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2067. if ($input->getOption('unset')) {
  2068. return $this->configSource->removeConfigSetting($settingKey);
  2069. }
  2070. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  2071. }
  2072. if (preg_match('/^(github-oauth|gitlab-oauth|http-basic)\.(.+)/', $settingKey, $matches)) {
  2073. if ($input->getOption('unset')) {
  2074. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2075. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2076. return;
  2077. }
  2078. if ($matches[1] === 'github-oauth' || $matches[1] === 'gitlab-oauth') {
  2079. if (1 !== count($values)) {
  2080. throw new \RuntimeException('Too many arguments, expected only one token');
  2081. }
  2082. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2083. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2084. } elseif ($matches[1] === 'http-basic') {
  2085. if (2 !== count($values)) {
  2086. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2087. }
  2088. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2089. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2090. }
  2091. return;
  2092. }
  2093. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2094. }
  2095. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2096. {
  2097. $origK = $k;
  2098. $io = $this->getIO();
  2099. foreach ($contents as $key => $value) {
  2100. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2101. continue;
  2102. }
  2103. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2104. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2105. $k .= preg_replace('{^config\.}', '', $key . '.');
  2106. $this->listConfiguration($value, $rawVal, $output, $k);
  2107. $k = $origK;
  2108. continue;
  2109. }
  2110. if (is_array($value)) {
  2111. $value = array_map(function ($val) {
  2112. return is_array($val) ? json_encode($val) : $val;
  2113. }, $value);
  2114. $value = '['.implode(', ', $value).']';
  2115. }
  2116. if (is_bool($value)) {
  2117. $value = var_export($value, true);
  2118. }
  2119. if (is_string($rawVal) && $rawVal != $value) {
  2120. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
  2121. } else {
  2122. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
  2123. }
  2124. }
  2125. }
  2126. }
  2127. <?php
  2128. namespace Composer\Command;
  2129. use Composer\Config;
  2130. use Composer\Factory;
  2131. use Composer\Installer;
  2132. use Composer\Installer\ProjectInstaller;
  2133. use Composer\Installer\InstallationManager;
  2134. use Composer\IO\IOInterface;
  2135. use Composer\Package\BasePackage;
  2136. use Composer\DependencyResolver\Pool;
  2137. use Composer\DependencyResolver\Operation\InstallOperation;
  2138. use Composer\Package\Version\VersionSelector;
  2139. use Composer\Repository\ComposerRepository;
  2140. use Composer\Repository\CompositeRepository;
  2141. use Composer\Repository\FilesystemRepository;
  2142. use Composer\Repository\InstalledFilesystemRepository;
  2143. use Composer\Script\ScriptEvents;
  2144. use Composer\Util\Silencer;
  2145. use Symfony\Component\Console\Input\InputArgument;
  2146. use Symfony\Component\Console\Input\InputInterface;
  2147. use Symfony\Component\Console\Input\InputOption;
  2148. use Symfony\Component\Console\Output\OutputInterface;
  2149. use Symfony\Component\Finder\Finder;
  2150. use Composer\Json\JsonFile;
  2151. use Composer\Config\JsonConfigSource;
  2152. use Composer\Util\Filesystem;
  2153. use Composer\Package\Version\VersionParser;
  2154. class CreateProjectCommand extends BaseCommand
  2155. {
  2156. protected function configure()
  2157. {
  2158. $this
  2159. ->setName('create-project')
  2160. ->setDescription('Create new project from a package into given directory.')
  2161. ->setDefinition(array(
  2162. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2163. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2164. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2165. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2166. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2167. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2168. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'Pick a different repository url to look for the package.'),
  2169. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2170. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2171. new InputOption('no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'),
  2172. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2173. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2174. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2175. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deletion vcs folder.'),
  2176. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2177. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2178. ))
  2179. ->setHelp(<<<EOT
  2180. The <info>create-project</info> command creates a new project from a given
  2181. package into a new directory. If executed without params and in a directory
  2182. with a composer.json file it installs the packages for the current project.
  2183. You can use this command to bootstrap new projects or setup a clean
  2184. version-controlled installation for developers of your project.
  2185. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2186. You can also specify the version with the package name using = or : as separator.
  2187. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2188. To install unstable packages, either specify the version you want, or use the
  2189. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2190. To setup a developer workable version you should create the project using the source
  2191. controlled code by appending the <info>'--prefer-source'</info> flag.
  2192. To install a package from another repository than the default one you
  2193. can pass the <info>'--repository-url=https://myrepository.org'</info> flag.
  2194. EOT
  2195. )
  2196. ;
  2197. }
  2198. protected function execute(InputInterface $input, OutputInterface $output)
  2199. {
  2200. $config = Factory::createConfig();
  2201. $io = $this->getIO();
  2202. $this->updatePreferredOptions($config, $input, $preferSource, $preferDist, true);
  2203. if ($input->getOption('dev')) {
  2204. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2205. }
  2206. if ($input->getOption('no-custom-installers')) {
  2207. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2208. $input->setOption('no-plugins', true);
  2209. }
  2210. return $this->installProject(
  2211. $io,
  2212. $config,
  2213. $input,
  2214. $input->getArgument('package'),
  2215. $input->getArgument('directory'),
  2216. $input->getArgument('version'),
  2217. $input->getOption('stability'),
  2218. $preferSource,
  2219. $preferDist,
  2220. !$input->getOption('no-dev'),
  2221. $input->getOption('repository-url'),
  2222. $input->getOption('no-plugins'),
  2223. $input->getOption('no-scripts'),
  2224. $input->getOption('keep-vcs'),
  2225. $input->getOption('no-progress'),
  2226. $input->getOption('no-install'),
  2227. $input->getOption('ignore-platform-reqs')
  2228. );
  2229. }
  2230. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false)
  2231. {
  2232. $oldCwd = getcwd();
  2233. $io->loadConfiguration($config);
  2234. if ($packageName !== null) {
  2235. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repositoryUrl, $disablePlugins, $noScripts, $keepVcs, $noProgress);
  2236. } else {
  2237. $installedFromVcs = false;
  2238. }
  2239. $composer = Factory::create($io, null, $disablePlugins);
  2240. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2241. $fs = new Filesystem();
  2242. if ($noScripts === false) {
  2243. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2244. }
  2245. $rootPackageConfig = $composer->getConfig();
  2246. $this->updatePreferredOptions($rootPackageConfig, $input, $preferSource, $preferDist);
  2247. if ($noInstall === false) {
  2248. $installer = Installer::create($io, $composer);
  2249. $installer->setPreferSource($preferSource)
  2250. ->setPreferDist($preferDist)
  2251. ->setDevMode($installDevPackages)
  2252. ->setRunScripts(!$noScripts)
  2253. ->setIgnorePlatformRequirements($ignorePlatformReqs);
  2254. if ($disablePlugins) {
  2255. $installer->disablePlugins();
  2256. }
  2257. $status = $installer->run();
  2258. if (0 !== $status) {
  2259. return $status;
  2260. }
  2261. }
  2262. $hasVcs = $installedFromVcs;
  2263. if (!$keepVcs && $installedFromVcs
  2264. && (
  2265. !$io->isInteractive()
  2266. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2267. )
  2268. ) {
  2269. $finder = new Finder();
  2270. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2271. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg') as $vcsName) {
  2272. $finder->name($vcsName);
  2273. }
  2274. try {
  2275. $dirs = iterator_to_array($finder);
  2276. unset($finder);
  2277. foreach ($dirs as $dir) {
  2278. if (!$fs->removeDirectory($dir)) {
  2279. throw new \RuntimeException('Could not remove '.$dir);
  2280. }
  2281. }
  2282. } catch (\Exception $e) {
  2283. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2284. }
  2285. $hasVcs = false;
  2286. }
  2287. if (!$hasVcs) {
  2288. $package = $composer->getPackage();
  2289. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2290. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2291. foreach ($package->{'get'.$meta['method']}() as $link) {
  2292. if ($link->getPrettyConstraint() === 'self.version') {
  2293. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2294. }
  2295. }
  2296. }
  2297. }
  2298. if ($noScripts === false) {
  2299. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2300. }
  2301. chdir($oldCwd);
  2302. $vendorComposerDir = $composer->getConfig()->get('vendor-dir').'/composer';
  2303. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2304. Silencer::call('rmdir', $vendorComposerDir);
  2305. $vendorDir = $composer->getConfig()->get('vendor-dir');
  2306. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2307. Silencer::call('rmdir', $vendorDir);
  2308. }
  2309. }
  2310. return 0;
  2311. }
  2312. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false)
  2313. {
  2314. if (null === $repositoryUrl) {
  2315. $sourceRepo = new CompositeRepository(Factory::createDefaultRepositories($io, $config));
  2316. } elseif ("json" === pathinfo($repositoryUrl, PATHINFO_EXTENSION) && file_exists($repositoryUrl)) {
  2317. $json = new JsonFile($repositoryUrl, Factory::createRemoteFilesystem($io, $config));
  2318. $data = $json->read();
  2319. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  2320. $sourceRepo = new ComposerRepository(array('url' => 'file://' . strtr(realpath($repositoryUrl), '\\', '/')), $io, $config);
  2321. } else {
  2322. $sourceRepo = new FilesystemRepository($json);
  2323. }
  2324. } elseif (0 === strpos($repositoryUrl, 'http')) {
  2325. $sourceRepo = new ComposerRepository(array('url' => $repositoryUrl), $io, $config);
  2326. } else {
  2327. throw new \InvalidArgumentException("Invalid repository url given. Has to be a .json file or an http url.");
  2328. }
  2329. $parser = new VersionParser();
  2330. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2331. $name = strtolower($requirements[0]['name']);
  2332. if (!$packageVersion && isset($requirements[0]['version'])) {
  2333. $packageVersion = $requirements[0]['version'];
  2334. }
  2335. if (null === $stability) {
  2336. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2337. $stability = $match[1];
  2338. } else {
  2339. $stability = VersionParser::parseStability($packageVersion);
  2340. }
  2341. }
  2342. $stability = VersionParser::normalizeStability($stability);
  2343. if (!isset(BasePackage::$stabilities[$stability])) {
  2344. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2345. }
  2346. $pool = new Pool($stability);
  2347. $pool->addRepository($sourceRepo);
  2348. $phpVersion = PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION;
  2349. $versionSelector = new VersionSelector($pool);
  2350. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2351. if (!$package) {
  2352. throw new \InvalidArgumentException("Could not find package $name" . ($packageVersion ? " with version $packageVersion." : " with stability $stability."));
  2353. }
  2354. if (null === $directory) {
  2355. $parts = explode("/", $name, 2);
  2356. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2357. }
  2358. if (function_exists('pcntl_signal')) {
  2359. declare(ticks=100);
  2360. pcntl_signal(SIGINT, function () use ($directory) {
  2361. $fs = new Filesystem();
  2362. $fs->removeDirectory($directory);
  2363. exit(130);
  2364. });
  2365. }
  2366. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2367. if ($disablePlugins) {
  2368. $io->writeError('<info>Plugins have been disabled.</info>');
  2369. }
  2370. if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
  2371. $package->setSourceReference(substr($package->getPrettyVersion(), 4));
  2372. }
  2373. $dm = $this->createDownloadManager($io, $config);
  2374. $dm->setPreferSource($preferSource)
  2375. ->setPreferDist($preferDist)
  2376. ->setOutputProgress(!$noProgress);
  2377. $projectInstaller = new ProjectInstaller($directory, $dm);
  2378. $im = $this->createInstallationManager();
  2379. $im->addInstaller($projectInstaller);
  2380. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2381. $im->notifyInstalls($io);
  2382. $installedFromVcs = 'source' === $package->getInstallationSource();
  2383. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2384. chdir($directory);
  2385. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2386. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2387. return $installedFromVcs;
  2388. }
  2389. protected function createDownloadManager(IOInterface $io, Config $config)
  2390. {
  2391. $factory = new Factory();
  2392. return $factory->createDownloadManager($io, $config);
  2393. }
  2394. protected function createInstallationManager()
  2395. {
  2396. return new InstallationManager();
  2397. }
  2398. protected function updatePreferredOptions(Config $config, InputInterface $input, &$preferSource, &$preferDist, $keepVcsRequiresPreferSource = false)
  2399. {
  2400. $preferSource = false;
  2401. $preferDist = false;
  2402. switch ($config->get('preferred-install')) {
  2403. case 'source':
  2404. $preferSource = true;
  2405. break;
  2406. case 'dist':
  2407. $preferDist = true;
  2408. break;
  2409. case 'auto':
  2410. default:
  2411. break;
  2412. }
  2413. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->getOption('keep-vcs'))) {
  2414. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->getOption('keep-vcs'));
  2415. $preferDist = $input->getOption('prefer-dist');
  2416. }
  2417. }
  2418. }
  2419. <?php
  2420. namespace Composer\Command;
  2421. use Symfony\Component\Console\Input\InputInterface;
  2422. use Symfony\Component\Console\Output\OutputInterface;
  2423. class DependsCommand extends BaseDependencyCommand
  2424. {
  2425. protected function configure()
  2426. {
  2427. parent::configure();
  2428. $this
  2429. ->setName('depends')
  2430. ->setAliases(array('why'))
  2431. ->setDescription('Shows which packages cause the given package to be installed')
  2432. ->setHelp(<<<EOT
  2433. Displays detailed information about where a package is referenced.
  2434. <info>php composer.phar depends composer/composer</info>
  2435. EOT
  2436. )
  2437. ;
  2438. }
  2439. protected function execute(InputInterface $input, OutputInterface $output)
  2440. {
  2441. return parent::doExecute($input, $output, false);
  2442. }
  2443. }
  2444. <?php
  2445. namespace Composer\Command;
  2446. use Composer\Composer;
  2447. use Composer\Factory;
  2448. use Composer\Config;
  2449. use Composer\Downloader\TransportException;
  2450. use Composer\Plugin\CommandEvent;
  2451. use Composer\Plugin\PluginEvents;
  2452. use Composer\Util\ConfigValidator;
  2453. use Composer\Util\ProcessExecutor;
  2454. use Composer\Util\RemoteFilesystem;
  2455. use Composer\Util\StreamContextFactory;
  2456. use Composer\Util\Keys;
  2457. use Symfony\Component\Console\Input\InputInterface;
  2458. use Symfony\Component\Console\Output\OutputInterface;
  2459. class DiagnoseCommand extends BaseCommand
  2460. {
  2461. protected $rfs;
  2462. protected $process;
  2463. protected $failures = 0;
  2464. protected function configure()
  2465. {
  2466. $this
  2467. ->setName('diagnose')
  2468. ->setDescription('Diagnoses the system to identify common errors.')
  2469. ->setHelp(<<<EOT
  2470. The <info>diagnose</info> command checks common errors to help debugging problems.
  2471. EOT
  2472. )
  2473. ;
  2474. }
  2475. protected function execute(InputInterface $input, OutputInterface $output)
  2476. {
  2477. $composer = $this->getComposer(false);
  2478. $io = $this->getIO();
  2479. if ($composer) {
  2480. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2481. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2482. $io->write('Checking composer.json: ', false);
  2483. $this->outputResult($this->checkComposerSchema());
  2484. }
  2485. if ($composer) {
  2486. $config = $composer->getConfig();
  2487. } else {
  2488. $config = Factory::createConfig();
  2489. }
  2490. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2491. $this->process = new ProcessExecutor($io);
  2492. $io->write('Checking platform settings: ', false);
  2493. $this->outputResult($this->checkPlatform());
  2494. $io->write('Checking git settings: ', false);
  2495. $this->outputResult($this->checkGit());
  2496. $io->write('Checking http connectivity to packagist: ', false);
  2497. $this->outputResult($this->checkHttp('http', $config));
  2498. $io->write('Checking https connectivity to packagist: ', false);
  2499. $this->outputResult($this->checkHttp('https', $config));
  2500. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2501. if (!empty($opts['http']['proxy'])) {
  2502. $io->write('Checking HTTP proxy: ', false);
  2503. $this->outputResult($this->checkHttpProxy());
  2504. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2505. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2506. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2507. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2508. }
  2509. if ($oauth = $config->get('github-oauth')) {
  2510. foreach ($oauth as $domain => $token) {
  2511. $io->write('Checking '.$domain.' oauth access: ', false);
  2512. $this->outputResult($this->checkGithubOauth($domain, $token));
  2513. }
  2514. } else {
  2515. $io->write('Checking github.com rate limit: ', false);
  2516. try {
  2517. $rate = $this->getGithubRateLimit('github.com');
  2518. $this->outputResult(true);
  2519. if (10 > $rate['remaining']) {
  2520. $io->write('<warning>WARNING</warning>');
  2521. $io->write(sprintf(
  2522. '<comment>Github has a rate limit on their API. '
  2523. . 'You currently have <options=bold>%u</options=bold> '
  2524. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2525. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2526. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2527. $rate['remaining'],
  2528. $rate['limit']
  2529. ));
  2530. }
  2531. } catch (\Exception $e) {
  2532. if ($e instanceof TransportException && $e->getCode() === 401) {
  2533. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2534. } else {
  2535. $this->outputResult($e);
  2536. }
  2537. }
  2538. }
  2539. $io->write('Checking disk free space: ', false);
  2540. $this->outputResult($this->checkDiskSpace($config));
  2541. $io->write('Checking pubkeys: ', false);
  2542. $this->outputResult($this->checkPubKeys($config));
  2543. $io->write('Checking composer version: ', false);
  2544. $this->outputResult($this->checkVersion());
  2545. return $this->failures;
  2546. }
  2547. private function checkComposerSchema()
  2548. {
  2549. $validator = new ConfigValidator($this->getIO());
  2550. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2551. if ($errors || $warnings) {
  2552. $messages = array(
  2553. 'error' => $errors,
  2554. 'warning' => $warnings,
  2555. );
  2556. $output = '';
  2557. foreach ($messages as $style => $msgs) {
  2558. foreach ($msgs as $msg) {
  2559. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2560. }
  2561. }
  2562. return rtrim($output);
  2563. }
  2564. return true;
  2565. }
  2566. private function checkGit()
  2567. {
  2568. $this->process->execute('git config color.ui', $output);
  2569. if (strtolower(trim($output)) === 'always') {
  2570. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  2571. }
  2572. return true;
  2573. }
  2574. private function checkHttp($proto, Config $config)
  2575. {
  2576. $disableTls = false;
  2577. $result = array();
  2578. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2579. $disableTls = true;
  2580. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2581. }
  2582. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2583. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2584. }
  2585. try {
  2586. $this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false);
  2587. } catch (TransportException $e) {
  2588. if (false !== strpos($e->getMessage(), 'cafile')) {
  2589. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2590. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2591. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2592. } else {
  2593. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2594. }
  2595. }
  2596. if (count($result) > 0) {
  2597. return $result;
  2598. }
  2599. return true;
  2600. }
  2601. private function checkHttpProxy()
  2602. {
  2603. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2604. try {
  2605. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false), true);
  2606. $hash = reset($json['provider-includes']);
  2607. $hash = $hash['sha256'];
  2608. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2609. $provider = $this->rfs->getContents('packagist.org', $protocol . '://packagist.org/'.$path, false);
  2610. if (hash('sha256', $provider) !== $hash) {
  2611. return 'It seems that your proxy is modifying http traffic on the fly';
  2612. }
  2613. } catch (\Exception $e) {
  2614. return $e;
  2615. }
  2616. return true;
  2617. }
  2618. private function checkHttpProxyFullUriRequestParam()
  2619. {
  2620. $url = 'http://packagist.org/packages.json';
  2621. try {
  2622. $this->rfs->getContents('packagist.org', $url, false);
  2623. } catch (TransportException $e) {
  2624. try {
  2625. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2626. } catch (TransportException $e) {
  2627. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2628. }
  2629. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2630. }
  2631. return true;
  2632. }
  2633. private function checkHttpsProxyFullUriRequestParam()
  2634. {
  2635. if (!extension_loaded('openssl')) {
  2636. return 'You need the openssl extension installed for this check';
  2637. }
  2638. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2639. try {
  2640. $this->rfs->getContents('github.com', $url, false);
  2641. } catch (TransportException $e) {
  2642. try {
  2643. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2644. } catch (TransportException $e) {
  2645. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2646. }
  2647. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2648. }
  2649. return true;
  2650. }
  2651. private function checkGithubOauth($domain, $token)
  2652. {
  2653. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2654. try {
  2655. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2656. return $this->rfs->getContents($domain, $url, false, array(
  2657. 'retry-auth-failure' => false,
  2658. )) ? true : 'Unexpected error';
  2659. } catch (\Exception $e) {
  2660. if ($e instanceof TransportException && $e->getCode() === 401) {
  2661. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2662. }
  2663. return $e;
  2664. }
  2665. }
  2666. private function getGithubRateLimit($domain, $token = null)
  2667. {
  2668. if ($token) {
  2669. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2670. }
  2671. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2672. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2673. $data = json_decode($json, true);
  2674. return $data['resources']['core'];
  2675. }
  2676. private function checkDiskSpace($config)
  2677. {
  2678. $minSpaceFree = 1024 * 1024;
  2679. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2680. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2681. ) {
  2682. return '<error>The disk hosting '.$dir.' is full</error>';
  2683. }
  2684. return true;
  2685. }
  2686. private function checkPubKeys($config)
  2687. {
  2688. $home = $config->get('home');
  2689. $errors = array();
  2690. $io = $this->getIO();
  2691. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2692. $io->write('');
  2693. }
  2694. if (file_exists($home.'/keys.tags.pub')) {
  2695. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2696. } else {
  2697. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2698. }
  2699. if (file_exists($home.'/keys.dev.pub')) {
  2700. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2701. } else {
  2702. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2703. }
  2704. if ($errors) {
  2705. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2706. }
  2707. return $errors ?: true;
  2708. }
  2709. private function checkVersion()
  2710. {
  2711. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2712. $latest = trim($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/version', false));
  2713. if (Composer::VERSION !== $latest && Composer::VERSION !== '@package_version@') {
  2714. return '<comment>You are not running the latest version, run `composer self-update` to update</comment>';
  2715. }
  2716. return true;
  2717. }
  2718. private function outputResult($result)
  2719. {
  2720. $io = $this->getIO();
  2721. if (true === $result) {
  2722. $io->write('<info>OK</info>');
  2723. } else {
  2724. $this->failures++;
  2725. $io->write('<error>FAIL</error>');
  2726. if ($result instanceof \Exception) {
  2727. $io->write('['.get_class($result).'] '.$result->getMessage());
  2728. } elseif ($result) {
  2729. if (is_array($result)) {
  2730. foreach ($result as $message) {
  2731. $io->write($message);
  2732. }
  2733. } else {
  2734. $io->write($result);
  2735. }
  2736. }
  2737. }
  2738. }
  2739. private function checkPlatform()
  2740. {
  2741. $output = '';
  2742. $out = function ($msg, $style) use (&$output) {
  2743. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2744. };
  2745. $errors = array();
  2746. $warnings = array();
  2747. $iniPath = php_ini_loaded_file();
  2748. $displayIniMessage = false;
  2749. if ($iniPath) {
  2750. $iniMessage = PHP_EOL.PHP_EOL.'The php.ini used by your command-line PHP is: ' . $iniPath;
  2751. } else {
  2752. $iniMessage = PHP_EOL.PHP_EOL.'A php.ini file does not exist. You will have to create one.';
  2753. }
  2754. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  2755. if (!function_exists('json_decode')) {
  2756. $errors['json'] = true;
  2757. }
  2758. if (!extension_loaded('Phar')) {
  2759. $errors['phar'] = true;
  2760. }
  2761. if (!extension_loaded('filter')) {
  2762. $errors['filter'] = true;
  2763. }
  2764. if (!extension_loaded('hash')) {
  2765. $errors['hash'] = true;
  2766. }
  2767. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2768. $errors['iconv_mbstring'] = true;
  2769. }
  2770. if (!ini_get('allow_url_fopen')) {
  2771. $errors['allow_url_fopen'] = true;
  2772. }
  2773. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2774. $errors['ioncube'] = ioncube_loader_version();
  2775. }
  2776. if (PHP_VERSION_ID < 50302) {
  2777. $errors['php'] = PHP_VERSION;
  2778. }
  2779. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2780. $warnings['php'] = PHP_VERSION;
  2781. }
  2782. if (!extension_loaded('openssl')) {
  2783. $errors['openssl'] = true;
  2784. }
  2785. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2786. $warnings['openssl_version'] = true;
  2787. }
  2788. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
  2789. $warnings['apc_cli'] = true;
  2790. }
  2791. ob_start();
  2792. phpinfo(INFO_GENERAL);
  2793. $phpinfo = ob_get_clean();
  2794. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2795. $configure = $match[1];
  2796. if (false !== strpos($configure, '--enable-sigchild')) {
  2797. $warnings['sigchild'] = true;
  2798. }
  2799. if (false !== strpos($configure, '--with-curlwrappers')) {
  2800. $warnings['curlwrappers'] = true;
  2801. }
  2802. }
  2803. if (ini_get('xdebug.profiler_enabled')) {
  2804. $warnings['xdebug_profile'] = true;
  2805. } elseif (extension_loaded('xdebug')) {
  2806. $warnings['xdebug_loaded'] = true;
  2807. }
  2808. if (!empty($errors)) {
  2809. foreach ($errors as $error => $current) {
  2810. switch ($error) {
  2811. case 'json':
  2812. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  2813. $text .= "Install it or recompile php without --disable-json";
  2814. break;
  2815. case 'phar':
  2816. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  2817. $text .= "Install it or recompile php without --disable-phar";
  2818. break;
  2819. case 'filter':
  2820. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  2821. $text .= "Install it or recompile php without --disable-filter";
  2822. break;
  2823. case 'hash':
  2824. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  2825. $text .= "Install it or recompile php without --disable-hash";
  2826. break;
  2827. case 'iconv_mbstring':
  2828. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  2829. $text .= "Install either of them or recompile php without --disable-iconv";
  2830. break;
  2831. case 'unicode':
  2832. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  2833. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2834. $text .= " detect_unicode = Off";
  2835. $displayIniMessage = true;
  2836. break;
  2837. case 'suhosin':
  2838. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  2839. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  2840. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  2841. $displayIniMessage = true;
  2842. break;
  2843. case 'php':
  2844. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  2845. break;
  2846. case 'allow_url_fopen':
  2847. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  2848. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2849. $text .= " allow_url_fopen = On";
  2850. $displayIniMessage = true;
  2851. break;
  2852. case 'ioncube':
  2853. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  2854. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  2855. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  2856. $displayIniMessage = true;
  2857. break;
  2858. case 'openssl':
  2859. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  2860. $text .= "If possible you should enable it or recompile php with --with-openssl";
  2861. break;
  2862. }
  2863. $out($text, 'error');
  2864. }
  2865. $output .= PHP_EOL;
  2866. }
  2867. if (!empty($warnings)) {
  2868. foreach ($warnings as $warning => $current) {
  2869. switch ($warning) {
  2870. case 'apc_cli':
  2871. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  2872. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2873. $text .= " apc.enable_cli = Off";
  2874. $displayIniMessage = true;
  2875. break;
  2876. case 'sigchild':
  2877. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  2878. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  2879. $text .= " https://bugs.php.net/bug.php?id=22999";
  2880. break;
  2881. case 'curlwrappers':
  2882. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  2883. $text .= " Recompile it without this flag if possible";
  2884. break;
  2885. case 'php':
  2886. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  2887. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  2888. break;
  2889. case 'openssl_version':
  2890. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  2891. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  2892. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  2893. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  2894. break;
  2895. case 'xdebug_loaded':
  2896. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  2897. $text .= " Disabling it when using Composer is recommended.";
  2898. break;
  2899. case 'xdebug_profile':
  2900. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  2901. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  2902. $text .= " xdebug.profiler_enabled = 0";
  2903. $displayIniMessage = true;
  2904. break;
  2905. }
  2906. $out($text, 'comment');
  2907. }
  2908. }
  2909. if ($displayIniMessage) {
  2910. $out($iniMessage, 'comment');
  2911. }
  2912. return !$warnings && !$errors ? true : $output;
  2913. }
  2914. }
  2915. <?php
  2916. namespace Composer\Command;
  2917. use Composer\Plugin\CommandEvent;
  2918. use Composer\Plugin\PluginEvents;
  2919. use Symfony\Component\Console\Input\InputInterface;
  2920. use Symfony\Component\Console\Input\InputOption;
  2921. use Symfony\Component\Console\Output\OutputInterface;
  2922. class DumpAutoloadCommand extends BaseCommand
  2923. {
  2924. protected function configure()
  2925. {
  2926. $this
  2927. ->setName('dump-autoload')
  2928. ->setAliases(array('dumpautoload'))
  2929. ->setDescription('Dumps the autoloader')
  2930. ->setDefinition(array(
  2931. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  2932. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  2933. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  2934. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  2935. ))
  2936. ->setHelp(<<<EOT
  2937. <info>php composer.phar dump-autoload</info>
  2938. EOT
  2939. )
  2940. ;
  2941. }
  2942. protected function execute(InputInterface $input, OutputInterface $output)
  2943. {
  2944. $composer = $this->getComposer();
  2945. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  2946. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2947. $installationManager = $composer->getInstallationManager();
  2948. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  2949. $package = $composer->getPackage();
  2950. $config = $composer->getConfig();
  2951. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  2952. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  2953. if ($optimize || $authoritative) {
  2954. $this->getIO()->writeError('<info>Generating optimized autoload files</info>');
  2955. } else {
  2956. $this->getIO()->writeError('<info>Generating autoload files</info>');
  2957. }
  2958. $generator = $composer->getAutoloadGenerator();
  2959. $generator->setDevMode(!$input->getOption('no-dev'));
  2960. $generator->setClassMapAuthoritative($authoritative);
  2961. $generator->setRunScripts(!$input->getOption('no-scripts'));
  2962. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  2963. }
  2964. }
  2965. <?php
  2966. namespace Composer\Command;
  2967. use Composer\Factory;
  2968. use Symfony\Component\Console\Input\InputInterface;
  2969. use Symfony\Component\Console\Input\InputArgument;
  2970. use Symfony\Component\Console\Input\StringInput;
  2971. use Symfony\Component\Console\Output\OutputInterface;
  2972. class GlobalCommand extends BaseCommand
  2973. {
  2974. protected function configure()
  2975. {
  2976. $this
  2977. ->setName('global')
  2978. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  2979. ->setDefinition(array(
  2980. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  2981. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  2982. ))
  2983. ->setHelp(<<<EOT
  2984. Use this command as a wrapper to run other Composer commands
  2985. within the global context of COMPOSER_HOME.
  2986. You can use this to install CLI utilities globally, all you need
  2987. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  2988. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  2989. and /home/<user>/.composer on unix systems.
  2990. Note: This path may vary depending on customizations to bin-dir in
  2991. composer.json or the environmental variable COMPOSER_BIN_DIR.
  2992. EOT
  2993. )
  2994. ;
  2995. }
  2996. public function run(InputInterface $input, OutputInterface $output)
  2997. {
  2998. $tokens = preg_split('{\s+}', $input->__toString());
  2999. $args = array();
  3000. foreach ($tokens as $token) {
  3001. if ($token && $token[0] !== '-') {
  3002. $args[] = $token;
  3003. if (count($args) >= 2) {
  3004. break;
  3005. }
  3006. }
  3007. }
  3008. if (count($args) < 2) {
  3009. return parent::run($input, $output);
  3010. }
  3011. $config = Factory::createConfig();
  3012. chdir($config->get('home'));
  3013. $this->getIO()->writeError('<info>Changed current directory to '.$config->get('home').'</info>');
  3014. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3015. return $this->getApplication()->run($input, $output);
  3016. }
  3017. }
  3018. <?php
  3019. namespace Composer\Command;
  3020. use Composer\Factory;
  3021. use Composer\Package\CompletePackageInterface;
  3022. use Composer\Repository\RepositoryInterface;
  3023. use Composer\Repository\ArrayRepository;
  3024. use Composer\Util\Platform;
  3025. use Composer\Util\ProcessExecutor;
  3026. use Symfony\Component\Console\Input\InputArgument;
  3027. use Symfony\Component\Console\Input\InputOption;
  3028. use Symfony\Component\Console\Input\InputInterface;
  3029. use Symfony\Component\Console\Output\OutputInterface;
  3030. class HomeCommand extends BaseCommand
  3031. {
  3032. protected function configure()
  3033. {
  3034. $this
  3035. ->setName('browse')
  3036. ->setAliases(array('home'))
  3037. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3038. ->setDefinition(array(
  3039. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Package(s) to browse to.'),
  3040. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3041. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3042. ))
  3043. ->setHelp(<<<EOT
  3044. The home command opens or shows a package's repository URL or
  3045. homepage in your default browser.
  3046. To open the homepage by default, use -H or --homepage.
  3047. To show instead of open the repository or homepage URL, use -s or --show.
  3048. EOT
  3049. );
  3050. }
  3051. protected function execute(InputInterface $input, OutputInterface $output)
  3052. {
  3053. $repos = $this->initializeRepos();
  3054. $io = $this->getIO();
  3055. $return = 0;
  3056. foreach ($input->getArgument('packages') as $packageName) {
  3057. $handled = false;
  3058. $packageExists = false;
  3059. foreach ($repos as $repo) {
  3060. foreach ($repo->findPackages($packageName) as $package) {
  3061. $packageExists = true;
  3062. if ($this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3063. $handled = true;
  3064. break 2;
  3065. }
  3066. }
  3067. }
  3068. if (!$packageExists) {
  3069. $return = 1;
  3070. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3071. }
  3072. if (!$handled) {
  3073. $return = 1;
  3074. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3075. }
  3076. }
  3077. return $return;
  3078. }
  3079. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3080. {
  3081. $support = $package->getSupport();
  3082. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3083. if (!$url || $showHomepage) {
  3084. $url = $package->getHomepage();
  3085. }
  3086. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3087. return false;
  3088. }
  3089. if ($showOnly) {
  3090. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3091. } else {
  3092. $this->openBrowser($url);
  3093. }
  3094. return true;
  3095. }
  3096. private function openBrowser($url)
  3097. {
  3098. $url = ProcessExecutor::escape($url);
  3099. if (Platform::isWindows()) {
  3100. return passthru('start "web" explorer "' . $url . '"');
  3101. }
  3102. passthru('which xdg-open', $linux);
  3103. passthru('which open', $osx);
  3104. if (0 === $linux) {
  3105. passthru('xdg-open ' . $url);
  3106. } elseif (0 === $osx) {
  3107. passthru('open ' . $url);
  3108. } else {
  3109. $this->getIO()->writeError('no suitable browser opening command found, open yourself: ' . $url);
  3110. }
  3111. }
  3112. private function initializeRepos()
  3113. {
  3114. $composer = $this->getComposer(false);
  3115. if ($composer) {
  3116. return array_merge(
  3117. array(new ArrayRepository(array($composer->getPackage()))),
  3118. array($composer->getRepositoryManager()->getLocalRepository()),
  3119. $composer->getRepositoryManager()->getRepositories()
  3120. );
  3121. }
  3122. $defaultRepos = Factory::createDefaultRepositories($this->getIO());
  3123. return $defaultRepos;
  3124. }
  3125. }
  3126. <?php
  3127. namespace Composer\Command;
  3128. use Composer\DependencyResolver\Pool;
  3129. use Composer\Json\JsonFile;
  3130. use Composer\Factory;
  3131. use Composer\Package\BasePackage;
  3132. use Composer\Package\Version\VersionParser;
  3133. use Composer\Package\Version\VersionSelector;
  3134. use Composer\Repository\CompositeRepository;
  3135. use Composer\Repository\PlatformRepository;
  3136. use Composer\Util\ProcessExecutor;
  3137. use Symfony\Component\Console\Input\InputInterface;
  3138. use Symfony\Component\Console\Input\InputOption;
  3139. use Symfony\Component\Console\Output\OutputInterface;
  3140. use Symfony\Component\Process\Process;
  3141. use Symfony\Component\Process\ExecutableFinder;
  3142. class InitCommand extends BaseCommand
  3143. {
  3144. protected $repos;
  3145. private $gitConfig;
  3146. private $pool;
  3147. protected function configure()
  3148. {
  3149. $this
  3150. ->setName('init')
  3151. ->setDescription('Creates a basic composer.json file in current directory.')
  3152. ->setDefinition(array(
  3153. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3154. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3155. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3156. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package'),
  3157. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3158. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3159. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3160. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3161. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3162. ))
  3163. ->setHelp(<<<EOT
  3164. The <info>init</info> command creates a basic composer.json file
  3165. in the current directory.
  3166. <info>php composer.phar init</info>
  3167. EOT
  3168. )
  3169. ;
  3170. }
  3171. protected function execute(InputInterface $input, OutputInterface $output)
  3172. {
  3173. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3174. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3175. if (isset($options['author'])) {
  3176. $options['authors'] = $this->formatAuthors($options['author']);
  3177. unset($options['author']);
  3178. }
  3179. if (isset($options['stability'])) {
  3180. $options['minimum-stability'] = $options['stability'];
  3181. unset($options['stability']);
  3182. }
  3183. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3184. if (array() === $options['require']) {
  3185. $options['require'] = new \stdClass;
  3186. }
  3187. if (isset($options['require-dev'])) {
  3188. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3189. if (array() === $options['require-dev']) {
  3190. $options['require-dev'] = new \stdClass;
  3191. }
  3192. }
  3193. $file = new JsonFile('composer.json');
  3194. $json = $file->encode($options);
  3195. $io = $this->getIO();
  3196. if ($input->isInteractive()) {
  3197. $io->writeError(array('', $json, ''));
  3198. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3199. $io->writeError('<error>Command aborted</error>');
  3200. return 1;
  3201. }
  3202. }
  3203. $file->write($options);
  3204. if ($input->isInteractive() && is_dir('.git')) {
  3205. $ignoreFile = realpath('.gitignore');
  3206. if (false === $ignoreFile) {
  3207. $ignoreFile = realpath('.') . '/.gitignore';
  3208. }
  3209. if (!$this->hasVendorIgnore($ignoreFile)) {
  3210. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3211. if ($io->askConfirmation($question, true)) {
  3212. $this->addVendorIgnore($ignoreFile);
  3213. }
  3214. }
  3215. }
  3216. }
  3217. protected function interact(InputInterface $input, OutputInterface $output)
  3218. {
  3219. $git = $this->getGitConfig();
  3220. $io = $this->getIO();
  3221. $formatter = $this->getHelperSet()->get('formatter');
  3222. $io->writeError(array(
  3223. '',
  3224. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3225. '',
  3226. ));
  3227. $io->writeError(array(
  3228. '',
  3229. 'This command will guide you through creating your composer.json config.',
  3230. '',
  3231. ));
  3232. $cwd = realpath(".");
  3233. if (!$name = $input->getOption('name')) {
  3234. $name = basename($cwd);
  3235. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3236. $name = strtolower($name);
  3237. if (isset($git['github.user'])) {
  3238. $name = $git['github.user'] . '/' . $name;
  3239. } elseif (!empty($_SERVER['USERNAME'])) {
  3240. $name = $_SERVER['USERNAME'] . '/' . $name;
  3241. } elseif (get_current_user()) {
  3242. $name = get_current_user() . '/' . $name;
  3243. } else {
  3244. $name = $name . '/' . $name;
  3245. }
  3246. } else {
  3247. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
  3248. throw new \InvalidArgumentException(
  3249. 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3250. );
  3251. }
  3252. }
  3253. $name = $io->askAndValidate(
  3254. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3255. function ($value) use ($name) {
  3256. if (null === $value) {
  3257. return $name;
  3258. }
  3259. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
  3260. throw new \InvalidArgumentException(
  3261. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3262. );
  3263. }
  3264. return $value;
  3265. },
  3266. null,
  3267. $name
  3268. );
  3269. $input->setOption('name', $name);
  3270. $description = $input->getOption('description') ?: false;
  3271. $description = $io->ask(
  3272. 'Description [<comment>'.$description.'</comment>]: ',
  3273. $description
  3274. );
  3275. $input->setOption('description', $description);
  3276. if (null === $author = $input->getOption('author')) {
  3277. if (isset($git['user.name']) && isset($git['user.email'])) {
  3278. $author = sprintf('%s <%s>', $git['user.name'], $git['user.email']);
  3279. }
  3280. }
  3281. $self = $this;
  3282. $author = $io->askAndValidate(
  3283. 'Author [<comment>'.$author.'</comment>]: ',
  3284. function ($value) use ($self, $author) {
  3285. $value = $value ?: $author;
  3286. $author = $self->parseAuthorString($value);
  3287. return sprintf('%s <%s>', $author['name'], $author['email']);
  3288. },
  3289. null,
  3290. $author
  3291. );
  3292. $input->setOption('author', $author);
  3293. $minimumStability = $input->getOption('stability') ?: null;
  3294. $minimumStability = $io->askAndValidate(
  3295. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3296. function ($value) use ($self, $minimumStability) {
  3297. if (null === $value) {
  3298. return $minimumStability;
  3299. }
  3300. if (!isset(BasePackage::$stabilities[$value])) {
  3301. throw new \InvalidArgumentException(
  3302. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3303. implode(', ', array_keys(BasePackage::$stabilities))
  3304. );
  3305. }
  3306. return $value;
  3307. },
  3308. null,
  3309. $minimumStability
  3310. );
  3311. $input->setOption('stability', $minimumStability);
  3312. $type = $input->getOption('type') ?: false;
  3313. $type = $io->ask(
  3314. 'Package Type [<comment>'.$type.'</comment>]: ',
  3315. $type
  3316. );
  3317. $input->setOption('type', $type);
  3318. $license = $input->getOption('license') ?: false;
  3319. $license = $io->ask(
  3320. 'License [<comment>'.$license.'</comment>]: ',
  3321. $license
  3322. );
  3323. $input->setOption('license', $license);
  3324. $io->writeError(array('', 'Define your dependencies.', ''));
  3325. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3326. $requirements = array();
  3327. if ($io->askConfirmation($question, true)) {
  3328. $requirements = $this->determineRequirements($input, $output, $input->getOption('require'));
  3329. }
  3330. $input->setOption('require', $requirements);
  3331. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3332. $devRequirements = array();
  3333. if ($io->askConfirmation($question, true)) {
  3334. $devRequirements = $this->determineRequirements($input, $output, $input->getOption('require-dev'));
  3335. }
  3336. $input->setOption('require-dev', $devRequirements);
  3337. }
  3338. public function parseAuthorString($author)
  3339. {
  3340. if (preg_match('/^(?P<name>[- \.,\p{L}\p{N}\'’]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3341. if ($this->isValidEmail($match['email'])) {
  3342. return array(
  3343. 'name' => trim($match['name']),
  3344. 'email' => $match['email'],
  3345. );
  3346. }
  3347. }
  3348. throw new \InvalidArgumentException(
  3349. 'Invalid author string. Must be in the format: '.
  3350. 'John Smith <john@example.com>'
  3351. );
  3352. }
  3353. protected function findPackages($name)
  3354. {
  3355. return $this->getRepos()->search($name);
  3356. }
  3357. protected function getRepos()
  3358. {
  3359. if (!$this->repos) {
  3360. $this->repos = new CompositeRepository(array_merge(
  3361. array(new PlatformRepository),
  3362. Factory::createDefaultRepositories($this->getIO())
  3363. ));
  3364. }
  3365. return $this->repos;
  3366. }
  3367. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null)
  3368. {
  3369. if ($requires) {
  3370. $requires = $this->normalizeRequirements($requires);
  3371. $result = array();
  3372. $io = $this->getIO();
  3373. foreach ($requires as $requirement) {
  3374. if (!isset($requirement['version'])) {
  3375. $version = $this->findBestVersionForPackage($input, $requirement['name'], $phpVersion);
  3376. $requirement['version'] = $version;
  3377. $io->writeError(sprintf(
  3378. 'Using version <info>%s</info> for <info>%s</info>',
  3379. $requirement['version'],
  3380. $requirement['name']
  3381. ));
  3382. }
  3383. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3384. }
  3385. return $result;
  3386. }
  3387. $versionParser = new VersionParser();
  3388. $io = $this->getIO();
  3389. while (null !== $package = $io->ask('Search for a package: ')) {
  3390. $matches = $this->findPackages($package);
  3391. if (count($matches)) {
  3392. $exactMatch = null;
  3393. $choices = array();
  3394. foreach ($matches as $position => $foundPackage) {
  3395. $choices[] = sprintf(' <info>%5s</info> %s', "[$position]", $foundPackage['name']);
  3396. if ($foundPackage['name'] === $package) {
  3397. $exactMatch = true;
  3398. break;
  3399. }
  3400. }
  3401. if (!$exactMatch) {
  3402. $io->writeError(array(
  3403. '',
  3404. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3405. '',
  3406. ));
  3407. $io->writeError($choices);
  3408. $io->writeError('');
  3409. $validator = function ($selection) use ($matches, $versionParser) {
  3410. if ('' === $selection) {
  3411. return false;
  3412. }
  3413. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3414. $package = $matches[(int) $selection];
  3415. return $package['name'];
  3416. }
  3417. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3418. if (isset($packageMatches['version'])) {
  3419. $versionParser->parseConstraints($packageMatches['version']);
  3420. return $packageMatches['name'].' '.$packageMatches['version'];
  3421. }
  3422. return $packageMatches['name'];
  3423. }
  3424. throw new \Exception('Not a valid selection');
  3425. };
  3426. $package = $io->askAndValidate(
  3427. 'Enter package # to add, or the complete package name if it is not listed: ',
  3428. $validator,
  3429. 3,
  3430. false
  3431. );
  3432. }
  3433. if (false !== $package && false === strpos($package, ' ')) {
  3434. $validator = function ($input) {
  3435. $input = trim($input);
  3436. return $input ?: false;
  3437. };
  3438. $constraint = $io->askAndValidate(
  3439. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3440. $validator,
  3441. 3,
  3442. false
  3443. );
  3444. if (false === $constraint) {
  3445. $constraint = $this->findBestVersionForPackage($input, $package, $phpVersion);
  3446. $io->writeError(sprintf(
  3447. 'Using version <info>%s</info> for <info>%s</info>',
  3448. $constraint,
  3449. $package
  3450. ));
  3451. }
  3452. $package .= ' '.$constraint;
  3453. }
  3454. if (false !== $package) {
  3455. $requires[] = $package;
  3456. }
  3457. }
  3458. }
  3459. return $requires;
  3460. }
  3461. protected function formatAuthors($author)
  3462. {
  3463. return array($this->parseAuthorString($author));
  3464. }
  3465. protected function formatRequirements(array $requirements)
  3466. {
  3467. $requires = array();
  3468. $requirements = $this->normalizeRequirements($requirements);
  3469. foreach ($requirements as $requirement) {
  3470. $requires[$requirement['name']] = $requirement['version'];
  3471. }
  3472. return $requires;
  3473. }
  3474. protected function getGitConfig()
  3475. {
  3476. if (null !== $this->gitConfig) {
  3477. return $this->gitConfig;
  3478. }
  3479. $finder = new ExecutableFinder();
  3480. $gitBin = $finder->find('git');
  3481. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3482. $cmd->run();
  3483. if ($cmd->isSuccessful()) {
  3484. $this->gitConfig = array();
  3485. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3486. foreach ($matches as $match) {
  3487. $this->gitConfig[$match[1]] = $match[2];
  3488. }
  3489. return $this->gitConfig;
  3490. }
  3491. return $this->gitConfig = array();
  3492. }
  3493. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3494. {
  3495. if (!file_exists($ignoreFile)) {
  3496. return false;
  3497. }
  3498. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3499. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3500. foreach ($lines as $line) {
  3501. if (preg_match($pattern, $line)) {
  3502. return true;
  3503. }
  3504. }
  3505. return false;
  3506. }
  3507. protected function normalizeRequirements(array $requirements)
  3508. {
  3509. $parser = new VersionParser();
  3510. return $parser->parseNameVersionPairs($requirements);
  3511. }
  3512. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3513. {
  3514. $contents = "";
  3515. if (file_exists($ignoreFile)) {
  3516. $contents = file_get_contents($ignoreFile);
  3517. if ("\n" !== substr($contents, 0, -1)) {
  3518. $contents .= "\n";
  3519. }
  3520. }
  3521. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3522. }
  3523. protected function isValidEmail($email)
  3524. {
  3525. if (!function_exists('filter_var')) {
  3526. return true;
  3527. }
  3528. if (PHP_VERSION_ID < 50303) {
  3529. return true;
  3530. }
  3531. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3532. }
  3533. private function getPool(InputInterface $input)
  3534. {
  3535. if (!$this->pool) {
  3536. $this->pool = new Pool($this->getMinimumStability($input));
  3537. $this->pool->addRepository($this->getRepos());
  3538. }
  3539. return $this->pool;
  3540. }
  3541. private function getMinimumStability(InputInterface $input)
  3542. {
  3543. if ($input->hasOption('stability')) {
  3544. return $input->getOption('stability') ?: 'stable';
  3545. }
  3546. $file = Factory::getComposerFile();
  3547. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3548. if (!empty($composer['minimum-stability'])) {
  3549. return $composer['minimum-stability'];
  3550. }
  3551. }
  3552. return 'stable';
  3553. }
  3554. private function findBestVersionForPackage(InputInterface $input, $name, $phpVersion)
  3555. {
  3556. $versionSelector = new VersionSelector($this->getPool($input));
  3557. $package = $versionSelector->findBestCandidate($name, null, $phpVersion);
  3558. if (!$package) {
  3559. throw new \InvalidArgumentException(sprintf(
  3560. 'Could not find package %s at any version for your minimum-stability (%s). Check the package spelling or your minimum-stability',
  3561. $name,
  3562. $this->getMinimumStability($input)
  3563. ));
  3564. }
  3565. return $versionSelector->findRecommendedRequireVersion($package);
  3566. }
  3567. }
  3568. <?php
  3569. namespace Composer\Command;
  3570. use Composer\Installer;
  3571. use Composer\Plugin\CommandEvent;
  3572. use Composer\Plugin\PluginEvents;
  3573. use Symfony\Component\Console\Input\InputInterface;
  3574. use Symfony\Component\Console\Input\InputOption;
  3575. use Symfony\Component\Console\Input\InputArgument;
  3576. use Symfony\Component\Console\Output\OutputInterface;
  3577. class InstallCommand extends BaseCommand
  3578. {
  3579. protected function configure()
  3580. {
  3581. $this
  3582. ->setName('install')
  3583. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  3584. ->setDefinition(array(
  3585. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3586. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3587. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  3588. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3589. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3590. new InputOption('no-plugins', null, InputOption::VALUE_NONE, 'Disables all plugins.'),
  3591. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3592. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  3593. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3594. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3595. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  3596. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3597. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3598. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3599. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  3600. ))
  3601. ->setHelp(<<<EOT
  3602. The <info>install</info> command reads the composer.lock file from
  3603. the current directory, processes it, and downloads and installs all the
  3604. libraries and dependencies outlined in that file. If the file does not
  3605. exist it will look for composer.json and do the same.
  3606. <info>php composer.phar install</info>
  3607. EOT
  3608. )
  3609. ;
  3610. }
  3611. protected function execute(InputInterface $input, OutputInterface $output)
  3612. {
  3613. $io = $this->getIO();
  3614. if ($args = $input->getArgument('packages')) {
  3615. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  3616. return 1;
  3617. }
  3618. if ($input->getOption('no-custom-installers')) {
  3619. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3620. $input->setOption('no-plugins', true);
  3621. }
  3622. if ($input->getOption('dev')) {
  3623. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3624. }
  3625. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3626. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3627. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  3628. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3629. $install = Installer::create($io, $composer);
  3630. $preferSource = false;
  3631. $preferDist = false;
  3632. $config = $composer->getConfig();
  3633. switch ($config->get('preferred-install')) {
  3634. case 'source':
  3635. $preferSource = true;
  3636. break;
  3637. case 'dist':
  3638. $preferDist = true;
  3639. break;
  3640. case 'auto':
  3641. default:
  3642. break;
  3643. }
  3644. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist')) {
  3645. $preferSource = $input->getOption('prefer-source');
  3646. $preferDist = $input->getOption('prefer-dist');
  3647. }
  3648. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  3649. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3650. $install
  3651. ->setDryRun($input->getOption('dry-run'))
  3652. ->setVerbose($input->getOption('verbose'))
  3653. ->setPreferSource($preferSource)
  3654. ->setPreferDist($preferDist)
  3655. ->setDevMode(!$input->getOption('no-dev'))
  3656. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  3657. ->setRunScripts(!$input->getOption('no-scripts'))
  3658. ->setOptimizeAutoloader($optimize)
  3659. ->setClassMapAuthoritative($authoritative)
  3660. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3661. ;
  3662. if ($input->getOption('no-plugins')) {
  3663. $install->disablePlugins();
  3664. }
  3665. return $install->run();
  3666. }
  3667. }
  3668. <?php
  3669. namespace Composer\Command;
  3670. use Composer\Json\JsonFile;
  3671. use Composer\Plugin\CommandEvent;
  3672. use Composer\Plugin\PluginEvents;
  3673. use Composer\Package\PackageInterface;
  3674. use Composer\Repository\RepositoryInterface;
  3675. use Symfony\Component\Console\Helper\Table;
  3676. use Symfony\Component\Console\Input\InputInterface;
  3677. use Symfony\Component\Console\Input\InputOption;
  3678. use Symfony\Component\Console\Output\OutputInterface;
  3679. class LicensesCommand extends BaseCommand
  3680. {
  3681. protected function configure()
  3682. {
  3683. $this
  3684. ->setName('licenses')
  3685. ->setDescription('Show information about licenses of dependencies')
  3686. ->setDefinition(array(
  3687. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  3688. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  3689. ))
  3690. ->setHelp(<<<EOT
  3691. The license command displays detailed information about the licenses of
  3692. the installed dependencies.
  3693. EOT
  3694. )
  3695. ;
  3696. }
  3697. protected function execute(InputInterface $input, OutputInterface $output)
  3698. {
  3699. $composer = $this->getComposer();
  3700. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  3701. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3702. $root = $composer->getPackage();
  3703. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3704. if ($input->getOption('no-dev')) {
  3705. $packages = $this->filterRequiredPackages($repo, $root);
  3706. } else {
  3707. $packages = $this->appendPackages($repo->getPackages(), array());
  3708. }
  3709. ksort($packages);
  3710. $io = $this->getIO();
  3711. switch ($format = $input->getOption('format')) {
  3712. case 'text':
  3713. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  3714. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  3715. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  3716. $io->write('Dependencies:');
  3717. $io->write('');
  3718. $table = new Table($output);
  3719. $table->setStyle('compact');
  3720. $table->getStyle()->setVerticalBorderChar('');
  3721. $table->getStyle()->setCellRowContentFormat('%s ');
  3722. $table->setHeaders(array('Name', 'Version', 'License'));
  3723. foreach ($packages as $package) {
  3724. $table->addRow(array(
  3725. $package->getPrettyName(),
  3726. $package->getFullPrettyVersion(),
  3727. implode(', ', $package->getLicense()) ?: 'none',
  3728. ));
  3729. }
  3730. $table->render();
  3731. break;
  3732. case 'json':
  3733. $dependencies = array();
  3734. foreach ($packages as $package) {
  3735. $dependencies[$package->getPrettyName()] = array(
  3736. 'version' => $package->getFullPrettyVersion(),
  3737. 'license' => $package->getLicense(),
  3738. );
  3739. }
  3740. $io->write(JsonFile::encode(array(
  3741. 'name' => $root->getPrettyName(),
  3742. 'version' => $root->getFullPrettyVersion(),
  3743. 'license' => $root->getLicense(),
  3744. 'dependencies' => $dependencies,
  3745. )));
  3746. break;
  3747. default:
  3748. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  3749. }
  3750. }
  3751. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  3752. {
  3753. $requires = array_keys($package->getRequires());
  3754. $packageListNames = array_keys($bucket);
  3755. $packages = array_filter(
  3756. $repo->getPackages(),
  3757. function ($package) use ($requires, $packageListNames) {
  3758. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  3759. }
  3760. );
  3761. $bucket = $this->appendPackages($packages, $bucket);
  3762. foreach ($packages as $package) {
  3763. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  3764. }
  3765. return $bucket;
  3766. }
  3767. public function appendPackages(array $packages, array $bucket)
  3768. {
  3769. foreach ($packages as $package) {
  3770. $bucket[$package->getName()] = $package;
  3771. }
  3772. return $bucket;
  3773. }
  3774. }
  3775. <?php
  3776. namespace Composer\Command;
  3777. use Symfony\Component\Console\Input\InputInterface;
  3778. use Symfony\Component\Console\Output\OutputInterface;
  3779. class ProhibitsCommand extends BaseDependencyCommand
  3780. {
  3781. protected function configure()
  3782. {
  3783. parent::configure();
  3784. $this
  3785. ->setName('prohibits')
  3786. ->setAliases(array('why-not'))
  3787. ->setDescription('Shows which packages prevent the given package from being installed')
  3788. ->setHelp(<<<EOT
  3789. Displays detailed information about why a package cannot be installed.
  3790. <info>php composer.phar prohibits composer/composer</info>
  3791. EOT
  3792. )
  3793. ;
  3794. }
  3795. protected function execute(InputInterface $input, OutputInterface $output)
  3796. {
  3797. return parent::doExecute($input, $output, true);
  3798. }
  3799. }
  3800. <?php
  3801. namespace Composer\Command;
  3802. use Composer\Config\JsonConfigSource;
  3803. use Composer\Installer;
  3804. use Composer\Plugin\CommandEvent;
  3805. use Composer\Plugin\PluginEvents;
  3806. use Composer\Json\JsonFile;
  3807. use Composer\Factory;
  3808. use Symfony\Component\Console\Input\InputInterface;
  3809. use Symfony\Component\Console\Input\InputOption;
  3810. use Symfony\Component\Console\Input\InputArgument;
  3811. use Symfony\Component\Console\Output\OutputInterface;
  3812. class RemoveCommand extends BaseCommand
  3813. {
  3814. protected function configure()
  3815. {
  3816. $this
  3817. ->setName('remove')
  3818. ->setDescription('Removes a package from the require or require-dev')
  3819. ->setDefinition(array(
  3820. new InputArgument('packages', InputArgument::IS_ARRAY, 'Packages that should be removed.'),
  3821. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  3822. new InputOption('no-plugins', null, InputOption::VALUE_NONE, 'Disables all plugins.'),
  3823. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3824. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  3825. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  3826. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies.'),
  3827. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3828. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3829. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3830. ))
  3831. ->setHelp(<<<EOT
  3832. The <info>remove</info> command removes a package from the current
  3833. list of installed packages
  3834. <info>php composer.phar remove</info>
  3835. EOT
  3836. )
  3837. ;
  3838. }
  3839. protected function execute(InputInterface $input, OutputInterface $output)
  3840. {
  3841. $packages = $input->getArgument('packages');
  3842. $file = Factory::getComposerFile();
  3843. $jsonFile = new JsonFile($file);
  3844. $composer = $jsonFile->read();
  3845. $composerBackup = file_get_contents($jsonFile->getPath());
  3846. $json = new JsonConfigSource($jsonFile);
  3847. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  3848. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  3849. $io = $this->getIO();
  3850. foreach ($packages as $package) {
  3851. if (isset($composer[$type][$package])) {
  3852. $json->removeLink($type, $package);
  3853. } elseif (isset($composer[$altType][$package])) {
  3854. $io->writeError('<warning>'.$package.' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
  3855. if ($io->isInteractive()) {
  3856. if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
  3857. $json->removeLink($altType, $package);
  3858. }
  3859. }
  3860. } else {
  3861. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  3862. }
  3863. }
  3864. if ($input->getOption('no-update')) {
  3865. return 0;
  3866. }
  3867. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3868. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3869. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  3870. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3871. $install = Installer::create($io, $composer);
  3872. $updateDevMode = !$input->getOption('update-no-dev');
  3873. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  3874. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  3875. $install
  3876. ->setVerbose($input->getOption('verbose'))
  3877. ->setDevMode($updateDevMode)
  3878. ->setOptimizeAutoloader($optimize)
  3879. ->setClassMapAuthoritative($authoritative)
  3880. ->setUpdate(true)
  3881. ->setUpdateWhitelist($packages)
  3882. ->setWhitelistDependencies($input->getOption('update-with-dependencies'))
  3883. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3884. ;
  3885. $status = $install->run();
  3886. if ($status !== 0) {
  3887. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  3888. file_put_contents($jsonFile->getPath(), $composerBackup);
  3889. }
  3890. return $status;
  3891. }
  3892. }
  3893. <?php
  3894. namespace Composer\Command;
  3895. use Symfony\Component\Console\Input\InputInterface;
  3896. use Symfony\Component\Console\Input\InputArgument;
  3897. use Symfony\Component\Console\Input\InputOption;
  3898. use Symfony\Component\Console\Output\OutputInterface;
  3899. use Composer\Factory;
  3900. use Composer\Installer;
  3901. use Composer\Json\JsonFile;
  3902. use Composer\Json\JsonManipulator;
  3903. use Composer\Package\Version\VersionParser;
  3904. use Composer\Plugin\CommandEvent;
  3905. use Composer\Plugin\PluginEvents;
  3906. use Composer\Repository\CompositeRepository;
  3907. use Composer\Repository\PlatformRepository;
  3908. class RequireCommand extends InitCommand
  3909. {
  3910. protected function configure()
  3911. {
  3912. $this
  3913. ->setName('require')
  3914. ->setDescription('Adds required packages to your composer.json and installs them')
  3915. ->setDefinition(array(
  3916. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Required package name optionally including a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3917. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  3918. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3919. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3920. new InputOption('no-plugins', null, InputOption::VALUE_NONE, 'Disables all plugins.'),
  3921. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3922. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  3923. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  3924. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies.'),
  3925. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3926. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  3927. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3928. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3929. ))
  3930. ->setHelp(<<<EOT
  3931. The require command adds required packages to your composer.json and installs them.
  3932. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  3933. If you do not want to install the new dependencies immediately you can call it with --no-update
  3934. EOT
  3935. )
  3936. ;
  3937. }
  3938. protected function execute(InputInterface $input, OutputInterface $output)
  3939. {
  3940. $file = Factory::getComposerFile();
  3941. $io = $this->getIO();
  3942. $newlyCreated = !file_exists($file);
  3943. if (!file_exists($file) && !file_put_contents($file, "{\n}\n")) {
  3944. $io->writeError('<error>'.$file.' could not be created.</error>');
  3945. return 1;
  3946. }
  3947. if (!is_readable($file)) {
  3948. $io->writeError('<error>'.$file.' is not readable.</error>');
  3949. return 1;
  3950. }
  3951. if (!is_writable($file)) {
  3952. $io->writeError('<error>'.$file.' is not writable.</error>');
  3953. return 1;
  3954. }
  3955. if (filesize($file) === 0) {
  3956. file_put_contents($file, "{\n}\n");
  3957. }
  3958. $json = new JsonFile($file);
  3959. $composerDefinition = $json->read();
  3960. $composerBackup = file_get_contents($json->getPath());
  3961. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3962. $repos = $composer->getRepositoryManager()->getRepositories();
  3963. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  3964. $this->repos = new CompositeRepository(array_merge(
  3965. array(new PlatformRepository(array(), $platformOverrides)),
  3966. $repos
  3967. ));
  3968. $phpVersion = $this->repos->findPackage('php', '*')->getVersion();
  3969. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion);
  3970. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  3971. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  3972. $baseRequirements = array_key_exists($requireKey, $composerDefinition) ? $composerDefinition[$requireKey] : array();
  3973. $requirements = $this->formatRequirements($requirements);
  3974. $versionParser = new VersionParser();
  3975. foreach ($requirements as $constraint) {
  3976. $versionParser->parseConstraints($constraint);
  3977. }
  3978. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  3979. if (!$this->updateFileCleanly($json, $baseRequirements, $requirements, $requireKey, $removeKey, $sortPackages)) {
  3980. foreach ($requirements as $package => $version) {
  3981. $baseRequirements[$package] = $version;
  3982. if (isset($composerDefinition[$removeKey][$package])) {
  3983. unset($composerDefinition[$removeKey][$package]);
  3984. }
  3985. }
  3986. $composerDefinition[$requireKey] = $baseRequirements;
  3987. $json->write($composerDefinition);
  3988. }
  3989. $io->writeError('<info>'.$file.' has been '.($newlyCreated ? 'created' : 'updated').'</info>');
  3990. if ($input->getOption('no-update')) {
  3991. return 0;
  3992. }
  3993. $updateDevMode = !$input->getOption('update-no-dev');
  3994. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  3995. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  3996. $this->resetComposer();
  3997. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3998. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3999. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4000. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4001. $install = Installer::create($io, $composer);
  4002. $install
  4003. ->setVerbose($input->getOption('verbose'))
  4004. ->setPreferSource($input->getOption('prefer-source'))
  4005. ->setPreferDist($input->getOption('prefer-dist'))
  4006. ->setDevMode($updateDevMode)
  4007. ->setOptimizeAutoloader($optimize)
  4008. ->setClassMapAuthoritative($authoritative)
  4009. ->setUpdate(true)
  4010. ->setUpdateWhitelist(array_keys($requirements))
  4011. ->setWhitelistDependencies($input->getOption('update-with-dependencies'))
  4012. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4013. ;
  4014. $status = $install->run();
  4015. if ($status !== 0) {
  4016. if ($newlyCreated) {
  4017. $io->writeError("\n".'<error>Installation failed, deleting '.$file.'.</error>');
  4018. unlink($json->getPath());
  4019. } else {
  4020. $io->writeError("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
  4021. file_put_contents($json->getPath(), $composerBackup);
  4022. }
  4023. }
  4024. return $status;
  4025. }
  4026. private function updateFileCleanly($json, array $base, array $new, $requireKey, $removeKey, $sortPackages)
  4027. {
  4028. $contents = file_get_contents($json->getPath());
  4029. $manipulator = new JsonManipulator($contents);
  4030. foreach ($new as $package => $constraint) {
  4031. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4032. return false;
  4033. }
  4034. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4035. return false;
  4036. }
  4037. }
  4038. file_put_contents($json->getPath(), $manipulator->getContents());
  4039. return true;
  4040. }
  4041. protected function interact(InputInterface $input, OutputInterface $output)
  4042. {
  4043. return;
  4044. }
  4045. }
  4046. <?php
  4047. namespace Composer\Command;
  4048. use Composer\Script\CommandEvent;
  4049. use Composer\Script\ScriptEvents;
  4050. use Composer\Util\ProcessExecutor;
  4051. use Symfony\Component\Console\Input\InputInterface;
  4052. use Symfony\Component\Console\Input\InputOption;
  4053. use Symfony\Component\Console\Input\InputArgument;
  4054. use Symfony\Component\Console\Output\OutputInterface;
  4055. class RunScriptCommand extends BaseCommand
  4056. {
  4057. protected $scriptEvents = array(
  4058. ScriptEvents::PRE_INSTALL_CMD,
  4059. ScriptEvents::POST_INSTALL_CMD,
  4060. ScriptEvents::PRE_UPDATE_CMD,
  4061. ScriptEvents::POST_UPDATE_CMD,
  4062. ScriptEvents::PRE_STATUS_CMD,
  4063. ScriptEvents::POST_STATUS_CMD,
  4064. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4065. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4066. ScriptEvents::PRE_ARCHIVE_CMD,
  4067. ScriptEvents::POST_ARCHIVE_CMD,
  4068. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4069. ScriptEvents::POST_AUTOLOAD_DUMP,
  4070. );
  4071. protected function configure()
  4072. {
  4073. $this
  4074. ->setName('run-script')
  4075. ->setDescription('Run the scripts defined in composer.json.')
  4076. ->setDefinition(array(
  4077. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4078. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4079. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4080. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4081. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4082. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4083. ))
  4084. ->setHelp(<<<EOT
  4085. The <info>run-script</info> command runs scripts defined in composer.json:
  4086. <info>php composer.phar run-script post-update-cmd</info>
  4087. EOT
  4088. )
  4089. ;
  4090. }
  4091. protected function execute(InputInterface $input, OutputInterface $output)
  4092. {
  4093. if ($input->getOption('list')) {
  4094. return $this->listScripts();
  4095. } elseif (!$input->getArgument('script')) {
  4096. throw new \RunTimeException('Missing required argument "script"');
  4097. }
  4098. $script = $input->getArgument('script');
  4099. if (!in_array($script, $this->scriptEvents)) {
  4100. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4101. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4102. }
  4103. }
  4104. $composer = $this->getComposer();
  4105. $hasListeners = $composer->getEventDispatcher()->hasEventListeners(new CommandEvent($script, $composer, $this->getIO()));
  4106. if (!$hasListeners) {
  4107. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4108. }
  4109. $args = $input->getArgument('args');
  4110. if (!is_null($timeout = $input->getOption('timeout'))) {
  4111. if (!ctype_digit($timeout)) {
  4112. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4113. }
  4114. ProcessExecutor::setTimeout((int)$timeout);
  4115. }
  4116. return $composer->getEventDispatcher()->dispatchScript($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args);
  4117. }
  4118. protected function listScripts()
  4119. {
  4120. $scripts = $this->getComposer()->getPackage()->getScripts();
  4121. if (!count($scripts)) {
  4122. return 0;
  4123. }
  4124. $io = $this->getIO();
  4125. $io->writeError('<info>scripts:</info>');
  4126. foreach ($scripts as $name => $script) {
  4127. $io->write(' ' . $name);
  4128. }
  4129. return 0;
  4130. }
  4131. }
  4132. <?php
  4133. namespace Composer\Command;
  4134. use Symfony\Component\Console\Input\InputInterface;
  4135. use Symfony\Component\Console\Input\InputOption;
  4136. use Symfony\Component\Console\Input\InputArgument;
  4137. use Symfony\Component\Console\Output\OutputInterface;
  4138. class ScriptAliasCommand extends BaseCommand
  4139. {
  4140. private $script;
  4141. public function __construct($script)
  4142. {
  4143. $this->script = $script;
  4144. parent::__construct();
  4145. }
  4146. protected function configure()
  4147. {
  4148. $this
  4149. ->setName($this->script)
  4150. ->setDescription('Run the '.$this->script.' script as defined in composer.json.')
  4151. ->setDefinition(array(
  4152. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4153. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4154. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4155. ))
  4156. ->setHelp(<<<EOT
  4157. The <info>run-script</info> command runs scripts defined in composer.json:
  4158. <info>php composer.phar run-script post-update-cmd</info>
  4159. EOT
  4160. )
  4161. ;
  4162. }
  4163. protected function execute(InputInterface $input, OutputInterface $output)
  4164. {
  4165. $composer = $this->getComposer();
  4166. $args = $input->getArguments();
  4167. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4168. }
  4169. }
  4170. <?php
  4171. namespace Composer\Command;
  4172. use Symfony\Component\Console\Input\InputInterface;
  4173. use Symfony\Component\Console\Input\InputArgument;
  4174. use Symfony\Component\Console\Input\InputOption;
  4175. use Symfony\Component\Console\Output\OutputInterface;
  4176. use Composer\Repository\CompositeRepository;
  4177. use Composer\Repository\PlatformRepository;
  4178. use Composer\Repository\RepositoryInterface;
  4179. use Composer\Factory;
  4180. use Composer\Plugin\CommandEvent;
  4181. use Composer\Plugin\PluginEvents;
  4182. class SearchCommand extends BaseCommand
  4183. {
  4184. protected $matches;
  4185. protected $lowMatches = array();
  4186. protected $tokens;
  4187. protected $output;
  4188. protected $onlyName;
  4189. protected function configure()
  4190. {
  4191. $this
  4192. ->setName('search')
  4193. ->setDescription('Search for packages')
  4194. ->setDefinition(array(
  4195. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4196. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4197. ))
  4198. ->setHelp(<<<EOT
  4199. The search command searches for packages by its name
  4200. <info>php composer.phar search symfony composer</info>
  4201. EOT
  4202. )
  4203. ;
  4204. }
  4205. protected function execute(InputInterface $input, OutputInterface $output)
  4206. {
  4207. $platformRepo = new PlatformRepository;
  4208. $io = $this->getIO();
  4209. if ($composer = $this->getComposer(false)) {
  4210. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4211. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4212. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4213. } else {
  4214. $defaultRepos = Factory::createDefaultRepositories($io);
  4215. $io->writeError('No composer.json found in the current directory, showing packages from ' . implode(', ', array_keys($defaultRepos)));
  4216. $installedRepo = $platformRepo;
  4217. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  4218. }
  4219. if ($composer) {
  4220. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4221. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4222. }
  4223. $onlyName = $input->getOption('only-name');
  4224. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4225. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags);
  4226. foreach ($results as $result) {
  4227. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4228. }
  4229. }
  4230. }
  4231. <?php
  4232. namespace Composer\Command;
  4233. use Composer\Composer;
  4234. use Composer\Factory;
  4235. use Composer\Config;
  4236. use Composer\Util\Filesystem;
  4237. use Composer\Util\Keys;
  4238. use Composer\IO\IOInterface;
  4239. use Composer\Downloader\FilesystemException;
  4240. use Symfony\Component\Console\Input\InputInterface;
  4241. use Symfony\Component\Console\Input\InputOption;
  4242. use Symfony\Component\Console\Input\InputArgument;
  4243. use Symfony\Component\Console\Output\OutputInterface;
  4244. use Symfony\Component\Finder\Finder;
  4245. class SelfUpdateCommand extends BaseCommand
  4246. {
  4247. const HOMEPAGE = 'getcomposer.org';
  4248. const OLD_INSTALL_EXT = '-old.phar';
  4249. protected function configure()
  4250. {
  4251. $this
  4252. ->setName('self-update')
  4253. ->setAliases(array('selfupdate'))
  4254. ->setDescription('Updates composer.phar to the latest version.')
  4255. ->setDefinition(array(
  4256. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4257. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  4258. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4259. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4260. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4261. ))
  4262. ->setHelp(<<<EOT
  4263. The <info>self-update</info> command checks getcomposer.org for newer
  4264. versions of composer and if found, installs the latest.
  4265. <info>php composer.phar self-update</info>
  4266. EOT
  4267. )
  4268. ;
  4269. }
  4270. protected function execute(InputInterface $input, OutputInterface $output)
  4271. {
  4272. $config = Factory::createConfig();
  4273. if ($config->get('disable-tls') === true) {
  4274. $baseUrl = 'http://' . self::HOMEPAGE;
  4275. } else {
  4276. $baseUrl = 'https://' . self::HOMEPAGE;
  4277. }
  4278. $io = $this->getIO();
  4279. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4280. $cacheDir = $config->get('cache-dir');
  4281. $rollbackDir = $config->get('data-dir');
  4282. $home = $config->get('home');
  4283. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4284. if ($input->getOption('update-keys')) {
  4285. return $this->fetchKeys($io, $config);
  4286. }
  4287. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4288. if (!is_writable($tmpDir)) {
  4289. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4290. }
  4291. if ($input->getOption('rollback')) {
  4292. return $this->rollback($output, $rollbackDir, $localFilename);
  4293. }
  4294. $latestVersion = trim($remoteFilesystem->getContents(self::HOMEPAGE, $baseUrl. '/version', false));
  4295. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4296. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4297. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4298. return 1;
  4299. }
  4300. if (Composer::VERSION === $updateVersion) {
  4301. $io->writeError('<info>You are already using composer version '.$updateVersion.'.</info>');
  4302. return 0;
  4303. }
  4304. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4305. $backupFile = sprintf(
  4306. '%s/%s-%s%s',
  4307. $rollbackDir,
  4308. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4309. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4310. self::OLD_INSTALL_EXT
  4311. );
  4312. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4313. $io->write(sprintf("Updating to version <info>%s</info>.", $updateVersion));
  4314. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4315. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4316. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4317. if (!file_exists($tempFilename) || !$signature) {
  4318. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4319. return 1;
  4320. }
  4321. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4322. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4323. } else {
  4324. if (!extension_loaded('openssl')) {
  4325. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4326. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  4327. }
  4328. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4329. if (!file_exists($sigFile)) {
  4330. file_put_contents($home.'/keys.dev.pub', <<<DEVPUBKEY
  4331. -----BEGIN PUBLIC KEY-----
  4332. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4333. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4334. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4335. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4336. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4337. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4338. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4339. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4340. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4341. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4342. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4343. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4344. -----END PUBLIC KEY-----
  4345. DEVPUBKEY
  4346. );
  4347. file_put_contents($home.'/keys.tags.pub', <<<TAGSPUBKEY
  4348. -----BEGIN PUBLIC KEY-----
  4349. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4350. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4351. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4352. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4353. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4354. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4355. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4356. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4357. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4358. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4359. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4360. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4361. -----END PUBLIC KEY-----
  4362. TAGSPUBKEY
  4363. );
  4364. }
  4365. $pubkeyid = openssl_pkey_get_public($sigFile);
  4366. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4367. if (!in_array('SHA384', openssl_get_md_methods())) {
  4368. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  4369. }
  4370. $signature = json_decode($signature, true);
  4371. $signature = base64_decode($signature['sha384']);
  4372. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  4373. openssl_free_key($pubkeyid);
  4374. if (!$verified) {
  4375. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  4376. }
  4377. }
  4378. if ($input->getOption('clean-backups')) {
  4379. $finder = $this->getOldInstallationFinder($rollbackDir);
  4380. $fs = new Filesystem;
  4381. foreach ($finder as $file) {
  4382. $file = (string) $file;
  4383. $io->writeError('<info>Removing: '.$file.'</info>');
  4384. $fs->remove($file);
  4385. }
  4386. }
  4387. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  4388. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  4389. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  4390. return 1;
  4391. }
  4392. if (file_exists($backupFile)) {
  4393. $io->writeError('Use <info>composer self-update --rollback</info> to return to version '.Composer::VERSION);
  4394. } else {
  4395. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  4396. }
  4397. }
  4398. protected function fetchKeys(IOInterface $io, Config $config)
  4399. {
  4400. if (!$io->isInteractive()) {
  4401. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  4402. }
  4403. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  4404. $validator = function ($value) {
  4405. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  4406. throw new \UnexpectedValueException('Invalid input');
  4407. }
  4408. return trim($value)."\n";
  4409. };
  4410. $devKey = '';
  4411. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  4412. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  4413. while ($line = $io->ask('')) {
  4414. $devKey .= trim($line)."\n";
  4415. if (trim($line) === '-----END PUBLIC KEY-----') {
  4416. break;
  4417. }
  4418. }
  4419. }
  4420. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  4421. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4422. $tagsKey = '';
  4423. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  4424. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  4425. while ($line = $io->ask('')) {
  4426. $tagsKey .= trim($line)."\n";
  4427. if (trim($line) === '-----END PUBLIC KEY-----') {
  4428. break;
  4429. }
  4430. }
  4431. }
  4432. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  4433. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4434. $io->write('Public keys stored in '.$config->get('home'));
  4435. }
  4436. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  4437. {
  4438. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  4439. if (!$rollbackVersion) {
  4440. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  4441. }
  4442. $old = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  4443. if (!is_file($old)) {
  4444. throw new FilesystemException('Composer rollback failed: "'.$old.'" could not be found');
  4445. }
  4446. if (!is_readable($old)) {
  4447. throw new FilesystemException('Composer rollback failed: "'.$old.'" could not be read');
  4448. }
  4449. $oldFile = $rollbackDir . "/{$rollbackVersion}" . self::OLD_INSTALL_EXT;
  4450. $io = $this->getIO();
  4451. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  4452. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  4453. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().') and has been removed.</error>');
  4454. return 1;
  4455. }
  4456. return 0;
  4457. }
  4458. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  4459. {
  4460. try {
  4461. @chmod($newFilename, fileperms($localFilename));
  4462. if (!ini_get('phar.readonly')) {
  4463. $phar = new \Phar($newFilename);
  4464. unset($phar);
  4465. }
  4466. if ($backupTarget && file_exists($localFilename)) {
  4467. @copy($localFilename, $backupTarget);
  4468. }
  4469. rename($newFilename, $localFilename);
  4470. } catch (\Exception $e) {
  4471. if ($backupTarget) {
  4472. @unlink($newFilename);
  4473. }
  4474. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  4475. throw $e;
  4476. }
  4477. return $e;
  4478. }
  4479. }
  4480. protected function getLastBackupVersion($rollbackDir)
  4481. {
  4482. $finder = $this->getOldInstallationFinder($rollbackDir);
  4483. $finder->sortByName();
  4484. $files = iterator_to_array($finder);
  4485. if (count($files)) {
  4486. return basename(end($files), self::OLD_INSTALL_EXT);
  4487. }
  4488. return false;
  4489. }
  4490. protected function getOldInstallationFinder($rollbackDir)
  4491. {
  4492. $finder = Finder::create()
  4493. ->depth(0)
  4494. ->files()
  4495. ->name('*' . self::OLD_INSTALL_EXT)
  4496. ->in($rollbackDir);
  4497. return $finder;
  4498. }
  4499. }
  4500. <?php
  4501. namespace Composer\Command;
  4502. use Composer\DependencyResolver\Pool;
  4503. use Composer\DependencyResolver\DefaultPolicy;
  4504. use Composer\Factory;
  4505. use Composer\Package\CompletePackageInterface;
  4506. use Composer\Package\Version\VersionParser;
  4507. use Composer\Plugin\CommandEvent;
  4508. use Composer\Plugin\PluginEvents;
  4509. use Composer\Package\PackageInterface;
  4510. use Composer\Util\Platform;
  4511. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  4512. use Symfony\Component\Console\Input\InputInterface;
  4513. use Symfony\Component\Console\Input\InputArgument;
  4514. use Symfony\Component\Console\Input\InputOption;
  4515. use Symfony\Component\Console\Output\OutputInterface;
  4516. use Composer\Repository\ArrayRepository;
  4517. use Composer\Repository\CompositeRepository;
  4518. use Composer\Repository\ComposerRepository;
  4519. use Composer\Repository\PlatformRepository;
  4520. use Composer\Repository\RepositoryInterface;
  4521. use Composer\Spdx\SpdxLicenses;
  4522. class ShowCommand extends BaseCommand
  4523. {
  4524. protected $versionParser;
  4525. protected $colors;
  4526. protected function configure()
  4527. {
  4528. $this
  4529. ->setName('show')
  4530. ->setAliases(array('info'))
  4531. ->setDescription('Show information about packages')
  4532. ->setDefinition(array(
  4533. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect'),
  4534. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  4535. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only'),
  4536. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  4537. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  4538. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  4539. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  4540. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  4541. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  4542. ))
  4543. ->setHelp(<<<EOT
  4544. The show command displays detailed information about a package, or
  4545. lists all packages available.
  4546. EOT
  4547. )
  4548. ;
  4549. }
  4550. protected function execute(InputInterface $input, OutputInterface $output)
  4551. {
  4552. $this->versionParser = new VersionParser;
  4553. if ($input->getOption('tree')) {
  4554. $this->initStyles($output);
  4555. }
  4556. $composer = $this->getComposer(false);
  4557. $io = $this->getIO();
  4558. if ($input->getOption('tree') && !$input->getOption('installed')) {
  4559. $io->writeError('The --tree (-t) option is only usable in combination with --installed (-i) or by passing a single package name to show, assuming -i');
  4560. $input->setOption('installed', true);
  4561. }
  4562. $platformOverrides = array();
  4563. if ($composer) {
  4564. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4565. }
  4566. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  4567. if ($input->getOption('self')) {
  4568. $package = $this->getComposer()->getPackage();
  4569. $repos = $installedRepo = new ArrayRepository(array($package));
  4570. } elseif ($input->getOption('platform')) {
  4571. $repos = $installedRepo = $platformRepo;
  4572. } elseif ($input->getOption('installed')) {
  4573. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  4574. } elseif ($input->getOption('available')) {
  4575. $installedRepo = $platformRepo;
  4576. if ($composer) {
  4577. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  4578. } else {
  4579. $defaultRepos = Factory::createDefaultRepositories($io);
  4580. $repos = new CompositeRepository($defaultRepos);
  4581. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  4582. }
  4583. } elseif ($composer) {
  4584. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4585. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4586. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4587. } else {
  4588. $defaultRepos = Factory::createDefaultRepositories($io);
  4589. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  4590. $installedRepo = $platformRepo;
  4591. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  4592. }
  4593. if ($composer) {
  4594. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  4595. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4596. }
  4597. if ($input->getArgument('package') || !empty($package)) {
  4598. $versions = array();
  4599. if (empty($package)) {
  4600. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  4601. if (!$package) {
  4602. throw new \InvalidArgumentException('Package '.$input->getArgument('package').' not found');
  4603. }
  4604. } else {
  4605. $versions = array($package->getPrettyVersion() => $package->getVersion());
  4606. }
  4607. if ($input->getOption('tree')) {
  4608. $this->displayPackageTree($package, $installedRepo, $repos);
  4609. } else {
  4610. $this->printMeta($package, $versions, $installedRepo, $repos);
  4611. $this->printLinks($package, 'requires');
  4612. $this->printLinks($package, 'devRequires', 'requires (dev)');
  4613. if ($package->getSuggests()) {
  4614. $io->write("\n<info>suggests</info>");
  4615. foreach ($package->getSuggests() as $suggested => $reason) {
  4616. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  4617. }
  4618. }
  4619. $this->printLinks($package, 'provides');
  4620. $this->printLinks($package, 'conflicts');
  4621. $this->printLinks($package, 'replaces');
  4622. }
  4623. return;
  4624. }
  4625. if ($input->getOption('tree')) {
  4626. $rootPackage = $this->getComposer()->getPackage();
  4627. $rootRequires = array_map(
  4628. 'strtolower',
  4629. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  4630. );
  4631. foreach ($installedRepo->getPackages() as $package) {
  4632. if (in_array($package->getName(), $rootRequires, true)) {
  4633. $this->displayPackageTree($package, $installedRepo, $repos);
  4634. }
  4635. }
  4636. return 0;
  4637. }
  4638. if ($repos instanceof CompositeRepository) {
  4639. $repos = $repos->getRepositories();
  4640. } elseif (!is_array($repos)) {
  4641. $repos = array($repos);
  4642. }
  4643. $packages = array();
  4644. foreach ($repos as $repo) {
  4645. if ($repo === $platformRepo) {
  4646. $type = '<info>platform</info>:';
  4647. } elseif (
  4648. $repo === $installedRepo
  4649. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  4650. ) {
  4651. $type = '<info>installed</info>:';
  4652. } else {
  4653. $type = '<comment>available</comment>:';
  4654. }
  4655. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  4656. foreach ($repo->getProviderNames() as $name) {
  4657. $packages[$type][$name] = $name;
  4658. }
  4659. } else {
  4660. foreach ($repo->getPackages() as $package) {
  4661. if (!isset($packages[$type][$package->getName()])
  4662. || !is_object($packages[$type][$package->getName()])
  4663. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  4664. ) {
  4665. $packages[$type][$package->getName()] = $package;
  4666. }
  4667. }
  4668. }
  4669. }
  4670. $showAllTypes = !$input->getOption('platform') && !$input->getOption('installed') && !$input->getOption('available');
  4671. $indent = $showAllTypes ? ' ' : '';
  4672. foreach (array('<info>platform</info>:' => true, '<comment>available</comment>:' => false, '<info>installed</info>:' => true) as $type => $showVersion) {
  4673. if (isset($packages[$type])) {
  4674. if ($showAllTypes) {
  4675. $io->write($type);
  4676. }
  4677. ksort($packages[$type]);
  4678. $nameLength = $versionLength = 0;
  4679. foreach ($packages[$type] as $package) {
  4680. if (is_object($package)) {
  4681. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  4682. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  4683. } else {
  4684. $nameLength = max($nameLength, $package);
  4685. }
  4686. }
  4687. list($width) = $this->getApplication()->getTerminalDimensions();
  4688. if (null === $width) {
  4689. $width = PHP_INT_MAX;
  4690. }
  4691. if (Platform::isWindows()) {
  4692. $width--;
  4693. }
  4694. if ($input->getOption('path') && null === $composer) {
  4695. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  4696. $input->setOption('path', false);
  4697. }
  4698. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  4699. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion && ($nameLength + $versionLength + 3 <= $width);
  4700. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path') && ($nameLength + ($showVersion ? $versionLength : 0) + 24 <= $width);
  4701. foreach ($packages[$type] as $package) {
  4702. if (is_object($package)) {
  4703. $io->write($indent . str_pad($package->getPrettyName(), $nameLength, ' '), false);
  4704. if ($writeVersion) {
  4705. $io->write(' ' . str_pad($package->getFullPrettyVersion(), $versionLength, ' '), false);
  4706. }
  4707. if ($writeDescription) {
  4708. $description = strtok($package->getDescription(), "\r\n");
  4709. $remaining = $width - $nameLength - $versionLength - 4;
  4710. if (strlen($description) > $remaining) {
  4711. $description = substr($description, 0, $remaining - 3) . '...';
  4712. }
  4713. $io->write(' ' . $description, false);
  4714. }
  4715. if ($writePath) {
  4716. $path = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  4717. $io->write(' ' . $path, false);
  4718. }
  4719. } else {
  4720. $io->write($indent . $package, false);
  4721. }
  4722. $io->write('');
  4723. }
  4724. if ($showAllTypes) {
  4725. $io->write('');
  4726. }
  4727. }
  4728. }
  4729. }
  4730. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  4731. {
  4732. $name = strtolower($name);
  4733. $constraint = null;
  4734. if ($version) {
  4735. $constraint = $this->versionParser->parseConstraints($version);
  4736. }
  4737. $policy = new DefaultPolicy();
  4738. $pool = new Pool('dev');
  4739. $pool->addRepository($repos);
  4740. $matchedPackage = null;
  4741. $versions = array();
  4742. $matches = $pool->whatProvides($name, $constraint);
  4743. foreach ($matches as $index => $package) {
  4744. if ($package->getName() !== $name) {
  4745. unset($matches[$index]);
  4746. continue;
  4747. }
  4748. if (null === $version && $installedRepo->hasPackage($package)) {
  4749. $matchedPackage = $package;
  4750. }
  4751. $versions[$package->getPrettyVersion()] = $package->getVersion();
  4752. $matches[$index] = $package->getId();
  4753. }
  4754. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  4755. $matchedPackage = $pool->literalToPackage($preferred[0]);
  4756. }
  4757. return array($matchedPackage, $versions);
  4758. }
  4759. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  4760. {
  4761. $io = $this->getIO();
  4762. $io->write('<info>name</info> : ' . $package->getPrettyName());
  4763. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  4764. $io->write('<info>keywords</info> : ' . join(', ', $package->getKeywords() ?: array()));
  4765. $this->printVersions($package, $versions, $installedRepo);
  4766. $io->write('<info>type</info> : ' . $package->getType());
  4767. $this->printLicenses($package);
  4768. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  4769. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  4770. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  4771. if ($package->isAbandoned()) {
  4772. $replacement = ($package->getReplacementPackage() !== null)
  4773. ? ' The author suggests using the ' . $package->getReplacementPackage(). ' package instead.'
  4774. : null;
  4775. $io->writeError(
  4776. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  4777. );
  4778. }
  4779. if ($package->getSupport()) {
  4780. $io->write("\n<info>support</info>");
  4781. foreach ($package->getSupport() as $type => $value) {
  4782. $io->write('<comment>' . $type . '</comment> : '.$value);
  4783. }
  4784. }
  4785. if ($package->getAutoload()) {
  4786. $io->write("\n<info>autoload</info>");
  4787. foreach ($package->getAutoload() as $type => $autoloads) {
  4788. $io->write('<comment>' . $type . '</comment>');
  4789. if ($type === 'psr-0') {
  4790. foreach ($autoloads as $name => $path) {
  4791. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  4792. }
  4793. } elseif ($type === 'psr-4') {
  4794. foreach ($autoloads as $name => $path) {
  4795. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  4796. }
  4797. } elseif ($type === 'classmap') {
  4798. $io->write(implode(', ', $autoloads));
  4799. }
  4800. }
  4801. if ($package->getIncludePaths()) {
  4802. $io->write('<comment>include-path</comment>');
  4803. $io->write(implode(', ', $package->getIncludePaths()));
  4804. }
  4805. }
  4806. }
  4807. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  4808. {
  4809. uasort($versions, 'version_compare');
  4810. $versions = array_keys(array_reverse($versions));
  4811. if ($installedRepo->hasPackage($package)) {
  4812. $installedVersion = $package->getPrettyVersion();
  4813. $key = array_search($installedVersion, $versions);
  4814. if (false !== $key) {
  4815. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  4816. }
  4817. }
  4818. $versions = implode(', ', $versions);
  4819. $this->getIO()->write('<info>versions</info> : ' . $versions);
  4820. }
  4821. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  4822. {
  4823. $title = $title ?: $linkType;
  4824. $io = $this->getIO();
  4825. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  4826. $io->write("\n<info>" . $title . "</info>");
  4827. foreach ($links as $link) {
  4828. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  4829. }
  4830. }
  4831. }
  4832. protected function printLicenses(CompletePackageInterface $package)
  4833. {
  4834. $spdxLicenses = new SpdxLicenses();
  4835. $licenses = $package->getLicense();
  4836. $io = $this->getIO();
  4837. foreach ($licenses as $licenseId) {
  4838. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  4839. if (!$license) {
  4840. $out = $licenseId;
  4841. } else {
  4842. if ($license[1] === true) {
  4843. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  4844. } else {
  4845. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  4846. }
  4847. }
  4848. $io->write('<info>license</info> : ' . $out);
  4849. }
  4850. }
  4851. protected function initStyles(OutputInterface $output)
  4852. {
  4853. $this->colors = array(
  4854. 'green',
  4855. 'yellow',
  4856. 'cyan',
  4857. 'magenta',
  4858. 'blue',
  4859. );
  4860. foreach ($this->colors as $color) {
  4861. $style = new OutputFormatterStyle($color);
  4862. $output->getFormatter()->setStyle($color, $style);
  4863. }
  4864. }
  4865. protected function displayPackageTree(PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos)
  4866. {
  4867. $packagesInTree = array();
  4868. $packagesInTree[] = $package;
  4869. $io = $this->getIO();
  4870. $io->write(sprintf('<info>%s</info>', $package->getPrettyName()), false);
  4871. $io->write(' ' . $package->getPrettyVersion(), false);
  4872. $io->write(' ' . strtok($package->getDescription(), "\r\n"));
  4873. if (is_object($package)) {
  4874. $requires = $package->getRequires();
  4875. $treeBar = '├';
  4876. $j = 0;
  4877. $total = count($requires);
  4878. foreach ($requires as $requireName => $require) {
  4879. $j++;
  4880. if ($j == 0) {
  4881. $this->writeTreeLine($treeBar);
  4882. }
  4883. if ($j == $total) {
  4884. $treeBar = 'â””';
  4885. }
  4886. $level = 1;
  4887. $color = $this->colors[$level];
  4888. $info = sprintf('%s──<%s>%s</%s> %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint());
  4889. $this->writeTreeLine($info);
  4890. $treeBar = str_replace('â””', ' ', $treeBar);
  4891. $packagesInTree[] = $requireName;
  4892. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree, $treeBar, $level + 1);
  4893. }
  4894. }
  4895. }
  4896. protected function displayTree($name, $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos, array $packagesInTree, $previousTreeBar = '├', $level = 1)
  4897. {
  4898. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  4899. list($package, $versions) = $this->getPackage($installedRepo, $distantRepos, $name, $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint());
  4900. if (is_object($package)) {
  4901. $requires = $package->getRequires();
  4902. $treeBar = $previousTreeBar . ' ├';
  4903. $i = 0;
  4904. $total = count($requires);
  4905. foreach ($requires as $requireName => $require) {
  4906. $i++;
  4907. if ($i == $total) {
  4908. $treeBar = $previousTreeBar . ' â””';
  4909. }
  4910. $colorIdent = $level % count($this->colors);
  4911. $color = $this->colors[$colorIdent];
  4912. $info = sprintf('%s──<%s>%s</%s> %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint());
  4913. $this->writeTreeLine($info);
  4914. $treeBar = str_replace('â””', ' ', $treeBar);
  4915. if (!in_array($requireName, $packagesInTree)) {
  4916. $packagesInTree[] = $requireName;
  4917. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree, $treeBar, $level + 1);
  4918. }
  4919. }
  4920. }
  4921. }
  4922. private function writeTreeLine($line)
  4923. {
  4924. $io = $this->getIO();
  4925. if (!$io->isDecorated()) {
  4926. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  4927. }
  4928. $io->write($line);
  4929. }
  4930. }
  4931. <?php
  4932. namespace Composer\Command;
  4933. use Symfony\Component\Console\Input\InputInterface;
  4934. use Symfony\Component\Console\Input\InputOption;
  4935. use Symfony\Component\Console\Output\OutputInterface;
  4936. use Composer\Downloader\ChangeReportInterface;
  4937. use Composer\Plugin\CommandEvent;
  4938. use Composer\Plugin\PluginEvents;
  4939. use Composer\Script\ScriptEvents;
  4940. class StatusCommand extends BaseCommand
  4941. {
  4942. protected function configure()
  4943. {
  4944. $this
  4945. ->setName('status')
  4946. ->setDescription('Show a list of locally modified packages')
  4947. ->setDefinition(array(
  4948. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  4949. ))
  4950. ->setHelp(<<<EOT
  4951. The status command displays a list of dependencies that have
  4952. been modified locally.
  4953. EOT
  4954. )
  4955. ;
  4956. }
  4957. protected function execute(InputInterface $input, OutputInterface $output)
  4958. {
  4959. $composer = $this->getComposer();
  4960. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  4961. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4962. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  4963. $dm = $composer->getDownloadManager();
  4964. $im = $composer->getInstallationManager();
  4965. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  4966. $errors = array();
  4967. $io = $this->getIO();
  4968. foreach ($installedRepo->getPackages() as $package) {
  4969. $downloader = $dm->getDownloaderForInstalledPackage($package);
  4970. if ($downloader instanceof ChangeReportInterface) {
  4971. $targetDir = $im->getInstallPath($package);
  4972. if (is_link($targetDir)) {
  4973. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  4974. }
  4975. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  4976. $errors[$targetDir] = $changes;
  4977. }
  4978. }
  4979. }
  4980. if (!$errors) {
  4981. $io->writeError('<info>No local changes</info>');
  4982. } else {
  4983. $io->writeError('<error>You have changes in the following dependencies:</error>');
  4984. }
  4985. foreach ($errors as $path => $changes) {
  4986. if ($input->getOption('verbose')) {
  4987. $indentedChanges = implode("\n", array_map(function ($line) {
  4988. return ' ' . ltrim($line);
  4989. }, explode("\n", $changes)));
  4990. $io->write('<info>'.$path.'</info>:');
  4991. $io->write($indentedChanges);
  4992. } else {
  4993. $io->write($path);
  4994. }
  4995. }
  4996. if ($errors && !$input->getOption('verbose')) {
  4997. $io->writeError('Use --verbose (-v) to see modified files');
  4998. }
  4999. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  5000. return $errors ? 1 : 0;
  5001. }
  5002. }
  5003. <?php
  5004. namespace Composer\Command;
  5005. use Symfony\Component\Console\Input\InputArgument;
  5006. use Symfony\Component\Console\Input\InputInterface;
  5007. use Symfony\Component\Console\Input\InputOption;
  5008. use Symfony\Component\Console\Output\OutputInterface;
  5009. class SuggestsCommand extends BaseCommand
  5010. {
  5011. protected function configure()
  5012. {
  5013. $this
  5014. ->setName('suggests')
  5015. ->setDescription('Show package suggestions')
  5016. ->setDefinition(array(
  5017. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  5018. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  5019. ))
  5020. ->setHelp(<<<EOT
  5021. The <info>%command.name%</info> command shows suggested packages.
  5022. With <info>-v</info> you also see which package suggested it and why.
  5023. EOT
  5024. )
  5025. ;
  5026. }
  5027. protected function execute(InputInterface $input, OutputInterface $output)
  5028. {
  5029. $lock = $this->getComposer()->getLocker()->getLockData();
  5030. if (empty($lock)) {
  5031. throw new \RuntimeException('Lockfile seems to be empty?');
  5032. }
  5033. $packages = $lock['packages'];
  5034. if (!$input->getOption('no-dev')) {
  5035. $packages += $lock['packages-dev'];
  5036. }
  5037. $filter = $input->getArgument('packages');
  5038. foreach ($packages as $package) {
  5039. if (empty($package['suggest'])) {
  5040. continue;
  5041. }
  5042. if (!empty($filter) && !in_array($package['name'], $filter)) {
  5043. continue;
  5044. }
  5045. $this->printSuggestions($packages, $package['name'], $package['suggest']);
  5046. }
  5047. }
  5048. protected function printSuggestions($installed, $source, $suggestions)
  5049. {
  5050. foreach ($suggestions as $suggestion => $reason) {
  5051. foreach ($installed as $package) {
  5052. if ($package['name'] === $suggestion) {
  5053. continue 2;
  5054. }
  5055. }
  5056. if (empty($reason)) {
  5057. $reason = '*';
  5058. }
  5059. $this->printSuggestion($source, $suggestion, $reason);
  5060. }
  5061. }
  5062. protected function printSuggestion($package, $suggestion, $reason)
  5063. {
  5064. $io = $this->getIO();
  5065. if ($io->isVerbose()) {
  5066. $io->write(sprintf('<comment>%s</comment> suggests <info>%s</info>: %s', $package, $suggestion, $reason));
  5067. } else {
  5068. $io->write(sprintf('<info>%s</info>', $suggestion));
  5069. }
  5070. }
  5071. }
  5072. <?php
  5073. namespace Composer\Command;
  5074. use Composer\Composer;
  5075. use Composer\Installer;
  5076. use Composer\IO\IOInterface;
  5077. use Composer\Plugin\CommandEvent;
  5078. use Composer\Plugin\PluginEvents;
  5079. use Symfony\Component\Console\Helper\Table;
  5080. use Symfony\Component\Console\Input\InputInterface;
  5081. use Symfony\Component\Console\Input\InputOption;
  5082. use Symfony\Component\Console\Input\InputArgument;
  5083. use Symfony\Component\Console\Output\OutputInterface;
  5084. use Symfony\Component\Console\Question\Question;
  5085. class UpdateCommand extends BaseCommand
  5086. {
  5087. protected function configure()
  5088. {
  5089. $this
  5090. ->setName('update')
  5091. ->setDescription('Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  5092. ->setDefinition(array(
  5093. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  5094. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5095. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  5096. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5097. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  5098. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  5099. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  5100. new InputOption('no-plugins', null, InputOption::VALUE_NONE, 'Disables all plugins.'),
  5101. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  5102. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  5103. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  5104. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5105. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist.'),
  5106. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  5107. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  5108. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5109. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  5110. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  5111. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  5112. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  5113. ))
  5114. ->setHelp(<<<EOT
  5115. The <info>update</info> command reads the composer.json file from the
  5116. current directory, processes it, and updates, removes or installs all the
  5117. dependencies.
  5118. <info>php composer.phar update</info>
  5119. To limit the update operation to a few packages, you can list the package(s)
  5120. you want to update as such:
  5121. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  5122. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  5123. from a specific vendor:
  5124. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  5125. To select packages names interactively with auto-completion use <info>-i</info>.
  5126. EOT
  5127. )
  5128. ;
  5129. }
  5130. protected function execute(InputInterface $input, OutputInterface $output)
  5131. {
  5132. $io = $this->getIO();
  5133. if ($input->getOption('no-custom-installers')) {
  5134. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  5135. $input->setOption('no-plugins', true);
  5136. }
  5137. if ($input->getOption('dev')) {
  5138. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  5139. }
  5140. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  5141. $packages = $input->getArgument('packages');
  5142. if ($input->getOption('interactive')) {
  5143. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  5144. }
  5145. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  5146. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  5147. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5148. $install = Installer::create($io, $composer);
  5149. $preferSource = false;
  5150. $preferDist = false;
  5151. $config = $composer->getConfig();
  5152. switch ($config->get('preferred-install')) {
  5153. case 'source':
  5154. $preferSource = true;
  5155. break;
  5156. case 'dist':
  5157. $preferDist = true;
  5158. break;
  5159. case 'auto':
  5160. default:
  5161. break;
  5162. }
  5163. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist')) {
  5164. $preferSource = $input->getOption('prefer-source');
  5165. $preferDist = $input->getOption('prefer-dist');
  5166. }
  5167. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  5168. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5169. $install
  5170. ->setDryRun($input->getOption('dry-run'))
  5171. ->setVerbose($input->getOption('verbose'))
  5172. ->setPreferSource($preferSource)
  5173. ->setPreferDist($preferDist)
  5174. ->setDevMode(!$input->getOption('no-dev'))
  5175. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  5176. ->setRunScripts(!$input->getOption('no-scripts'))
  5177. ->setOptimizeAutoloader($optimize)
  5178. ->setClassMapAuthoritative($authoritative)
  5179. ->setUpdate(true)
  5180. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  5181. ->setWhitelistDependencies($input->getOption('with-dependencies'))
  5182. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  5183. ->setPreferStable($input->getOption('prefer-stable'))
  5184. ->setPreferLowest($input->getOption('prefer-lowest'))
  5185. ;
  5186. if ($input->getOption('no-plugins')) {
  5187. $install->disablePlugins();
  5188. }
  5189. return $install->run();
  5190. }
  5191. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  5192. {
  5193. if (!$input->isInteractive()) {
  5194. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  5195. }
  5196. $requires = array_merge(
  5197. $composer->getPackage()->getRequires(),
  5198. $composer->getPackage()->getDevRequires()
  5199. );
  5200. $autocompleterValues = array();
  5201. foreach ($requires as $require) {
  5202. $autocompleterValues[strtolower($require->getTarget())] = $require->getTarget();
  5203. }
  5204. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  5205. foreach ($installedPackages as $package) {
  5206. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  5207. }
  5208. $helper = $this->getHelper('question');
  5209. $question = new Question('<comment>Enter package name: </comment>', null);
  5210. $io->writeError('<info>Press enter without value to end submission</info>');
  5211. do {
  5212. $autocompleterValues = array_diff($autocompleterValues, $packages);
  5213. $question->setAutocompleterValues($autocompleterValues);
  5214. $addedPackage = $helper->ask($input, $output, $question);
  5215. if (!is_string($addedPackage) || empty($addedPackage)) {
  5216. break;
  5217. }
  5218. $addedPackage = strtolower($addedPackage);
  5219. if (!in_array($addedPackage, $packages)) {
  5220. $packages[] = $addedPackage;
  5221. }
  5222. } while (true);
  5223. $packages = array_filter($packages);
  5224. if (!$packages) {
  5225. throw new \InvalidArgumentException('You must enter minimum one package.');
  5226. }
  5227. $table = new Table($output);
  5228. $table->setHeaders(array('Selected packages'));
  5229. foreach ($packages as $package) {
  5230. $table->addRow(array($package));
  5231. }
  5232. $table->render();
  5233. if ($io->askConfirmation(sprintf(
  5234. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  5235. 1 === count($packages) ? '' : 's'
  5236. ), true)) {
  5237. return $packages;
  5238. }
  5239. throw new \RuntimeException('Installation aborted.');
  5240. }
  5241. }
  5242. <?php
  5243. namespace Composer\Command;
  5244. use Composer\Factory;
  5245. use Composer\Package\Loader\ValidatingArrayLoader;
  5246. use Composer\Plugin\CommandEvent;
  5247. use Composer\Plugin\PluginEvents;
  5248. use Composer\Script\ScriptEvents;
  5249. use Composer\Util\ConfigValidator;
  5250. use Symfony\Component\Console\Input\InputArgument;
  5251. use Symfony\Component\Console\Input\InputInterface;
  5252. use Symfony\Component\Console\Input\InputOption;
  5253. use Symfony\Component\Console\Output\OutputInterface;
  5254. class ValidateCommand extends BaseCommand
  5255. {
  5256. protected function configure()
  5257. {
  5258. $this
  5259. ->setName('validate')
  5260. ->setDescription('Validates a composer.json and composer.lock')
  5261. ->setDefinition(array(
  5262. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'),
  5263. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  5264. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  5265. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  5266. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  5267. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file', './composer.json'),
  5268. ))
  5269. ->setHelp(<<<EOT
  5270. The validate command validates a given composer.json and composer.lock
  5271. Exit codes in case of errors are:
  5272. 1 validation warning(s), only when --strict is given
  5273. 2 validation error(s)
  5274. 3 file unreadable or missing
  5275. EOT
  5276. );
  5277. }
  5278. protected function execute(InputInterface $input, OutputInterface $output)
  5279. {
  5280. $file = $input->getArgument('file');
  5281. $io = $this->getIO();
  5282. if (!file_exists($file)) {
  5283. $io->writeError('<error>' . $file . ' not found.</error>');
  5284. return 3;
  5285. }
  5286. if (!is_readable($file)) {
  5287. $io->writeError('<error>' . $file . ' is not readable.</error>');
  5288. return 3;
  5289. }
  5290. $validator = new ConfigValidator($io);
  5291. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  5292. $checkPublish = !$input->getOption('no-check-publish');
  5293. $checkLock = !$input->getOption('no-check-lock');
  5294. $isStrict = $input->getOption('strict');
  5295. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  5296. $lockErrors = array();
  5297. $composer = Factory::create($io, $file);
  5298. $locker = $composer->getLocker();
  5299. if ($locker->isLocked() && !$locker->isFresh()) {
  5300. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  5301. }
  5302. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  5303. $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0);
  5304. if ($input->getOption('with-dependencies')) {
  5305. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5306. foreach ($localRepo->getPackages() as $package) {
  5307. $path = $composer->getInstallationManager()->getInstallPath($package);
  5308. $file = $path . '/composer.json';
  5309. if (is_dir($path) && file_exists($file)) {
  5310. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  5311. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  5312. $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0);
  5313. $exitCode = max($depCode, $exitCode);
  5314. }
  5315. }
  5316. }
  5317. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  5318. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5319. $exitCode = max($eventCode, $exitCode);
  5320. return $exitCode;
  5321. }
  5322. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  5323. {
  5324. if (!$errors && !$publishErrors && !$warnings) {
  5325. $io->write('<info>' . $name . ' is valid</info>');
  5326. } elseif (!$errors && !$publishErrors) {
  5327. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  5328. if ($printSchemaUrl) {
  5329. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  5330. }
  5331. } elseif (!$errors) {
  5332. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  5333. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  5334. if ($printSchemaUrl) {
  5335. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  5336. }
  5337. } else {
  5338. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  5339. }
  5340. if ($checkPublish) {
  5341. $errors = array_merge($errors, $publishErrors);
  5342. } else {
  5343. $warnings = array_merge($warnings, $publishErrors);
  5344. }
  5345. if ($checkLock) {
  5346. $errors = array_merge($errors, $lockErrors);
  5347. } else {
  5348. $warnings = array_merge($warnings, $lockErrors);
  5349. }
  5350. $messages = array(
  5351. 'error' => $errors,
  5352. 'warning' => $warnings,
  5353. );
  5354. foreach ($messages as $style => $msgs) {
  5355. foreach ($msgs as $msg) {
  5356. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  5357. }
  5358. }
  5359. }
  5360. }
  5361. <?php
  5362. namespace Composer;
  5363. use Composer\Package\RootPackageInterface;
  5364. use Composer\Package\Locker;
  5365. use Composer\Repository\RepositoryManager;
  5366. use Composer\Installer\InstallationManager;
  5367. use Composer\Plugin\PluginManager;
  5368. use Composer\Downloader\DownloadManager;
  5369. use Composer\EventDispatcher\EventDispatcher;
  5370. use Composer\Autoload\AutoloadGenerator;
  5371. class Composer
  5372. {
  5373. const VERSION = 'dc2f201152f37c2563e328531a6af349ac287cce';
  5374. const BRANCH_ALIAS_VERSION = '1.0-dev';
  5375. const RELEASE_DATE = '2016-02-24 19:54:01';
  5376. private $package;
  5377. private $locker;
  5378. private $repositoryManager;
  5379. private $downloadManager;
  5380. private $installationManager;
  5381. private $pluginManager;
  5382. private $config;
  5383. private $eventDispatcher;
  5384. private $autoloadGenerator;
  5385. public function setPackage(RootPackageInterface $package)
  5386. {
  5387. $this->package = $package;
  5388. }
  5389. public function getPackage()
  5390. {
  5391. return $this->package;
  5392. }
  5393. public function setConfig(Config $config)
  5394. {
  5395. $this->config = $config;
  5396. }
  5397. public function getConfig()
  5398. {
  5399. return $this->config;
  5400. }
  5401. public function setLocker(Locker $locker)
  5402. {
  5403. $this->locker = $locker;
  5404. }
  5405. public function getLocker()
  5406. {
  5407. return $this->locker;
  5408. }
  5409. public function setRepositoryManager(RepositoryManager $manager)
  5410. {
  5411. $this->repositoryManager = $manager;
  5412. }
  5413. public function getRepositoryManager()
  5414. {
  5415. return $this->repositoryManager;
  5416. }
  5417. public function setDownloadManager(DownloadManager $manager)
  5418. {
  5419. $this->downloadManager = $manager;
  5420. }
  5421. public function getDownloadManager()
  5422. {
  5423. return $this->downloadManager;
  5424. }
  5425. public function setInstallationManager(InstallationManager $manager)
  5426. {
  5427. $this->installationManager = $manager;
  5428. }
  5429. public function getInstallationManager()
  5430. {
  5431. return $this->installationManager;
  5432. }
  5433. public function setPluginManager(PluginManager $manager)
  5434. {
  5435. $this->pluginManager = $manager;
  5436. }
  5437. public function getPluginManager()
  5438. {
  5439. return $this->pluginManager;
  5440. }
  5441. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  5442. {
  5443. $this->eventDispatcher = $eventDispatcher;
  5444. }
  5445. public function getEventDispatcher()
  5446. {
  5447. return $this->eventDispatcher;
  5448. }
  5449. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  5450. {
  5451. $this->autoloadGenerator = $autoloadGenerator;
  5452. }
  5453. public function getAutoloadGenerator()
  5454. {
  5455. return $this->autoloadGenerator;
  5456. }
  5457. }
  5458. <?php
  5459. namespace Composer;
  5460. use Composer\Config\ConfigSourceInterface;
  5461. class Config
  5462. {
  5463. const RELATIVE_PATHS = 1;
  5464. public static $defaultConfig = array(
  5465. 'process-timeout' => 300,
  5466. 'use-include-path' => false,
  5467. 'preferred-install' => 'auto',
  5468. 'notify-on-install' => true,
  5469. 'github-protocols' => array('git', 'https', 'ssh'),
  5470. 'vendor-dir' => 'vendor',
  5471. 'bin-dir' => '{$vendor-dir}/bin',
  5472. 'cache-dir' => '{$home}/cache',
  5473. 'data-dir' => '{$home}',
  5474. 'cache-files-dir' => '{$cache-dir}/files',
  5475. 'cache-repo-dir' => '{$cache-dir}/repo',
  5476. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  5477. 'cache-ttl' => 15552000,
  5478. 'cache-files-ttl' => null,
  5479. 'cache-files-maxsize' => '300MiB',
  5480. 'bin-compat' => 'auto',
  5481. 'discard-changes' => false,
  5482. 'autoloader-suffix' => null,
  5483. 'sort-packages' => false,
  5484. 'optimize-autoloader' => false,
  5485. 'classmap-authoritative' => false,
  5486. 'prepend-autoloader' => true,
  5487. 'github-domains' => array('github.com'),
  5488. 'disable-tls' => false,
  5489. 'cafile' => null,
  5490. 'capath' => null,
  5491. 'github-expose-hostname' => true,
  5492. 'gitlab-domains' => array('gitlab.com'),
  5493. 'store-auths' => 'prompt',
  5494. 'platform' => array(),
  5495. 'archive-format' => 'tar',
  5496. 'archive-dir' => '.',
  5497. );
  5498. public static $defaultRepositories = array(
  5499. 'packagist' => array(
  5500. 'type' => 'composer',
  5501. 'url' => 'https?://packagist.org',
  5502. 'allow_ssl_downgrade' => true,
  5503. ),
  5504. );
  5505. private $config;
  5506. private $baseDir;
  5507. private $repositories;
  5508. private $configSource;
  5509. private $authConfigSource;
  5510. private $useEnvironment;
  5511. public function __construct($useEnvironment = true, $baseDir = null)
  5512. {
  5513. $this->config = static::$defaultConfig;
  5514. $this->repositories = static::$defaultRepositories;
  5515. $this->useEnvironment = (bool) $useEnvironment;
  5516. $this->baseDir = $baseDir;
  5517. }
  5518. public function setConfigSource(ConfigSourceInterface $source)
  5519. {
  5520. $this->configSource = $source;
  5521. }
  5522. public function getConfigSource()
  5523. {
  5524. return $this->configSource;
  5525. }
  5526. public function setAuthConfigSource(ConfigSourceInterface $source)
  5527. {
  5528. $this->authConfigSource = $source;
  5529. }
  5530. public function getAuthConfigSource()
  5531. {
  5532. return $this->authConfigSource;
  5533. }
  5534. public function merge($config)
  5535. {
  5536. if (!empty($config['config']) && is_array($config['config'])) {
  5537. foreach ($config['config'] as $key => $val) {
  5538. if (in_array($key, array('github-oauth', 'gitlab-oauth', 'http-basic')) && isset($this->config[$key])) {
  5539. $this->config[$key] = array_merge($this->config[$key], $val);
  5540. } else {
  5541. $this->config[$key] = $val;
  5542. }
  5543. }
  5544. }
  5545. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  5546. $this->repositories = array_reverse($this->repositories, true);
  5547. $newRepos = array_reverse($config['repositories'], true);
  5548. foreach ($newRepos as $name => $repository) {
  5549. if (false === $repository) {
  5550. unset($this->repositories[$name]);
  5551. continue;
  5552. }
  5553. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  5554. unset($this->repositories[key($repository)]);
  5555. continue;
  5556. }
  5557. if (is_int($name)) {
  5558. $this->repositories[] = $repository;
  5559. } else {
  5560. $this->repositories[$name] = $repository;
  5561. }
  5562. }
  5563. $this->repositories = array_reverse($this->repositories, true);
  5564. }
  5565. }
  5566. public function getRepositories()
  5567. {
  5568. return $this->repositories;
  5569. }
  5570. public function get($key, $flags = 0)
  5571. {
  5572. switch ($key) {
  5573. case 'vendor-dir':
  5574. case 'bin-dir':
  5575. case 'process-timeout':
  5576. case 'data-dir':
  5577. case 'cache-dir':
  5578. case 'cache-files-dir':
  5579. case 'cache-repo-dir':
  5580. case 'cache-vcs-dir':
  5581. case 'cafile':
  5582. case 'capath':
  5583. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  5584. $val = rtrim($this->process($this->getComposerEnv($env) ?: $this->config[$key], $flags), '/\\');
  5585. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $val);
  5586. if (substr($key, -4) !== '-dir') {
  5587. return $val;
  5588. }
  5589. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  5590. case 'cache-ttl':
  5591. return (int) $this->config[$key];
  5592. case 'cache-files-maxsize':
  5593. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  5594. throw new \RuntimeException(
  5595. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  5596. );
  5597. }
  5598. $size = $matches[1];
  5599. if (isset($matches[2])) {
  5600. switch (strtolower($matches[2])) {
  5601. case 'g':
  5602. $size *= 1024;
  5603. case 'm':
  5604. $size *= 1024;
  5605. case 'k':
  5606. $size *= 1024;
  5607. break;
  5608. }
  5609. }
  5610. return $size;
  5611. case 'cache-files-ttl':
  5612. if (isset($this->config[$key])) {
  5613. return (int) $this->config[$key];
  5614. }
  5615. return (int) $this->config['cache-ttl'];
  5616. case 'home':
  5617. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  5618. return rtrim($this->process($val, $flags), '/\\');
  5619. case 'bin-compat':
  5620. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  5621. if (!in_array($value, array('auto', 'full'))) {
  5622. throw new \RuntimeException(
  5623. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  5624. );
  5625. }
  5626. return $value;
  5627. case 'discard-changes':
  5628. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  5629. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  5630. throw new \RuntimeException(
  5631. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  5632. );
  5633. }
  5634. if ('stash' === $env) {
  5635. return 'stash';
  5636. }
  5637. return $env !== 'false' && (bool) $env;
  5638. }
  5639. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  5640. throw new \RuntimeException(
  5641. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  5642. );
  5643. }
  5644. return $this->config[$key];
  5645. case 'github-protocols':
  5646. if (reset($this->config['github-protocols']) === 'http') {
  5647. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  5648. }
  5649. return $this->config[$key];
  5650. case 'disable-tls':
  5651. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  5652. default:
  5653. if (!isset($this->config[$key])) {
  5654. return null;
  5655. }
  5656. return $this->process($this->config[$key], $flags);
  5657. }
  5658. }
  5659. public function all($flags = 0)
  5660. {
  5661. $all = array(
  5662. 'repositories' => $this->getRepositories(),
  5663. );
  5664. foreach (array_keys($this->config) as $key) {
  5665. $all['config'][$key] = $this->get($key, $flags);
  5666. }
  5667. return $all;
  5668. }
  5669. public function raw()
  5670. {
  5671. return array(
  5672. 'repositories' => $this->getRepositories(),
  5673. 'config' => $this->config,
  5674. );
  5675. }
  5676. public function has($key)
  5677. {
  5678. return array_key_exists($key, $this->config);
  5679. }
  5680. private function process($value, $flags)
  5681. {
  5682. $config = $this;
  5683. if (!is_string($value)) {
  5684. return $value;
  5685. }
  5686. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  5687. return $config->get($match[1], $flags);
  5688. }, $value);
  5689. }
  5690. private function realpath($path)
  5691. {
  5692. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  5693. return $path;
  5694. }
  5695. return $this->baseDir . '/' . $path;
  5696. }
  5697. private function getComposerEnv($var)
  5698. {
  5699. if ($this->useEnvironment) {
  5700. return getenv($var);
  5701. }
  5702. return false;
  5703. }
  5704. }
  5705. <?php
  5706. namespace Composer\Config;
  5707. interface ConfigSourceInterface
  5708. {
  5709. public function addRepository($name, $config);
  5710. public function removeRepository($name);
  5711. public function addConfigSetting($name, $value);
  5712. public function removeConfigSetting($name);
  5713. public function addLink($type, $name, $value);
  5714. public function removeLink($type, $name);
  5715. public function getName();
  5716. }
  5717. <?php
  5718. namespace Composer\Config;
  5719. use Composer\Json\JsonFile;
  5720. use Composer\Json\JsonManipulator;
  5721. use Composer\Util\Silencer;
  5722. class JsonConfigSource implements ConfigSourceInterface
  5723. {
  5724. private $file;
  5725. private $authConfig;
  5726. public function __construct(JsonFile $file, $authConfig = false)
  5727. {
  5728. $this->file = $file;
  5729. $this->authConfig = $authConfig;
  5730. }
  5731. public function getName()
  5732. {
  5733. return $this->file->getPath();
  5734. }
  5735. public function addRepository($name, $config)
  5736. {
  5737. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  5738. $config['repositories'][$repo] = $repoConfig;
  5739. });
  5740. }
  5741. public function removeRepository($name)
  5742. {
  5743. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  5744. unset($config['repositories'][$repo]);
  5745. });
  5746. }
  5747. public function addConfigSetting($name, $value)
  5748. {
  5749. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) {
  5750. if (preg_match('{^(github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) {
  5751. list($key, $host) = explode('.', $key, 2);
  5752. if ($this->authConfig) {
  5753. $config[$key][$host] = $val;
  5754. } else {
  5755. $config['config'][$key][$host] = $val;
  5756. }
  5757. } else {
  5758. $config['config'][$key] = $val;
  5759. }
  5760. });
  5761. }
  5762. public function removeConfigSetting($name)
  5763. {
  5764. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) {
  5765. if (preg_match('{^(github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) {
  5766. list($key, $host) = explode('.', $key, 2);
  5767. if ($this->authConfig) {
  5768. unset($config[$key][$host]);
  5769. } else {
  5770. unset($config['config'][$key][$host]);
  5771. }
  5772. } else {
  5773. unset($config['config'][$key]);
  5774. }
  5775. });
  5776. }
  5777. public function addLink($type, $name, $value)
  5778. {
  5779. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  5780. $config[$type][$name] = $value;
  5781. });
  5782. }
  5783. public function removeLink($type, $name)
  5784. {
  5785. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  5786. unset($config[$type][$name]);
  5787. });
  5788. }
  5789. protected function manipulateJson($method, $args, $fallback)
  5790. {
  5791. $args = func_get_args();
  5792. array_shift($args);
  5793. $fallback = array_pop($args);
  5794. if ($this->file->exists()) {
  5795. if (!is_writable($this->file->getPath())) {
  5796. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  5797. }
  5798. if (!is_readable($this->file->getPath())) {
  5799. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  5800. }
  5801. $contents = file_get_contents($this->file->getPath());
  5802. } elseif ($this->authConfig) {
  5803. $contents = "{\n}\n";
  5804. } else {
  5805. $contents = "{\n \"config\": {\n }\n}\n";
  5806. }
  5807. $manipulator = new JsonManipulator($contents);
  5808. $newFile = !$this->file->exists();
  5809. if ($this->authConfig && $method === 'addConfigSetting') {
  5810. $method = 'addSubNode';
  5811. list($mainNode, $name) = explode('.', $args[0], 2);
  5812. $args = array($mainNode, $name, $args[1]);
  5813. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  5814. $method = 'removeSubNode';
  5815. list($mainNode, $name) = explode('.', $args[0], 2);
  5816. $args = array($mainNode, $name);
  5817. }
  5818. if (call_user_func_array(array($manipulator, $method), $args)) {
  5819. file_put_contents($this->file->getPath(), $manipulator->getContents());
  5820. } else {
  5821. $config = $this->file->read();
  5822. $this->arrayUnshiftRef($args, $config);
  5823. call_user_func_array($fallback, $args);
  5824. $this->file->write($config);
  5825. }
  5826. if ($newFile) {
  5827. Silencer::call('chmod', $this->file->getPath(), 0600);
  5828. }
  5829. }
  5830. private function arrayUnshiftRef(&$array, &$value)
  5831. {
  5832. $return = array_unshift($array, '');
  5833. $array[0] = &$value;
  5834. return $return;
  5835. }
  5836. }
  5837. <?php
  5838. namespace Composer\Console;
  5839. use Composer\Util\Platform;
  5840. use Composer\Util\Silencer;
  5841. use Symfony\Component\Console\Application as BaseApplication;
  5842. use Symfony\Component\Console\Input\InputInterface;
  5843. use Symfony\Component\Console\Input\InputOption;
  5844. use Symfony\Component\Console\Output\OutputInterface;
  5845. use Symfony\Component\Console\Output\ConsoleOutput;
  5846. use Symfony\Component\Console\Formatter\OutputFormatter;
  5847. use Composer\Command;
  5848. use Composer\Composer;
  5849. use Composer\Factory;
  5850. use Composer\IO\IOInterface;
  5851. use Composer\IO\ConsoleIO;
  5852. use Composer\Json\JsonValidationException;
  5853. use Composer\Util\ErrorHandler;
  5854. class Application extends BaseApplication
  5855. {
  5856. protected $composer;
  5857. protected $io;
  5858. private static $logo = ' ______
  5859. / ____/___ ____ ___ ____ ____ ________ _____
  5860. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  5861. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  5862. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  5863. /_/
  5864. ';
  5865. public function __construct()
  5866. {
  5867. static $shutdownRegistered = false;
  5868. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  5869. ini_set('xdebug.show_exception_trace', false);
  5870. ini_set('xdebug.scream', false);
  5871. }
  5872. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  5873. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  5874. }
  5875. if (!$shutdownRegistered) {
  5876. $shutdownRegistered = true;
  5877. register_shutdown_function(function () {
  5878. $lastError = error_get_last();
  5879. if ($lastError && $lastError['message'] &&
  5880. (strpos($lastError['message'], 'Allowed memory') !== false ||
  5881. strpos($lastError['message'], 'exceeded memory') !== false )) {
  5882. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  5883. }
  5884. });
  5885. }
  5886. parent::__construct('Composer', Composer::VERSION);
  5887. }
  5888. public function run(InputInterface $input = null, OutputInterface $output = null)
  5889. {
  5890. if (null === $output) {
  5891. $styles = Factory::createAdditionalStyles();
  5892. $formatter = new OutputFormatter(null, $styles);
  5893. $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  5894. }
  5895. return parent::run($input, $output);
  5896. }
  5897. public function doRun(InputInterface $input, OutputInterface $output)
  5898. {
  5899. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  5900. ErrorHandler::register($io);
  5901. $commandName = '';
  5902. if ($name = $this->getCommandName($input)) {
  5903. try {
  5904. $commandName = $this->find($name)->getName();
  5905. } catch (\InvalidArgumentException $e) {
  5906. }
  5907. }
  5908. if ($commandName !== 'global') {
  5909. if (PHP_VERSION_ID < 50302) {
  5910. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  5911. }
  5912. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  5913. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  5914. }
  5915. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  5916. $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  5917. }
  5918. if (getenv('COMPOSER_NO_INTERACTION')) {
  5919. $input->setInteractive(false);
  5920. }
  5921. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  5922. $oldWorkingDir = getcwd();
  5923. chdir($newWorkDir);
  5924. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  5925. }
  5926. $file = Factory::getComposerFile();
  5927. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  5928. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  5929. foreach ($composer['scripts'] as $script => $dummy) {
  5930. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  5931. if ($this->has($script)) {
  5932. $io->writeError('<warning>A script named '.$script.' would override a native Composer function and has been skipped</warning>');
  5933. } else {
  5934. $this->add(new Command\ScriptAliasCommand($script));
  5935. }
  5936. }
  5937. }
  5938. }
  5939. }
  5940. }
  5941. try {
  5942. if ($input->hasParameterOption('--profile')) {
  5943. $startTime = microtime(true);
  5944. $this->io->enableDebugging($startTime);
  5945. }
  5946. $result = parent::doRun($input, $output);
  5947. if (isset($oldWorkingDir)) {
  5948. chdir($oldWorkingDir);
  5949. }
  5950. if (isset($startTime)) {
  5951. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MB), time: '.round(microtime(true) - $startTime, 2).'s');
  5952. }
  5953. return $result;
  5954. } catch (\Exception $e) {
  5955. $this->hintCommonErrors($e);
  5956. throw $e;
  5957. }
  5958. }
  5959. private function getNewWorkingDir(InputInterface $input)
  5960. {
  5961. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  5962. if (false !== $workingDir && !is_dir($workingDir)) {
  5963. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  5964. }
  5965. return $workingDir;
  5966. }
  5967. private function hintCommonErrors($exception)
  5968. {
  5969. $io = $this->getIO();
  5970. Silencer::suppress();
  5971. try {
  5972. $composer = $this->getComposer(false, true);
  5973. if ($composer) {
  5974. $config = $composer->getConfig();
  5975. $minSpaceFree = 1024 * 1024;
  5976. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  5977. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  5978. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  5979. ) {
  5980. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  5981. }
  5982. }
  5983. } catch (\Exception $e) {
  5984. }
  5985. Silencer::restore();
  5986. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  5987. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  5988. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  5989. }
  5990. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  5991. $io->writeError('<error>The following exception is caused by a lack of memory and not having swap configured</error>', true, IOInterface::QUIET);
  5992. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  5993. }
  5994. }
  5995. public function getComposer($required = true, $disablePlugins = false)
  5996. {
  5997. if (null === $this->composer) {
  5998. try {
  5999. $this->composer = Factory::create($this->io, null, $disablePlugins);
  6000. } catch (\InvalidArgumentException $e) {
  6001. if ($required) {
  6002. $this->io->writeError($e->getMessage());
  6003. exit(1);
  6004. }
  6005. } catch (JsonValidationException $e) {
  6006. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  6007. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  6008. throw new JsonValidationException($message);
  6009. }
  6010. }
  6011. return $this->composer;
  6012. }
  6013. public function resetComposer()
  6014. {
  6015. $this->composer = null;
  6016. }
  6017. public function getIO()
  6018. {
  6019. return $this->io;
  6020. }
  6021. public function getHelp()
  6022. {
  6023. return self::$logo . parent::getHelp();
  6024. }
  6025. protected function getDefaultCommands()
  6026. {
  6027. $commands = array_merge(parent::getDefaultCommands(), array(
  6028. new Command\AboutCommand(),
  6029. new Command\ConfigCommand(),
  6030. new Command\DependsCommand(),
  6031. new Command\ProhibitsCommand(),
  6032. new Command\InitCommand(),
  6033. new Command\InstallCommand(),
  6034. new Command\CreateProjectCommand(),
  6035. new Command\UpdateCommand(),
  6036. new Command\SearchCommand(),
  6037. new Command\ValidateCommand(),
  6038. new Command\ShowCommand(),
  6039. new Command\SuggestsCommand(),
  6040. new Command\RequireCommand(),
  6041. new Command\DumpAutoloadCommand(),
  6042. new Command\StatusCommand(),
  6043. new Command\ArchiveCommand(),
  6044. new Command\DiagnoseCommand(),
  6045. new Command\RunScriptCommand(),
  6046. new Command\LicensesCommand(),
  6047. new Command\GlobalCommand(),
  6048. new Command\ClearCacheCommand(),
  6049. new Command\RemoveCommand(),
  6050. new Command\HomeCommand(),
  6051. ));
  6052. if ('phar:' === substr(__FILE__, 0, 5)) {
  6053. $commands[] = new Command\SelfUpdateCommand();
  6054. }
  6055. return $commands;
  6056. }
  6057. public function getLongVersion()
  6058. {
  6059. if (Composer::BRANCH_ALIAS_VERSION) {
  6060. return sprintf(
  6061. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  6062. $this->getName(),
  6063. Composer::BRANCH_ALIAS_VERSION,
  6064. $this->getVersion(),
  6065. Composer::RELEASE_DATE
  6066. );
  6067. }
  6068. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  6069. }
  6070. protected function getDefaultInputDefinition()
  6071. {
  6072. $definition = parent::getDefaultInputDefinition();
  6073. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  6074. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  6075. return $definition;
  6076. }
  6077. }
  6078. <?php
  6079. namespace Composer\Console;
  6080. use Symfony\Component\Console\Formatter\OutputFormatter;
  6081. class HtmlOutputFormatter extends OutputFormatter
  6082. {
  6083. private static $availableForegroundColors = array(
  6084. 30 => 'black',
  6085. 31 => 'red',
  6086. 32 => 'green',
  6087. 33 => 'yellow',
  6088. 34 => 'blue',
  6089. 35 => 'magenta',
  6090. 36 => 'cyan',
  6091. 37 => 'white',
  6092. );
  6093. private static $availableBackgroundColors = array(
  6094. 40 => 'black',
  6095. 41 => 'red',
  6096. 42 => 'green',
  6097. 43 => 'yellow',
  6098. 44 => 'blue',
  6099. 45 => 'magenta',
  6100. 46 => 'cyan',
  6101. 47 => 'white',
  6102. );
  6103. private static $availableOptions = array(
  6104. 1 => 'bold',
  6105. 4 => 'underscore',
  6106. );
  6107. public function __construct(array $styles = array())
  6108. {
  6109. parent::__construct(true, $styles);
  6110. }
  6111. public function format($message)
  6112. {
  6113. $formatted = parent::format($message);
  6114. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  6115. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  6116. }
  6117. private function formatHtml($matches)
  6118. {
  6119. $out = '<span style="';
  6120. foreach (explode(';', $matches[1]) as $code) {
  6121. if (isset(self::$availableForegroundColors[$code])) {
  6122. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  6123. } elseif (isset(self::$availableBackgroundColors[$code])) {
  6124. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  6125. } elseif (isset(self::$availableOptions[$code])) {
  6126. switch (self::$availableOptions[$code]) {
  6127. case 'bold':
  6128. $out .= 'font-weight:bold;';
  6129. break;
  6130. case 'underscore':
  6131. $out .= 'text-decoration:underline;';
  6132. break;
  6133. }
  6134. }
  6135. }
  6136. return $out.'">'.$matches[2].'</span>';
  6137. }
  6138. }
  6139. <?php
  6140. namespace Composer\DependencyResolver;
  6141. class Decisions implements \Iterator, \Countable
  6142. {
  6143. const DECISION_LITERAL = 0;
  6144. const DECISION_REASON = 1;
  6145. protected $pool;
  6146. protected $decisionMap;
  6147. protected $decisionQueue = array();
  6148. public function __construct($pool)
  6149. {
  6150. $this->pool = $pool;
  6151. $this->decisionMap = array();
  6152. }
  6153. public function decide($literal, $level, $why)
  6154. {
  6155. $this->addDecision($literal, $level);
  6156. $this->decisionQueue[] = array(
  6157. self::DECISION_LITERAL => $literal,
  6158. self::DECISION_REASON => $why,
  6159. );
  6160. }
  6161. public function satisfy($literal)
  6162. {
  6163. $packageId = abs($literal);
  6164. return (
  6165. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  6166. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  6167. );
  6168. }
  6169. public function conflict($literal)
  6170. {
  6171. $packageId = abs($literal);
  6172. return (
  6173. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  6174. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  6175. );
  6176. }
  6177. public function decided($literalOrPackageId)
  6178. {
  6179. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  6180. }
  6181. public function undecided($literalOrPackageId)
  6182. {
  6183. return empty($this->decisionMap[abs($literalOrPackageId)]);
  6184. }
  6185. public function decidedInstall($literalOrPackageId)
  6186. {
  6187. $packageId = abs($literalOrPackageId);
  6188. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  6189. }
  6190. public function decisionLevel($literalOrPackageId)
  6191. {
  6192. $packageId = abs($literalOrPackageId);
  6193. if (isset($this->decisionMap[$packageId])) {
  6194. return abs($this->decisionMap[$packageId]);
  6195. }
  6196. return 0;
  6197. }
  6198. public function decisionRule($literalOrPackageId)
  6199. {
  6200. $packageId = abs($literalOrPackageId);
  6201. foreach ($this->decisionQueue as $i => $decision) {
  6202. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  6203. return $decision[self::DECISION_REASON];
  6204. }
  6205. }
  6206. return null;
  6207. }
  6208. public function atOffset($queueOffset)
  6209. {
  6210. return $this->decisionQueue[$queueOffset];
  6211. }
  6212. public function validOffset($queueOffset)
  6213. {
  6214. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  6215. }
  6216. public function lastReason()
  6217. {
  6218. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  6219. }
  6220. public function lastLiteral()
  6221. {
  6222. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  6223. }
  6224. public function reset()
  6225. {
  6226. while ($decision = array_pop($this->decisionQueue)) {
  6227. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  6228. }
  6229. }
  6230. public function resetToOffset($offset)
  6231. {
  6232. while (count($this->decisionQueue) > $offset + 1) {
  6233. $decision = array_pop($this->decisionQueue);
  6234. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  6235. }
  6236. }
  6237. public function revertLast()
  6238. {
  6239. $this->decisionMap[abs($this->lastLiteral())] = 0;
  6240. array_pop($this->decisionQueue);
  6241. }
  6242. public function count()
  6243. {
  6244. return count($this->decisionQueue);
  6245. }
  6246. public function rewind()
  6247. {
  6248. end($this->decisionQueue);
  6249. }
  6250. public function current()
  6251. {
  6252. return current($this->decisionQueue);
  6253. }
  6254. public function key()
  6255. {
  6256. return key($this->decisionQueue);
  6257. }
  6258. public function next()
  6259. {
  6260. return prev($this->decisionQueue);
  6261. }
  6262. public function valid()
  6263. {
  6264. return false !== current($this->decisionQueue);
  6265. }
  6266. public function isEmpty()
  6267. {
  6268. return count($this->decisionQueue) === 0;
  6269. }
  6270. protected function addDecision($literal, $level)
  6271. {
  6272. $packageId = abs($literal);
  6273. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  6274. if ($previousDecision != 0) {
  6275. $literalString = $this->pool->literalToString($literal);
  6276. $package = $this->pool->literalToPackage($literal);
  6277. throw new SolverBugException(
  6278. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  6279. );
  6280. }
  6281. if ($literal > 0) {
  6282. $this->decisionMap[$packageId] = $level;
  6283. } else {
  6284. $this->decisionMap[$packageId] = -$level;
  6285. }
  6286. }
  6287. }
  6288. <?php
  6289. namespace Composer\DependencyResolver;
  6290. use Composer\Package\PackageInterface;
  6291. use Composer\Package\AliasPackage;
  6292. use Composer\Package\BasePackage;
  6293. use Composer\Semver\Constraint\Constraint;
  6294. class DefaultPolicy implements PolicyInterface
  6295. {
  6296. private $preferStable;
  6297. private $preferLowest;
  6298. public function __construct($preferStable = false, $preferLowest = false)
  6299. {
  6300. $this->preferStable = $preferStable;
  6301. $this->preferLowest = $preferLowest;
  6302. }
  6303. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  6304. {
  6305. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  6306. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  6307. }
  6308. $constraint = new Constraint($operator, $b->getVersion());
  6309. $version = new Constraint('==', $a->getVersion());
  6310. return $constraint->matchSpecific($version, true);
  6311. }
  6312. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  6313. {
  6314. $packages = array();
  6315. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  6316. if ($candidate !== $package) {
  6317. $packages[] = $candidate;
  6318. }
  6319. }
  6320. return $packages;
  6321. }
  6322. public function getPriority(Pool $pool, PackageInterface $package)
  6323. {
  6324. return $pool->getPriority($package->getRepository());
  6325. }
  6326. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  6327. {
  6328. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  6329. foreach ($packages as &$literals) {
  6330. $policy = $this;
  6331. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  6332. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  6333. });
  6334. }
  6335. foreach ($packages as &$literals) {
  6336. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  6337. $literals = $this->pruneToBestVersion($pool, $literals);
  6338. $literals = $this->pruneRemoteAliases($pool, $literals);
  6339. }
  6340. $selected = call_user_func_array('array_merge', $packages);
  6341. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  6342. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  6343. });
  6344. return $selected;
  6345. }
  6346. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  6347. {
  6348. $packages = array();
  6349. foreach ($literals as $literal) {
  6350. $packageName = $pool->literalToPackage($literal)->getName();
  6351. if (!isset($packages[$packageName])) {
  6352. $packages[$packageName] = array();
  6353. }
  6354. if (isset($installedMap[abs($literal)])) {
  6355. array_unshift($packages[$packageName], $literal);
  6356. } else {
  6357. $packages[$packageName][] = $literal;
  6358. }
  6359. }
  6360. return $packages;
  6361. }
  6362. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  6363. {
  6364. if ($a->getRepository() === $b->getRepository()) {
  6365. if ($a->getName() === $b->getName()) {
  6366. $aAliased = $a instanceof AliasPackage;
  6367. $bAliased = $b instanceof AliasPackage;
  6368. if ($aAliased && !$bAliased) {
  6369. return -1;
  6370. }
  6371. if (!$aAliased && $bAliased) {
  6372. return 1;
  6373. }
  6374. }
  6375. if (!$ignoreReplace) {
  6376. if ($this->replaces($a, $b)) {
  6377. return 1;
  6378. }
  6379. if ($this->replaces($b, $a)) {
  6380. return -1;
  6381. }
  6382. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  6383. $requiredVendor = substr($requiredPackage, 0, $pos);
  6384. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  6385. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  6386. if ($bIsSameVendor !== $aIsSameVendor) {
  6387. return $aIsSameVendor ? -1 : 1;
  6388. }
  6389. }
  6390. }
  6391. if ($a->id === $b->id) {
  6392. return 0;
  6393. }
  6394. return ($a->id < $b->id) ? -1 : 1;
  6395. }
  6396. if (isset($installedMap[$a->id])) {
  6397. return -1;
  6398. }
  6399. if (isset($installedMap[$b->id])) {
  6400. return 1;
  6401. }
  6402. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  6403. }
  6404. protected function replaces(PackageInterface $source, PackageInterface $target)
  6405. {
  6406. foreach ($source->getReplaces() as $link) {
  6407. if ($link->getTarget() === $target->getName()
  6408. ) {
  6409. return true;
  6410. }
  6411. }
  6412. return false;
  6413. }
  6414. protected function pruneToBestVersion(Pool $pool, $literals)
  6415. {
  6416. $operator = $this->preferLowest ? '<' : '>';
  6417. $bestLiterals = array($literals[0]);
  6418. $bestPackage = $pool->literalToPackage($literals[0]);
  6419. foreach ($literals as $i => $literal) {
  6420. if (0 === $i) {
  6421. continue;
  6422. }
  6423. $package = $pool->literalToPackage($literal);
  6424. if ($this->versionCompare($package, $bestPackage, $operator)) {
  6425. $bestPackage = $package;
  6426. $bestLiterals = array($literal);
  6427. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  6428. $bestLiterals[] = $literal;
  6429. }
  6430. }
  6431. return $bestLiterals;
  6432. }
  6433. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  6434. {
  6435. $selected = array();
  6436. $priority = null;
  6437. foreach ($literals as $literal) {
  6438. $package = $pool->literalToPackage($literal);
  6439. if (isset($installedMap[$package->id])) {
  6440. $selected[] = $literal;
  6441. continue;
  6442. }
  6443. if (null === $priority) {
  6444. $priority = $this->getPriority($pool, $package);
  6445. }
  6446. if ($this->getPriority($pool, $package) != $priority) {
  6447. break;
  6448. }
  6449. $selected[] = $literal;
  6450. }
  6451. return $selected;
  6452. }
  6453. protected function pruneRemoteAliases(Pool $pool, array $literals)
  6454. {
  6455. $hasLocalAlias = false;
  6456. foreach ($literals as $literal) {
  6457. $package = $pool->literalToPackage($literal);
  6458. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  6459. $hasLocalAlias = true;
  6460. break;
  6461. }
  6462. }
  6463. if (!$hasLocalAlias) {
  6464. return $literals;
  6465. }
  6466. $selected = array();
  6467. foreach ($literals as $literal) {
  6468. $package = $pool->literalToPackage($literal);
  6469. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  6470. $selected[] = $literal;
  6471. }
  6472. }
  6473. return $selected;
  6474. }
  6475. }
  6476. <?php
  6477. namespace Composer\DependencyResolver\Operation;
  6478. use Composer\Package\PackageInterface;
  6479. class InstallOperation extends SolverOperation
  6480. {
  6481. protected $package;
  6482. public function __construct(PackageInterface $package, $reason = null)
  6483. {
  6484. parent::__construct($reason);
  6485. $this->package = $package;
  6486. }
  6487. public function getPackage()
  6488. {
  6489. return $this->package;
  6490. }
  6491. public function getJobType()
  6492. {
  6493. return 'install';
  6494. }
  6495. public function __toString()
  6496. {
  6497. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  6498. }
  6499. }
  6500. <?php
  6501. namespace Composer\DependencyResolver\Operation;
  6502. use Composer\Package\AliasPackage;
  6503. use Composer\Package\PackageInterface;
  6504. class MarkAliasInstalledOperation extends SolverOperation
  6505. {
  6506. protected $package;
  6507. public function __construct(AliasPackage $package, $reason = null)
  6508. {
  6509. parent::__construct($reason);
  6510. $this->package = $package;
  6511. }
  6512. public function getPackage()
  6513. {
  6514. return $this->package;
  6515. }
  6516. public function getJobType()
  6517. {
  6518. return 'markAliasInstalled';
  6519. }
  6520. public function __toString()
  6521. {
  6522. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  6523. }
  6524. }
  6525. <?php
  6526. namespace Composer\DependencyResolver\Operation;
  6527. use Composer\Package\AliasPackage;
  6528. use Composer\Package\PackageInterface;
  6529. class MarkAliasUninstalledOperation extends SolverOperation
  6530. {
  6531. protected $package;
  6532. public function __construct(AliasPackage $package, $reason = null)
  6533. {
  6534. parent::__construct($reason);
  6535. $this->package = $package;
  6536. }
  6537. public function getPackage()
  6538. {
  6539. return $this->package;
  6540. }
  6541. public function getJobType()
  6542. {
  6543. return 'markAliasUninstalled';
  6544. }
  6545. public function __toString()
  6546. {
  6547. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  6548. }
  6549. }
  6550. <?php
  6551. namespace Composer\DependencyResolver\Operation;
  6552. interface OperationInterface
  6553. {
  6554. public function getJobType();
  6555. public function getReason();
  6556. public function __toString();
  6557. }
  6558. <?php
  6559. namespace Composer\DependencyResolver\Operation;
  6560. use Composer\Package\PackageInterface;
  6561. abstract class SolverOperation implements OperationInterface
  6562. {
  6563. protected $reason;
  6564. public function __construct($reason = null)
  6565. {
  6566. $this->reason = $reason;
  6567. }
  6568. public function getReason()
  6569. {
  6570. return $this->reason;
  6571. }
  6572. protected function formatVersion(PackageInterface $package)
  6573. {
  6574. return $package->getFullPrettyVersion();
  6575. }
  6576. }
  6577. <?php
  6578. namespace Composer\DependencyResolver\Operation;
  6579. use Composer\Package\PackageInterface;
  6580. class UninstallOperation extends SolverOperation
  6581. {
  6582. protected $package;
  6583. public function __construct(PackageInterface $package, $reason = null)
  6584. {
  6585. parent::__construct($reason);
  6586. $this->package = $package;
  6587. }
  6588. public function getPackage()
  6589. {
  6590. return $this->package;
  6591. }
  6592. public function getJobType()
  6593. {
  6594. return 'uninstall';
  6595. }
  6596. public function __toString()
  6597. {
  6598. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  6599. }
  6600. }
  6601. <?php
  6602. namespace Composer\DependencyResolver\Operation;
  6603. use Composer\Package\PackageInterface;
  6604. class UpdateOperation extends SolverOperation
  6605. {
  6606. protected $initialPackage;
  6607. protected $targetPackage;
  6608. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  6609. {
  6610. parent::__construct($reason);
  6611. $this->initialPackage = $initial;
  6612. $this->targetPackage = $target;
  6613. }
  6614. public function getInitialPackage()
  6615. {
  6616. return $this->initialPackage;
  6617. }
  6618. public function getTargetPackage()
  6619. {
  6620. return $this->targetPackage;
  6621. }
  6622. public function getJobType()
  6623. {
  6624. return 'update';
  6625. }
  6626. public function __toString()
  6627. {
  6628. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  6629. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  6630. }
  6631. }
  6632. <?php
  6633. namespace Composer\DependencyResolver;
  6634. use Composer\Package\PackageInterface;
  6635. interface PolicyInterface
  6636. {
  6637. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  6638. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  6639. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals);
  6640. }
  6641. <?php
  6642. namespace Composer\DependencyResolver;
  6643. use Composer\Package\BasePackage;
  6644. use Composer\Package\AliasPackage;
  6645. use Composer\Package\Version\VersionParser;
  6646. use Composer\Semver\Constraint\ConstraintInterface;
  6647. use Composer\Semver\Constraint\Constraint;
  6648. use Composer\Semver\Constraint\EmptyConstraint;
  6649. use Composer\Repository\RepositoryInterface;
  6650. use Composer\Repository\CompositeRepository;
  6651. use Composer\Repository\ComposerRepository;
  6652. use Composer\Repository\InstalledRepositoryInterface;
  6653. use Composer\Repository\PlatformRepository;
  6654. use Composer\Package\PackageInterface;
  6655. class Pool implements \Countable
  6656. {
  6657. const MATCH_NAME = -1;
  6658. const MATCH_NONE = 0;
  6659. const MATCH = 1;
  6660. const MATCH_PROVIDE = 2;
  6661. const MATCH_REPLACE = 3;
  6662. const MATCH_FILTERED = 4;
  6663. protected $repositories = array();
  6664. protected $providerRepos = array();
  6665. protected $packages = array();
  6666. protected $packageByName = array();
  6667. protected $packageByExactName = array();
  6668. protected $acceptableStabilities;
  6669. protected $stabilityFlags;
  6670. protected $versionParser;
  6671. protected $providerCache = array();
  6672. protected $filterRequires;
  6673. protected $whitelist = null;
  6674. protected $id = 1;
  6675. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  6676. {
  6677. $this->versionParser = new VersionParser;
  6678. $this->acceptableStabilities = array();
  6679. foreach (BasePackage::$stabilities as $stability => $value) {
  6680. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  6681. $this->acceptableStabilities[$stability] = $value;
  6682. }
  6683. }
  6684. $this->stabilityFlags = $stabilityFlags;
  6685. $this->filterRequires = $filterRequires;
  6686. foreach ($filterRequires as $name => $constraint) {
  6687. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  6688. unset($this->filterRequires[$name]);
  6689. }
  6690. }
  6691. }
  6692. public function setWhitelist($whitelist)
  6693. {
  6694. $this->whitelist = $whitelist;
  6695. $this->providerCache = array();
  6696. }
  6697. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  6698. {
  6699. if ($repo instanceof CompositeRepository) {
  6700. $repos = $repo->getRepositories();
  6701. } else {
  6702. $repos = array($repo);
  6703. }
  6704. foreach ($repos as $repo) {
  6705. $this->repositories[] = $repo;
  6706. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  6707. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  6708. $this->providerRepos[] = $repo;
  6709. $repo->setRootAliases($rootAliases);
  6710. $repo->resetPackageIds();
  6711. } else {
  6712. foreach ($repo->getPackages() as $package) {
  6713. $names = $package->getNames();
  6714. $stability = $package->getStability();
  6715. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  6716. $package->setId($this->id++);
  6717. $this->packages[] = $package;
  6718. $this->packageByExactName[$package->getName()][$package->id] = $package;
  6719. foreach ($names as $provided) {
  6720. $this->packageByName[$provided][] = $package;
  6721. }
  6722. $name = $package->getName();
  6723. if (isset($rootAliases[$name][$package->getVersion()])) {
  6724. $alias = $rootAliases[$name][$package->getVersion()];
  6725. if ($package instanceof AliasPackage) {
  6726. $package = $package->getAliasOf();
  6727. }
  6728. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  6729. $aliasPackage->setRootPackageAlias(true);
  6730. $aliasPackage->setId($this->id++);
  6731. $package->getRepository()->addPackage($aliasPackage);
  6732. $this->packages[] = $aliasPackage;
  6733. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  6734. foreach ($aliasPackage->getNames() as $name) {
  6735. $this->packageByName[$name][] = $aliasPackage;
  6736. }
  6737. }
  6738. }
  6739. }
  6740. }
  6741. }
  6742. }
  6743. public function getPriority(RepositoryInterface $repo)
  6744. {
  6745. $priority = array_search($repo, $this->repositories, true);
  6746. if (false === $priority) {
  6747. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  6748. }
  6749. return -$priority;
  6750. }
  6751. public function packageById($id)
  6752. {
  6753. return $this->packages[$id - 1];
  6754. }
  6755. public function count()
  6756. {
  6757. return count($this->packages);
  6758. }
  6759. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false)
  6760. {
  6761. $key = ((int) $mustMatchName).$constraint;
  6762. if (isset($this->providerCache[$name][$key])) {
  6763. return $this->providerCache[$name][$key];
  6764. }
  6765. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName);
  6766. }
  6767. private function computeWhatProvides($name, $constraint, $mustMatchName = false)
  6768. {
  6769. $candidates = array();
  6770. foreach ($this->providerRepos as $repo) {
  6771. foreach ($repo->whatProvides($this, $name) as $candidate) {
  6772. $candidates[] = $candidate;
  6773. if ($candidate->id < 1) {
  6774. $candidate->setId($this->id++);
  6775. $this->packages[$this->id - 2] = $candidate;
  6776. }
  6777. }
  6778. }
  6779. if ($mustMatchName) {
  6780. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  6781. return $candidate->getName() == $name;
  6782. });
  6783. if (isset($this->packageByExactName[$name])) {
  6784. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  6785. }
  6786. } elseif (isset($this->packageByName[$name])) {
  6787. $candidates = array_merge($candidates, $this->packageByName[$name]);
  6788. }
  6789. $matches = $provideMatches = array();
  6790. $nameMatch = false;
  6791. foreach ($candidates as $candidate) {
  6792. $aliasOfCandidate = null;
  6793. if ($candidate instanceof AliasPackage) {
  6794. $aliasOfCandidate = $candidate->getAliasOf();
  6795. }
  6796. if ($this->whitelist !== null && (
  6797. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  6798. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  6799. )) {
  6800. continue;
  6801. }
  6802. switch ($this->match($candidate, $name, $constraint)) {
  6803. case self::MATCH_NONE:
  6804. break;
  6805. case self::MATCH_NAME:
  6806. $nameMatch = true;
  6807. break;
  6808. case self::MATCH:
  6809. $nameMatch = true;
  6810. $matches[] = $candidate;
  6811. break;
  6812. case self::MATCH_PROVIDE:
  6813. $provideMatches[] = $candidate;
  6814. break;
  6815. case self::MATCH_REPLACE:
  6816. $matches[] = $candidate;
  6817. break;
  6818. case self::MATCH_FILTERED:
  6819. break;
  6820. default:
  6821. throw new \UnexpectedValueException('Unexpected match type');
  6822. }
  6823. }
  6824. if ($nameMatch) {
  6825. return $matches;
  6826. }
  6827. return array_merge($matches, $provideMatches);
  6828. }
  6829. public function literalToPackage($literal)
  6830. {
  6831. $packageId = abs($literal);
  6832. return $this->packageById($packageId);
  6833. }
  6834. public function literalToPrettyString($literal, $installedMap)
  6835. {
  6836. $package = $this->literalToPackage($literal);
  6837. if (isset($installedMap[$package->id])) {
  6838. $prefix = ($literal > 0 ? 'keep' : 'remove');
  6839. } else {
  6840. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  6841. }
  6842. return $prefix.' '.$package->getPrettyString();
  6843. }
  6844. public function isPackageAcceptable($name, $stability)
  6845. {
  6846. foreach ((array) $name as $n) {
  6847. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  6848. return true;
  6849. }
  6850. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  6851. return true;
  6852. }
  6853. }
  6854. return false;
  6855. }
  6856. private function match($candidate, $name, ConstraintInterface $constraint = null)
  6857. {
  6858. $candidateName = $candidate->getName();
  6859. $candidateVersion = $candidate->getVersion();
  6860. $isDev = $candidate->getStability() === 'dev';
  6861. $isAlias = $candidate instanceof AliasPackage;
  6862. if (!$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  6863. $requireFilter = $this->filterRequires[$name];
  6864. } else {
  6865. $requireFilter = new EmptyConstraint;
  6866. }
  6867. if ($candidateName === $name) {
  6868. $pkgConstraint = new Constraint('==', $candidateVersion);
  6869. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  6870. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  6871. }
  6872. return self::MATCH_NAME;
  6873. }
  6874. $provides = $candidate->getProvides();
  6875. $replaces = $candidate->getReplaces();
  6876. if (isset($replaces[0]) || isset($provides[0])) {
  6877. foreach ($provides as $link) {
  6878. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  6879. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  6880. }
  6881. }
  6882. foreach ($replaces as $link) {
  6883. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  6884. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  6885. }
  6886. }
  6887. return self::MATCH_NONE;
  6888. }
  6889. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  6890. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  6891. }
  6892. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  6893. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  6894. }
  6895. return self::MATCH_NONE;
  6896. }
  6897. }
  6898. <?php
  6899. namespace Composer\DependencyResolver;
  6900. class Problem
  6901. {
  6902. protected $reasonSeen;
  6903. protected $reasons = array();
  6904. protected $section = 0;
  6905. protected $pool;
  6906. public function __construct(Pool $pool)
  6907. {
  6908. $this->pool = $pool;
  6909. }
  6910. public function addRule(Rule $rule)
  6911. {
  6912. $this->addReason(spl_object_hash($rule), array(
  6913. 'rule' => $rule,
  6914. 'job' => $rule->getJob(),
  6915. ));
  6916. }
  6917. public function getReasons()
  6918. {
  6919. return $this->reasons;
  6920. }
  6921. public function getPrettyString(array $installedMap = array())
  6922. {
  6923. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  6924. if (count($reasons) === 1) {
  6925. reset($reasons);
  6926. $reason = current($reasons);
  6927. $rule = $reason['rule'];
  6928. $job = $reason['job'];
  6929. if (isset($job['constraint'])) {
  6930. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  6931. } else {
  6932. $packages = array();
  6933. }
  6934. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  6935. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  6936. $available = $this->pool->whatProvides($job['packageName']);
  6937. $version = count($available) ? $available[0]->getPrettyVersion() : phpversion();
  6938. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  6939. if (defined('HHVM_VERSION')) {
  6940. return $msg . 'your HHVM version does not satisfy that requirement.';
  6941. } elseif ($job['packageName'] === 'hhvm') {
  6942. return $msg . 'you are running this with PHP and not HHVM.';
  6943. }
  6944. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  6945. }
  6946. if (0 === stripos($job['packageName'], 'ext-')) {
  6947. $ext = substr($job['packageName'], 4);
  6948. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  6949. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  6950. }
  6951. if (0 === stripos($job['packageName'], 'lib-')) {
  6952. if (strtolower($job['packageName']) === 'lib-icu') {
  6953. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  6954. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  6955. }
  6956. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  6957. }
  6958. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  6959. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  6960. return "\n - The requested package ".$job['packageName'].' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  6961. }
  6962. if (!$this->pool->whatProvides($job['packageName'])) {
  6963. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  6964. }
  6965. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' could not be found.';
  6966. }
  6967. }
  6968. $messages = array();
  6969. foreach ($reasons as $reason) {
  6970. $rule = $reason['rule'];
  6971. $job = $reason['job'];
  6972. if ($job) {
  6973. $messages[] = $this->jobToText($job);
  6974. } elseif ($rule) {
  6975. if ($rule instanceof Rule) {
  6976. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  6977. }
  6978. }
  6979. }
  6980. return "\n - ".implode("\n - ", $messages);
  6981. }
  6982. protected function addReason($id, $reason)
  6983. {
  6984. if (!isset($this->reasonSeen[$id])) {
  6985. $this->reasonSeen[$id] = true;
  6986. $this->reasons[$this->section][] = $reason;
  6987. }
  6988. }
  6989. public function nextSection()
  6990. {
  6991. $this->section++;
  6992. }
  6993. protected function jobToText($job)
  6994. {
  6995. switch ($job['cmd']) {
  6996. case 'install':
  6997. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  6998. if (!$packages) {
  6999. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  7000. }
  7001. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  7002. case 'update':
  7003. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  7004. case 'remove':
  7005. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  7006. }
  7007. if (isset($job['constraint'])) {
  7008. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7009. } else {
  7010. $packages = array();
  7011. }
  7012. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  7013. }
  7014. protected function getPackageList($packages)
  7015. {
  7016. $prepared = array();
  7017. foreach ($packages as $package) {
  7018. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  7019. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  7020. }
  7021. foreach ($prepared as $name => $package) {
  7022. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  7023. }
  7024. return implode(', ', $prepared);
  7025. }
  7026. protected function constraintToText($constraint)
  7027. {
  7028. return ($constraint) ? ' '.$constraint->getPrettyString() : '';
  7029. }
  7030. }
  7031. <?php
  7032. namespace Composer\DependencyResolver;
  7033. use Composer\Semver\Constraint\ConstraintInterface;
  7034. class Request
  7035. {
  7036. protected $jobs;
  7037. public function __construct()
  7038. {
  7039. $this->jobs = array();
  7040. }
  7041. public function install($packageName, ConstraintInterface $constraint = null)
  7042. {
  7043. $this->addJob($packageName, 'install', $constraint);
  7044. }
  7045. public function update($packageName, ConstraintInterface $constraint = null)
  7046. {
  7047. $this->addJob($packageName, 'update', $constraint);
  7048. }
  7049. public function remove($packageName, ConstraintInterface $constraint = null)
  7050. {
  7051. $this->addJob($packageName, 'remove', $constraint);
  7052. }
  7053. public function fix($packageName, ConstraintInterface $constraint = null)
  7054. {
  7055. $this->addJob($packageName, 'install', $constraint, true);
  7056. }
  7057. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  7058. {
  7059. $packageName = strtolower($packageName);
  7060. $this->jobs[] = array(
  7061. 'cmd' => $cmd,
  7062. 'packageName' => $packageName,
  7063. 'constraint' => $constraint,
  7064. 'fixed' => $fixed,
  7065. );
  7066. }
  7067. public function updateAll()
  7068. {
  7069. $this->jobs[] = array('cmd' => 'update-all');
  7070. }
  7071. public function getJobs()
  7072. {
  7073. return $this->jobs;
  7074. }
  7075. }
  7076. <?php
  7077. namespace Composer\DependencyResolver;
  7078. use Composer\Package\CompletePackage;
  7079. class Rule
  7080. {
  7081. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  7082. const RULE_JOB_INSTALL = 2;
  7083. const RULE_JOB_REMOVE = 3;
  7084. const RULE_PACKAGE_CONFLICT = 6;
  7085. const RULE_PACKAGE_REQUIRES = 7;
  7086. const RULE_PACKAGE_OBSOLETES = 8;
  7087. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  7088. const RULE_PACKAGE_SAME_NAME = 10;
  7089. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  7090. const RULE_LEARNED = 12;
  7091. const RULE_PACKAGE_ALIAS = 13;
  7092. const BITFIELD_TYPE = 0;
  7093. const BITFIELD_REASON = 8;
  7094. const BITFIELD_DISABLED = 16;
  7095. public $literals;
  7096. protected $bitfield;
  7097. protected $reasonData;
  7098. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7099. {
  7100. sort($literals);
  7101. $this->literals = $literals;
  7102. $this->reasonData = $reasonData;
  7103. if ($job) {
  7104. $this->job = $job;
  7105. }
  7106. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  7107. ($reason << self::BITFIELD_REASON) |
  7108. (255 << self::BITFIELD_TYPE);
  7109. }
  7110. public function getHash()
  7111. {
  7112. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7113. return $data['hash'];
  7114. }
  7115. public function getJob()
  7116. {
  7117. return isset($this->job) ? $this->job : null;
  7118. }
  7119. public function getReason()
  7120. {
  7121. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  7122. }
  7123. public function getReasonData()
  7124. {
  7125. return $this->reasonData;
  7126. }
  7127. public function getRequiredPackage()
  7128. {
  7129. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  7130. return $this->reasonData;
  7131. }
  7132. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  7133. return $this->reasonData->getTarget();
  7134. }
  7135. }
  7136. public function equals(Rule $rule)
  7137. {
  7138. if (count($this->literals) != count($rule->literals)) {
  7139. return false;
  7140. }
  7141. for ($i = 0, $n = count($this->literals); $i < $n; $i++) {
  7142. if ($this->literals[$i] !== $rule->literals[$i]) {
  7143. return false;
  7144. }
  7145. }
  7146. return true;
  7147. }
  7148. public function setType($type)
  7149. {
  7150. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  7151. }
  7152. public function getType()
  7153. {
  7154. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  7155. }
  7156. public function disable()
  7157. {
  7158. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  7159. }
  7160. public function enable()
  7161. {
  7162. $this->bitfield = $this->bitfield & ~(255 << self::BITFIELD_DISABLED);
  7163. }
  7164. public function isDisabled()
  7165. {
  7166. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  7167. }
  7168. public function isEnabled()
  7169. {
  7170. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  7171. }
  7172. public function isAssertion()
  7173. {
  7174. return 1 === count($this->literals);
  7175. }
  7176. public function getPrettyString(Pool $pool, array $installedMap = array())
  7177. {
  7178. $ruleText = '';
  7179. foreach ($this->literals as $i => $literal) {
  7180. if ($i != 0) {
  7181. $ruleText .= '|';
  7182. }
  7183. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  7184. }
  7185. switch ($this->getReason()) {
  7186. case self::RULE_INTERNAL_ALLOW_UPDATE:
  7187. return $ruleText;
  7188. case self::RULE_JOB_INSTALL:
  7189. return "Install command rule ($ruleText)";
  7190. case self::RULE_JOB_REMOVE:
  7191. return "Remove command rule ($ruleText)";
  7192. case self::RULE_PACKAGE_CONFLICT:
  7193. $package1 = $pool->literalToPackage($this->literals[0]);
  7194. $package2 = $pool->literalToPackage($this->literals[1]);
  7195. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  7196. case self::RULE_PACKAGE_REQUIRES:
  7197. $literals = $this->literals;
  7198. $sourceLiteral = array_shift($literals);
  7199. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  7200. $requires = array();
  7201. foreach ($literals as $literal) {
  7202. $requires[] = $pool->literalToPackage($literal);
  7203. }
  7204. $text = $this->reasonData->getPrettyString($sourcePackage);
  7205. if ($requires) {
  7206. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  7207. } else {
  7208. $targetName = $this->reasonData->getTarget();
  7209. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  7210. if (defined('HHVM_VERSION')) {
  7211. return $text . ' -> your HHVM version does not satisfy that requirement.';
  7212. } elseif ($targetName === 'hhvm') {
  7213. return $text . ' -> you are running this with PHP and not HHVM.';
  7214. } else {
  7215. $packages = $pool->whatProvides($targetName);
  7216. $package = count($packages) ? current($packages) : phpversion();
  7217. if (!($package instanceof CompletePackage)) {
  7218. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  7219. }
  7220. $extra = $package->getExtra();
  7221. if (!empty($extra['config.platform'])) {
  7222. $text .= ' -> your PHP version ('.phpversion().') overriden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  7223. } else {
  7224. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  7225. }
  7226. return $text;
  7227. }
  7228. } elseif (0 === strpos($targetName, 'ext-')) {
  7229. $ext = substr($targetName, 4);
  7230. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  7231. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  7232. } elseif (0 === strpos($targetName, 'lib-')) {
  7233. $lib = substr($targetName, 4);
  7234. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  7235. } else {
  7236. return $text . ' -> no matching package found.';
  7237. }
  7238. }
  7239. return $text;
  7240. case self::RULE_PACKAGE_OBSOLETES:
  7241. return $ruleText;
  7242. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  7243. return $ruleText;
  7244. case self::RULE_PACKAGE_SAME_NAME:
  7245. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $this->literals) . '.';
  7246. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  7247. return $ruleText;
  7248. case self::RULE_LEARNED:
  7249. return 'Conclusion: '.$ruleText;
  7250. case self::RULE_PACKAGE_ALIAS:
  7251. return $ruleText;
  7252. default:
  7253. return '('.$ruleText.')';
  7254. }
  7255. }
  7256. protected function formatPackagesUnique($pool, array $packages)
  7257. {
  7258. $prepared = array();
  7259. foreach ($packages as $package) {
  7260. if (!is_object($package)) {
  7261. $package = $pool->literalToPackage($package);
  7262. }
  7263. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  7264. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  7265. }
  7266. foreach ($prepared as $name => $package) {
  7267. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  7268. }
  7269. return implode(', ', $prepared);
  7270. }
  7271. public function __toString()
  7272. {
  7273. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  7274. foreach ($this->literals as $i => $literal) {
  7275. if ($i != 0) {
  7276. $result .= '|';
  7277. }
  7278. $result .= $literal;
  7279. }
  7280. $result .= ')';
  7281. return $result;
  7282. }
  7283. }
  7284. <?php
  7285. namespace Composer\DependencyResolver;
  7286. class RuleSet implements \IteratorAggregate, \Countable
  7287. {
  7288. const TYPE_PACKAGE = 0;
  7289. const TYPE_JOB = 1;
  7290. const TYPE_LEARNED = 4;
  7291. public $ruleById;
  7292. protected static $types = array(
  7293. 255 => 'UNKNOWN',
  7294. self::TYPE_PACKAGE => 'PACKAGE',
  7295. self::TYPE_JOB => 'JOB',
  7296. self::TYPE_LEARNED => 'LEARNED',
  7297. );
  7298. protected $rules;
  7299. protected $nextRuleId;
  7300. protected $rulesByHash;
  7301. public function __construct()
  7302. {
  7303. $this->nextRuleId = 0;
  7304. foreach ($this->getTypes() as $type) {
  7305. $this->rules[$type] = array();
  7306. }
  7307. $this->rulesByHash = array();
  7308. }
  7309. public function add(Rule $rule, $type)
  7310. {
  7311. if (!isset(self::$types[$type])) {
  7312. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  7313. }
  7314. if (!isset($this->rules[$type])) {
  7315. $this->rules[$type] = array();
  7316. }
  7317. $this->rules[$type][] = $rule;
  7318. $this->ruleById[$this->nextRuleId] = $rule;
  7319. $rule->setType($type);
  7320. $this->nextRuleId++;
  7321. $hash = $rule->getHash();
  7322. if (!isset($this->rulesByHash[$hash])) {
  7323. $this->rulesByHash[$hash] = array($rule);
  7324. } else {
  7325. $this->rulesByHash[$hash][] = $rule;
  7326. }
  7327. }
  7328. public function count()
  7329. {
  7330. return $this->nextRuleId;
  7331. }
  7332. public function ruleById($id)
  7333. {
  7334. return $this->ruleById[$id];
  7335. }
  7336. public function getRules()
  7337. {
  7338. return $this->rules;
  7339. }
  7340. public function getIterator()
  7341. {
  7342. return new RuleSetIterator($this->getRules());
  7343. }
  7344. public function getIteratorFor($types)
  7345. {
  7346. if (!is_array($types)) {
  7347. $types = array($types);
  7348. }
  7349. $allRules = $this->getRules();
  7350. $rules = array();
  7351. foreach ($types as $type) {
  7352. $rules[$type] = $allRules[$type];
  7353. }
  7354. return new RuleSetIterator($rules);
  7355. }
  7356. public function getIteratorWithout($types)
  7357. {
  7358. if (!is_array($types)) {
  7359. $types = array($types);
  7360. }
  7361. $rules = $this->getRules();
  7362. foreach ($types as $type) {
  7363. unset($rules[$type]);
  7364. }
  7365. return new RuleSetIterator($rules);
  7366. }
  7367. public function getTypes()
  7368. {
  7369. $types = self::$types;
  7370. unset($types[255]);
  7371. return array_keys($types);
  7372. }
  7373. public function containsEqual($rule)
  7374. {
  7375. if (isset($this->rulesByHash[$rule->getHash()])) {
  7376. $potentialDuplicates = $this->rulesByHash[$rule->getHash()];
  7377. foreach ($potentialDuplicates as $potentialDuplicate) {
  7378. if ($rule->equals($potentialDuplicate)) {
  7379. return true;
  7380. }
  7381. }
  7382. }
  7383. return false;
  7384. }
  7385. public function getPrettyString(Pool $pool = null)
  7386. {
  7387. $string = "\n";
  7388. foreach ($this->rules as $type => $rules) {
  7389. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  7390. foreach ($rules as $rule) {
  7391. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  7392. }
  7393. $string .= "\n\n";
  7394. }
  7395. return $string;
  7396. }
  7397. public function __toString()
  7398. {
  7399. return $this->getPrettyString(null);
  7400. }
  7401. }
  7402. <?php
  7403. namespace Composer\DependencyResolver;
  7404. use Composer\Package\PackageInterface;
  7405. use Composer\Package\AliasPackage;
  7406. use Composer\Repository\PlatformRepository;
  7407. class RuleSetGenerator
  7408. {
  7409. protected $policy;
  7410. protected $pool;
  7411. protected $rules;
  7412. protected $jobs;
  7413. protected $installedMap;
  7414. protected $whitelistedMap;
  7415. protected $addedMap;
  7416. public function __construct(PolicyInterface $policy, Pool $pool)
  7417. {
  7418. $this->policy = $policy;
  7419. $this->pool = $pool;
  7420. }
  7421. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  7422. {
  7423. $literals = array(-$package->id);
  7424. foreach ($providers as $provider) {
  7425. if ($provider === $package) {
  7426. return null;
  7427. }
  7428. $literals[] = $provider->id;
  7429. }
  7430. return new Rule($literals, $reason, $reasonData);
  7431. }
  7432. protected function createInstallOneOfRule(array $packages, $reason, $job)
  7433. {
  7434. $literals = array();
  7435. foreach ($packages as $package) {
  7436. $literals[] = $package->id;
  7437. }
  7438. return new Rule($literals, $reason, $job['packageName'], $job);
  7439. }
  7440. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  7441. {
  7442. return new Rule(array(-$package->id), $reason, $job['packageName'], $job);
  7443. }
  7444. protected function createConflictRule(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  7445. {
  7446. if ($issuer === $provider) {
  7447. return null;
  7448. }
  7449. return new Rule(array(-$issuer->id, -$provider->id), $reason, $reasonData);
  7450. }
  7451. private function addRule($type, Rule $newRule = null)
  7452. {
  7453. if (!$newRule || $this->rules->containsEqual($newRule)) {
  7454. return;
  7455. }
  7456. $this->rules->add($newRule, $type);
  7457. }
  7458. protected function whitelistFromPackage(PackageInterface $package)
  7459. {
  7460. $workQueue = new \SplQueue;
  7461. $workQueue->enqueue($package);
  7462. while (!$workQueue->isEmpty()) {
  7463. $package = $workQueue->dequeue();
  7464. if (isset($this->whitelistedMap[$package->id])) {
  7465. continue;
  7466. }
  7467. $this->whitelistedMap[$package->id] = true;
  7468. foreach ($package->getRequires() as $link) {
  7469. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  7470. foreach ($possibleRequires as $require) {
  7471. $workQueue->enqueue($require);
  7472. }
  7473. }
  7474. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  7475. foreach ($obsoleteProviders as $provider) {
  7476. if ($provider === $package) {
  7477. continue;
  7478. }
  7479. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  7480. $workQueue->enqueue($provider);
  7481. }
  7482. }
  7483. }
  7484. }
  7485. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  7486. {
  7487. $workQueue = new \SplQueue;
  7488. $workQueue->enqueue($package);
  7489. while (!$workQueue->isEmpty()) {
  7490. $package = $workQueue->dequeue();
  7491. if (isset($this->addedMap[$package->id])) {
  7492. continue;
  7493. }
  7494. $this->addedMap[$package->id] = true;
  7495. foreach ($package->getRequires() as $link) {
  7496. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  7497. continue;
  7498. }
  7499. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  7500. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  7501. foreach ($possibleRequires as $require) {
  7502. $workQueue->enqueue($require);
  7503. }
  7504. }
  7505. foreach ($package->getConflicts() as $link) {
  7506. $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  7507. foreach ($possibleConflicts as $conflict) {
  7508. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  7509. }
  7510. }
  7511. $isInstalled = (isset($this->installedMap[$package->id]));
  7512. foreach ($package->getReplaces() as $link) {
  7513. $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  7514. foreach ($obsoleteProviders as $provider) {
  7515. if ($provider === $package) {
  7516. continue;
  7517. }
  7518. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  7519. $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  7520. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, $link));
  7521. }
  7522. }
  7523. }
  7524. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
  7525. foreach ($obsoleteProviders as $provider) {
  7526. if ($provider === $package) {
  7527. continue;
  7528. }
  7529. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  7530. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  7531. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  7532. $reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  7533. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createConflictRule($package, $provider, $reason, $package));
  7534. }
  7535. }
  7536. }
  7537. }
  7538. protected function obsoleteImpossibleForAlias($package, $provider)
  7539. {
  7540. $packageIsAlias = $package instanceof AliasPackage;
  7541. $providerIsAlias = $provider instanceof AliasPackage;
  7542. $impossible = (
  7543. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  7544. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  7545. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  7546. );
  7547. return $impossible;
  7548. }
  7549. protected function whitelistFromJobs()
  7550. {
  7551. foreach ($this->jobs as $job) {
  7552. switch ($job['cmd']) {
  7553. case 'install':
  7554. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  7555. foreach ($packages as $package) {
  7556. $this->whitelistFromPackage($package);
  7557. }
  7558. break;
  7559. }
  7560. }
  7561. }
  7562. protected function addRulesForJobs($ignorePlatformReqs)
  7563. {
  7564. foreach ($this->jobs as $job) {
  7565. switch ($job['cmd']) {
  7566. case 'install':
  7567. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  7568. continue;
  7569. }
  7570. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7571. if ($packages) {
  7572. foreach ($packages as $package) {
  7573. if (!isset($this->installedMap[$package->id])) {
  7574. $this->addRulesForPackage($package, $ignorePlatformReqs);
  7575. }
  7576. }
  7577. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  7578. $this->addRule(RuleSet::TYPE_JOB, $rule);
  7579. }
  7580. break;
  7581. case 'remove':
  7582. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7583. foreach ($packages as $package) {
  7584. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  7585. $this->addRule(RuleSet::TYPE_JOB, $rule);
  7586. }
  7587. break;
  7588. }
  7589. }
  7590. }
  7591. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  7592. {
  7593. $this->jobs = $jobs;
  7594. $this->rules = new RuleSet;
  7595. $this->installedMap = $installedMap;
  7596. $this->whitelistedMap = array();
  7597. foreach ($this->installedMap as $package) {
  7598. $this->whitelistFromPackage($package);
  7599. }
  7600. $this->whitelistFromJobs();
  7601. $this->pool->setWhitelist($this->whitelistedMap);
  7602. $this->addedMap = array();
  7603. foreach ($this->installedMap as $package) {
  7604. $this->addRulesForPackage($package, $ignorePlatformReqs);
  7605. }
  7606. $this->addRulesForJobs($ignorePlatformReqs);
  7607. return $this->rules;
  7608. }
  7609. }
  7610. <?php
  7611. namespace Composer\DependencyResolver;
  7612. class RuleSetIterator implements \Iterator
  7613. {
  7614. protected $rules;
  7615. protected $types;
  7616. protected $currentOffset;
  7617. protected $currentType;
  7618. protected $currentTypeOffset;
  7619. public function __construct(array $rules)
  7620. {
  7621. $this->rules = $rules;
  7622. $this->types = array_keys($rules);
  7623. sort($this->types);
  7624. $this->rewind();
  7625. }
  7626. public function current()
  7627. {
  7628. return $this->rules[$this->currentType][$this->currentOffset];
  7629. }
  7630. public function key()
  7631. {
  7632. return $this->currentType;
  7633. }
  7634. public function next()
  7635. {
  7636. $this->currentOffset++;
  7637. if (!isset($this->rules[$this->currentType])) {
  7638. return;
  7639. }
  7640. if ($this->currentOffset >= sizeof($this->rules[$this->currentType])) {
  7641. $this->currentOffset = 0;
  7642. do {
  7643. $this->currentTypeOffset++;
  7644. if (!isset($this->types[$this->currentTypeOffset])) {
  7645. $this->currentType = -1;
  7646. break;
  7647. }
  7648. $this->currentType = $this->types[$this->currentTypeOffset];
  7649. } while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
  7650. }
  7651. }
  7652. public function rewind()
  7653. {
  7654. $this->currentOffset = 0;
  7655. $this->currentTypeOffset = -1;
  7656. $this->currentType = -1;
  7657. do {
  7658. $this->currentTypeOffset++;
  7659. if (!isset($this->types[$this->currentTypeOffset])) {
  7660. $this->currentType = -1;
  7661. break;
  7662. }
  7663. $this->currentType = $this->types[$this->currentTypeOffset];
  7664. } while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
  7665. }
  7666. public function valid()
  7667. {
  7668. return isset($this->rules[$this->currentType])
  7669. && isset($this->rules[$this->currentType][$this->currentOffset]);
  7670. }
  7671. }
  7672. <?php
  7673. namespace Composer\DependencyResolver;
  7674. class RuleWatchChain extends \SplDoublyLinkedList
  7675. {
  7676. protected $offset = 0;
  7677. public function seek($offset)
  7678. {
  7679. $this->rewind();
  7680. for ($i = 0; $i < $offset; $i++, $this->next());
  7681. }
  7682. public function remove()
  7683. {
  7684. $offset = $this->key();
  7685. $this->offsetUnset($offset);
  7686. $this->seek($offset);
  7687. }
  7688. }
  7689. <?php
  7690. namespace Composer\DependencyResolver;
  7691. class RuleWatchGraph
  7692. {
  7693. protected $watchChains = array();
  7694. public function insert(RuleWatchNode $node)
  7695. {
  7696. if ($node->getRule()->isAssertion()) {
  7697. return;
  7698. }
  7699. foreach (array($node->watch1, $node->watch2) as $literal) {
  7700. if (!isset($this->watchChains[$literal])) {
  7701. $this->watchChains[$literal] = new RuleWatchChain;
  7702. }
  7703. $this->watchChains[$literal]->unshift($node);
  7704. }
  7705. }
  7706. public function propagateLiteral($decidedLiteral, $level, $decisions)
  7707. {
  7708. $literal = -$decidedLiteral;
  7709. if (!isset($this->watchChains[$literal])) {
  7710. return null;
  7711. }
  7712. $chain = $this->watchChains[$literal];
  7713. $chain->rewind();
  7714. while ($chain->valid()) {
  7715. $node = $chain->current();
  7716. $otherWatch = $node->getOtherWatch($literal);
  7717. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  7718. $ruleLiterals = $node->getRule()->literals;
  7719. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  7720. return $literal !== $ruleLiteral &&
  7721. $otherWatch !== $ruleLiteral &&
  7722. !$decisions->conflict($ruleLiteral);
  7723. });
  7724. if ($alternativeLiterals) {
  7725. reset($alternativeLiterals);
  7726. $this->moveWatch($literal, current($alternativeLiterals), $node);
  7727. continue;
  7728. }
  7729. if ($decisions->conflict($otherWatch)) {
  7730. return $node->getRule();
  7731. }
  7732. $decisions->decide($otherWatch, $level, $node->getRule());
  7733. }
  7734. $chain->next();
  7735. }
  7736. return null;
  7737. }
  7738. protected function moveWatch($fromLiteral, $toLiteral, $node)
  7739. {
  7740. if (!isset($this->watchChains[$toLiteral])) {
  7741. $this->watchChains[$toLiteral] = new RuleWatchChain;
  7742. }
  7743. $node->moveWatch($fromLiteral, $toLiteral);
  7744. $this->watchChains[$fromLiteral]->remove();
  7745. $this->watchChains[$toLiteral]->unshift($node);
  7746. }
  7747. }
  7748. <?php
  7749. namespace Composer\DependencyResolver;
  7750. class RuleWatchNode
  7751. {
  7752. public $watch1;
  7753. public $watch2;
  7754. protected $rule;
  7755. public function __construct($rule)
  7756. {
  7757. $this->rule = $rule;
  7758. $literals = $rule->literals;
  7759. $this->watch1 = count($literals) > 0 ? $literals[0] : 0;
  7760. $this->watch2 = count($literals) > 1 ? $literals[1] : 0;
  7761. }
  7762. public function watch2OnHighest(Decisions $decisions)
  7763. {
  7764. $literals = $this->rule->literals;
  7765. if (count($literals) < 3) {
  7766. return;
  7767. }
  7768. $watchLevel = 0;
  7769. foreach ($literals as $literal) {
  7770. $level = $decisions->decisionLevel($literal);
  7771. if ($level > $watchLevel) {
  7772. $this->watch2 = $literal;
  7773. $watchLevel = $level;
  7774. }
  7775. }
  7776. }
  7777. public function getRule()
  7778. {
  7779. return $this->rule;
  7780. }
  7781. public function getOtherWatch($literal)
  7782. {
  7783. if ($this->watch1 == $literal) {
  7784. return $this->watch2;
  7785. } else {
  7786. return $this->watch1;
  7787. }
  7788. }
  7789. public function moveWatch($from, $to)
  7790. {
  7791. if ($this->watch1 == $from) {
  7792. $this->watch1 = $to;
  7793. } else {
  7794. $this->watch2 = $to;
  7795. }
  7796. }
  7797. }
  7798. <?php
  7799. namespace Composer\DependencyResolver;
  7800. use Composer\Repository\RepositoryInterface;
  7801. use Composer\Repository\PlatformRepository;
  7802. class Solver
  7803. {
  7804. const BRANCH_LITERALS = 0;
  7805. const BRANCH_LEVEL = 1;
  7806. protected $policy;
  7807. protected $pool;
  7808. protected $installed;
  7809. protected $rules;
  7810. protected $ruleSetGenerator;
  7811. protected $jobs;
  7812. protected $updateMap = array();
  7813. protected $watchGraph;
  7814. protected $decisions;
  7815. protected $installedMap;
  7816. protected $propagateIndex;
  7817. protected $branches = array();
  7818. protected $problems = array();
  7819. protected $learnedPool = array();
  7820. protected $learnedWhy = array();
  7821. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed)
  7822. {
  7823. $this->policy = $policy;
  7824. $this->pool = $pool;
  7825. $this->installed = $installed;
  7826. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  7827. }
  7828. public function getRuleSetSize()
  7829. {
  7830. return count($this->rules);
  7831. }
  7832. private function makeAssertionRuleDecisions()
  7833. {
  7834. $decisionStart = count($this->decisions) - 1;
  7835. $rulesCount = count($this->rules);
  7836. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  7837. $rule = $this->rules->ruleById[$ruleIndex];
  7838. if (!$rule->isAssertion() || $rule->isDisabled()) {
  7839. continue;
  7840. }
  7841. $literals = $rule->literals;
  7842. $literal = $literals[0];
  7843. if (!$this->decisions->decided(abs($literal))) {
  7844. $this->decisions->decide($literal, 1, $rule);
  7845. continue;
  7846. }
  7847. if ($this->decisions->satisfy($literal)) {
  7848. continue;
  7849. }
  7850. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  7851. $rule->disable();
  7852. continue;
  7853. }
  7854. $conflict = $this->decisions->decisionRule($literal);
  7855. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  7856. $problem = new Problem($this->pool);
  7857. $problem->addRule($rule);
  7858. $problem->addRule($conflict);
  7859. $this->disableProblem($rule);
  7860. $this->problems[] = $problem;
  7861. continue;
  7862. }
  7863. $problem = new Problem($this->pool);
  7864. $problem->addRule($rule);
  7865. $problem->addRule($conflict);
  7866. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  7867. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  7868. continue;
  7869. }
  7870. $assertRuleLiterals = $assertRule->literals;
  7871. $assertRuleLiteral = $assertRuleLiterals[0];
  7872. if (abs($literal) !== abs($assertRuleLiteral)) {
  7873. continue;
  7874. }
  7875. $problem->addRule($assertRule);
  7876. $this->disableProblem($assertRule);
  7877. }
  7878. $this->problems[] = $problem;
  7879. $this->decisions->resetToOffset($decisionStart);
  7880. $ruleIndex = -1;
  7881. }
  7882. }
  7883. protected function setupInstalledMap()
  7884. {
  7885. $this->installedMap = array();
  7886. foreach ($this->installed->getPackages() as $package) {
  7887. $this->installedMap[$package->id] = $package;
  7888. }
  7889. }
  7890. protected function checkForRootRequireProblems($ignorePlatformReqs)
  7891. {
  7892. foreach ($this->jobs as $job) {
  7893. switch ($job['cmd']) {
  7894. case 'update':
  7895. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7896. foreach ($packages as $package) {
  7897. if (isset($this->installedMap[$package->id])) {
  7898. $this->updateMap[$package->id] = true;
  7899. }
  7900. }
  7901. break;
  7902. case 'update-all':
  7903. foreach ($this->installedMap as $package) {
  7904. $this->updateMap[$package->id] = true;
  7905. }
  7906. break;
  7907. case 'install':
  7908. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  7909. break;
  7910. }
  7911. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  7912. $problem = new Problem($this->pool);
  7913. $problem->addRule(new Rule(array(), null, null, $job));
  7914. $this->problems[] = $problem;
  7915. }
  7916. break;
  7917. }
  7918. }
  7919. }
  7920. public function solve(Request $request, $ignorePlatformReqs = false)
  7921. {
  7922. $this->jobs = $request->getJobs();
  7923. $this->setupInstalledMap();
  7924. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  7925. $this->checkForRootRequireProblems($ignorePlatformReqs);
  7926. $this->decisions = new Decisions($this->pool);
  7927. $this->watchGraph = new RuleWatchGraph;
  7928. foreach ($this->rules as $rule) {
  7929. $this->watchGraph->insert(new RuleWatchNode($rule));
  7930. }
  7931. $this->makeAssertionRuleDecisions();
  7932. $this->runSat(true);
  7933. foreach ($this->installedMap as $packageId => $void) {
  7934. if ($this->decisions->undecided($packageId)) {
  7935. $this->decisions->decide(-$packageId, 1, null);
  7936. }
  7937. }
  7938. if ($this->problems) {
  7939. throw new SolverProblemsException($this->problems, $this->installedMap);
  7940. }
  7941. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  7942. return $transaction->getOperations();
  7943. }
  7944. protected function propagate($level)
  7945. {
  7946. while ($this->decisions->validOffset($this->propagateIndex)) {
  7947. $decision = $this->decisions->atOffset($this->propagateIndex);
  7948. $conflict = $this->watchGraph->propagateLiteral(
  7949. $decision[Decisions::DECISION_LITERAL],
  7950. $level,
  7951. $this->decisions
  7952. );
  7953. $this->propagateIndex++;
  7954. if ($conflict) {
  7955. return $conflict;
  7956. }
  7957. }
  7958. return null;
  7959. }
  7960. private function revert($level)
  7961. {
  7962. while (!$this->decisions->isEmpty()) {
  7963. $literal = $this->decisions->lastLiteral();
  7964. if ($this->decisions->undecided($literal)) {
  7965. break;
  7966. }
  7967. $decisionLevel = $this->decisions->decisionLevel($literal);
  7968. if ($decisionLevel <= $level) {
  7969. break;
  7970. }
  7971. $this->decisions->revertLast();
  7972. $this->propagateIndex = count($this->decisions);
  7973. }
  7974. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  7975. array_pop($this->branches);
  7976. }
  7977. }
  7978. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  7979. {
  7980. $level++;
  7981. $this->decisions->decide($literal, $level, $rule);
  7982. while (true) {
  7983. $rule = $this->propagate($level);
  7984. if (!$rule) {
  7985. break;
  7986. }
  7987. if ($level == 1) {
  7988. return $this->analyzeUnsolvable($rule, $disableRules);
  7989. }
  7990. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  7991. if ($newLevel <= 0 || $newLevel >= $level) {
  7992. throw new SolverBugException(
  7993. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  7994. );
  7995. } elseif (!$newRule) {
  7996. throw new SolverBugException(
  7997. "No rule was learned from analyzing $rule at level $level."
  7998. );
  7999. }
  8000. $level = $newLevel;
  8001. $this->revert($level);
  8002. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  8003. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  8004. $ruleNode = new RuleWatchNode($newRule);
  8005. $ruleNode->watch2OnHighest($this->decisions);
  8006. $this->watchGraph->insert($ruleNode);
  8007. $this->decisions->decide($learnLiteral, $level, $newRule);
  8008. }
  8009. return $level;
  8010. }
  8011. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  8012. {
  8013. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  8014. $selectedLiteral = array_shift($literals);
  8015. if (count($literals)) {
  8016. $this->branches[] = array($literals, $level);
  8017. }
  8018. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  8019. }
  8020. protected function analyze($level, Rule $rule)
  8021. {
  8022. $analyzedRule = $rule;
  8023. $ruleLevel = 1;
  8024. $num = 0;
  8025. $l1num = 0;
  8026. $seen = array();
  8027. $learnedLiterals = array(null);
  8028. $decisionId = count($this->decisions);
  8029. $this->learnedPool[] = array();
  8030. while (true) {
  8031. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  8032. foreach ($rule->literals as $literal) {
  8033. if ($this->decisions->satisfy($literal)) {
  8034. continue;
  8035. }
  8036. if (isset($seen[abs($literal)])) {
  8037. continue;
  8038. }
  8039. $seen[abs($literal)] = true;
  8040. $l = $this->decisions->decisionLevel($literal);
  8041. if (1 === $l) {
  8042. $l1num++;
  8043. } elseif ($level === $l) {
  8044. $num++;
  8045. } else {
  8046. $learnedLiterals[] = $literal;
  8047. if ($l > $ruleLevel) {
  8048. $ruleLevel = $l;
  8049. }
  8050. }
  8051. }
  8052. $l1retry = true;
  8053. while ($l1retry) {
  8054. $l1retry = false;
  8055. if (!$num && !--$l1num) {
  8056. break 2;
  8057. }
  8058. while (true) {
  8059. if ($decisionId <= 0) {
  8060. throw new SolverBugException(
  8061. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  8062. );
  8063. }
  8064. $decisionId--;
  8065. $decision = $this->decisions->atOffset($decisionId);
  8066. $literal = $decision[Decisions::DECISION_LITERAL];
  8067. if (isset($seen[abs($literal)])) {
  8068. break;
  8069. }
  8070. }
  8071. unset($seen[abs($literal)]);
  8072. if ($num && 0 === --$num) {
  8073. $learnedLiterals[0] = -abs($literal);
  8074. if (!$l1num) {
  8075. break 2;
  8076. }
  8077. foreach ($learnedLiterals as $i => $learnedLiteral) {
  8078. if ($i !== 0) {
  8079. unset($seen[abs($learnedLiteral)]);
  8080. }
  8081. }
  8082. $l1num++;
  8083. $l1retry = true;
  8084. }
  8085. }
  8086. $decision = $this->decisions->atOffset($decisionId);
  8087. $rule = $decision[Decisions::DECISION_REASON];
  8088. }
  8089. $why = count($this->learnedPool) - 1;
  8090. if (!$learnedLiterals[0]) {
  8091. throw new SolverBugException(
  8092. "Did not find a learnable literal in analyzed rule $analyzedRule."
  8093. );
  8094. }
  8095. $newRule = new Rule($learnedLiterals, Rule::RULE_LEARNED, $why);
  8096. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  8097. }
  8098. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  8099. {
  8100. $why = spl_object_hash($conflictRule);
  8101. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  8102. $learnedWhy = $this->learnedWhy[$why];
  8103. $problemRules = $this->learnedPool[$learnedWhy];
  8104. foreach ($problemRules as $problemRule) {
  8105. $this->analyzeUnsolvableRule($problem, $problemRule);
  8106. }
  8107. return;
  8108. }
  8109. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  8110. return;
  8111. }
  8112. $problem->nextSection();
  8113. $problem->addRule($conflictRule);
  8114. }
  8115. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  8116. {
  8117. $problem = new Problem($this->pool);
  8118. $problem->addRule($conflictRule);
  8119. $this->analyzeUnsolvableRule($problem, $conflictRule);
  8120. $this->problems[] = $problem;
  8121. $seen = array();
  8122. $literals = $conflictRule->literals;
  8123. foreach ($literals as $literal) {
  8124. if ($this->decisions->satisfy($literal)) {
  8125. continue;
  8126. }
  8127. $seen[abs($literal)] = true;
  8128. }
  8129. foreach ($this->decisions as $decision) {
  8130. $literal = $decision[Decisions::DECISION_LITERAL];
  8131. if (!isset($seen[abs($literal)])) {
  8132. continue;
  8133. }
  8134. $why = $decision[Decisions::DECISION_REASON];
  8135. $problem->addRule($why);
  8136. $this->analyzeUnsolvableRule($problem, $why);
  8137. $literals = $why->literals;
  8138. foreach ($literals as $literal) {
  8139. if ($this->decisions->satisfy($literal)) {
  8140. continue;
  8141. }
  8142. $seen[abs($literal)] = true;
  8143. }
  8144. }
  8145. if ($disableRules) {
  8146. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  8147. $this->disableProblem($reason['rule']);
  8148. }
  8149. $this->resetSolver();
  8150. return 1;
  8151. }
  8152. return 0;
  8153. }
  8154. private function disableProblem(Rule $why)
  8155. {
  8156. $job = $why->getJob();
  8157. if (!$job) {
  8158. $why->disable();
  8159. return;
  8160. }
  8161. foreach ($this->rules as $rule) {
  8162. if ($job === $rule->getJob()) {
  8163. $rule->disable();
  8164. }
  8165. }
  8166. }
  8167. private function resetSolver()
  8168. {
  8169. $this->decisions->reset();
  8170. $this->propagateIndex = 0;
  8171. $this->branches = array();
  8172. $this->enableDisableLearnedRules();
  8173. $this->makeAssertionRuleDecisions();
  8174. }
  8175. private function enableDisableLearnedRules()
  8176. {
  8177. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  8178. $why = $this->learnedWhy[spl_object_hash($rule)];
  8179. $problemRules = $this->learnedPool[$why];
  8180. $foundDisabled = false;
  8181. foreach ($problemRules as $problemRule) {
  8182. if ($problemRule->isDisabled()) {
  8183. $foundDisabled = true;
  8184. break;
  8185. }
  8186. }
  8187. if ($foundDisabled && $rule->isEnabled()) {
  8188. $rule->disable();
  8189. } elseif (!$foundDisabled && $rule->isDisabled()) {
  8190. $rule->enable();
  8191. }
  8192. }
  8193. }
  8194. private function runSat($disableRules = true)
  8195. {
  8196. $this->propagateIndex = 0;
  8197. $decisionQueue = array();
  8198. $decisionSupplementQueue = array();
  8199. $disableRules = array();
  8200. $level = 1;
  8201. $systemLevel = $level + 1;
  8202. $installedPos = 0;
  8203. while (true) {
  8204. if (1 === $level) {
  8205. $conflictRule = $this->propagate($level);
  8206. if (null !== $conflictRule) {
  8207. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  8208. continue;
  8209. }
  8210. return;
  8211. }
  8212. }
  8213. if ($level < $systemLevel) {
  8214. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  8215. foreach ($iterator as $rule) {
  8216. if ($rule->isEnabled()) {
  8217. $decisionQueue = array();
  8218. $noneSatisfied = true;
  8219. foreach ($rule->literals as $literal) {
  8220. if ($this->decisions->satisfy($literal)) {
  8221. $noneSatisfied = false;
  8222. break;
  8223. }
  8224. if ($literal > 0 && $this->decisions->undecided($literal)) {
  8225. $decisionQueue[] = $literal;
  8226. }
  8227. }
  8228. if ($noneSatisfied && count($decisionQueue)) {
  8229. if (count($this->installed) != count($this->updateMap)) {
  8230. $prunedQueue = array();
  8231. foreach ($decisionQueue as $literal) {
  8232. if (isset($this->installedMap[abs($literal)])) {
  8233. $prunedQueue[] = $literal;
  8234. if (isset($this->updateMap[abs($literal)])) {
  8235. $prunedQueue = $decisionQueue;
  8236. break;
  8237. }
  8238. }
  8239. }
  8240. $decisionQueue = $prunedQueue;
  8241. }
  8242. }
  8243. if ($noneSatisfied && count($decisionQueue)) {
  8244. $oLevel = $level;
  8245. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  8246. if (0 === $level) {
  8247. return;
  8248. }
  8249. if ($level <= $oLevel) {
  8250. break;
  8251. }
  8252. }
  8253. }
  8254. }
  8255. $systemLevel = $level + 1;
  8256. $iterator->next();
  8257. if ($iterator->valid()) {
  8258. continue;
  8259. }
  8260. }
  8261. if ($level < $systemLevel) {
  8262. $systemLevel = $level;
  8263. }
  8264. for ($i = 0, $n = 0; $n < count($this->rules); $i++, $n++) {
  8265. if ($i == count($this->rules)) {
  8266. $i = 0;
  8267. }
  8268. $rule = $this->rules->ruleById[$i];
  8269. $literals = $rule->literals;
  8270. if ($rule->isDisabled()) {
  8271. continue;
  8272. }
  8273. $decisionQueue = array();
  8274. foreach ($literals as $literal) {
  8275. if ($literal <= 0) {
  8276. if (!$this->decisions->decidedInstall(abs($literal))) {
  8277. continue 2;
  8278. }
  8279. } else {
  8280. if ($this->decisions->decidedInstall(abs($literal))) {
  8281. continue 2;
  8282. }
  8283. if ($this->decisions->undecided(abs($literal))) {
  8284. $decisionQueue[] = $literal;
  8285. }
  8286. }
  8287. }
  8288. if (count($decisionQueue) < 2) {
  8289. continue;
  8290. }
  8291. $oLevel = $level;
  8292. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  8293. if (0 === $level) {
  8294. return;
  8295. }
  8296. $n = -1;
  8297. }
  8298. if ($level < $systemLevel) {
  8299. continue;
  8300. }
  8301. if (count($this->branches)) {
  8302. $lastLiteral = null;
  8303. $lastLevel = null;
  8304. $lastBranchIndex = 0;
  8305. $lastBranchOffset = 0;
  8306. $l = 0;
  8307. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  8308. list($literals, $l) = $this->branches[$i];
  8309. foreach ($literals as $offset => $literal) {
  8310. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  8311. $lastLiteral = $literal;
  8312. $lastBranchIndex = $i;
  8313. $lastBranchOffset = $offset;
  8314. $lastLevel = $l;
  8315. }
  8316. }
  8317. }
  8318. if ($lastLiteral) {
  8319. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  8320. $level = $lastLevel;
  8321. $this->revert($level);
  8322. $why = $this->decisions->lastReason();
  8323. $oLevel = $level;
  8324. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  8325. if ($level == 0) {
  8326. return;
  8327. }
  8328. continue;
  8329. }
  8330. }
  8331. break;
  8332. }
  8333. }
  8334. }
  8335. <?php
  8336. namespace Composer\DependencyResolver;
  8337. class SolverBugException extends \RuntimeException
  8338. {
  8339. public function __construct($message)
  8340. {
  8341. parent::__construct(
  8342. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  8343. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n");
  8344. }
  8345. }
  8346. <?php
  8347. namespace Composer\DependencyResolver;
  8348. class SolverProblemsException extends \RuntimeException
  8349. {
  8350. protected $problems;
  8351. protected $installedMap;
  8352. public function __construct(array $problems, array $installedMap)
  8353. {
  8354. $this->problems = $problems;
  8355. $this->installedMap = $installedMap;
  8356. parent::__construct($this->createMessage(), 2);
  8357. }
  8358. protected function createMessage()
  8359. {
  8360. $text = "\n";
  8361. $hasExtensionProblems = false;
  8362. foreach ($this->problems as $i => $problem) {
  8363. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  8364. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  8365. $hasExtensionProblems = true;
  8366. }
  8367. }
  8368. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  8369. $text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  8370. }
  8371. if ($hasExtensionProblems) {
  8372. $text .= $this->createExtensionHint();
  8373. }
  8374. return $text;
  8375. }
  8376. public function getProblems()
  8377. {
  8378. return $this->problems;
  8379. }
  8380. private function createExtensionHint()
  8381. {
  8382. $paths = array();
  8383. if (($iniPath = php_ini_loaded_file()) !== false) {
  8384. $paths[] = $iniPath;
  8385. }
  8386. if (!defined('HHVM_VERSION') && $additionalIniPaths = php_ini_scanned_files()) {
  8387. $paths = array_merge($paths, array_map("trim", explode(",", $additionalIniPaths)));
  8388. }
  8389. if (count($paths) === 0) {
  8390. return '';
  8391. }
  8392. $text = "\n To enable extensions, verify that they are enabled in those .ini files:\n - ";
  8393. $text .= implode("\n - ", $paths);
  8394. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  8395. return $text;
  8396. }
  8397. private function hasExtensionProblems(array $reasonSets)
  8398. {
  8399. foreach ($reasonSets as $reasonSet) {
  8400. foreach ($reasonSet as $reason) {
  8401. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  8402. return true;
  8403. }
  8404. }
  8405. }
  8406. return false;
  8407. }
  8408. }
  8409. <?php
  8410. namespace Composer\DependencyResolver;
  8411. use Composer\Package\AliasPackage;
  8412. class Transaction
  8413. {
  8414. protected $policy;
  8415. protected $pool;
  8416. protected $installedMap;
  8417. protected $decisions;
  8418. protected $transaction;
  8419. public function __construct($policy, $pool, $installedMap, $decisions)
  8420. {
  8421. $this->policy = $policy;
  8422. $this->pool = $pool;
  8423. $this->installedMap = $installedMap;
  8424. $this->decisions = $decisions;
  8425. $this->transaction = array();
  8426. }
  8427. public function getOperations()
  8428. {
  8429. $installMeansUpdateMap = $this->findUpdates();
  8430. $updateMap = array();
  8431. $installMap = array();
  8432. $uninstallMap = array();
  8433. foreach ($this->decisions as $i => $decision) {
  8434. $literal = $decision[Decisions::DECISION_LITERAL];
  8435. $reason = $decision[Decisions::DECISION_REASON];
  8436. $package = $this->pool->literalToPackage($literal);
  8437. if (($literal > 0) == (isset($this->installedMap[$package->id]))) {
  8438. continue;
  8439. }
  8440. if ($literal > 0) {
  8441. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  8442. $source = $installMeansUpdateMap[abs($literal)];
  8443. $updateMap[$package->id] = array(
  8444. 'package' => $package,
  8445. 'source' => $source,
  8446. 'reason' => $reason,
  8447. );
  8448. unset($installMeansUpdateMap[abs($literal)]);
  8449. $ignoreRemove[$source->id] = true;
  8450. } else {
  8451. $installMap[$package->id] = array(
  8452. 'package' => $package,
  8453. 'reason' => $reason,
  8454. );
  8455. }
  8456. }
  8457. }
  8458. foreach ($this->decisions as $i => $decision) {
  8459. $literal = $decision[Decisions::DECISION_LITERAL];
  8460. $reason = $decision[Decisions::DECISION_REASON];
  8461. $package = $this->pool->literalToPackage($literal);
  8462. if ($literal <= 0 &&
  8463. isset($this->installedMap[$package->id]) &&
  8464. !isset($ignoreRemove[$package->id])) {
  8465. $uninstallMap[$package->id] = array(
  8466. 'package' => $package,
  8467. 'reason' => $reason,
  8468. );
  8469. }
  8470. }
  8471. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  8472. return $this->transaction;
  8473. }
  8474. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  8475. {
  8476. $queue = array_map(function ($operation) {
  8477. return $operation['package'];
  8478. },
  8479. $this->findRootPackages($installMap, $updateMap)
  8480. );
  8481. $visited = array();
  8482. while (!empty($queue)) {
  8483. $package = array_pop($queue);
  8484. $packageId = $package->id;
  8485. if (!isset($visited[$packageId])) {
  8486. array_push($queue, $package);
  8487. if ($package instanceof AliasPackage) {
  8488. array_push($queue, $package->getAliasOf());
  8489. } else {
  8490. foreach ($package->getRequires() as $link) {
  8491. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8492. foreach ($possibleRequires as $require) {
  8493. array_push($queue, $require);
  8494. }
  8495. }
  8496. }
  8497. $visited[$package->id] = true;
  8498. } else {
  8499. if (isset($installMap[$packageId])) {
  8500. $this->install(
  8501. $installMap[$packageId]['package'],
  8502. $installMap[$packageId]['reason']
  8503. );
  8504. unset($installMap[$packageId]);
  8505. }
  8506. if (isset($updateMap[$packageId])) {
  8507. $this->update(
  8508. $updateMap[$packageId]['source'],
  8509. $updateMap[$packageId]['package'],
  8510. $updateMap[$packageId]['reason']
  8511. );
  8512. unset($updateMap[$packageId]);
  8513. }
  8514. }
  8515. }
  8516. foreach ($uninstallMap as $uninstall) {
  8517. $this->uninstall($uninstall['package'], $uninstall['reason']);
  8518. }
  8519. }
  8520. protected function findRootPackages($installMap, $updateMap)
  8521. {
  8522. $packages = $installMap + $updateMap;
  8523. $roots = $packages;
  8524. foreach ($packages as $packageId => $operation) {
  8525. $package = $operation['package'];
  8526. if (!isset($roots[$packageId])) {
  8527. continue;
  8528. }
  8529. foreach ($package->getRequires() as $link) {
  8530. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8531. foreach ($possibleRequires as $require) {
  8532. unset($roots[$require->id]);
  8533. }
  8534. }
  8535. }
  8536. return $roots;
  8537. }
  8538. protected function findUpdates()
  8539. {
  8540. $installMeansUpdateMap = array();
  8541. foreach ($this->decisions as $i => $decision) {
  8542. $literal = $decision[Decisions::DECISION_LITERAL];
  8543. $package = $this->pool->literalToPackage($literal);
  8544. if ($package instanceof AliasPackage) {
  8545. continue;
  8546. }
  8547. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  8548. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  8549. $literals = array($package->id);
  8550. foreach ($updates as $update) {
  8551. $literals[] = $update->id;
  8552. }
  8553. foreach ($literals as $updateLiteral) {
  8554. if ($updateLiteral !== $literal) {
  8555. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  8556. }
  8557. }
  8558. }
  8559. }
  8560. return $installMeansUpdateMap;
  8561. }
  8562. protected function install($package, $reason)
  8563. {
  8564. if ($package instanceof AliasPackage) {
  8565. return $this->markAliasInstalled($package, $reason);
  8566. }
  8567. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  8568. }
  8569. protected function update($from, $to, $reason)
  8570. {
  8571. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  8572. }
  8573. protected function uninstall($package, $reason)
  8574. {
  8575. if ($package instanceof AliasPackage) {
  8576. return $this->markAliasUninstalled($package, $reason);
  8577. }
  8578. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  8579. }
  8580. protected function markAliasInstalled($package, $reason)
  8581. {
  8582. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  8583. }
  8584. protected function markAliasUninstalled($package, $reason)
  8585. {
  8586. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  8587. }
  8588. }
  8589. <?php
  8590. namespace Composer\Downloader;
  8591. use Composer\Package\PackageInterface;
  8592. use Symfony\Component\Finder\Finder;
  8593. use Composer\IO\IOInterface;
  8594. abstract class ArchiveDownloader extends FileDownloader
  8595. {
  8596. public function download(PackageInterface $package, $path)
  8597. {
  8598. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  8599. $retries = 3;
  8600. while ($retries--) {
  8601. $fileName = parent::download($package, $path);
  8602. $this->io->writeError(' Extracting archive', true, IOInterface::VERBOSE);
  8603. try {
  8604. $this->filesystem->ensureDirectoryExists($temporaryDir);
  8605. try {
  8606. $this->extract($fileName, $temporaryDir);
  8607. } catch (\Exception $e) {
  8608. parent::clearLastCacheWrite($package);
  8609. throw $e;
  8610. }
  8611. $this->filesystem->unlink($fileName);
  8612. $contentDir = $this->getFolderContent($temporaryDir);
  8613. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  8614. $contentDir = $this->getFolderContent((string) reset($contentDir));
  8615. }
  8616. foreach ($contentDir as $file) {
  8617. $file = (string) $file;
  8618. $this->filesystem->rename($file, $path . '/' . basename($file));
  8619. }
  8620. $this->filesystem->removeDirectory($temporaryDir);
  8621. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  8622. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  8623. }
  8624. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  8625. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  8626. }
  8627. } catch (\Exception $e) {
  8628. $this->filesystem->removeDirectory($path);
  8629. $this->filesystem->removeDirectory($temporaryDir);
  8630. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  8631. if ($this->io->isDebug()) {
  8632. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  8633. } else {
  8634. $this->io->writeError(' Invalid zip file, retrying...');
  8635. }
  8636. usleep(500000);
  8637. continue;
  8638. }
  8639. throw $e;
  8640. }
  8641. break;
  8642. }
  8643. $this->io->writeError('');
  8644. }
  8645. protected function getFileName(PackageInterface $package, $path)
  8646. {
  8647. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  8648. }
  8649. protected function processUrl(PackageInterface $package, $url)
  8650. {
  8651. if ($package->getDistReference() && strpos($url, 'github.com')) {
  8652. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  8653. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  8654. } elseif ($package->getDistReference() && preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  8655. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  8656. } elseif ($package->getDistReference() && preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  8657. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  8658. }
  8659. } elseif ($package->getDistReference() && strpos($url, 'bitbucket.org')) {
  8660. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  8661. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $package->getDistReference() . '.' . $match[4];
  8662. }
  8663. }
  8664. return parent::processUrl($package, $url);
  8665. }
  8666. abstract protected function extract($file, $path);
  8667. private function getFolderContent($dir)
  8668. {
  8669. $finder = Finder::create()
  8670. ->ignoreVCS(false)
  8671. ->ignoreDotFiles(false)
  8672. ->depth(0)
  8673. ->in($dir);
  8674. return iterator_to_array($finder);
  8675. }
  8676. }
  8677. <?php
  8678. namespace Composer\Downloader;
  8679. use Composer\Package\PackageInterface;
  8680. interface ChangeReportInterface
  8681. {
  8682. public function getLocalChanges(PackageInterface $package, $path);
  8683. }
  8684. <?php
  8685. namespace Composer\Downloader;
  8686. use Composer\Package\PackageInterface;
  8687. use Composer\IO\IOInterface;
  8688. use Composer\Util\Filesystem;
  8689. class DownloadManager
  8690. {
  8691. private $io;
  8692. private $preferDist = false;
  8693. private $preferSource = false;
  8694. private $filesystem;
  8695. private $downloaders = array();
  8696. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  8697. {
  8698. $this->io = $io;
  8699. $this->preferSource = $preferSource;
  8700. $this->filesystem = $filesystem ?: new Filesystem();
  8701. }
  8702. public function setPreferSource($preferSource)
  8703. {
  8704. $this->preferSource = $preferSource;
  8705. return $this;
  8706. }
  8707. public function setPreferDist($preferDist)
  8708. {
  8709. $this->preferDist = $preferDist;
  8710. return $this;
  8711. }
  8712. public function setOutputProgress($outputProgress)
  8713. {
  8714. foreach ($this->downloaders as $downloader) {
  8715. $downloader->setOutputProgress($outputProgress);
  8716. }
  8717. return $this;
  8718. }
  8719. public function setDownloader($type, DownloaderInterface $downloader)
  8720. {
  8721. $type = strtolower($type);
  8722. $this->downloaders[$type] = $downloader;
  8723. return $this;
  8724. }
  8725. public function getDownloader($type)
  8726. {
  8727. $type = strtolower($type);
  8728. if (!isset($this->downloaders[$type])) {
  8729. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  8730. }
  8731. return $this->downloaders[$type];
  8732. }
  8733. public function getDownloaderForInstalledPackage(PackageInterface $package)
  8734. {
  8735. $installationSource = $package->getInstallationSource();
  8736. if ('metapackage' === $package->getType()) {
  8737. return;
  8738. }
  8739. if ('dist' === $installationSource) {
  8740. $downloader = $this->getDownloader($package->getDistType());
  8741. } elseif ('source' === $installationSource) {
  8742. $downloader = $this->getDownloader($package->getSourceType());
  8743. } else {
  8744. throw new \InvalidArgumentException(
  8745. 'Package '.$package.' seems not been installed properly'
  8746. );
  8747. }
  8748. if ($installationSource !== $downloader->getInstallationSource()) {
  8749. throw new \LogicException(sprintf(
  8750. 'Downloader "%s" is a %s type downloader and can not be used to download %s',
  8751. get_class($downloader), $downloader->getInstallationSource(), $installationSource
  8752. ));
  8753. }
  8754. return $downloader;
  8755. }
  8756. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  8757. {
  8758. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  8759. $sourceType = $package->getSourceType();
  8760. $distType = $package->getDistType();
  8761. $sources = array();
  8762. if ($sourceType) {
  8763. $sources[] = 'source';
  8764. }
  8765. if ($distType) {
  8766. $sources[] = 'dist';
  8767. }
  8768. if (empty($sources)) {
  8769. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  8770. }
  8771. if ((!$package->isDev() || $this->preferDist) && !$preferSource) {
  8772. $sources = array_reverse($sources);
  8773. }
  8774. $this->filesystem->ensureDirectoryExists($targetDir);
  8775. foreach ($sources as $i => $source) {
  8776. if (isset($e)) {
  8777. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  8778. }
  8779. $package->setInstallationSource($source);
  8780. try {
  8781. $downloader = $this->getDownloaderForInstalledPackage($package);
  8782. if ($downloader) {
  8783. $downloader->download($package, $targetDir);
  8784. }
  8785. break;
  8786. } catch (\RuntimeException $e) {
  8787. if ($i === count($sources) - 1) {
  8788. throw $e;
  8789. }
  8790. $this->io->writeError(
  8791. ' <warning>Failed to download '.
  8792. $package->getPrettyName().
  8793. ' from ' . $source . ': '.
  8794. $e->getMessage().'</warning>'
  8795. );
  8796. }
  8797. }
  8798. }
  8799. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  8800. {
  8801. $downloader = $this->getDownloaderForInstalledPackage($initial);
  8802. if (!$downloader) {
  8803. return;
  8804. }
  8805. $installationSource = $initial->getInstallationSource();
  8806. if ('dist' === $installationSource) {
  8807. $initialType = $initial->getDistType();
  8808. $targetType = $target->getDistType();
  8809. } else {
  8810. $initialType = $initial->getSourceType();
  8811. $targetType = $target->getSourceType();
  8812. }
  8813. if ($target->isDev() && 'dist' === $installationSource) {
  8814. $downloader->remove($initial, $targetDir);
  8815. $this->download($target, $targetDir);
  8816. return;
  8817. }
  8818. if ($initialType === $targetType) {
  8819. $target->setInstallationSource($installationSource);
  8820. try {
  8821. $downloader->update($initial, $target, $targetDir);
  8822. return;
  8823. } catch (\RuntimeException $e) {
  8824. if (!$this->io->isInteractive()) {
  8825. throw $e;
  8826. }
  8827. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  8828. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  8829. throw $e;
  8830. }
  8831. }
  8832. }
  8833. $downloader->remove($initial, $targetDir);
  8834. $this->download($target, $targetDir, 'source' === $installationSource);
  8835. }
  8836. public function remove(PackageInterface $package, $targetDir)
  8837. {
  8838. $downloader = $this->getDownloaderForInstalledPackage($package);
  8839. if ($downloader) {
  8840. $downloader->remove($package, $targetDir);
  8841. }
  8842. }
  8843. }
  8844. <?php
  8845. namespace Composer\Downloader;
  8846. use Composer\Package\PackageInterface;
  8847. interface DownloaderInterface
  8848. {
  8849. public function getInstallationSource();
  8850. public function download(PackageInterface $package, $path);
  8851. public function update(PackageInterface $initial, PackageInterface $target, $path);
  8852. public function remove(PackageInterface $package, $path);
  8853. public function setOutputProgress($outputProgress);
  8854. }
  8855. <?php
  8856. namespace Composer\Downloader;
  8857. use Composer\Config;
  8858. use Composer\Cache;
  8859. use Composer\Factory;
  8860. use Composer\IO\IOInterface;
  8861. use Composer\Package\PackageInterface;
  8862. use Composer\Plugin\PluginEvents;
  8863. use Composer\Plugin\PreFileDownloadEvent;
  8864. use Composer\EventDispatcher\EventDispatcher;
  8865. use Composer\Util\Filesystem;
  8866. use Composer\Util\RemoteFilesystem;
  8867. class FileDownloader implements DownloaderInterface
  8868. {
  8869. protected $io;
  8870. protected $config;
  8871. protected $rfs;
  8872. protected $filesystem;
  8873. protected $cache;
  8874. protected $outputProgress = true;
  8875. private $lastCacheWrites = array();
  8876. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  8877. {
  8878. $this->io = $io;
  8879. $this->config = $config;
  8880. $this->eventDispatcher = $eventDispatcher;
  8881. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  8882. $this->filesystem = $filesystem ?: new Filesystem();
  8883. $this->cache = $cache;
  8884. if ($this->cache && $this->cache->gcIsNecessary()) {
  8885. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  8886. }
  8887. }
  8888. public function getInstallationSource()
  8889. {
  8890. return 'dist';
  8891. }
  8892. public function download(PackageInterface $package, $path)
  8893. {
  8894. if (!$package->getDistUrl()) {
  8895. throw new \InvalidArgumentException('The given package is missing url information');
  8896. }
  8897. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  8898. $urls = $package->getDistUrls();
  8899. while ($url = array_shift($urls)) {
  8900. try {
  8901. return $this->doDownload($package, $path, $url);
  8902. } catch (\Exception $e) {
  8903. if ($this->io->isDebug()) {
  8904. $this->io->writeError('');
  8905. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  8906. } elseif (count($urls)) {
  8907. $this->io->writeError('');
  8908. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')');
  8909. }
  8910. if (!count($urls)) {
  8911. throw $e;
  8912. }
  8913. }
  8914. }
  8915. $this->io->writeError('');
  8916. }
  8917. protected function doDownload(PackageInterface $package, $path, $url)
  8918. {
  8919. $this->filesystem->emptyDirectory($path);
  8920. $fileName = $this->getFileName($package, $path);
  8921. $processedUrl = $this->processUrl($package, $url);
  8922. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  8923. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  8924. if ($this->eventDispatcher) {
  8925. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  8926. }
  8927. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  8928. try {
  8929. $checksum = $package->getDistSha1Checksum();
  8930. $cacheKey = $this->getCacheKey($package, $processedUrl);
  8931. if (!$this->cache || ($checksum && $checksum !== $this->cache->sha1($cacheKey)) || !$this->cache->copyTo($cacheKey, $fileName)) {
  8932. if (!$this->outputProgress) {
  8933. $this->io->writeError(' Downloading');
  8934. }
  8935. $retries = 3;
  8936. while ($retries--) {
  8937. try {
  8938. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  8939. break;
  8940. } catch (TransportException $e) {
  8941. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  8942. throw $e;
  8943. }
  8944. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  8945. usleep(500000);
  8946. }
  8947. }
  8948. if ($this->cache) {
  8949. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  8950. $this->cache->copyFrom($cacheKey, $fileName);
  8951. }
  8952. } else {
  8953. $this->io->writeError(' Loading from cache');
  8954. }
  8955. if (!file_exists($fileName)) {
  8956. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  8957. .' directory is writable and you have internet connectivity');
  8958. }
  8959. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  8960. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  8961. }
  8962. } catch (\Exception $e) {
  8963. $this->filesystem->removeDirectory($path);
  8964. $this->clearLastCacheWrite($package);
  8965. throw $e;
  8966. }
  8967. return $fileName;
  8968. }
  8969. public function setOutputProgress($outputProgress)
  8970. {
  8971. $this->outputProgress = $outputProgress;
  8972. return $this;
  8973. }
  8974. protected function clearLastCacheWrite(PackageInterface $package)
  8975. {
  8976. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  8977. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  8978. unset($this->lastCacheWrites[$package->getName()]);
  8979. }
  8980. }
  8981. public function update(PackageInterface $initial, PackageInterface $target, $path)
  8982. {
  8983. $this->remove($initial, $path);
  8984. $this->download($target, $path);
  8985. }
  8986. public function remove(PackageInterface $package, $path)
  8987. {
  8988. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  8989. if (!$this->filesystem->removeDirectory($path)) {
  8990. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  8991. }
  8992. }
  8993. protected function getFileName(PackageInterface $package, $path)
  8994. {
  8995. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  8996. }
  8997. protected function processUrl(PackageInterface $package, $url)
  8998. {
  8999. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  9000. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  9001. }
  9002. return $url;
  9003. }
  9004. private function getCacheKey(PackageInterface $package, $processedUrl)
  9005. {
  9006. $cacheKey = sha1($processedUrl);
  9007. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  9008. }
  9009. }
  9010. <?php
  9011. namespace Composer\Downloader;
  9012. class FilesystemException extends \Exception
  9013. {
  9014. public function __construct($message = '', $code = 0, \Exception $previous = null)
  9015. {
  9016. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  9017. }
  9018. }
  9019. <?php
  9020. namespace Composer\Downloader;
  9021. use Composer\Package\PackageInterface;
  9022. use Composer\Util\Git as GitUtil;
  9023. use Composer\Util\Platform;
  9024. use Composer\Util\ProcessExecutor;
  9025. use Composer\IO\IOInterface;
  9026. use Composer\Util\Filesystem;
  9027. use Composer\Config;
  9028. class GitDownloader extends VcsDownloader
  9029. {
  9030. private $hasStashedChanges = false;
  9031. private $hasDiscardedChanges = false;
  9032. private $gitUtil;
  9033. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  9034. {
  9035. parent::__construct($io, $config, $process, $fs);
  9036. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  9037. }
  9038. public function doDownload(PackageInterface $package, $path, $url)
  9039. {
  9040. GitUtil::cleanEnv();
  9041. $path = $this->normalizePath($path);
  9042. $ref = $package->getSourceReference();
  9043. $flag = Platform::isWindows() ? '/D ' : '';
  9044. $command = 'git clone --no-checkout %s %s && cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer';
  9045. $this->io->writeError(" Cloning ".$ref);
  9046. $commandCallable = function ($url) use ($ref, $path, $command) {
  9047. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($path), ProcessExecutor::escape($ref));
  9048. };
  9049. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  9050. if ($url !== $package->getSourceUrl()) {
  9051. $url = $package->getSourceUrl();
  9052. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  9053. }
  9054. $this->setPushUrl($path, $url);
  9055. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  9056. if ($package->getDistReference() === $package->getSourceReference()) {
  9057. $package->setDistReference($newRef);
  9058. }
  9059. $package->setSourceReference($newRef);
  9060. }
  9061. }
  9062. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9063. {
  9064. GitUtil::cleanEnv();
  9065. if (!$this->hasMetadataRepository($path)) {
  9066. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  9067. }
  9068. $ref = $target->getSourceReference();
  9069. $this->io->writeError(" Checking out ".$ref);
  9070. $command = 'git remote set-url composer %s && git fetch composer && git fetch --tags composer';
  9071. $commandCallable = function ($url) use ($command) {
  9072. return sprintf($command, ProcessExecutor::escape($url));
  9073. };
  9074. $this->gitUtil->runCommand($commandCallable, $url, $path);
  9075. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  9076. if ($target->getDistReference() === $target->getSourceReference()) {
  9077. $target->setDistReference($newRef);
  9078. }
  9079. $target->setSourceReference($newRef);
  9080. }
  9081. }
  9082. public function getLocalChanges(PackageInterface $package, $path)
  9083. {
  9084. GitUtil::cleanEnv();
  9085. if (!$this->hasMetadataRepository($path)) {
  9086. return;
  9087. }
  9088. $command = 'git status --porcelain --untracked-files=no';
  9089. if (0 !== $this->process->execute($command, $output, $path)) {
  9090. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9091. }
  9092. return trim($output) ?: null;
  9093. }
  9094. protected function cleanChanges(PackageInterface $package, $path, $update)
  9095. {
  9096. GitUtil::cleanEnv();
  9097. $path = $this->normalizePath($path);
  9098. if (!$changes = $this->getLocalChanges($package, $path)) {
  9099. return;
  9100. }
  9101. if (!$this->io->isInteractive()) {
  9102. $discardChanges = $this->config->get('discard-changes');
  9103. if (true === $discardChanges) {
  9104. return $this->discardChanges($path);
  9105. }
  9106. if ('stash' === $discardChanges) {
  9107. if (!$update) {
  9108. return parent::cleanChanges($package, $path, $update);
  9109. }
  9110. return $this->stashChanges($path);
  9111. }
  9112. return parent::cleanChanges($package, $path, $update);
  9113. }
  9114. $changes = array_map(function ($elem) {
  9115. return ' '.$elem;
  9116. }, preg_split('{\s*\r?\n\s*}', $changes));
  9117. $this->io->writeError(' <error>The package has modified files:</error>');
  9118. $this->io->writeError(array_slice($changes, 0, 10));
  9119. if (count($changes) > 10) {
  9120. $this->io->writeError(' <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
  9121. }
  9122. while (true) {
  9123. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  9124. case 'y':
  9125. $this->discardChanges($path);
  9126. break 2;
  9127. case 's':
  9128. if (!$update) {
  9129. goto help;
  9130. }
  9131. $this->stashChanges($path);
  9132. break 2;
  9133. case 'n':
  9134. throw new \RuntimeException('Update aborted');
  9135. case 'v':
  9136. $this->io->writeError($changes);
  9137. break;
  9138. case 'd':
  9139. $this->viewDiff($path);
  9140. break;
  9141. case '?':
  9142. default:
  9143. help:
  9144. $this->io->writeError(array(
  9145. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  9146. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  9147. ' v - view modified files',
  9148. ' d - view local modifications (diff)',
  9149. ));
  9150. if ($update) {
  9151. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  9152. }
  9153. $this->io->writeError(' ? - print help');
  9154. break;
  9155. }
  9156. }
  9157. }
  9158. protected function reapplyChanges($path)
  9159. {
  9160. $path = $this->normalizePath($path);
  9161. if ($this->hasStashedChanges) {
  9162. $this->hasStashedChanges = false;
  9163. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  9164. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  9165. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  9166. }
  9167. }
  9168. $this->hasDiscardedChanges = false;
  9169. }
  9170. protected function updateToCommit($path, $reference, $branch, $date)
  9171. {
  9172. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  9173. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  9174. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  9175. $branches = null;
  9176. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  9177. $branches = $output;
  9178. }
  9179. $gitRef = $reference;
  9180. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  9181. && $branches
  9182. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  9183. ) {
  9184. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  9185. if (0 === $this->process->execute($command, $output, $path)) {
  9186. return;
  9187. }
  9188. }
  9189. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  9190. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  9191. $branch = 'v' . $branch;
  9192. }
  9193. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  9194. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  9195. if (0 === $this->process->execute($command, $output, $path)
  9196. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  9197. ) {
  9198. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  9199. if (0 === $this->process->execute($command, $output, $path)) {
  9200. return;
  9201. }
  9202. }
  9203. }
  9204. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  9205. if (0 === $this->process->execute($command, $output, $path)) {
  9206. return;
  9207. }
  9208. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  9209. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  9210. }
  9211. throw new \RuntimeException('Failed to execute ' . GitUtil::sanitizeUrl($command) . "\n\n" . $this->process->getErrorOutput());
  9212. }
  9213. protected function setPushUrl($path, $url)
  9214. {
  9215. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  9216. $protocols = $this->config->get('github-protocols');
  9217. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  9218. if ($protocols[0] !== 'git') {
  9219. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  9220. }
  9221. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  9222. $this->process->execute($cmd, $ignoredOutput, $path);
  9223. }
  9224. }
  9225. protected function getCommitLogs($fromReference, $toReference, $path)
  9226. {
  9227. $path = $this->normalizePath($path);
  9228. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', $fromReference, $toReference);
  9229. if (0 !== $this->process->execute($command, $output, $path)) {
  9230. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9231. }
  9232. return $output;
  9233. }
  9234. protected function discardChanges($path)
  9235. {
  9236. $path = $this->normalizePath($path);
  9237. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  9238. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  9239. }
  9240. $this->hasDiscardedChanges = true;
  9241. }
  9242. protected function stashChanges($path)
  9243. {
  9244. $path = $this->normalizePath($path);
  9245. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  9246. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  9247. }
  9248. $this->hasStashedChanges = true;
  9249. }
  9250. protected function viewDiff($path)
  9251. {
  9252. $path = $this->normalizePath($path);
  9253. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  9254. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  9255. }
  9256. $this->io->writeError($output);
  9257. }
  9258. protected function normalizePath($path)
  9259. {
  9260. if (Platform::isWindows() && strlen($path) > 0) {
  9261. $basePath = $path;
  9262. $removed = array();
  9263. while (!is_dir($basePath) && $basePath !== '\\') {
  9264. array_unshift($removed, basename($basePath));
  9265. $basePath = dirname($basePath);
  9266. }
  9267. if ($basePath === '\\') {
  9268. return $path;
  9269. }
  9270. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  9271. }
  9272. return $path;
  9273. }
  9274. protected function hasMetadataRepository($path)
  9275. {
  9276. $path = $this->normalizePath($path);
  9277. return is_dir($path.'/.git');
  9278. }
  9279. }
  9280. <?php
  9281. namespace Composer\Downloader;
  9282. use Composer\Config;
  9283. use Composer\Cache;
  9284. use Composer\EventDispatcher\EventDispatcher;
  9285. use Composer\Package\PackageInterface;
  9286. use Composer\Util\Platform;
  9287. use Composer\Util\ProcessExecutor;
  9288. use Composer\Util\RemoteFilesystem;
  9289. use Composer\IO\IOInterface;
  9290. class GzipDownloader extends ArchiveDownloader
  9291. {
  9292. protected $process;
  9293. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  9294. {
  9295. $this->process = $process ?: new ProcessExecutor($io);
  9296. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  9297. }
  9298. protected function extract($file, $path)
  9299. {
  9300. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  9301. if (!Platform::isWindows()) {
  9302. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  9303. if (0 === $this->process->execute($command, $ignoredOutput)) {
  9304. return;
  9305. }
  9306. if (extension_loaded('zlib')) {
  9307. $this->extractUsingExt($file, $targetFilepath);
  9308. return;
  9309. }
  9310. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  9311. throw new \RuntimeException($processError);
  9312. }
  9313. $this->extractUsingExt($file, $targetFilepath);
  9314. }
  9315. protected function getFileName(PackageInterface $package, $path)
  9316. {
  9317. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  9318. }
  9319. private function extractUsingExt($file, $targetFilepath)
  9320. {
  9321. $archiveFile = gzopen($file, 'rb');
  9322. $targetFile = fopen($targetFilepath, 'wb');
  9323. while ($string = gzread($archiveFile, 4096)) {
  9324. fwrite($targetFile, $string, strlen($string));
  9325. }
  9326. gzclose($archiveFile);
  9327. fclose($targetFile);
  9328. }
  9329. }
  9330. <?php
  9331. namespace Composer\Downloader;
  9332. use Composer\Package\PackageInterface;
  9333. use Composer\Util\ProcessExecutor;
  9334. class HgDownloader extends VcsDownloader
  9335. {
  9336. public function doDownload(PackageInterface $package, $path, $url)
  9337. {
  9338. $url = ProcessExecutor::escape($url);
  9339. $ref = ProcessExecutor::escape($package->getSourceReference());
  9340. $this->io->writeError(" Cloning ".$package->getSourceReference());
  9341. $command = sprintf('hg clone %s %s', $url, ProcessExecutor::escape($path));
  9342. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  9343. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9344. }
  9345. $command = sprintf('hg up %s', $ref);
  9346. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9347. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9348. }
  9349. }
  9350. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9351. {
  9352. $url = ProcessExecutor::escape($url);
  9353. $ref = ProcessExecutor::escape($target->getSourceReference());
  9354. $this->io->writeError(" Updating to ".$target->getSourceReference());
  9355. if (!$this->hasMetadataRepository($path)) {
  9356. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  9357. }
  9358. $command = sprintf('hg pull %s && hg up %s', $url, $ref);
  9359. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9360. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9361. }
  9362. }
  9363. public function getLocalChanges(PackageInterface $package, $path)
  9364. {
  9365. if (!is_dir($path.'/.hg')) {
  9366. return;
  9367. }
  9368. $this->process->execute('hg st', $output, realpath($path));
  9369. return trim($output) ?: null;
  9370. }
  9371. protected function getCommitLogs($fromReference, $toReference, $path)
  9372. {
  9373. $command = sprintf('hg log -r %s:%s --style compact', $fromReference, $toReference);
  9374. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  9375. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9376. }
  9377. return $output;
  9378. }
  9379. protected function hasMetadataRepository($path)
  9380. {
  9381. return is_dir($path . '/.hg');
  9382. }
  9383. }
  9384. <?php
  9385. namespace Composer\Downloader;
  9386. use Composer\Package\PackageInterface;
  9387. use Composer\Util\Platform;
  9388. use Symfony\Component\Filesystem\Exception\IOException;
  9389. use Symfony\Component\Filesystem\Filesystem;
  9390. class PathDownloader extends FileDownloader
  9391. {
  9392. public function download(PackageInterface $package, $path)
  9393. {
  9394. $url = $package->getDistUrl();
  9395. $realUrl = realpath($url);
  9396. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  9397. throw new \RuntimeException(sprintf(
  9398. 'Source path "%s" is not found for package %s', $url, $package->getName()
  9399. ));
  9400. }
  9401. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  9402. throw new \RuntimeException(sprintf(
  9403. 'Package %s cannot install to "%s" inside its source at "%s"',
  9404. $package->getName(), realpath($path), $realUrl
  9405. ));
  9406. }
  9407. $fileSystem = new Filesystem();
  9408. $this->filesystem->removeDirectory($path);
  9409. $this->io->writeError(sprintf(
  9410. ' - Installing <info>%s</info> (<comment>%s</comment>)',
  9411. $package->getName(),
  9412. $package->getFullPrettyVersion()
  9413. ));
  9414. try {
  9415. if (Platform::isWindows()) {
  9416. $this->filesystem->junction($realUrl, $path);
  9417. $this->io->writeError(sprintf(' Junctioned from %s', $url));
  9418. } else {
  9419. $shortestPath = $this->filesystem->findShortestPath($path, $realUrl);
  9420. $fileSystem->symlink($shortestPath, $path);
  9421. $this->io->writeError(sprintf(' Symlinked from %s', $url));
  9422. }
  9423. } catch (IOException $e) {
  9424. $fileSystem->mirror($realUrl, $path);
  9425. $this->io->writeError(sprintf(' Mirrored from %s', $url));
  9426. }
  9427. $this->io->writeError('');
  9428. }
  9429. }
  9430. <?php
  9431. namespace Composer\Downloader;
  9432. use Composer\Util\Filesystem;
  9433. class PearPackageExtractor
  9434. {
  9435. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  9436. private $filesystem;
  9437. private $file;
  9438. public function __construct($file)
  9439. {
  9440. if (!is_file($file)) {
  9441. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  9442. }
  9443. $this->filesystem = new Filesystem();
  9444. $this->file = $file;
  9445. }
  9446. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  9447. {
  9448. $extractionPath = $target.'/tarball';
  9449. try {
  9450. $archive = new \PharData($this->file);
  9451. $archive->extractTo($extractionPath, null, true);
  9452. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  9453. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  9454. }
  9455. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  9456. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  9457. $this->filesystem->removeDirectory($extractionPath);
  9458. } catch (\Exception $exception) {
  9459. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  9460. }
  9461. }
  9462. private function copyFiles($files, $source, $target, $roles, $vars)
  9463. {
  9464. foreach ($files as $file) {
  9465. $from = $this->combine($source, $file['from']);
  9466. $to = $this->combine($target, $roles[$file['role']]);
  9467. $to = $this->combine($to, $file['to']);
  9468. $tasks = $file['tasks'];
  9469. $this->copyFile($from, $to, $tasks, $vars);
  9470. }
  9471. }
  9472. private function copyFile($from, $to, $tasks, $vars)
  9473. {
  9474. if (!is_file($from)) {
  9475. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  9476. }
  9477. $this->filesystem->ensureDirectoryExists(dirname($to));
  9478. if (0 == count($tasks)) {
  9479. $copied = copy($from, $to);
  9480. } else {
  9481. $content = file_get_contents($from);
  9482. $replacements = array();
  9483. foreach ($tasks as $task) {
  9484. $pattern = $task['from'];
  9485. $varName = $task['to'];
  9486. if (isset($vars[$varName])) {
  9487. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  9488. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  9489. } else {
  9490. $replacements[$pattern] = $vars[$varName];
  9491. }
  9492. }
  9493. }
  9494. $content = strtr($content, $replacements);
  9495. $copied = file_put_contents($to, $content);
  9496. }
  9497. if (false === $copied) {
  9498. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  9499. }
  9500. }
  9501. private function buildCopyActions($source, array $roles, $vars)
  9502. {
  9503. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  9504. if (false === $package) {
  9505. throw new \RuntimeException('Package definition file is not valid.');
  9506. }
  9507. $packageSchemaVersion = $package['version'];
  9508. if ('1.0' == $packageSchemaVersion) {
  9509. $children = $package->release->filelist->children();
  9510. $packageName = (string) $package->name;
  9511. $packageVersion = (string) $package->release->version;
  9512. $sourceDir = $packageName . '-' . $packageVersion;
  9513. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  9514. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  9515. $children = $package->contents->children();
  9516. $packageName = (string) $package->name;
  9517. $packageVersion = (string) $package->version->release;
  9518. $sourceDir = $packageName . '-' . $packageVersion;
  9519. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  9520. $namespaces = $package->getNamespaces();
  9521. $package->registerXPathNamespace('ns', $namespaces['']);
  9522. $releaseNodes = $package->xpath('ns:phprelease');
  9523. $this->applyRelease($result, $releaseNodes, $vars);
  9524. } else {
  9525. throw new \RuntimeException('Unsupported schema version of package definition file.');
  9526. }
  9527. return $result;
  9528. }
  9529. private function applyRelease(&$actions, $releaseNodes, $vars)
  9530. {
  9531. foreach ($releaseNodes as $releaseNode) {
  9532. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  9533. if ($requiredOs && $vars['os'] != $requiredOs) {
  9534. continue;
  9535. }
  9536. if ($releaseNode->filelist) {
  9537. foreach ($releaseNode->filelist->children() as $action) {
  9538. if ('install' == $action->getName()) {
  9539. $name = (string) $action['name'];
  9540. $as = (string) $action['as'];
  9541. if (isset($actions[$name])) {
  9542. $actions[$name]['to'] = $as;
  9543. }
  9544. } elseif ('ignore' == $action->getName()) {
  9545. $name = (string) $action['name'];
  9546. unset($actions[$name]);
  9547. } else {
  9548. }
  9549. }
  9550. }
  9551. break;
  9552. }
  9553. }
  9554. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  9555. {
  9556. $result = array();
  9557. foreach ($children as $child) {
  9558. if ($child->getName() == 'dir') {
  9559. $dirSource = $this->combine($source, (string) $child['name']);
  9560. $dirTarget = $child['baseinstalldir'] ?: $target;
  9561. $dirRole = $child['role'] ?: $role;
  9562. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  9563. $result = array_merge($result, $dirFiles);
  9564. } elseif ($child->getName() == 'file') {
  9565. $fileRole = (string) $child['role'] ?: $role;
  9566. if (isset($targetRoles[$fileRole])) {
  9567. $fileName = (string) ($child['name'] ?: $child[0]);
  9568. $fileSource = $this->combine($source, $fileName);
  9569. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  9570. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  9571. $fileTarget = $packageName . '/' . $fileTarget;
  9572. }
  9573. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  9574. }
  9575. }
  9576. }
  9577. return $result;
  9578. }
  9579. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  9580. {
  9581. $result = array();
  9582. foreach ($children as $child) {
  9583. if ('dir' == $child->getName()) {
  9584. $dirSource = $this->combine($source, $child['name']);
  9585. $dirTarget = $child['baseinstalldir'] ?: $target;
  9586. $dirRole = $child['role'] ?: $role;
  9587. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  9588. $result = array_merge($result, $dirFiles);
  9589. } elseif ('file' == $child->getName()) {
  9590. $fileRole = (string) $child['role'] ?: $role;
  9591. if (isset($targetRoles[$fileRole])) {
  9592. $fileSource = $this->combine($source, (string) $child['name']);
  9593. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  9594. $fileTasks = array();
  9595. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  9596. if ('replace' == $taskNode->getName()) {
  9597. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  9598. }
  9599. }
  9600. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  9601. $fileTarget = $packageName . '/' . $fileTarget;
  9602. }
  9603. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  9604. }
  9605. }
  9606. }
  9607. return $result;
  9608. }
  9609. private function combine($left, $right)
  9610. {
  9611. return rtrim($left, '/') . '/' . ltrim($right, '/');
  9612. }
  9613. }
  9614. <?php
  9615. namespace Composer\Downloader;
  9616. use Composer\Package\PackageInterface;
  9617. use Composer\Repository\VcsRepository;
  9618. use Composer\Util\Perforce;
  9619. class PerforceDownloader extends VcsDownloader
  9620. {
  9621. protected $perforce;
  9622. public function doDownload(PackageInterface $package, $path, $url)
  9623. {
  9624. $ref = $package->getSourceReference();
  9625. $label = $this->getLabelFromSourceReference($ref);
  9626. $this->io->writeError(' Cloning ' . $ref);
  9627. $this->initPerforce($package, $path, $url);
  9628. $this->perforce->setStream($ref);
  9629. $this->perforce->p4Login($this->io);
  9630. $this->perforce->writeP4ClientSpec();
  9631. $this->perforce->connectClient();
  9632. $this->perforce->syncCodeBase($label);
  9633. $this->perforce->cleanupClientSpec();
  9634. }
  9635. private function getLabelFromSourceReference($ref)
  9636. {
  9637. $pos = strpos($ref, '@');
  9638. if (false !== $pos) {
  9639. return substr($ref, $pos + 1);
  9640. }
  9641. return null;
  9642. }
  9643. public function initPerforce($package, $path, $url)
  9644. {
  9645. if (!empty($this->perforce)) {
  9646. $this->perforce->initializePath($path);
  9647. return;
  9648. }
  9649. $repository = $package->getRepository();
  9650. $repoConfig = null;
  9651. if ($repository instanceof VcsRepository) {
  9652. $repoConfig = $this->getRepoConfig($repository);
  9653. }
  9654. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  9655. }
  9656. private function getRepoConfig(VcsRepository $repository)
  9657. {
  9658. return $repository->getRepoConfig();
  9659. }
  9660. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9661. {
  9662. $this->doDownload($target, $path, $url);
  9663. }
  9664. public function getLocalChanges(PackageInterface $package, $path)
  9665. {
  9666. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  9667. return;
  9668. }
  9669. protected function getCommitLogs($fromReference, $toReference, $path)
  9670. {
  9671. $commitLogs = $this->perforce->getCommitLogs($fromReference, $toReference);
  9672. return $commitLogs;
  9673. }
  9674. public function setPerforce($perforce)
  9675. {
  9676. $this->perforce = $perforce;
  9677. }
  9678. protected function hasMetadataRepository($path)
  9679. {
  9680. return true;
  9681. }
  9682. }
  9683. <?php
  9684. namespace Composer\Downloader;
  9685. class PharDownloader extends ArchiveDownloader
  9686. {
  9687. protected function extract($file, $path)
  9688. {
  9689. $archive = new \Phar($file);
  9690. $archive->extractTo($path, null, true);
  9691. }
  9692. }
  9693. <?php
  9694. namespace Composer\Downloader;
  9695. use Composer\Config;
  9696. use Composer\Cache;
  9697. use Composer\EventDispatcher\EventDispatcher;
  9698. use Composer\Util\Platform;
  9699. use Composer\Util\ProcessExecutor;
  9700. use Composer\Util\RemoteFilesystem;
  9701. use Composer\IO\IOInterface;
  9702. use RarArchive;
  9703. class RarDownloader extends ArchiveDownloader
  9704. {
  9705. protected $process;
  9706. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  9707. {
  9708. $this->process = $process ?: new ProcessExecutor($io);
  9709. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  9710. }
  9711. protected function extract($file, $path)
  9712. {
  9713. $processError = null;
  9714. if (!Platform::isWindows()) {
  9715. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' && chmod -R u+w ' . ProcessExecutor::escape($path);
  9716. if (0 === $this->process->execute($command, $ignoredOutput)) {
  9717. return;
  9718. }
  9719. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  9720. }
  9721. if (!class_exists('RarArchive')) {
  9722. $iniPath = php_ini_loaded_file();
  9723. if ($iniPath) {
  9724. $iniMessage = 'The php.ini used by your command-line PHP is: ' . $iniPath;
  9725. } else {
  9726. $iniMessage = 'A php.ini file does not exist. You will have to create one.';
  9727. }
  9728. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  9729. . $iniMessage . "\n" . $processError;
  9730. if (!Platform::isWindows()) {
  9731. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  9732. }
  9733. throw new \RuntimeException($error);
  9734. }
  9735. $rarArchive = RarArchive::open($file);
  9736. if (false === $rarArchive) {
  9737. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  9738. }
  9739. $entries = $rarArchive->getEntries();
  9740. if (false === $entries) {
  9741. throw new \RuntimeException('Could not retrieve RAR archive entries');
  9742. }
  9743. foreach ($entries as $entry) {
  9744. if (false === $entry->extract($path)) {
  9745. throw new \RuntimeException('Could not extract entry');
  9746. }
  9747. }
  9748. $rarArchive->close();
  9749. }
  9750. }
  9751. <?php
  9752. namespace Composer\Downloader;
  9753. use Composer\Package\PackageInterface;
  9754. use Composer\Util\Svn as SvnUtil;
  9755. use Composer\Repository\VcsRepository;
  9756. class SvnDownloader extends VcsDownloader
  9757. {
  9758. protected $cacheCredentials = true;
  9759. public function doDownload(PackageInterface $package, $path, $url)
  9760. {
  9761. SvnUtil::cleanEnv();
  9762. $ref = $package->getSourceReference();
  9763. $repo = $package->getRepository();
  9764. if ($repo instanceof VcsRepository) {
  9765. $repoConfig = $repo->getRepoConfig();
  9766. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  9767. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  9768. }
  9769. }
  9770. $this->io->writeError(" Checking out ".$package->getSourceReference());
  9771. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  9772. }
  9773. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9774. {
  9775. SvnUtil::cleanEnv();
  9776. $ref = $target->getSourceReference();
  9777. if (!$this->hasMetadataRepository($path)) {
  9778. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  9779. }
  9780. $flags = "";
  9781. if (0 === $this->process->execute('svn --version', $output)) {
  9782. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match) && version_compare($match[1], '1.7.0', '>=')) {
  9783. $flags .= ' --ignore-ancestry';
  9784. }
  9785. }
  9786. $this->io->writeError(" Checking out " . $ref);
  9787. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  9788. }
  9789. public function getLocalChanges(PackageInterface $package, $path)
  9790. {
  9791. if (!$this->hasMetadataRepository($path)) {
  9792. return;
  9793. }
  9794. $this->process->execute('svn status --ignore-externals', $output, $path);
  9795. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  9796. }
  9797. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  9798. {
  9799. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  9800. $util->setCacheCredentials($this->cacheCredentials);
  9801. try {
  9802. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  9803. } catch (\RuntimeException $e) {
  9804. throw new \RuntimeException(
  9805. 'Package could not be downloaded, '.$e->getMessage()
  9806. );
  9807. }
  9808. }
  9809. protected function cleanChanges(PackageInterface $package, $path, $update)
  9810. {
  9811. if (!$changes = $this->getLocalChanges($package, $path)) {
  9812. return;
  9813. }
  9814. if (!$this->io->isInteractive()) {
  9815. if (true === $this->config->get('discard-changes')) {
  9816. return $this->discardChanges($path);
  9817. }
  9818. return parent::cleanChanges($package, $path, $update);
  9819. }
  9820. $changes = array_map(function ($elem) {
  9821. return ' '.$elem;
  9822. }, preg_split('{\s*\r?\n\s*}', $changes));
  9823. $this->io->writeError(' <error>The package has modified files:</error>');
  9824. $this->io->writeError(array_slice($changes, 0, 10));
  9825. if (count($changes) > 10) {
  9826. $this->io->writeError(' <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
  9827. }
  9828. while (true) {
  9829. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  9830. case 'y':
  9831. $this->discardChanges($path);
  9832. break 2;
  9833. case 'n':
  9834. throw new \RuntimeException('Update aborted');
  9835. case 'v':
  9836. $this->io->writeError($changes);
  9837. break;
  9838. case '?':
  9839. default:
  9840. $this->io->writeError(array(
  9841. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  9842. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  9843. ' v - view modified files',
  9844. ' ? - print help',
  9845. ));
  9846. break;
  9847. }
  9848. }
  9849. }
  9850. protected function getCommitLogs($fromReference, $toReference, $path)
  9851. {
  9852. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  9853. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  9854. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  9855. $command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
  9856. if (0 !== $this->process->execute($command, $output, $path)) {
  9857. throw new \RuntimeException(
  9858. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  9859. );
  9860. }
  9861. } else {
  9862. $output = "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  9863. }
  9864. return $output;
  9865. }
  9866. protected function discardChanges($path)
  9867. {
  9868. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  9869. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  9870. }
  9871. }
  9872. protected function hasMetadataRepository($path)
  9873. {
  9874. return is_dir($path.'/.svn');
  9875. }
  9876. }
  9877. <?php
  9878. namespace Composer\Downloader;
  9879. class TarDownloader extends ArchiveDownloader
  9880. {
  9881. protected function extract($file, $path)
  9882. {
  9883. $archive = new \PharData($file);
  9884. $archive->extractTo($path, null, true);
  9885. }
  9886. }
  9887. <?php
  9888. namespace Composer\Downloader;
  9889. class TransportException extends \RuntimeException
  9890. {
  9891. protected $headers;
  9892. protected $response;
  9893. protected $statusCode;
  9894. public function setHeaders($headers)
  9895. {
  9896. $this->headers = $headers;
  9897. }
  9898. public function getHeaders()
  9899. {
  9900. return $this->headers;
  9901. }
  9902. public function setResponse($response)
  9903. {
  9904. $this->response = $response;
  9905. }
  9906. public function getResponse()
  9907. {
  9908. return $this->response;
  9909. }
  9910. public function setStatusCode($statusCode)
  9911. {
  9912. $this->statusCode = $statusCode;
  9913. }
  9914. public function getStatusCode()
  9915. {
  9916. return $this->statusCode;
  9917. }
  9918. }
  9919. <?php
  9920. namespace Composer\Downloader;
  9921. use Composer\Config;
  9922. use Composer\Package\PackageInterface;
  9923. use Composer\Util\ProcessExecutor;
  9924. use Composer\IO\IOInterface;
  9925. use Composer\Util\Filesystem;
  9926. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface
  9927. {
  9928. protected $io;
  9929. protected $config;
  9930. protected $process;
  9931. protected $filesystem;
  9932. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  9933. {
  9934. $this->io = $io;
  9935. $this->config = $config;
  9936. $this->process = $process ?: new ProcessExecutor($io);
  9937. $this->filesystem = $fs ?: new Filesystem($this->process);
  9938. }
  9939. public function getInstallationSource()
  9940. {
  9941. return 'source';
  9942. }
  9943. public function download(PackageInterface $package, $path)
  9944. {
  9945. if (!$package->getSourceReference()) {
  9946. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  9947. }
  9948. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  9949. $this->filesystem->emptyDirectory($path);
  9950. $urls = $package->getSourceUrls();
  9951. while ($url = array_shift($urls)) {
  9952. try {
  9953. if (Filesystem::isLocalPath($url)) {
  9954. $url = realpath($url);
  9955. }
  9956. $this->doDownload($package, $path, $url);
  9957. break;
  9958. } catch (\Exception $e) {
  9959. if ($this->io->isDebug()) {
  9960. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  9961. } elseif (count($urls)) {
  9962. $this->io->writeError(' Failed, trying the next URL');
  9963. }
  9964. if (!count($urls)) {
  9965. throw $e;
  9966. }
  9967. }
  9968. }
  9969. $this->io->writeError('');
  9970. }
  9971. public function update(PackageInterface $initial, PackageInterface $target, $path)
  9972. {
  9973. if (!$target->getSourceReference()) {
  9974. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  9975. }
  9976. $name = $target->getName();
  9977. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  9978. if ($target->getSourceType() === 'svn') {
  9979. $from = $initial->getSourceReference();
  9980. $to = $target->getSourceReference();
  9981. } else {
  9982. $from = substr($initial->getSourceReference(), 0, 7);
  9983. $to = substr($target->getSourceReference(), 0, 7);
  9984. }
  9985. $name .= ' '.$initial->getPrettyVersion();
  9986. } else {
  9987. $from = $initial->getFullPrettyVersion();
  9988. $to = $target->getFullPrettyVersion();
  9989. }
  9990. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  9991. $this->cleanChanges($initial, $path, true);
  9992. $urls = $target->getSourceUrls();
  9993. $exception = null;
  9994. while ($url = array_shift($urls)) {
  9995. try {
  9996. if (Filesystem::isLocalPath($url)) {
  9997. $url = realpath($url);
  9998. }
  9999. $this->doUpdate($initial, $target, $path, $url);
  10000. $exception = null;
  10001. break;
  10002. } catch (\Exception $exception) {
  10003. if ($this->io->isDebug()) {
  10004. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  10005. } elseif (count($urls)) {
  10006. $this->io->writeError(' Failed, trying the next URL');
  10007. }
  10008. }
  10009. }
  10010. $this->reapplyChanges($path);
  10011. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  10012. $message = 'Pulling in changes:';
  10013. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  10014. if (!trim($logs)) {
  10015. $message = 'Rolling back changes:';
  10016. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  10017. }
  10018. if (trim($logs)) {
  10019. $logs = implode("\n", array_map(function ($line) {
  10020. return ' ' . $line;
  10021. }, explode("\n", $logs)));
  10022. $logs = str_replace('<', '\<', $logs);
  10023. $this->io->writeError(' '.$message);
  10024. $this->io->writeError($logs);
  10025. }
  10026. }
  10027. if (!$urls && $exception) {
  10028. throw $exception;
  10029. }
  10030. $this->io->writeError('');
  10031. }
  10032. public function remove(PackageInterface $package, $path)
  10033. {
  10034. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  10035. $this->cleanChanges($package, $path, false);
  10036. if (!$this->filesystem->removeDirectory($path)) {
  10037. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10038. }
  10039. }
  10040. public function setOutputProgress($outputProgress)
  10041. {
  10042. return $this;
  10043. }
  10044. protected function cleanChanges(PackageInterface $package, $path, $update)
  10045. {
  10046. if (null !== $this->getLocalChanges($package, $path)) {
  10047. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  10048. }
  10049. }
  10050. protected function reapplyChanges($path)
  10051. {
  10052. }
  10053. abstract protected function doDownload(PackageInterface $package, $path, $url);
  10054. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  10055. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  10056. abstract protected function hasMetadataRepository($path);
  10057. }
  10058. <?php
  10059. namespace Composer\Downloader;
  10060. use Composer\Config;
  10061. use Composer\Cache;
  10062. use Composer\EventDispatcher\EventDispatcher;
  10063. use Composer\Package\PackageInterface;
  10064. use Composer\Util\ProcessExecutor;
  10065. use Composer\Util\RemoteFilesystem;
  10066. use Composer\IO\IOInterface;
  10067. class XzDownloader extends ArchiveDownloader
  10068. {
  10069. protected $process;
  10070. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10071. {
  10072. $this->process = $process ?: new ProcessExecutor($io);
  10073. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10074. }
  10075. protected function extract($file, $path)
  10076. {
  10077. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  10078. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10079. return;
  10080. }
  10081. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10082. throw new \RuntimeException($processError);
  10083. }
  10084. protected function getFileName(PackageInterface $package, $path)
  10085. {
  10086. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10087. }
  10088. }
  10089. <?php
  10090. namespace Composer\Downloader;
  10091. use Composer\Config;
  10092. use Composer\Cache;
  10093. use Composer\EventDispatcher\EventDispatcher;
  10094. use Composer\Util\Platform;
  10095. use Composer\Util\ProcessExecutor;
  10096. use Composer\Util\RemoteFilesystem;
  10097. use Composer\IO\IOInterface;
  10098. use ZipArchive;
  10099. class ZipDownloader extends ArchiveDownloader
  10100. {
  10101. protected $process;
  10102. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10103. {
  10104. $this->process = $process ?: new ProcessExecutor($io);
  10105. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10106. }
  10107. protected function extract($file, $path)
  10108. {
  10109. $processError = null;
  10110. if (!Platform::isWindows()) {
  10111. $command = 'unzip '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path) . ' && chmod -R u+w ' . ProcessExecutor::escape($path);
  10112. try {
  10113. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10114. return;
  10115. }
  10116. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10117. } catch (\Exception $e) {
  10118. $processError = 'Failed to execute ' . $command . "\n\n" . $e->getMessage();
  10119. }
  10120. }
  10121. if (!class_exists('ZipArchive')) {
  10122. $iniPath = php_ini_loaded_file();
  10123. if ($iniPath) {
  10124. $iniMessage = 'The php.ini used by your command-line PHP is: ' . $iniPath;
  10125. } else {
  10126. $iniMessage = 'A php.ini file does not exist. You will have to create one.';
  10127. }
  10128. $error = "Could not decompress the archive, enable the PHP zip extension or install unzip.\n"
  10129. . $iniMessage . "\n" . $processError;
  10130. if (!Platform::isWindows()) {
  10131. $error = "Could not decompress the archive, enable the PHP zip extension.\n" . $iniMessage;
  10132. }
  10133. throw new \RuntimeException($error);
  10134. }
  10135. $zipArchive = new ZipArchive();
  10136. if (true !== ($retval = $zipArchive->open($file))) {
  10137. throw new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n".$processError), $retval);
  10138. }
  10139. if (true !== $zipArchive->extractTo($path)) {
  10140. throw new \RuntimeException("There was an error extracting the ZIP file. Corrupt file?");
  10141. }
  10142. $zipArchive->close();
  10143. }
  10144. protected function getErrorMessage($retval, $file)
  10145. {
  10146. switch ($retval) {
  10147. case ZipArchive::ER_EXISTS:
  10148. return sprintf("File '%s' already exists.", $file);
  10149. case ZipArchive::ER_INCONS:
  10150. return sprintf("Zip archive '%s' is inconsistent.", $file);
  10151. case ZipArchive::ER_INVAL:
  10152. return sprintf("Invalid argument (%s)", $file);
  10153. case ZipArchive::ER_MEMORY:
  10154. return sprintf("Malloc failure (%s)", $file);
  10155. case ZipArchive::ER_NOENT:
  10156. return sprintf("No such zip file: '%s'", $file);
  10157. case ZipArchive::ER_NOZIP:
  10158. return sprintf("'%s' is not a zip archive.", $file);
  10159. case ZipArchive::ER_OPEN:
  10160. return sprintf("Can't open zip file: %s", $file);
  10161. case ZipArchive::ER_READ:
  10162. return sprintf("Zip read error (%s)", $file);
  10163. case ZipArchive::ER_SEEK:
  10164. return sprintf("Zip seek error (%s)", $file);
  10165. default:
  10166. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  10167. }
  10168. }
  10169. }
  10170. <?php
  10171. namespace Composer\EventDispatcher;
  10172. class Event
  10173. {
  10174. protected $name;
  10175. protected $args;
  10176. protected $flags;
  10177. private $propagationStopped = false;
  10178. public function __construct($name, array $args = array(), array $flags = array())
  10179. {
  10180. $this->name = $name;
  10181. $this->args = $args;
  10182. $this->flags = $flags;
  10183. }
  10184. public function getName()
  10185. {
  10186. return $this->name;
  10187. }
  10188. public function getArguments()
  10189. {
  10190. return $this->args;
  10191. }
  10192. public function getFlags()
  10193. {
  10194. return $this->flags;
  10195. }
  10196. public function isPropagationStopped()
  10197. {
  10198. return $this->propagationStopped;
  10199. }
  10200. public function stopPropagation()
  10201. {
  10202. $this->propagationStopped = true;
  10203. }
  10204. }
  10205. <?php
  10206. namespace Composer\EventDispatcher;
  10207. use Composer\DependencyResolver\PolicyInterface;
  10208. use Composer\DependencyResolver\Pool;
  10209. use Composer\DependencyResolver\Request;
  10210. use Composer\Installer\InstallerEvent;
  10211. use Composer\IO\IOInterface;
  10212. use Composer\Composer;
  10213. use Composer\DependencyResolver\Operation\OperationInterface;
  10214. use Composer\Repository\CompositeRepository;
  10215. use Composer\Script;
  10216. use Composer\Script\CommandEvent;
  10217. use Composer\Script\PackageEvent;
  10218. use Composer\Util\ProcessExecutor;
  10219. class EventDispatcher
  10220. {
  10221. protected $composer;
  10222. protected $io;
  10223. protected $loader;
  10224. protected $process;
  10225. protected $listeners;
  10226. private $eventStack;
  10227. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  10228. {
  10229. $this->composer = $composer;
  10230. $this->io = $io;
  10231. $this->process = $process ?: new ProcessExecutor($io);
  10232. $this->eventStack = array();
  10233. }
  10234. public function dispatch($eventName, Event $event = null)
  10235. {
  10236. if (null == $event) {
  10237. $event = new Event($eventName);
  10238. }
  10239. return $this->doDispatch($event);
  10240. }
  10241. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  10242. {
  10243. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  10244. }
  10245. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  10246. {
  10247. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  10248. }
  10249. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  10250. {
  10251. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  10252. }
  10253. protected function doDispatch(Event $event)
  10254. {
  10255. $binDir = $this->composer->getConfig()->get('bin-dir');
  10256. if (is_dir($binDir)) {
  10257. $binDir = realpath($binDir);
  10258. if (isset($_SERVER['PATH']) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER['PATH'])) {
  10259. $_SERVER['PATH'] = $binDir.PATH_SEPARATOR.getenv('PATH');
  10260. putenv('PATH='.$_SERVER['PATH']);
  10261. }
  10262. }
  10263. $listeners = $this->getListeners($event);
  10264. $this->pushEvent($event);
  10265. $return = 0;
  10266. foreach ($listeners as $callable) {
  10267. if (!is_string($callable) && is_callable($callable)) {
  10268. $event = $this->checkListenerExpectedEvent($callable, $event);
  10269. $return = false === call_user_func($callable, $event) ? 1 : 0;
  10270. } elseif ($this->isComposerScript($callable)) {
  10271. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  10272. $scriptName = substr($callable, 1);
  10273. $args = $event->getArguments();
  10274. $flags = $event->getFlags();
  10275. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  10276. } elseif ($this->isPhpScript($callable)) {
  10277. $className = substr($callable, 0, strpos($callable, '::'));
  10278. $methodName = substr($callable, strpos($callable, '::') + 2);
  10279. if (!class_exists($className)) {
  10280. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>');
  10281. continue;
  10282. }
  10283. if (!is_callable($callable)) {
  10284. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>');
  10285. continue;
  10286. }
  10287. try {
  10288. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  10289. } catch (\Exception $e) {
  10290. $message = "Script %s handling the %s event terminated with an exception";
  10291. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>');
  10292. throw $e;
  10293. }
  10294. } else {
  10295. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  10296. $exec = $callable . ($args === '' ? '' : ' '.$args);
  10297. if ($this->io->isVerbose()) {
  10298. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  10299. } else {
  10300. $this->io->writeError(sprintf('> %s', $exec));
  10301. }
  10302. if (0 !== ($exitCode = $this->process->execute($exec))) {
  10303. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with an error</error>', $callable, $event->getName()));
  10304. throw new \RuntimeException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  10305. }
  10306. }
  10307. if ($event->isPropagationStopped()) {
  10308. break;
  10309. }
  10310. }
  10311. $this->popEvent();
  10312. return $return;
  10313. }
  10314. protected function executeEventPhpScript($className, $methodName, Event $event)
  10315. {
  10316. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  10317. if ($this->io->isVerbose()) {
  10318. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  10319. } else {
  10320. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  10321. }
  10322. return $className::$methodName($event);
  10323. }
  10324. protected function checkListenerExpectedEvent($target, Event $event)
  10325. {
  10326. try {
  10327. $reflected = new \ReflectionParameter($target, 0);
  10328. } catch (\Exception $e) {
  10329. return $event;
  10330. }
  10331. $typehint = $reflected->getClass();
  10332. if (!$typehint instanceof \ReflectionClass) {
  10333. return $event;
  10334. }
  10335. $expected = $typehint->getName();
  10336. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  10337. $event = new \Composer\Script\CommandEvent(
  10338. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getArguments()
  10339. );
  10340. }
  10341. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  10342. $event = new \Composer\Script\PackageEvent(
  10343. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  10344. $event->getPolicy(), $event->getPool(), $event->getInstalledRepo(), $event->getRequest(),
  10345. $event->getOperations(), $event->getOperation()
  10346. );
  10347. }
  10348. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  10349. $event = new \Composer\Script\Event(
  10350. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  10351. $event->getArguments(), $event->getFlags()
  10352. );
  10353. }
  10354. return $event;
  10355. }
  10356. protected function addListener($eventName, $listener, $priority = 0)
  10357. {
  10358. $this->listeners[$eventName][$priority][] = $listener;
  10359. }
  10360. public function addSubscriber(EventSubscriberInterface $subscriber)
  10361. {
  10362. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  10363. if (is_string($params)) {
  10364. $this->addListener($eventName, array($subscriber, $params));
  10365. } elseif (is_string($params[0])) {
  10366. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  10367. } else {
  10368. foreach ($params as $listener) {
  10369. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  10370. }
  10371. }
  10372. }
  10373. }
  10374. protected function getListeners(Event $event)
  10375. {
  10376. $scriptListeners = $this->getScriptListeners($event);
  10377. if (!isset($this->listeners[$event->getName()][0])) {
  10378. $this->listeners[$event->getName()][0] = array();
  10379. }
  10380. krsort($this->listeners[$event->getName()]);
  10381. $listeners = $this->listeners;
  10382. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  10383. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  10384. }
  10385. public function hasEventListeners(Event $event)
  10386. {
  10387. $listeners = $this->getListeners($event);
  10388. return count($listeners) > 0;
  10389. }
  10390. protected function getScriptListeners(Event $event)
  10391. {
  10392. $package = $this->composer->getPackage();
  10393. $scripts = $package->getScripts();
  10394. if (empty($scripts[$event->getName()])) {
  10395. return array();
  10396. }
  10397. if ($this->loader) {
  10398. $this->loader->unregister();
  10399. }
  10400. $generator = $this->composer->getAutoloadGenerator();
  10401. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  10402. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  10403. $map = $generator->parseAutoloads($packageMap, $package);
  10404. $this->loader = $generator->createLoader($map);
  10405. $this->loader->register();
  10406. return $scripts[$event->getName()];
  10407. }
  10408. protected function isPhpScript($callable)
  10409. {
  10410. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  10411. }
  10412. protected function isComposerScript($callable)
  10413. {
  10414. return '@' === substr($callable, 0, 1);
  10415. }
  10416. protected function pushEvent(Event $event)
  10417. {
  10418. $eventName = $event->getName();
  10419. if (in_array($eventName, $this->eventStack)) {
  10420. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  10421. }
  10422. return array_push($this->eventStack, $eventName);
  10423. }
  10424. protected function popEvent()
  10425. {
  10426. return array_pop($this->eventStack);
  10427. }
  10428. }
  10429. <?php
  10430. namespace Composer\EventDispatcher;
  10431. interface EventSubscriberInterface
  10432. {
  10433. public static function getSubscribedEvents();
  10434. }
  10435. <?php
  10436. namespace Composer;
  10437. use Composer\Config\JsonConfigSource;
  10438. use Composer\Json\JsonFile;
  10439. use Composer\IO\IOInterface;
  10440. use Composer\Package\Archiver;
  10441. use Composer\Package\Version\VersionGuesser;
  10442. use Composer\Repository\RepositoryManager;
  10443. use Composer\Repository\WritableRepositoryInterface;
  10444. use Composer\Util\Filesystem;
  10445. use Composer\Util\Platform;
  10446. use Composer\Util\ProcessExecutor;
  10447. use Composer\Util\RemoteFilesystem;
  10448. use Composer\Util\Silencer;
  10449. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  10450. use Composer\EventDispatcher\EventDispatcher;
  10451. use Composer\Autoload\AutoloadGenerator;
  10452. use Composer\Package\Version\VersionParser;
  10453. use Composer\Downloader\TransportException;
  10454. use Seld\JsonLint\JsonParser;
  10455. class Factory
  10456. {
  10457. protected static function getHomeDir()
  10458. {
  10459. $home = getenv('COMPOSER_HOME');
  10460. if ($home) {
  10461. return $home;
  10462. }
  10463. if (Platform::isWindows()) {
  10464. if (!getenv('APPDATA')) {
  10465. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  10466. }
  10467. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  10468. }
  10469. $userDir = self::getUserDir();
  10470. if (is_dir($userDir . '/.composer')) {
  10471. return $userDir . '/.composer';
  10472. }
  10473. if (self::useXdg()) {
  10474. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  10475. return $xdgConfig . '/composer';
  10476. }
  10477. return $userDir . '/.composer';
  10478. }
  10479. protected static function getCacheDir($home)
  10480. {
  10481. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  10482. if ($cacheDir) {
  10483. return $cacheDir;
  10484. }
  10485. $homeEnv = getenv('COMPOSER_HOME');
  10486. if ($homeEnv) {
  10487. return $homeEnv . '/cache';
  10488. }
  10489. if (Platform::isWindows()) {
  10490. if ($cacheDir = getenv('LOCALAPPDATA')) {
  10491. $cacheDir .= '/Composer';
  10492. } else {
  10493. $cacheDir = $home . '/cache';
  10494. }
  10495. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  10496. }
  10497. $userDir = self::getUserDir();
  10498. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  10499. return $home . '/cache';
  10500. }
  10501. if (self::useXdg()) {
  10502. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  10503. return $xdgCache . '/composer';
  10504. }
  10505. return $home . '/cache';
  10506. }
  10507. protected static function getDataDir($home)
  10508. {
  10509. $homeEnv = getenv('COMPOSER_HOME');
  10510. if ($homeEnv) {
  10511. return $homeEnv;
  10512. }
  10513. if (Platform::isWindows()) {
  10514. return strtr($home, '\\', '/');
  10515. }
  10516. $userDir = self::getUserDir();
  10517. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  10518. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  10519. return $xdgData . '/composer';
  10520. }
  10521. return $home;
  10522. }
  10523. public static function createConfig(IOInterface $io = null, $cwd = null)
  10524. {
  10525. $cwd = $cwd ?: getcwd();
  10526. $config = new Config(true, $cwd);
  10527. $home = self::getHomeDir();
  10528. $config->merge(array('config' => array(
  10529. 'home' => $home,
  10530. 'cache-dir' => self::getCacheDir($home),
  10531. 'data-dir' => self::getDataDir($home),
  10532. )));
  10533. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  10534. foreach ($dirs as $dir) {
  10535. if (!file_exists($dir . '/.htaccess')) {
  10536. if (!is_dir($dir)) {
  10537. Silencer::call('mkdir', $dir, 0777, true);
  10538. }
  10539. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  10540. }
  10541. }
  10542. $file = new JsonFile($config->get('home').'/config.json');
  10543. if ($file->exists()) {
  10544. if ($io && $io->isDebug()) {
  10545. $io->writeError('Loading config file ' . $file->getPath());
  10546. }
  10547. $config->merge($file->read());
  10548. }
  10549. $config->setConfigSource(new JsonConfigSource($file));
  10550. $file = new JsonFile($config->get('home').'/auth.json');
  10551. if ($file->exists()) {
  10552. if ($io && $io->isDebug()) {
  10553. $io->writeError('Loading config file ' . $file->getPath());
  10554. }
  10555. $config->merge(array('config' => $file->read()));
  10556. }
  10557. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  10558. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  10559. $authData = json_decode($composerAuthEnv, true);
  10560. if (is_null($authData)) {
  10561. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  10562. }
  10563. if ($io && $io->isDebug()) {
  10564. $io->writeError('Loading auth config from COMPOSER_AUTH');
  10565. }
  10566. $config->merge(array('config' => $authData));
  10567. }
  10568. return $config;
  10569. }
  10570. public static function getComposerFile()
  10571. {
  10572. return trim(getenv('COMPOSER')) ?: './composer.json';
  10573. }
  10574. public static function createAdditionalStyles()
  10575. {
  10576. return array(
  10577. 'highlight' => new OutputFormatterStyle('red'),
  10578. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  10579. );
  10580. }
  10581. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  10582. {
  10583. $repos = array();
  10584. if (!$config) {
  10585. $config = static::createConfig($io);
  10586. }
  10587. if (!$rm) {
  10588. if (!$io) {
  10589. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  10590. }
  10591. $factory = new static;
  10592. $rm = $factory->createRepositoryManager($io, $config, null, self::createRemoteFilesystem($io, $config));
  10593. }
  10594. foreach ($config->getRepositories() as $index => $repo) {
  10595. if (is_string($repo)) {
  10596. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  10597. }
  10598. if (!is_array($repo)) {
  10599. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  10600. }
  10601. if (!isset($repo['type'])) {
  10602. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  10603. }
  10604. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  10605. while (isset($repos[$name])) {
  10606. $name .= '2';
  10607. }
  10608. $repos[$name] = $rm->createRepository($repo['type'], $repo);
  10609. }
  10610. return $repos;
  10611. }
  10612. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  10613. {
  10614. $cwd = $cwd ?: getcwd();
  10615. if (null === $localConfig) {
  10616. $localConfig = static::getComposerFile();
  10617. }
  10618. if (is_string($localConfig)) {
  10619. $composerFile = $localConfig;
  10620. $file = new JsonFile($localConfig, null, $io);
  10621. if (!$file->exists()) {
  10622. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  10623. $message = 'Composer could not find a composer.json file in '.$cwd;
  10624. } else {
  10625. $message = 'Composer could not find the config file: '.$localConfig;
  10626. }
  10627. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  10628. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  10629. }
  10630. $file->validateSchema(JsonFile::LAX_SCHEMA);
  10631. $jsonParser = new JsonParser;
  10632. try {
  10633. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  10634. } catch (\Seld\JsonLint\DuplicateKeyException $e) {
  10635. $details = $e->getDetails();
  10636. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  10637. }
  10638. $localConfig = $file->read();
  10639. }
  10640. $config = static::createConfig($io, $cwd);
  10641. $config->merge($localConfig);
  10642. if (isset($composerFile)) {
  10643. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  10644. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json');
  10645. if ($localAuthFile->exists()) {
  10646. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  10647. $config->merge(array('config' => $localAuthFile->read()));
  10648. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  10649. }
  10650. }
  10651. $vendorDir = $config->get('vendor-dir');
  10652. $binDir = $config->get('bin-dir');
  10653. $composer = new Composer();
  10654. $composer->setConfig($config);
  10655. if ($fullLoad) {
  10656. $io->loadConfiguration($config);
  10657. }
  10658. $rfs = self::createRemoteFilesystem($io, $config);
  10659. $dispatcher = new EventDispatcher($composer, $io);
  10660. $composer->setEventDispatcher($dispatcher);
  10661. $rm = $this->createRepositoryManager($io, $config, $dispatcher, $rfs);
  10662. $composer->setRepositoryManager($rm);
  10663. $this->addLocalRepository($io, $rm, $vendorDir);
  10664. if (!$fullLoad && !isset($localConfig['version'])) {
  10665. $localConfig['version'] = '1.0.0';
  10666. }
  10667. $parser = new VersionParser;
  10668. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  10669. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser);
  10670. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  10671. $composer->setPackage($package);
  10672. $im = $this->createInstallationManager();
  10673. $composer->setInstallationManager($im);
  10674. if ($fullLoad) {
  10675. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  10676. $composer->setDownloadManager($dm);
  10677. $generator = new AutoloadGenerator($dispatcher, $io);
  10678. $composer->setAutoloadGenerator($generator);
  10679. }
  10680. $this->createDefaultInstallers($im, $composer, $io);
  10681. if ($fullLoad) {
  10682. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  10683. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  10684. $composer->setPluginManager($pm);
  10685. $pm->loadInstalledPlugins();
  10686. if ($rm->getLocalRepository()) {
  10687. $this->purgePackages($rm->getLocalRepository(), $im);
  10688. }
  10689. }
  10690. if ($fullLoad && isset($composerFile)) {
  10691. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  10692. ? substr($composerFile, 0, -4).'lock'
  10693. : $composerFile . '.lock';
  10694. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  10695. $composer->setLocker($locker);
  10696. }
  10697. return $composer;
  10698. }
  10699. protected function createRepositoryManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  10700. {
  10701. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  10702. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  10703. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  10704. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  10705. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  10706. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  10707. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  10708. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  10709. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  10710. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  10711. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  10712. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  10713. return $rm;
  10714. }
  10715. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  10716. {
  10717. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  10718. }
  10719. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins)
  10720. {
  10721. if (realpath($config->get('home')) === getcwd()) {
  10722. return;
  10723. }
  10724. $composer = null;
  10725. try {
  10726. $composer = self::createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), false);
  10727. } catch (\Exception $e) {
  10728. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  10729. }
  10730. return $composer;
  10731. }
  10732. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  10733. {
  10734. $cache = null;
  10735. if ($config->get('cache-files-ttl') > 0) {
  10736. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  10737. }
  10738. $dm = new Downloader\DownloadManager($io);
  10739. switch ($config->get('preferred-install')) {
  10740. case 'dist':
  10741. $dm->setPreferDist(true);
  10742. break;
  10743. case 'source':
  10744. $dm->setPreferSource(true);
  10745. break;
  10746. case 'auto':
  10747. default:
  10748. break;
  10749. }
  10750. $executor = new ProcessExecutor($io);
  10751. $fs = new Filesystem($executor);
  10752. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  10753. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  10754. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  10755. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  10756. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  10757. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  10758. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  10759. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  10760. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  10761. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  10762. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  10763. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  10764. return $dm;
  10765. }
  10766. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  10767. {
  10768. if (null === $dm) {
  10769. $io = new IO\NullIO();
  10770. $io->loadConfiguration($config);
  10771. $dm = $this->createDownloadManager($io, $config);
  10772. }
  10773. $am = new Archiver\ArchiveManager($dm);
  10774. $am->addArchiver(new Archiver\ZipArchiver);
  10775. $am->addArchiver(new Archiver\PharArchiver);
  10776. return $am;
  10777. }
  10778. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  10779. {
  10780. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  10781. }
  10782. protected function createInstallationManager()
  10783. {
  10784. return new Installer\InstallationManager();
  10785. }
  10786. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  10787. {
  10788. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  10789. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  10790. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  10791. $im->addInstaller(new Installer\MetapackageInstaller($io));
  10792. }
  10793. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  10794. {
  10795. foreach ($repo->getPackages() as $package) {
  10796. if (!$im->isPackageInstalled($repo, $package)) {
  10797. $repo->removePackage($package);
  10798. }
  10799. }
  10800. }
  10801. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  10802. {
  10803. $factory = new static();
  10804. return $factory->createComposer($io, $config, $disablePlugins);
  10805. }
  10806. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  10807. {
  10808. static $warned = false;
  10809. $disableTls = false;
  10810. if ($config && $config->get('disable-tls') === true) {
  10811. if (!$warned) {
  10812. $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  10813. }
  10814. $warned = true;
  10815. $disableTls = true;
  10816. } elseif (!extension_loaded('openssl')) {
  10817. throw new \RuntimeException('The openssl extension is required for SSL/TLS protection but is not available. '
  10818. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  10819. }
  10820. $remoteFilesystemOptions = array();
  10821. if ($disableTls === false) {
  10822. if ($config && $config->get('cafile')) {
  10823. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  10824. }
  10825. if ($config && $config->get('capath')) {
  10826. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  10827. }
  10828. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  10829. }
  10830. try {
  10831. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  10832. } catch (TransportException $e) {
  10833. if (false !== strpos($e->getMessage(), 'cafile')) {
  10834. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  10835. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  10836. if (PHP_VERSION_ID < 50600) {
  10837. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  10838. }
  10839. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  10840. }
  10841. throw $e;
  10842. }
  10843. return $remoteFilesystem;
  10844. }
  10845. private static function useXdg()
  10846. {
  10847. foreach (array_keys($_SERVER) as $key) {
  10848. if (substr($key, 0, 4) === 'XDG_') {
  10849. return true;
  10850. }
  10851. }
  10852. return false;
  10853. }
  10854. private static function getUserDir()
  10855. {
  10856. $home = getenv('HOME');
  10857. if (!$home) {
  10858. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  10859. }
  10860. return rtrim(strtr($home, '\\', '/'), '/');
  10861. }
  10862. }
  10863. <?php
  10864. namespace Composer\IO;
  10865. use Composer\Config;
  10866. use Composer\Util\ProcessExecutor;
  10867. abstract class BaseIO implements IOInterface
  10868. {
  10869. protected $authentications = array();
  10870. public function getAuthentications()
  10871. {
  10872. return $this->authentications;
  10873. }
  10874. public function hasAuthentication($repositoryName)
  10875. {
  10876. return isset($this->authentications[$repositoryName]);
  10877. }
  10878. public function getAuthentication($repositoryName)
  10879. {
  10880. if (isset($this->authentications[$repositoryName])) {
  10881. return $this->authentications[$repositoryName];
  10882. }
  10883. return array('username' => null, 'password' => null);
  10884. }
  10885. public function setAuthentication($repositoryName, $username, $password = null)
  10886. {
  10887. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  10888. }
  10889. public function loadConfiguration(Config $config)
  10890. {
  10891. $githubOauth = $config->get('github-oauth') ?: array();
  10892. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  10893. $httpBasic = $config->get('http-basic') ?: array();
  10894. foreach ($githubOauth as $domain => $token) {
  10895. if (!preg_match('{^[a-z0-9]+$}', $token)) {
  10896. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  10897. }
  10898. $this->setAuthentication($domain, $token, 'x-oauth-basic');
  10899. }
  10900. foreach ($gitlabOauth as $domain => $token) {
  10901. $this->setAuthentication($domain, $token, 'oauth2');
  10902. }
  10903. foreach ($httpBasic as $domain => $cred) {
  10904. $this->setAuthentication($domain, $cred['username'], $cred['password']);
  10905. }
  10906. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  10907. }
  10908. }
  10909. <?php
  10910. namespace Composer\IO;
  10911. use Symfony\Component\Console\Output\StreamOutput;
  10912. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  10913. use Symfony\Component\Console\Input\StringInput;
  10914. use Symfony\Component\Console\Helper\HelperSet;
  10915. class BufferIO extends ConsoleIO
  10916. {
  10917. public function __construct(
  10918. $input = '',
  10919. $verbosity = StreamOutput::VERBOSITY_NORMAL,
  10920. OutputFormatterInterface $formatter = null
  10921. ) {
  10922. $input = new StringInput($input);
  10923. $input->setInteractive(false);
  10924. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  10925. parent::__construct($input, $output, new HelperSet(array()));
  10926. }
  10927. public function getOutput()
  10928. {
  10929. fseek($this->output->getStream(), 0);
  10930. $output = stream_get_contents($this->output->getStream());
  10931. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  10932. $pre = strip_tags($matches[1]);
  10933. if (strlen($pre) === strlen($matches[2])) {
  10934. return '';
  10935. }
  10936. return rtrim($matches[1])."\n";
  10937. }, $output);
  10938. return $output;
  10939. }
  10940. }
  10941. <?php
  10942. namespace Composer\IO;
  10943. use Symfony\Component\Console\Input\InputInterface;
  10944. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  10945. use Symfony\Component\Console\Output\OutputInterface;
  10946. use Symfony\Component\Console\Helper\HelperSet;
  10947. use Symfony\Component\Console\Question\ConfirmationQuestion;
  10948. use Symfony\Component\Console\Question\Question;
  10949. class ConsoleIO extends BaseIO
  10950. {
  10951. protected $input;
  10952. protected $output;
  10953. protected $helperSet;
  10954. protected $lastMessage;
  10955. protected $lastMessageErr;
  10956. private $startTime;
  10957. private $verbosityMap;
  10958. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  10959. {
  10960. $this->input = $input;
  10961. $this->output = $output;
  10962. $this->helperSet = $helperSet;
  10963. $this->verbosityMap = array(
  10964. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  10965. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  10966. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  10967. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  10968. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  10969. );
  10970. }
  10971. public function enableDebugging($startTime)
  10972. {
  10973. $this->startTime = $startTime;
  10974. }
  10975. public function isInteractive()
  10976. {
  10977. return $this->input->isInteractive();
  10978. }
  10979. public function isDecorated()
  10980. {
  10981. return $this->output->isDecorated();
  10982. }
  10983. public function isVerbose()
  10984. {
  10985. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  10986. }
  10987. public function isVeryVerbose()
  10988. {
  10989. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  10990. }
  10991. public function isDebug()
  10992. {
  10993. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  10994. }
  10995. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  10996. {
  10997. $this->doWrite($messages, $newline, false, $verbosity);
  10998. }
  10999. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  11000. {
  11001. $this->doWrite($messages, $newline, true, $verbosity);
  11002. }
  11003. private function doWrite($messages, $newline, $stderr, $verbosity)
  11004. {
  11005. $sfVerbosity = $this->verbosityMap[$verbosity];
  11006. if ($sfVerbosity > $this->output->getVerbosity()) {
  11007. return;
  11008. }
  11009. if (OutputInterface::VERBOSITY_QUIET === 0) {
  11010. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  11011. }
  11012. if (null !== $this->startTime) {
  11013. $memoryUsage = memory_get_usage() / 1024 / 1024;
  11014. $timeSpent = microtime(true) - $this->startTime;
  11015. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  11016. return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  11017. }, (array) $messages);
  11018. }
  11019. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  11020. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  11021. $this->lastMessageErr = join($newline ? "\n" : '', (array) $messages);
  11022. return;
  11023. }
  11024. $this->output->write($messages, $newline, $sfVerbosity);
  11025. $this->lastMessage = join($newline ? "\n" : '', (array) $messages);
  11026. }
  11027. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  11028. {
  11029. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  11030. }
  11031. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  11032. {
  11033. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  11034. }
  11035. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  11036. {
  11037. $messages = join($newline ? "\n" : '', (array) $messages);
  11038. if (!isset($size)) {
  11039. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  11040. }
  11041. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  11042. $this->doWrite($messages, false, $stderr, $verbosity);
  11043. $fill = $size - strlen(strip_tags($messages));
  11044. if ($fill > 0) {
  11045. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  11046. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  11047. }
  11048. if ($newline) {
  11049. $this->doWrite('', true, $stderr, $verbosity);
  11050. }
  11051. if ($stderr) {
  11052. $this->lastMessageErr = $messages;
  11053. } else {
  11054. $this->lastMessage = $messages;
  11055. }
  11056. }
  11057. public function ask($question, $default = null)
  11058. {
  11059. $output = $this->output;
  11060. if ($output instanceof ConsoleOutputInterface) {
  11061. $output = $output->getErrorOutput();
  11062. }
  11063. $helper = $this->helperSet->get('question');
  11064. $question = new Question($question, $default);
  11065. return $helper->ask($this->input, $output, $question);
  11066. }
  11067. public function askConfirmation($question, $default = true)
  11068. {
  11069. $output = $this->output;
  11070. if ($output instanceof ConsoleOutputInterface) {
  11071. $output = $output->getErrorOutput();
  11072. }
  11073. $helper = $this->helperSet->get('question');
  11074. $question = new ConfirmationQuestion($question, $default);
  11075. return $helper->ask($this->input, $output, $question);
  11076. }
  11077. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  11078. {
  11079. $output = $this->output;
  11080. if ($output instanceof ConsoleOutputInterface) {
  11081. $output = $output->getErrorOutput();
  11082. }
  11083. $helper = $this->helperSet->get('question');
  11084. $question = new Question($question, $default);
  11085. $question->setValidator($validator);
  11086. $question->setMaxAttempts($attempts);
  11087. return $helper->ask($this->input, $output, $question);
  11088. }
  11089. public function askAndHideAnswer($question)
  11090. {
  11091. $this->writeError($question, false);
  11092. return \Seld\CliPrompt\CliPrompt::hiddenPrompt(true);
  11093. }
  11094. }
  11095. <?php
  11096. namespace Composer\IO;
  11097. use Composer\Config;
  11098. interface IOInterface
  11099. {
  11100. const QUIET = 1;
  11101. const NORMAL = 2;
  11102. const VERBOSE = 4;
  11103. const VERY_VERBOSE = 8;
  11104. const DEBUG = 16;
  11105. public function isInteractive();
  11106. public function isVerbose();
  11107. public function isVeryVerbose();
  11108. public function isDebug();
  11109. public function isDecorated();
  11110. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  11111. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  11112. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  11113. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  11114. public function ask($question, $default = null);
  11115. public function askConfirmation($question, $default = true);
  11116. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  11117. public function askAndHideAnswer($question);
  11118. public function getAuthentications();
  11119. public function hasAuthentication($repositoryName);
  11120. public function getAuthentication($repositoryName);
  11121. public function setAuthentication($repositoryName, $username, $password = null);
  11122. public function loadConfiguration(Config $config);
  11123. }
  11124. <?php
  11125. namespace Composer\IO;
  11126. class NullIO extends BaseIO
  11127. {
  11128. public function isInteractive()
  11129. {
  11130. return false;
  11131. }
  11132. public function isVerbose()
  11133. {
  11134. return false;
  11135. }
  11136. public function isVeryVerbose()
  11137. {
  11138. return false;
  11139. }
  11140. public function isDebug()
  11141. {
  11142. return false;
  11143. }
  11144. public function isDecorated()
  11145. {
  11146. return false;
  11147. }
  11148. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  11149. {
  11150. }
  11151. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  11152. {
  11153. }
  11154. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  11155. {
  11156. }
  11157. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  11158. {
  11159. }
  11160. public function ask($question, $default = null)
  11161. {
  11162. return $default;
  11163. }
  11164. public function askConfirmation($question, $default = true)
  11165. {
  11166. return $default;
  11167. }
  11168. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  11169. {
  11170. return $default;
  11171. }
  11172. public function askAndHideAnswer($question)
  11173. {
  11174. return null;
  11175. }
  11176. }
  11177. <?php
  11178. namespace Composer;
  11179. use Composer\Autoload\AutoloadGenerator;
  11180. use Composer\DependencyResolver\DefaultPolicy;
  11181. use Composer\DependencyResolver\Operation\UpdateOperation;
  11182. use Composer\DependencyResolver\Operation\InstallOperation;
  11183. use Composer\DependencyResolver\Operation\UninstallOperation;
  11184. use Composer\DependencyResolver\Operation\OperationInterface;
  11185. use Composer\DependencyResolver\PolicyInterface;
  11186. use Composer\DependencyResolver\Pool;
  11187. use Composer\DependencyResolver\Request;
  11188. use Composer\DependencyResolver\Rule;
  11189. use Composer\DependencyResolver\Solver;
  11190. use Composer\DependencyResolver\SolverProblemsException;
  11191. use Composer\Downloader\DownloadManager;
  11192. use Composer\EventDispatcher\EventDispatcher;
  11193. use Composer\Installer\InstallationManager;
  11194. use Composer\Installer\InstallerEvents;
  11195. use Composer\Installer\NoopInstaller;
  11196. use Composer\IO\IOInterface;
  11197. use Composer\Json\JsonFile;
  11198. use Composer\Package\AliasPackage;
  11199. use Composer\Package\CompletePackage;
  11200. use Composer\Package\Link;
  11201. use Composer\Semver\Constraint\Constraint;
  11202. use Composer\Package\Locker;
  11203. use Composer\Package\PackageInterface;
  11204. use Composer\Package\RootPackageInterface;
  11205. use Composer\Repository\CompositeRepository;
  11206. use Composer\Repository\InstalledArrayRepository;
  11207. use Composer\Repository\InstalledFilesystemRepository;
  11208. use Composer\Repository\PlatformRepository;
  11209. use Composer\Repository\RepositoryInterface;
  11210. use Composer\Repository\RepositoryManager;
  11211. use Composer\Repository\WritableRepositoryInterface;
  11212. use Composer\Script\ScriptEvents;
  11213. class Installer
  11214. {
  11215. protected $io;
  11216. protected $config;
  11217. protected $package;
  11218. protected $downloadManager;
  11219. protected $repositoryManager;
  11220. protected $locker;
  11221. protected $installationManager;
  11222. protected $eventDispatcher;
  11223. protected $autoloadGenerator;
  11224. protected $preferSource = false;
  11225. protected $preferDist = false;
  11226. protected $optimizeAutoloader = false;
  11227. protected $classMapAuthoritative = false;
  11228. protected $devMode = false;
  11229. protected $dryRun = false;
  11230. protected $verbose = false;
  11231. protected $update = false;
  11232. protected $dumpAutoloader = true;
  11233. protected $runScripts = true;
  11234. protected $ignorePlatformReqs = false;
  11235. protected $preferStable = false;
  11236. protected $preferLowest = false;
  11237. protected $updateWhitelist = null;
  11238. protected $whitelistDependencies = false;
  11239. protected $suggestedPackages;
  11240. protected $additionalInstalledRepository;
  11241. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  11242. {
  11243. $this->io = $io;
  11244. $this->config = $config;
  11245. $this->package = $package;
  11246. $this->downloadManager = $downloadManager;
  11247. $this->repositoryManager = $repositoryManager;
  11248. $this->locker = $locker;
  11249. $this->installationManager = $installationManager;
  11250. $this->eventDispatcher = $eventDispatcher;
  11251. $this->autoloadGenerator = $autoloadGenerator;
  11252. }
  11253. public function run()
  11254. {
  11255. gc_collect_cycles();
  11256. gc_disable();
  11257. if ($this->dryRun) {
  11258. $this->verbose = true;
  11259. $this->runScripts = false;
  11260. $this->installationManager->addInstaller(new NoopInstaller);
  11261. $this->mockLocalRepositories($this->repositoryManager);
  11262. }
  11263. if ($this->runScripts) {
  11264. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  11265. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  11266. }
  11267. $this->downloadManager->setPreferSource($this->preferSource);
  11268. $this->downloadManager->setPreferDist($this->preferDist);
  11269. $installedRootPackage = clone $this->package;
  11270. $installedRootPackage->setRequires(array());
  11271. $installedRootPackage->setDevRequires(array());
  11272. $localRepo = $this->repositoryManager->getLocalRepository();
  11273. if (!$this->update && $this->locker->isLocked()) {
  11274. $platformOverrides = $this->locker->getPlatformOverrides();
  11275. } else {
  11276. $platformOverrides = $this->config->get('platform') ?: array();
  11277. }
  11278. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  11279. $repos = array(
  11280. $localRepo,
  11281. new InstalledArrayRepository(array($installedRootPackage)),
  11282. $platformRepo,
  11283. );
  11284. $installedRepo = new CompositeRepository($repos);
  11285. if ($this->additionalInstalledRepository) {
  11286. $installedRepo->addRepository($this->additionalInstalledRepository);
  11287. }
  11288. $aliases = $this->getRootAliases();
  11289. $this->aliasPlatformPackages($platformRepo, $aliases);
  11290. try {
  11291. $this->suggestedPackages = array();
  11292. $res = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases, $this->devMode);
  11293. if ($res !== 0) {
  11294. return $res;
  11295. }
  11296. } catch (\Exception $e) {
  11297. if (!$this->dryRun) {
  11298. $this->installationManager->notifyInstalls($this->io);
  11299. }
  11300. throw $e;
  11301. }
  11302. if (!$this->dryRun) {
  11303. $this->installationManager->notifyInstalls($this->io);
  11304. }
  11305. if ($this->devMode) {
  11306. foreach ($this->suggestedPackages as $suggestion) {
  11307. $target = $suggestion['target'];
  11308. foreach ($installedRepo->getPackages() as $package) {
  11309. if (in_array($target, $package->getNames())) {
  11310. continue 2;
  11311. }
  11312. }
  11313. $this->io->writeError($suggestion['source'].' suggests installing '.$suggestion['target'].' ('.$suggestion['reason'].')');
  11314. }
  11315. }
  11316. foreach ($localRepo->getPackages() as $package) {
  11317. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  11318. continue;
  11319. }
  11320. $replacement = (is_string($package->getReplacementPackage()))
  11321. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  11322. : 'No replacement was suggested';
  11323. $this->io->writeError(
  11324. sprintf(
  11325. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  11326. $package->getPrettyName(),
  11327. $replacement
  11328. )
  11329. );
  11330. }
  11331. if (!$this->dryRun) {
  11332. if ($this->update || !$this->locker->isLocked()) {
  11333. $localRepo->reload();
  11334. $devPackages = ($this->devMode || !$this->package->getDevRequires()) ? array() : null;
  11335. if ($this->devMode && $this->package->getDevRequires()) {
  11336. $policy = $this->createPolicy();
  11337. $pool = $this->createPool(true);
  11338. $pool->addRepository($installedRepo, $aliases);
  11339. $request = $this->createRequest($this->package, $platformRepo);
  11340. $request->updateAll();
  11341. foreach ($this->package->getRequires() as $link) {
  11342. $request->install($link->getTarget(), $link->getConstraint());
  11343. }
  11344. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  11345. $solver = new Solver($policy, $pool, $installedRepo);
  11346. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  11347. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  11348. foreach ($ops as $op) {
  11349. if ($op->getJobType() === 'uninstall') {
  11350. $devPackages[] = $op->getPackage();
  11351. }
  11352. }
  11353. }
  11354. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  11355. $platformDevReqs = $this->devMode ? $this->extractPlatformRequirements($this->package->getDevRequires()) : array();
  11356. $updatedLock = $this->locker->setLockData(
  11357. array_diff($localRepo->getCanonicalPackages(), (array) $devPackages),
  11358. $devPackages,
  11359. $platformReqs,
  11360. $platformDevReqs,
  11361. $aliases,
  11362. $this->package->getMinimumStability(),
  11363. $this->package->getStabilityFlags(),
  11364. $this->preferStable || $this->package->getPreferStable(),
  11365. $this->preferLowest,
  11366. $this->config->get('platform') ?: array()
  11367. );
  11368. if ($updatedLock) {
  11369. $this->io->writeError('<info>Writing lock file</info>');
  11370. }
  11371. }
  11372. if ($this->dumpAutoloader) {
  11373. if ($this->optimizeAutoloader) {
  11374. $this->io->writeError('<info>Generating optimized autoload files</info>');
  11375. } else {
  11376. $this->io->writeError('<info>Generating autoload files</info>');
  11377. }
  11378. $this->autoloadGenerator->setDevMode($this->devMode);
  11379. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  11380. $this->autoloadGenerator->setRunScripts($this->runScripts);
  11381. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  11382. }
  11383. if ($this->runScripts) {
  11384. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  11385. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  11386. }
  11387. $vendorDir = $this->config->get('vendor-dir');
  11388. if (is_dir($vendorDir)) {
  11389. @touch($vendorDir);
  11390. }
  11391. }
  11392. return 0;
  11393. }
  11394. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases, $withDevReqs)
  11395. {
  11396. $lockedRepository = null;
  11397. $repositories = null;
  11398. $installFromLock = !$this->update && $this->locker->isLocked();
  11399. if ($installFromLock || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  11400. try {
  11401. $lockedRepository = $this->locker->getLockedRepository($withDevReqs);
  11402. } catch (\RuntimeException $e) {
  11403. if ($this->package->getDevRequires()) {
  11404. throw $e;
  11405. }
  11406. $lockedRepository = $this->locker->getLockedRepository();
  11407. }
  11408. }
  11409. $this->whitelistUpdateDependencies(
  11410. $localRepo,
  11411. $withDevReqs,
  11412. $this->package->getRequires(),
  11413. $this->package->getDevRequires()
  11414. );
  11415. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  11416. $policy = $this->createPolicy();
  11417. $pool = $this->createPool($withDevReqs, $installFromLock ? $lockedRepository : null);
  11418. $pool->addRepository($installedRepo, $aliases);
  11419. if (!$installFromLock) {
  11420. $repositories = $this->repositoryManager->getRepositories();
  11421. foreach ($repositories as $repository) {
  11422. $pool->addRepository($repository, $aliases);
  11423. }
  11424. }
  11425. if ($lockedRepository) {
  11426. $pool->addRepository($lockedRepository, $aliases);
  11427. }
  11428. $request = $this->createRequest($this->package, $platformRepo);
  11429. if (!$installFromLock) {
  11430. $removedUnstablePackages = array();
  11431. foreach ($localRepo->getPackages() as $package) {
  11432. if (
  11433. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  11434. && $this->installationManager->isPackageInstalled($localRepo, $package)
  11435. ) {
  11436. $removedUnstablePackages[$package->getName()] = true;
  11437. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  11438. }
  11439. }
  11440. }
  11441. if ($this->update) {
  11442. $this->io->writeError('<info>Updating dependencies'.($withDevReqs ? ' (including require-dev)' : '').'</info>');
  11443. $request->updateAll();
  11444. if ($withDevReqs) {
  11445. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  11446. } else {
  11447. $links = $this->package->getRequires();
  11448. }
  11449. foreach ($links as $link) {
  11450. $request->install($link->getTarget(), $link->getConstraint());
  11451. }
  11452. if ($this->updateWhitelist) {
  11453. $currentPackages = $this->getCurrentPackages($withDevReqs, $installedRepo);
  11454. $candidates = array();
  11455. foreach ($links as $link) {
  11456. $candidates[$link->getTarget()] = true;
  11457. }
  11458. foreach ($localRepo->getPackages() as $package) {
  11459. $candidates[$package->getName()] = true;
  11460. }
  11461. foreach ($candidates as $candidate => $dummy) {
  11462. foreach ($currentPackages as $curPackage) {
  11463. if ($curPackage->getName() === $candidate) {
  11464. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  11465. $constraint = new Constraint('=', $curPackage->getVersion());
  11466. $request->install($curPackage->getName(), $constraint);
  11467. }
  11468. break;
  11469. }
  11470. }
  11471. }
  11472. }
  11473. } elseif ($installFromLock) {
  11474. $this->io->writeError('<info>Installing dependencies'.($withDevReqs ? ' (including require-dev)' : '').' from lock file</info>');
  11475. if (!$this->locker->isFresh()) {
  11476. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>');
  11477. }
  11478. foreach ($lockedRepository->getPackages() as $package) {
  11479. $version = $package->getVersion();
  11480. if (isset($aliases[$package->getName()][$version])) {
  11481. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  11482. }
  11483. $constraint = new Constraint('=', $version);
  11484. $constraint->setPrettyString($package->getPrettyVersion());
  11485. $request->install($package->getName(), $constraint);
  11486. }
  11487. foreach ($this->locker->getPlatformRequirements($withDevReqs) as $link) {
  11488. $request->install($link->getTarget(), $link->getConstraint());
  11489. }
  11490. } else {
  11491. $this->io->writeError('<info>Installing dependencies'.($withDevReqs ? ' (including require-dev)' : '').'</info>');
  11492. if ($withDevReqs) {
  11493. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  11494. } else {
  11495. $links = $this->package->getRequires();
  11496. }
  11497. foreach ($links as $link) {
  11498. $request->install($link->getTarget(), $link->getConstraint());
  11499. }
  11500. }
  11501. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $installFromLock, $withDevReqs, 'force-links');
  11502. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  11503. $solver = new Solver($policy, $pool, $installedRepo);
  11504. try {
  11505. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  11506. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  11507. } catch (SolverProblemsException $e) {
  11508. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>');
  11509. $this->io->writeError($e->getMessage());
  11510. return max(1, $e->getCode());
  11511. }
  11512. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  11513. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  11514. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $installFromLock, $withDevReqs, 'force-updates', $operations);
  11515. if (!$operations) {
  11516. $this->io->writeError('Nothing to install or update');
  11517. }
  11518. $operations = $this->movePluginsToFront($operations);
  11519. $operations = $this->moveUninstallsToFront($operations);
  11520. foreach ($operations as $operation) {
  11521. if ('install' === $operation->getJobType()) {
  11522. foreach ($operation->getPackage()->getSuggests() as $target => $reason) {
  11523. $this->suggestedPackages[] = array(
  11524. 'source' => $operation->getPackage()->getPrettyName(),
  11525. 'target' => $target,
  11526. 'reason' => $reason,
  11527. );
  11528. }
  11529. }
  11530. if (!$installFromLock) {
  11531. $package = null;
  11532. if ('update' === $operation->getJobType()) {
  11533. $package = $operation->getTargetPackage();
  11534. } elseif ('install' === $operation->getJobType()) {
  11535. $package = $operation->getPackage();
  11536. }
  11537. if ($package && $package->isDev()) {
  11538. $references = $this->package->getReferences();
  11539. if (isset($references[$package->getName()])) {
  11540. $package->setSourceReference($references[$package->getName()]);
  11541. $package->setDistReference($references[$package->getName()]);
  11542. }
  11543. }
  11544. if ('update' === $operation->getJobType()
  11545. && $operation->getTargetPackage()->isDev()
  11546. && $operation->getTargetPackage()->getVersion() === $operation->getInitialPackage()->getVersion()
  11547. && (!$operation->getTargetPackage()->getSourceReference() || $operation->getTargetPackage()->getSourceReference() === $operation->getInitialPackage()->getSourceReference())
  11548. && (!$operation->getTargetPackage()->getDistReference() || $operation->getTargetPackage()->getDistReference() === $operation->getInitialPackage()->getDistReference())
  11549. ) {
  11550. $this->io->writeError(' - Skipping update of '. $operation->getTargetPackage()->getPrettyName().' to the same reference-locked version', true, IOInterface::DEBUG);
  11551. $this->io->writeError('', true, IOInterface::DEBUG);
  11552. continue;
  11553. }
  11554. }
  11555. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($operation->getJobType());
  11556. if (defined($event) && $this->runScripts) {
  11557. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  11558. }
  11559. if ($this->dryRun && false === strpos($operation->getJobType(), 'Alias')) {
  11560. $this->io->writeError(' - ' . $operation);
  11561. $this->io->writeError('');
  11562. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  11563. $this->io->writeError(' - ' . $operation);
  11564. $this->io->writeError('');
  11565. }
  11566. $this->installationManager->execute($localRepo, $operation);
  11567. if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
  11568. $reason = $operation->getReason();
  11569. if ($reason instanceof Rule) {
  11570. switch ($reason->getReason()) {
  11571. case Rule::RULE_JOB_INSTALL:
  11572. $this->io->writeError(' REASON: Required by root: '.$reason->getPrettyString($pool));
  11573. $this->io->writeError('');
  11574. break;
  11575. case Rule::RULE_PACKAGE_REQUIRES:
  11576. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  11577. $this->io->writeError('');
  11578. break;
  11579. }
  11580. }
  11581. }
  11582. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($operation->getJobType());
  11583. if (defined($event) && $this->runScripts) {
  11584. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  11585. }
  11586. if (!$this->dryRun) {
  11587. $localRepo->write();
  11588. }
  11589. }
  11590. if (!$this->dryRun) {
  11591. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  11592. $localRepo->write();
  11593. }
  11594. return 0;
  11595. }
  11596. private function movePluginsToFront(array $operations)
  11597. {
  11598. $installerOps = array();
  11599. foreach ($operations as $idx => $op) {
  11600. if ($op instanceof InstallOperation) {
  11601. $package = $op->getPackage();
  11602. } elseif ($op instanceof UpdateOperation) {
  11603. $package = $op->getTargetPackage();
  11604. } else {
  11605. continue;
  11606. }
  11607. if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
  11608. $requires = array_keys($package->getRequires());
  11609. foreach ($requires as $index => $req) {
  11610. if ($req === 'composer-plugin-api' || preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  11611. unset($requires[$index]);
  11612. }
  11613. }
  11614. if (!count($requires)) {
  11615. $installerOps[] = $op;
  11616. unset($operations[$idx]);
  11617. }
  11618. }
  11619. }
  11620. return array_merge($installerOps, $operations);
  11621. }
  11622. private function moveUninstallsToFront(array $operations)
  11623. {
  11624. $uninstOps = array();
  11625. foreach ($operations as $idx => $op) {
  11626. if ($op instanceof UninstallOperation) {
  11627. $uninstOps[] = $op;
  11628. unset($operations[$idx]);
  11629. }
  11630. }
  11631. return array_merge($uninstOps, $operations);
  11632. }
  11633. private function createPool($withDevReqs, RepositoryInterface $lockedRepository = null)
  11634. {
  11635. if (!$this->update && $this->locker->isLocked()) {
  11636. $minimumStability = $this->locker->getMinimumStability();
  11637. $stabilityFlags = $this->locker->getStabilityFlags();
  11638. $requires = array();
  11639. foreach ($lockedRepository->getPackages() as $package) {
  11640. $constraint = new Constraint('=', $package->getVersion());
  11641. $constraint->setPrettyString($package->getPrettyVersion());
  11642. $requires[$package->getName()] = $constraint;
  11643. }
  11644. } else {
  11645. $minimumStability = $this->package->getMinimumStability();
  11646. $stabilityFlags = $this->package->getStabilityFlags();
  11647. $requires = $this->package->getRequires();
  11648. if ($withDevReqs) {
  11649. $requires = array_merge($requires, $this->package->getDevRequires());
  11650. }
  11651. }
  11652. $rootConstraints = array();
  11653. foreach ($requires as $req => $constraint) {
  11654. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  11655. continue;
  11656. }
  11657. if ($constraint instanceof Link) {
  11658. $rootConstraints[$req] = $constraint->getConstraint();
  11659. } else {
  11660. $rootConstraints[$req] = $constraint;
  11661. }
  11662. }
  11663. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  11664. }
  11665. private function createPolicy()
  11666. {
  11667. $preferStable = null;
  11668. $preferLowest = null;
  11669. if (!$this->update && $this->locker->isLocked()) {
  11670. $preferStable = $this->locker->getPreferStable();
  11671. $preferLowest = $this->locker->getPreferLowest();
  11672. }
  11673. if (null === $preferStable) {
  11674. $preferStable = $this->preferStable || $this->package->getPreferStable();
  11675. }
  11676. if (null === $preferLowest) {
  11677. $preferLowest = $this->preferLowest;
  11678. }
  11679. return new DefaultPolicy($preferStable, $preferLowest);
  11680. }
  11681. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  11682. {
  11683. $request = new Request();
  11684. $constraint = new Constraint('=', $rootPackage->getVersion());
  11685. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  11686. $request->install($rootPackage->getName(), $constraint);
  11687. $fixedPackages = $platformRepo->getPackages();
  11688. if ($this->additionalInstalledRepository) {
  11689. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  11690. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  11691. }
  11692. $provided = $rootPackage->getProvides();
  11693. foreach ($fixedPackages as $package) {
  11694. $constraint = new Constraint('=', $package->getVersion());
  11695. $constraint->setPrettyString($package->getPrettyVersion());
  11696. if ($package->getRepository() !== $platformRepo
  11697. || !isset($provided[$package->getName()])
  11698. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  11699. ) {
  11700. $request->fix($package->getName(), $constraint);
  11701. }
  11702. }
  11703. return $request;
  11704. }
  11705. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $installFromLock, $withDevReqs, $task, array $operations = null)
  11706. {
  11707. if ($task === 'force-updates' && null === $operations) {
  11708. throw new \InvalidArgumentException('Missing operations argument');
  11709. }
  11710. if ($task === 'force-links') {
  11711. $operations = array();
  11712. }
  11713. if (!$installFromLock && $this->updateWhitelist) {
  11714. $currentPackages = $this->getCurrentPackages($withDevReqs, $installedRepo);
  11715. }
  11716. foreach ($localRepo->getCanonicalPackages() as $package) {
  11717. if (!$package->isDev()) {
  11718. continue;
  11719. }
  11720. foreach ($operations as $operation) {
  11721. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  11722. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  11723. ) {
  11724. continue 2;
  11725. }
  11726. }
  11727. if ($installFromLock) {
  11728. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  11729. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  11730. if ($task === 'force-links') {
  11731. $package->setRequires($lockedPackage->getRequires());
  11732. $package->setConflicts($lockedPackage->getConflicts());
  11733. $package->setProvides($lockedPackage->getProvides());
  11734. $package->setReplaces($lockedPackage->getReplaces());
  11735. } elseif ($task === 'force-updates') {
  11736. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  11737. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  11738. ) {
  11739. $operations[] = new UpdateOperation($package, $lockedPackage);
  11740. }
  11741. }
  11742. break;
  11743. }
  11744. }
  11745. } else {
  11746. if ($this->update) {
  11747. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  11748. foreach ($currentPackages as $curPackage) {
  11749. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  11750. if ($task === 'force-links') {
  11751. $package->setRequires($curPackage->getRequires());
  11752. $package->setConflicts($curPackage->getConflicts());
  11753. $package->setProvides($curPackage->getProvides());
  11754. $package->setReplaces($curPackage->getReplaces());
  11755. } elseif ($task === 'force-updates') {
  11756. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  11757. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  11758. ) {
  11759. $operations[] = new UpdateOperation($package, $curPackage);
  11760. }
  11761. }
  11762. break;
  11763. }
  11764. }
  11765. continue;
  11766. }
  11767. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  11768. foreach ($matches as $index => $match) {
  11769. if (!in_array($match->getRepository(), $repositories, true)) {
  11770. unset($matches[$index]);
  11771. continue;
  11772. }
  11773. if ($match->getName() !== $package->getName()) {
  11774. unset($matches[$index]);
  11775. continue;
  11776. }
  11777. $matches[$index] = $match->getId();
  11778. }
  11779. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  11780. $newPackage = $pool->literalToPackage($matches[0]);
  11781. if ($task === 'force-links' && $newPackage) {
  11782. $package->setRequires($newPackage->getRequires());
  11783. $package->setConflicts($newPackage->getConflicts());
  11784. $package->setProvides($newPackage->getProvides());
  11785. $package->setReplaces($newPackage->getReplaces());
  11786. }
  11787. if ($task === 'force-updates' && $newPackage && (
  11788. (($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  11789. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  11790. )
  11791. )) {
  11792. $operations[] = new UpdateOperation($package, $newPackage);
  11793. }
  11794. }
  11795. }
  11796. if ($task === 'force-updates') {
  11797. $references = $this->package->getReferences();
  11798. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  11799. $operations[] = new UpdateOperation($package, clone $package);
  11800. }
  11801. }
  11802. }
  11803. }
  11804. return $operations;
  11805. }
  11806. private function getCurrentPackages($withDevReqs, $installedRepo)
  11807. {
  11808. if ($this->locker->isLocked()) {
  11809. try {
  11810. return $this->locker->getLockedRepository($withDevReqs)->getPackages();
  11811. } catch (\RuntimeException $e) {
  11812. return $this->locker->getLockedRepository()->getPackages();
  11813. }
  11814. }
  11815. return $installedRepo->getPackages();
  11816. }
  11817. private function getRootAliases()
  11818. {
  11819. if (!$this->update && $this->locker->isLocked()) {
  11820. $aliases = $this->locker->getAliases();
  11821. } else {
  11822. $aliases = $this->package->getAliases();
  11823. }
  11824. $normalizedAliases = array();
  11825. foreach ($aliases as $alias) {
  11826. $normalizedAliases[$alias['package']][$alias['version']] = array(
  11827. 'alias' => $alias['alias'],
  11828. 'alias_normalized' => $alias['alias_normalized'],
  11829. );
  11830. }
  11831. return $normalizedAliases;
  11832. }
  11833. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  11834. {
  11835. if (!$this->update) {
  11836. return;
  11837. }
  11838. foreach ($localRepo->getCanonicalPackages() as $package) {
  11839. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  11840. foreach ($matches as $index => $match) {
  11841. if (!in_array($match->getRepository(), $repositories, true)) {
  11842. unset($matches[$index]);
  11843. continue;
  11844. }
  11845. if ($match->getName() !== $package->getName()) {
  11846. unset($matches[$index]);
  11847. continue;
  11848. }
  11849. $matches[$index] = $match->getId();
  11850. }
  11851. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  11852. $newPackage = $pool->literalToPackage($matches[0]);
  11853. $sourceUrl = $package->getSourceUrl();
  11854. $newSourceUrl = $newPackage->getSourceUrl();
  11855. if ($sourceUrl !== $newSourceUrl) {
  11856. $package->setSourceType($newPackage->getSourceType());
  11857. $package->setSourceUrl($newSourceUrl);
  11858. $package->setSourceReference($newPackage->getSourceReference());
  11859. }
  11860. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}', $newPackage->getDistUrl())) {
  11861. $package->setDistUrl($newPackage->getDistUrl());
  11862. }
  11863. }
  11864. }
  11865. }
  11866. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  11867. {
  11868. foreach ($aliases as $package => $versions) {
  11869. foreach ($versions as $version => $alias) {
  11870. $packages = $platformRepo->findPackages($package, $version);
  11871. foreach ($packages as $package) {
  11872. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  11873. $aliasPackage->setRootPackageAlias(true);
  11874. $platformRepo->addPackage($aliasPackage);
  11875. }
  11876. }
  11877. }
  11878. }
  11879. private function isUpdateable(PackageInterface $package)
  11880. {
  11881. if (!$this->updateWhitelist) {
  11882. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  11883. }
  11884. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  11885. $patternRegexp = $this->packageNameToRegexp($whiteListedPattern);
  11886. if (preg_match($patternRegexp, $package->getName())) {
  11887. return true;
  11888. }
  11889. }
  11890. return false;
  11891. }
  11892. private function packageNameToRegexp($whiteListedPattern)
  11893. {
  11894. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  11895. return "{^" . $cleanedWhiteListedPattern . "$}i";
  11896. }
  11897. private function extractPlatformRequirements($links)
  11898. {
  11899. $platformReqs = array();
  11900. foreach ($links as $link) {
  11901. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  11902. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  11903. }
  11904. }
  11905. return $platformReqs;
  11906. }
  11907. private function whitelistUpdateDependencies($localRepo, $devMode, array $rootRequires, array $rootDevRequires)
  11908. {
  11909. if (!$this->updateWhitelist) {
  11910. return;
  11911. }
  11912. $requiredPackageNames = array();
  11913. foreach (array_merge($rootRequires, $rootDevRequires) as $require) {
  11914. $requiredPackageNames[] = $require->getTarget();
  11915. }
  11916. if ($devMode) {
  11917. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  11918. }
  11919. $skipPackages = array();
  11920. foreach ($rootRequires as $require) {
  11921. $skipPackages[$require->getTarget()] = true;
  11922. }
  11923. $pool = new Pool;
  11924. $pool->addRepository($localRepo);
  11925. $seen = array();
  11926. $rootRequiredPackageNames = array_keys($rootRequires);
  11927. foreach ($this->updateWhitelist as $packageName => $void) {
  11928. $packageQueue = new \SplQueue;
  11929. $depPackages = $pool->whatProvides($packageName);
  11930. $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true);
  11931. if (!$nameMatchesRequiredPackage) {
  11932. $whitelistPatternRegexp = $this->packageNameToRegexp($packageName);
  11933. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  11934. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  11935. $nameMatchesRequiredPackage = true;
  11936. break;
  11937. }
  11938. }
  11939. }
  11940. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock'))) {
  11941. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  11942. }
  11943. foreach ($depPackages as $depPackage) {
  11944. $packageQueue->enqueue($depPackage);
  11945. }
  11946. while (!$packageQueue->isEmpty()) {
  11947. $package = $packageQueue->dequeue();
  11948. if (isset($seen[$package->getId()])) {
  11949. continue;
  11950. }
  11951. $seen[$package->getId()] = true;
  11952. $this->updateWhitelist[$package->getName()] = true;
  11953. if (!$this->whitelistDependencies) {
  11954. continue;
  11955. }
  11956. $requires = $package->getRequires();
  11957. foreach ($requires as $require) {
  11958. $requirePackages = $pool->whatProvides($require->getTarget());
  11959. foreach ($requirePackages as $requirePackage) {
  11960. if (isset($skipPackages[$requirePackage->getName()])) {
  11961. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  11962. continue;
  11963. }
  11964. $packageQueue->enqueue($requirePackage);
  11965. }
  11966. }
  11967. }
  11968. }
  11969. }
  11970. private function mockLocalRepositories(RepositoryManager $rm)
  11971. {
  11972. $packages = array();
  11973. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  11974. $packages[(string) $package] = clone $package;
  11975. }
  11976. foreach ($packages as $key => $package) {
  11977. if ($package instanceof AliasPackage) {
  11978. $alias = (string) $package->getAliasOf();
  11979. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  11980. }
  11981. }
  11982. $rm->setLocalRepository(
  11983. new InstalledArrayRepository($packages)
  11984. );
  11985. }
  11986. public static function create(IOInterface $io, Composer $composer)
  11987. {
  11988. return new static(
  11989. $io,
  11990. $composer->getConfig(),
  11991. $composer->getPackage(),
  11992. $composer->getDownloadManager(),
  11993. $composer->getRepositoryManager(),
  11994. $composer->getLocker(),
  11995. $composer->getInstallationManager(),
  11996. $composer->getEventDispatcher(),
  11997. $composer->getAutoloadGenerator()
  11998. );
  11999. }
  12000. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  12001. {
  12002. $this->additionalInstalledRepository = $additionalInstalledRepository;
  12003. return $this;
  12004. }
  12005. public function setDryRun($dryRun = true)
  12006. {
  12007. $this->dryRun = (boolean) $dryRun;
  12008. return $this;
  12009. }
  12010. public function isDryRun()
  12011. {
  12012. return $this->dryRun;
  12013. }
  12014. public function setPreferSource($preferSource = true)
  12015. {
  12016. $this->preferSource = (boolean) $preferSource;
  12017. return $this;
  12018. }
  12019. public function setPreferDist($preferDist = true)
  12020. {
  12021. $this->preferDist = (boolean) $preferDist;
  12022. return $this;
  12023. }
  12024. public function setOptimizeAutoloader($optimizeAutoloader = false)
  12025. {
  12026. $this->optimizeAutoloader = (boolean) $optimizeAutoloader;
  12027. if (!$this->optimizeAutoloader) {
  12028. $this->setClassMapAuthoritative(false);
  12029. }
  12030. return $this;
  12031. }
  12032. public function setClassMapAuthoritative($classMapAuthoritative = false)
  12033. {
  12034. $this->classMapAuthoritative = (boolean) $classMapAuthoritative;
  12035. if ($this->classMapAuthoritative) {
  12036. $this->setOptimizeAutoloader(true);
  12037. }
  12038. return $this;
  12039. }
  12040. public function setUpdate($update = true)
  12041. {
  12042. $this->update = (boolean) $update;
  12043. return $this;
  12044. }
  12045. public function setDevMode($devMode = true)
  12046. {
  12047. $this->devMode = (boolean) $devMode;
  12048. return $this;
  12049. }
  12050. public function setDumpAutoloader($dumpAutoloader = true)
  12051. {
  12052. $this->dumpAutoloader = (boolean) $dumpAutoloader;
  12053. return $this;
  12054. }
  12055. public function setRunScripts($runScripts = true)
  12056. {
  12057. $this->runScripts = (boolean) $runScripts;
  12058. return $this;
  12059. }
  12060. public function setConfig(Config $config)
  12061. {
  12062. $this->config = $config;
  12063. return $this;
  12064. }
  12065. public function setVerbose($verbose = true)
  12066. {
  12067. $this->verbose = (boolean) $verbose;
  12068. return $this;
  12069. }
  12070. public function isVerbose()
  12071. {
  12072. return $this->verbose;
  12073. }
  12074. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  12075. {
  12076. $this->ignorePlatformReqs = (boolean) $ignorePlatformReqs;
  12077. return $this;
  12078. }
  12079. public function setUpdateWhitelist(array $packages)
  12080. {
  12081. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  12082. return $this;
  12083. }
  12084. public function setWhitelistDependencies($updateDependencies = true)
  12085. {
  12086. $this->whitelistDependencies = (boolean) $updateDependencies;
  12087. return $this;
  12088. }
  12089. public function setPreferStable($preferStable = true)
  12090. {
  12091. $this->preferStable = (boolean) $preferStable;
  12092. return $this;
  12093. }
  12094. public function setPreferLowest($preferLowest = true)
  12095. {
  12096. $this->preferLowest = (boolean) $preferLowest;
  12097. return $this;
  12098. }
  12099. public function disablePlugins()
  12100. {
  12101. $this->installationManager->disablePlugins();
  12102. return $this;
  12103. }
  12104. }
  12105. <?php
  12106. namespace Composer\Installer;
  12107. use Composer\IO\IOInterface;
  12108. use Composer\Package\PackageInterface;
  12109. use Composer\Package\AliasPackage;
  12110. use Composer\Repository\RepositoryInterface;
  12111. use Composer\Repository\InstalledRepositoryInterface;
  12112. use Composer\DependencyResolver\Operation\OperationInterface;
  12113. use Composer\DependencyResolver\Operation\InstallOperation;
  12114. use Composer\DependencyResolver\Operation\UpdateOperation;
  12115. use Composer\DependencyResolver\Operation\UninstallOperation;
  12116. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  12117. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  12118. use Composer\Util\StreamContextFactory;
  12119. class InstallationManager
  12120. {
  12121. private $installers = array();
  12122. private $cache = array();
  12123. private $notifiablePackages = array();
  12124. public function reset()
  12125. {
  12126. $this->notifiablePackages = array();
  12127. }
  12128. public function addInstaller(InstallerInterface $installer)
  12129. {
  12130. array_unshift($this->installers, $installer);
  12131. $this->cache = array();
  12132. }
  12133. public function removeInstaller(InstallerInterface $installer)
  12134. {
  12135. if (false !== ($key = array_search($installer, $this->installers, true))) {
  12136. array_splice($this->installers, $key, 1);
  12137. $this->cache = array();
  12138. }
  12139. }
  12140. public function disablePlugins()
  12141. {
  12142. foreach ($this->installers as $i => $installer) {
  12143. if (!$installer instanceof PluginInstaller) {
  12144. continue;
  12145. }
  12146. unset($this->installers[$i]);
  12147. }
  12148. }
  12149. public function getInstaller($type)
  12150. {
  12151. $type = strtolower($type);
  12152. if (isset($this->cache[$type])) {
  12153. return $this->cache[$type];
  12154. }
  12155. foreach ($this->installers as $installer) {
  12156. if ($installer->supports($type)) {
  12157. return $this->cache[$type] = $installer;
  12158. }
  12159. }
  12160. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  12161. }
  12162. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  12163. {
  12164. if ($package instanceof AliasPackage) {
  12165. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  12166. }
  12167. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  12168. }
  12169. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  12170. {
  12171. $method = $operation->getJobType();
  12172. $this->$method($repo, $operation);
  12173. }
  12174. public function install(RepositoryInterface $repo, InstallOperation $operation)
  12175. {
  12176. $package = $operation->getPackage();
  12177. $installer = $this->getInstaller($package->getType());
  12178. $installer->install($repo, $package);
  12179. $this->markForNotification($package);
  12180. }
  12181. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  12182. {
  12183. $initial = $operation->getInitialPackage();
  12184. $target = $operation->getTargetPackage();
  12185. $initialType = $initial->getType();
  12186. $targetType = $target->getType();
  12187. if ($initialType === $targetType) {
  12188. $installer = $this->getInstaller($initialType);
  12189. $installer->update($repo, $initial, $target);
  12190. $this->markForNotification($target);
  12191. } else {
  12192. $this->getInstaller($initialType)->uninstall($repo, $initial);
  12193. $this->getInstaller($targetType)->install($repo, $target);
  12194. }
  12195. }
  12196. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  12197. {
  12198. $package = $operation->getPackage();
  12199. $installer = $this->getInstaller($package->getType());
  12200. $installer->uninstall($repo, $package);
  12201. }
  12202. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  12203. {
  12204. $package = $operation->getPackage();
  12205. if (!$repo->hasPackage($package)) {
  12206. $repo->addPackage(clone $package);
  12207. }
  12208. }
  12209. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  12210. {
  12211. $package = $operation->getPackage();
  12212. $repo->removePackage($package);
  12213. }
  12214. public function getInstallPath(PackageInterface $package)
  12215. {
  12216. $installer = $this->getInstaller($package->getType());
  12217. return $installer->getInstallPath($package);
  12218. }
  12219. public function notifyInstalls(IOInterface $io)
  12220. {
  12221. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  12222. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  12223. if ($io->hasAuthentication($repositoryName)) {
  12224. $auth = $io->getAuthentication($repositoryName);
  12225. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  12226. $authHeader = 'Authorization: Basic '.$authStr;
  12227. }
  12228. if (strpos($repoUrl, '%package%')) {
  12229. foreach ($packages as $package) {
  12230. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  12231. $params = array(
  12232. 'version' => $package->getPrettyVersion(),
  12233. 'version_normalized' => $package->getVersion(),
  12234. );
  12235. $opts = array('http' =>
  12236. array(
  12237. 'method' => 'POST',
  12238. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  12239. 'content' => http_build_query($params, '', '&'),
  12240. 'timeout' => 3,
  12241. ),
  12242. );
  12243. if (isset($authHeader)) {
  12244. $opts['http']['header'][] = $authHeader;
  12245. }
  12246. $context = StreamContextFactory::getContext($url, $opts);
  12247. @file_get_contents($url, false, $context);
  12248. }
  12249. continue;
  12250. }
  12251. $postData = array('downloads' => array());
  12252. foreach ($packages as $package) {
  12253. $postData['downloads'][] = array(
  12254. 'name' => $package->getPrettyName(),
  12255. 'version' => $package->getVersion(),
  12256. );
  12257. }
  12258. $opts = array('http' =>
  12259. array(
  12260. 'method' => 'POST',
  12261. 'header' => array('Content-Type: application/json'),
  12262. 'content' => json_encode($postData),
  12263. 'timeout' => 6,
  12264. ),
  12265. );
  12266. if (isset($authHeader)) {
  12267. $opts['http']['header'][] = $authHeader;
  12268. }
  12269. $context = StreamContextFactory::getContext($repoUrl, $opts);
  12270. @file_get_contents($repoUrl, false, $context);
  12271. }
  12272. $this->reset();
  12273. }
  12274. private function markForNotification(PackageInterface $package)
  12275. {
  12276. if ($package->getNotificationUrl()) {
  12277. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  12278. }
  12279. }
  12280. }
  12281. <?php
  12282. namespace Composer\Installer;
  12283. use Composer\Composer;
  12284. use Composer\DependencyResolver\PolicyInterface;
  12285. use Composer\DependencyResolver\Operation\OperationInterface;
  12286. use Composer\DependencyResolver\Pool;
  12287. use Composer\DependencyResolver\Request;
  12288. use Composer\EventDispatcher\Event;
  12289. use Composer\IO\IOInterface;
  12290. use Composer\Repository\CompositeRepository;
  12291. class InstallerEvent extends Event
  12292. {
  12293. private $composer;
  12294. private $io;
  12295. private $devMode;
  12296. private $policy;
  12297. private $pool;
  12298. private $installedRepo;
  12299. private $request;
  12300. private $operations;
  12301. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12302. {
  12303. parent::__construct($eventName);
  12304. $this->composer = $composer;
  12305. $this->io = $io;
  12306. $this->devMode = $devMode;
  12307. $this->policy = $policy;
  12308. $this->pool = $pool;
  12309. $this->installedRepo = $installedRepo;
  12310. $this->request = $request;
  12311. $this->operations = $operations;
  12312. }
  12313. public function getComposer()
  12314. {
  12315. return $this->composer;
  12316. }
  12317. public function getIO()
  12318. {
  12319. return $this->io;
  12320. }
  12321. public function isDevMode()
  12322. {
  12323. return $this->devMode;
  12324. }
  12325. public function getPolicy()
  12326. {
  12327. return $this->policy;
  12328. }
  12329. public function getPool()
  12330. {
  12331. return $this->pool;
  12332. }
  12333. public function getInstalledRepo()
  12334. {
  12335. return $this->installedRepo;
  12336. }
  12337. public function getRequest()
  12338. {
  12339. return $this->request;
  12340. }
  12341. public function getOperations()
  12342. {
  12343. return $this->operations;
  12344. }
  12345. }
  12346. <?php
  12347. namespace Composer\Installer;
  12348. class InstallerEvents
  12349. {
  12350. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  12351. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  12352. }
  12353. <?php
  12354. namespace Composer\Installer;
  12355. use Composer\Package\PackageInterface;
  12356. use Composer\Repository\InstalledRepositoryInterface;
  12357. use InvalidArgumentException;
  12358. interface InstallerInterface
  12359. {
  12360. public function supports($packageType);
  12361. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  12362. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  12363. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  12364. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  12365. public function getInstallPath(PackageInterface $package);
  12366. }
  12367. <?php
  12368. namespace Composer\Installer;
  12369. use Composer\Composer;
  12370. use Composer\IO\IOInterface;
  12371. use Composer\Repository\InstalledRepositoryInterface;
  12372. use Composer\Package\PackageInterface;
  12373. use Composer\Util\Filesystem;
  12374. use Composer\Util\Platform;
  12375. use Composer\Util\ProcessExecutor;
  12376. use Composer\Util\Silencer;
  12377. class LibraryInstaller implements InstallerInterface
  12378. {
  12379. protected $composer;
  12380. protected $vendorDir;
  12381. protected $binDir;
  12382. protected $downloadManager;
  12383. protected $io;
  12384. protected $type;
  12385. protected $filesystem;
  12386. protected $binCompat;
  12387. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null)
  12388. {
  12389. $this->composer = $composer;
  12390. $this->downloadManager = $composer->getDownloadManager();
  12391. $this->io = $io;
  12392. $this->type = $type;
  12393. $this->filesystem = $filesystem ?: new Filesystem();
  12394. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  12395. $this->binDir = rtrim($composer->getConfig()->get('bin-dir'), '/');
  12396. $this->binCompat = $composer->getConfig()->get('bin-compat');
  12397. }
  12398. public function supports($packageType)
  12399. {
  12400. return $packageType === $this->type || null === $this->type;
  12401. }
  12402. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  12403. {
  12404. return $repo->hasPackage($package) && is_readable($this->getInstallPath($package));
  12405. }
  12406. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  12407. {
  12408. $this->initializeVendorDir();
  12409. $downloadPath = $this->getInstallPath($package);
  12410. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  12411. $this->removeBinaries($package);
  12412. }
  12413. $this->installCode($package);
  12414. $this->installBinaries($package);
  12415. if (!$repo->hasPackage($package)) {
  12416. $repo->addPackage(clone $package);
  12417. }
  12418. }
  12419. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  12420. {
  12421. if (!$repo->hasPackage($initial)) {
  12422. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  12423. }
  12424. $this->initializeVendorDir();
  12425. $this->removeBinaries($initial);
  12426. $this->updateCode($initial, $target);
  12427. $this->installBinaries($target);
  12428. $repo->removePackage($initial);
  12429. if (!$repo->hasPackage($target)) {
  12430. $repo->addPackage(clone $target);
  12431. }
  12432. }
  12433. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  12434. {
  12435. if (!$repo->hasPackage($package)) {
  12436. throw new \InvalidArgumentException('Package is not installed: '.$package);
  12437. }
  12438. $this->removeCode($package);
  12439. $this->removeBinaries($package);
  12440. $repo->removePackage($package);
  12441. $downloadPath = $this->getPackageBasePath($package);
  12442. if (strpos($package->getName(), '/')) {
  12443. $packageVendorDir = dirname($downloadPath);
  12444. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  12445. Silencer::call('rmdir', $packageVendorDir);
  12446. }
  12447. }
  12448. }
  12449. public function getInstallPath(PackageInterface $package)
  12450. {
  12451. $this->initializeVendorDir();
  12452. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  12453. $targetDir = $package->getTargetDir();
  12454. return $basePath . ($targetDir ? '/'.$targetDir : '');
  12455. }
  12456. protected function getPackageBasePath(PackageInterface $package)
  12457. {
  12458. $installPath = $this->getInstallPath($package);
  12459. $targetDir = $package->getTargetDir();
  12460. if ($targetDir) {
  12461. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  12462. }
  12463. return $installPath;
  12464. }
  12465. protected function installCode(PackageInterface $package)
  12466. {
  12467. $downloadPath = $this->getInstallPath($package);
  12468. $this->downloadManager->download($package, $downloadPath);
  12469. }
  12470. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  12471. {
  12472. $initialDownloadPath = $this->getInstallPath($initial);
  12473. $targetDownloadPath = $this->getInstallPath($target);
  12474. if ($targetDownloadPath !== $initialDownloadPath) {
  12475. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  12476. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  12477. ) {
  12478. $this->removeCode($initial);
  12479. $this->installCode($target);
  12480. return;
  12481. }
  12482. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  12483. }
  12484. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  12485. }
  12486. protected function removeCode(PackageInterface $package)
  12487. {
  12488. $downloadPath = $this->getPackageBasePath($package);
  12489. $this->downloadManager->remove($package, $downloadPath);
  12490. }
  12491. protected function getBinaries(PackageInterface $package)
  12492. {
  12493. return $package->getBinaries();
  12494. }
  12495. protected function installBinaries(PackageInterface $package)
  12496. {
  12497. $binaries = $this->getBinaries($package);
  12498. if (!$binaries) {
  12499. return;
  12500. }
  12501. foreach ($binaries as $bin) {
  12502. $binPath = $this->getInstallPath($package).'/'.$bin;
  12503. if (!file_exists($binPath)) {
  12504. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  12505. continue;
  12506. }
  12507. $binPath = realpath($binPath);
  12508. $this->initializeBinDir();
  12509. $link = $this->binDir.'/'.basename($bin);
  12510. if (file_exists($link)) {
  12511. if (is_link($link)) {
  12512. Silencer::call('chmod', $link, 0777 & ~umask());
  12513. }
  12514. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  12515. continue;
  12516. }
  12517. if ($this->binCompat === "auto") {
  12518. if (Platform::isWindows()) {
  12519. $this->installFullBinaries($binPath, $link, $bin, $package);
  12520. } else {
  12521. $this->installSymlinkBinaries($binPath, $link);
  12522. }
  12523. } elseif ($this->binCompat === "full") {
  12524. $this->installFullBinaries($binPath, $link, $bin, $package);
  12525. }
  12526. Silencer::call('chmod', $link, 0777 & ~umask());
  12527. }
  12528. }
  12529. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  12530. {
  12531. if ('.bat' !== substr($binPath, -4)) {
  12532. $this->installUnixyProxyBinaries($binPath, $link);
  12533. @chmod($link, 0777 & ~umask());
  12534. $link .= '.bat';
  12535. if (file_exists($link)) {
  12536. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  12537. }
  12538. }
  12539. if (!file_exists($link)) {
  12540. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  12541. }
  12542. }
  12543. protected function installSymlinkBinaries($binPath, $link)
  12544. {
  12545. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  12546. $this->installUnixyProxyBinaries($binPath, $link);
  12547. }
  12548. }
  12549. protected function installUnixyProxyBinaries($binPath, $link)
  12550. {
  12551. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  12552. }
  12553. protected function removeBinaries(PackageInterface $package)
  12554. {
  12555. $binaries = $this->getBinaries($package);
  12556. if (!$binaries) {
  12557. return;
  12558. }
  12559. foreach ($binaries as $bin) {
  12560. $link = $this->binDir.'/'.basename($bin);
  12561. if (is_link($link) || file_exists($link)) {
  12562. $this->filesystem->unlink($link);
  12563. }
  12564. if (file_exists($link.'.bat')) {
  12565. $this->filesystem->unlink($link.'.bat');
  12566. }
  12567. }
  12568. if ((is_dir($this->binDir)) && ($this->filesystem->isDirEmpty($this->binDir))) {
  12569. Silencer::call('rmdir', $this->binDir);
  12570. }
  12571. }
  12572. protected function initializeVendorDir()
  12573. {
  12574. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  12575. $this->vendorDir = realpath($this->vendorDir);
  12576. }
  12577. protected function initializeBinDir()
  12578. {
  12579. $this->filesystem->ensureDirectoryExists($this->binDir);
  12580. $this->binDir = realpath($this->binDir);
  12581. }
  12582. protected function generateWindowsProxyCode($bin, $link)
  12583. {
  12584. $binPath = $this->filesystem->findShortestPath($link, $bin);
  12585. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  12586. $caller = 'call';
  12587. } else {
  12588. $handle = fopen($bin, 'r');
  12589. $line = fgets($handle);
  12590. fclose($handle);
  12591. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  12592. $caller = trim($match[1]);
  12593. } else {
  12594. $caller = 'php';
  12595. }
  12596. }
  12597. return "@ECHO OFF\r\n".
  12598. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"')."\r\n".
  12599. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  12600. }
  12601. protected function generateUnixyProxyCode($bin, $link)
  12602. {
  12603. $binPath = $this->filesystem->findShortestPath($link, $bin);
  12604. $binDir = ProcessExecutor::escape(dirname($binPath));
  12605. $binFile = basename($binPath);
  12606. $proxyCode = <<<PROXY
  12607. #!/usr/bin/env sh
  12608. dir=$(d=\${0%[/\\\\]*}; cd "\$d"; cd $binDir && pwd)
  12609. # See if we are running in Cygwin by checking for cygpath program
  12610. if command -v 'cygpath' >/dev/null 2>&1; then
  12611. # Cygwin paths start with /cygdrive/ which will break windows PHP,
  12612. # so we need to translate the dir path to windows format. However
  12613. # we could be using cygwin PHP which does not require this, so we
  12614. # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
  12615. if [[ $(which php) == /cygdrive/* ]]; then
  12616. dir=$(cygpath -m "\$dir");
  12617. fi
  12618. fi
  12619. dir=$(echo \$dir | sed 's/ /\ /g')
  12620. "\${dir}/$binFile" "$@"
  12621. PROXY;
  12622. return $proxyCode;
  12623. }
  12624. }
  12625. <?php
  12626. namespace Composer\Installer;
  12627. use Composer\Repository\InstalledRepositoryInterface;
  12628. use Composer\Package\PackageInterface;
  12629. class MetapackageInstaller implements InstallerInterface
  12630. {
  12631. public function supports($packageType)
  12632. {
  12633. return $packageType === 'metapackage';
  12634. }
  12635. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  12636. {
  12637. return $repo->hasPackage($package);
  12638. }
  12639. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  12640. {
  12641. $repo->addPackage(clone $package);
  12642. }
  12643. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  12644. {
  12645. if (!$repo->hasPackage($initial)) {
  12646. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  12647. }
  12648. $repo->removePackage($initial);
  12649. $repo->addPackage(clone $target);
  12650. }
  12651. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  12652. {
  12653. if (!$repo->hasPackage($package)) {
  12654. throw new \InvalidArgumentException('Package is not installed: '.$package);
  12655. }
  12656. $repo->removePackage($package);
  12657. }
  12658. public function getInstallPath(PackageInterface $package)
  12659. {
  12660. return '';
  12661. }
  12662. }
  12663. <?php
  12664. namespace Composer\Installer;
  12665. use Composer\Repository\InstalledRepositoryInterface;
  12666. use Composer\Package\PackageInterface;
  12667. class NoopInstaller implements InstallerInterface
  12668. {
  12669. public function supports($packageType)
  12670. {
  12671. return true;
  12672. }
  12673. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  12674. {
  12675. return $repo->hasPackage($package);
  12676. }
  12677. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  12678. {
  12679. if (!$repo->hasPackage($package)) {
  12680. $repo->addPackage(clone $package);
  12681. }
  12682. }
  12683. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  12684. {
  12685. if (!$repo->hasPackage($initial)) {
  12686. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  12687. }
  12688. $repo->removePackage($initial);
  12689. if (!$repo->hasPackage($target)) {
  12690. $repo->addPackage(clone $target);
  12691. }
  12692. }
  12693. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  12694. {
  12695. if (!$repo->hasPackage($package)) {
  12696. throw new \InvalidArgumentException('Package is not installed: '.$package);
  12697. }
  12698. $repo->removePackage($package);
  12699. }
  12700. public function getInstallPath(PackageInterface $package)
  12701. {
  12702. $targetDir = $package->getTargetDir();
  12703. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  12704. }
  12705. }
  12706. <?php
  12707. namespace Composer\Installer;
  12708. use Composer\Composer;
  12709. use Composer\IO\IOInterface;
  12710. use Composer\DependencyResolver\Operation\OperationInterface;
  12711. use Composer\DependencyResolver\PolicyInterface;
  12712. use Composer\DependencyResolver\Pool;
  12713. use Composer\DependencyResolver\Request;
  12714. use Composer\Repository\CompositeRepository;
  12715. class PackageEvent extends InstallerEvent
  12716. {
  12717. private $operation;
  12718. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12719. {
  12720. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  12721. $this->operation = $operation;
  12722. }
  12723. public function getOperation()
  12724. {
  12725. return $this->operation;
  12726. }
  12727. }
  12728. <?php
  12729. namespace Composer\Installer;
  12730. class PackageEvents
  12731. {
  12732. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  12733. const POST_PACKAGE_INSTALL = 'post-package-install';
  12734. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  12735. const POST_PACKAGE_UPDATE = 'post-package-update';
  12736. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  12737. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  12738. }
  12739. <?php
  12740. namespace Composer\Installer;
  12741. use Composer\IO\IOInterface;
  12742. use Composer\Composer;
  12743. use Composer\Downloader\PearPackageExtractor;
  12744. use Composer\Repository\InstalledRepositoryInterface;
  12745. use Composer\Package\PackageInterface;
  12746. use Composer\Util\Platform;
  12747. use Composer\Util\ProcessExecutor;
  12748. class PearInstaller extends LibraryInstaller
  12749. {
  12750. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  12751. {
  12752. parent::__construct($io, $composer, $type);
  12753. }
  12754. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  12755. {
  12756. $this->uninstall($repo, $initial);
  12757. $this->install($repo, $target);
  12758. }
  12759. protected function installCode(PackageInterface $package)
  12760. {
  12761. parent::installCode($package);
  12762. parent::initializeBinDir();
  12763. $isWindows = Platform::isWindows();
  12764. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  12765. if (!$isWindows) {
  12766. $php_bin = '/usr/bin/env ' . $php_bin;
  12767. }
  12768. $installPath = $this->getInstallPath($package);
  12769. $vars = array(
  12770. 'os' => $isWindows ? 'windows' : 'linux',
  12771. 'php_bin' => $php_bin,
  12772. 'pear_php' => $installPath,
  12773. 'php_dir' => $installPath,
  12774. 'bin_dir' => $installPath . '/bin',
  12775. 'data_dir' => $installPath . '/data',
  12776. 'version' => $package->getPrettyVersion(),
  12777. );
  12778. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  12779. $pearExtractor = new PearPackageExtractor($packageArchive);
  12780. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  12781. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  12782. $this->filesystem->unlink($packageArchive);
  12783. }
  12784. protected function getBinaries(PackageInterface $package)
  12785. {
  12786. $binariesPath = $this->getInstallPath($package) . '/bin/';
  12787. $binaries = array();
  12788. if (file_exists($binariesPath)) {
  12789. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  12790. if (!$value->isDir()) {
  12791. $binaries[] = 'bin/'.$fileName;
  12792. }
  12793. }
  12794. }
  12795. return $binaries;
  12796. }
  12797. protected function initializeBinDir()
  12798. {
  12799. parent::initializeBinDir();
  12800. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  12801. @chmod($this->binDir.'/composer-php', 0777);
  12802. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  12803. @chmod($this->binDir.'/composer-php.bat', 0777);
  12804. }
  12805. protected function generateWindowsProxyCode($bin, $link)
  12806. {
  12807. $binPath = $this->filesystem->findShortestPath($link, $bin);
  12808. if ('.bat' === substr($bin, -4)) {
  12809. $caller = 'call';
  12810. } else {
  12811. $handle = fopen($bin, 'r');
  12812. $line = fgets($handle);
  12813. fclose($handle);
  12814. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  12815. $caller = trim($match[1]);
  12816. } else {
  12817. $caller = 'php';
  12818. }
  12819. if ($caller === 'php') {
  12820. return "@echo off\r\n".
  12821. "pushd .\r\n".
  12822. "cd %~dp0\r\n".
  12823. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  12824. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  12825. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  12826. "popd\r\n".
  12827. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  12828. }
  12829. }
  12830. return "@echo off\r\n".
  12831. "pushd .\r\n".
  12832. "cd %~dp0\r\n".
  12833. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  12834. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  12835. "popd\r\n".
  12836. $caller." \"%BIN_TARGET%\" %*\r\n";
  12837. }
  12838. private function generateWindowsPhpProxyCode()
  12839. {
  12840. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  12841. return
  12842. "@echo off\r\n" .
  12843. "setlocal enabledelayedexpansion\r\n" .
  12844. "set BIN_DIR=%~dp0\r\n" .
  12845. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  12846. "set DIRS=.\r\n" .
  12847. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  12848. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  12849. " set DIRS=!DIRS!;%%~fP\r\n" .
  12850. " )\r\n" .
  12851. ")\r\n" .
  12852. "php.exe -d include_path=!DIRS! %*\r\n";
  12853. }
  12854. private function generateUnixyPhpProxyCode()
  12855. {
  12856. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  12857. return
  12858. "#!/usr/bin/env sh\n".
  12859. "SRC_DIR=`pwd`\n".
  12860. "BIN_DIR=`dirname $0`\n".
  12861. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  12862. "DIRS=\"\"\n".
  12863. "for vendor in \$VENDOR_DIR/*; do\n".
  12864. " if [ -d \"\$vendor\" ]; then\n".
  12865. " for package in \$vendor/*; do\n".
  12866. " if [ -d \"\$package\" ]; then\n".
  12867. " DIRS=\"\${DIRS}:\${package}\"\n".
  12868. " fi\n".
  12869. " done\n".
  12870. " fi\n".
  12871. "done\n".
  12872. "php -d include_path=\".\$DIRS\" $@\n";
  12873. }
  12874. }
  12875. <?php
  12876. namespace Composer\Installer;
  12877. use Composer\Composer;
  12878. use Composer\IO\IOInterface;
  12879. use Composer\Repository\InstalledRepositoryInterface;
  12880. use Composer\Package\PackageInterface;
  12881. class PluginInstaller extends LibraryInstaller
  12882. {
  12883. private $installationManager;
  12884. public function __construct(IOInterface $io, Composer $composer, $type = 'library')
  12885. {
  12886. parent::__construct($io, $composer, 'composer-plugin');
  12887. $this->installationManager = $composer->getInstallationManager();
  12888. }
  12889. public function supports($packageType)
  12890. {
  12891. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  12892. }
  12893. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  12894. {
  12895. $extra = $package->getExtra();
  12896. if (empty($extra['class'])) {
  12897. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  12898. }
  12899. parent::install($repo, $package);
  12900. $this->composer->getPluginManager()->registerPackage($package, true);
  12901. }
  12902. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  12903. {
  12904. $extra = $target->getExtra();
  12905. if (empty($extra['class'])) {
  12906. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  12907. }
  12908. parent::update($repo, $initial, $target);
  12909. $this->composer->getPluginManager()->registerPackage($target, true);
  12910. }
  12911. }
  12912. <?php
  12913. namespace Composer\Installer;
  12914. use Composer\Package\PackageInterface;
  12915. use Composer\Downloader\DownloadManager;
  12916. use Composer\Repository\InstalledRepositoryInterface;
  12917. use Composer\Util\Filesystem;
  12918. class ProjectInstaller implements InstallerInterface
  12919. {
  12920. private $installPath;
  12921. private $downloadManager;
  12922. private $filesystem;
  12923. public function __construct($installPath, DownloadManager $dm)
  12924. {
  12925. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  12926. $this->downloadManager = $dm;
  12927. $this->filesystem = new Filesystem;
  12928. }
  12929. public function supports($packageType)
  12930. {
  12931. return true;
  12932. }
  12933. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  12934. {
  12935. return false;
  12936. }
  12937. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  12938. {
  12939. $installPath = $this->installPath;
  12940. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  12941. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  12942. }
  12943. if (!is_dir($installPath)) {
  12944. mkdir($installPath, 0777, true);
  12945. }
  12946. $this->downloadManager->download($package, $installPath);
  12947. }
  12948. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  12949. {
  12950. throw new \InvalidArgumentException("not supported");
  12951. }
  12952. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  12953. {
  12954. throw new \InvalidArgumentException("not supported");
  12955. }
  12956. public function getInstallPath(PackageInterface $package)
  12957. {
  12958. return $this->installPath;
  12959. }
  12960. }
  12961. <?php
  12962. namespace Composer\Json;
  12963. use JsonSchema\Validator;
  12964. use Seld\JsonLint\JsonParser;
  12965. use Seld\JsonLint\ParsingException;
  12966. use Composer\Util\RemoteFilesystem;
  12967. use Composer\IO\IOInterface;
  12968. use Composer\Downloader\TransportException;
  12969. class JsonFile
  12970. {
  12971. const LAX_SCHEMA = 1;
  12972. const STRICT_SCHEMA = 2;
  12973. const JSON_UNESCAPED_SLASHES = 64;
  12974. const JSON_PRETTY_PRINT = 128;
  12975. const JSON_UNESCAPED_UNICODE = 256;
  12976. private $path;
  12977. private $rfs;
  12978. private $io;
  12979. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  12980. {
  12981. $this->path = $path;
  12982. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  12983. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  12984. }
  12985. $this->rfs = $rfs;
  12986. $this->io = $io;
  12987. }
  12988. public function getPath()
  12989. {
  12990. return $this->path;
  12991. }
  12992. public function exists()
  12993. {
  12994. return is_file($this->path);
  12995. }
  12996. public function read()
  12997. {
  12998. try {
  12999. if ($this->rfs) {
  13000. $json = $this->rfs->getContents($this->path, $this->path, false);
  13001. } else {
  13002. if ($this->io && $this->io->isDebug()) {
  13003. $this->io->writeError('Reading ' . $this->path);
  13004. }
  13005. $json = file_get_contents($this->path);
  13006. }
  13007. } catch (TransportException $e) {
  13008. throw new \RuntimeException($e->getMessage(), 0, $e);
  13009. } catch (\Exception $e) {
  13010. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  13011. }
  13012. return static::parseJson($json, $this->path);
  13013. }
  13014. public function write(array $hash, $options = 448)
  13015. {
  13016. $dir = dirname($this->path);
  13017. if (!is_dir($dir)) {
  13018. if (file_exists($dir)) {
  13019. throw new \UnexpectedValueException(
  13020. $dir.' exists and is not a directory.'
  13021. );
  13022. }
  13023. if (!@mkdir($dir, 0777, true)) {
  13024. throw new \UnexpectedValueException(
  13025. $dir.' does not exist and could not be created.'
  13026. );
  13027. }
  13028. }
  13029. $retries = 3;
  13030. while ($retries--) {
  13031. try {
  13032. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  13033. break;
  13034. } catch (\Exception $e) {
  13035. if ($retries) {
  13036. usleep(500000);
  13037. continue;
  13038. }
  13039. throw $e;
  13040. }
  13041. }
  13042. }
  13043. public function validateSchema($schema = self::STRICT_SCHEMA)
  13044. {
  13045. $content = file_get_contents($this->path);
  13046. $data = json_decode($content);
  13047. if (null === $data && 'null' !== $content) {
  13048. self::validateSyntax($content, $this->path);
  13049. }
  13050. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  13051. $schemaData = json_decode(file_get_contents($schemaFile));
  13052. if ($schema === self::LAX_SCHEMA) {
  13053. $schemaData->additionalProperties = true;
  13054. $schemaData->required = array();
  13055. }
  13056. $validator = new Validator();
  13057. $validator->check($data, $schemaData);
  13058. if (!$validator->isValid()) {
  13059. $errors = array();
  13060. foreach ((array) $validator->getErrors() as $error) {
  13061. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  13062. }
  13063. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  13064. }
  13065. return true;
  13066. }
  13067. public static function encode($data, $options = 448)
  13068. {
  13069. if (PHP_VERSION_ID >= 50400) {
  13070. $json = json_encode($data, $options);
  13071. if (false === $json) {
  13072. self::throwEncodeError(json_last_error());
  13073. }
  13074. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  13075. $json = preg_replace('/\[\s+\]/', '[]', $json);
  13076. $json = preg_replace('/\{\s+\}/', '{}', $json);
  13077. }
  13078. return $json;
  13079. }
  13080. $json = json_encode($data);
  13081. if (false === $json) {
  13082. self::throwEncodeError(json_last_error());
  13083. }
  13084. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  13085. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  13086. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  13087. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  13088. return $json;
  13089. }
  13090. $result = JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  13091. return $result;
  13092. }
  13093. private static function throwEncodeError($code)
  13094. {
  13095. switch ($code) {
  13096. case JSON_ERROR_DEPTH:
  13097. $msg = 'Maximum stack depth exceeded';
  13098. break;
  13099. case JSON_ERROR_STATE_MISMATCH:
  13100. $msg = 'Underflow or the modes mismatch';
  13101. break;
  13102. case JSON_ERROR_CTRL_CHAR:
  13103. $msg = 'Unexpected control character found';
  13104. break;
  13105. case JSON_ERROR_UTF8:
  13106. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  13107. break;
  13108. default:
  13109. $msg = 'Unknown error';
  13110. }
  13111. throw new \RuntimeException('JSON encoding failed: '.$msg);
  13112. }
  13113. public static function parseJson($json, $file = null)
  13114. {
  13115. if (null === $json) {
  13116. return;
  13117. }
  13118. $data = json_decode($json, true);
  13119. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  13120. self::validateSyntax($json, $file);
  13121. }
  13122. return $data;
  13123. }
  13124. protected static function validateSyntax($json, $file = null)
  13125. {
  13126. $parser = new JsonParser();
  13127. $result = $parser->lint($json);
  13128. if (null === $result) {
  13129. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  13130. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  13131. }
  13132. return true;
  13133. }
  13134. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  13135. }
  13136. }
  13137. <?php
  13138. namespace Composer\Json;
  13139. class JsonFormatter
  13140. {
  13141. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  13142. {
  13143. $result = '';
  13144. $pos = 0;
  13145. $strLen = strlen($json);
  13146. $indentStr = ' ';
  13147. $newLine = "\n";
  13148. $outOfQuotes = true;
  13149. $buffer = '';
  13150. $noescape = true;
  13151. for ($i = 0; $i < $strLen; $i++) {
  13152. $char = substr($json, $i, 1);
  13153. if ('"' === $char && $noescape) {
  13154. $outOfQuotes = !$outOfQuotes;
  13155. }
  13156. if (!$outOfQuotes) {
  13157. $buffer .= $char;
  13158. $noescape = '\\' === $char ? !$noescape : true;
  13159. continue;
  13160. } elseif ('' !== $buffer) {
  13161. if ($unescapeSlashes) {
  13162. $buffer = str_replace('\\/', '/', $buffer);
  13163. }
  13164. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  13165. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  13166. $l = strlen($match[1]);
  13167. if ($l % 2) {
  13168. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  13169. pack('H*', $match[2]),
  13170. 'UTF-8',
  13171. 'UCS-2BE'
  13172. );
  13173. }
  13174. return $match[0];
  13175. }, $buffer);
  13176. }
  13177. $result .= $buffer.$char;
  13178. $buffer = '';
  13179. continue;
  13180. }
  13181. if (':' === $char) {
  13182. $char .= ' ';
  13183. } elseif (('}' === $char || ']' === $char)) {
  13184. $pos--;
  13185. $prevChar = substr($json, $i - 1, 1);
  13186. if ('{' !== $prevChar && '[' !== $prevChar) {
  13187. $result .= $newLine;
  13188. for ($j = 0; $j < $pos; $j++) {
  13189. $result .= $indentStr;
  13190. }
  13191. } else {
  13192. $result = rtrim($result);
  13193. }
  13194. }
  13195. $result .= $char;
  13196. if (',' === $char || '{' === $char || '[' === $char) {
  13197. $result .= $newLine;
  13198. if ('{' === $char || '[' === $char) {
  13199. $pos++;
  13200. }
  13201. for ($j = 0; $j < $pos; $j++) {
  13202. $result .= $indentStr;
  13203. }
  13204. }
  13205. }
  13206. return $result;
  13207. }
  13208. }
  13209. <?php
  13210. namespace Composer\Json;
  13211. use Composer\Repository\PlatformRepository;
  13212. class JsonManipulator
  13213. {
  13214. private static $RECURSE_BLOCKS;
  13215. private static $RECURSE_ARRAYS;
  13216. private static $JSON_VALUE;
  13217. private static $JSON_STRING;
  13218. private $contents;
  13219. private $newline;
  13220. private $indent;
  13221. public function __construct($contents)
  13222. {
  13223. if (!self::$RECURSE_BLOCKS) {
  13224. self::$RECURSE_BLOCKS = '(?:[^{}]*|\{(?:[^{}]*|\{(?:[^{}]*|\{(?:[^{}]*|\{[^{}]*\})*\})*\})*\})*';
  13225. self::$RECURSE_ARRAYS = '(?:[^\]]*|\[(?:[^\]]*|\[(?:[^\]]*|\[(?:[^\]]*|\[[^\]]*\])*\])*\])*\]|'.self::$RECURSE_BLOCKS.')*';
  13226. self::$JSON_STRING = '"(?:[^\0-\x09\x0a-\x1f\\\\"]+|\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})*"';
  13227. self::$JSON_VALUE = '(?:[0-9.]+|null|true|false|'.self::$JSON_STRING.'|\['.self::$RECURSE_ARRAYS.'\]|\{'.self::$RECURSE_BLOCKS.'\})';
  13228. }
  13229. $contents = trim($contents);
  13230. if ($contents === '') {
  13231. $contents = '{}';
  13232. }
  13233. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  13234. throw new \InvalidArgumentException('The json file must be an object ({})');
  13235. }
  13236. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  13237. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  13238. $this->detectIndenting();
  13239. }
  13240. public function getContents()
  13241. {
  13242. return $this->contents . $this->newline;
  13243. }
  13244. public function addLink($type, $package, $constraint, $sortPackages = false)
  13245. {
  13246. $decoded = JsonFile::parseJson($this->contents);
  13247. if (!isset($decoded[$type])) {
  13248. return $this->addMainKey($type, array($package => $constraint));
  13249. }
  13250. $regex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
  13251. '('.preg_quote(JsonFile::encode($type)).'\s*:\s*)('.self::$JSON_VALUE.')(.*)}s';
  13252. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  13253. return false;
  13254. }
  13255. $links = $matches[3];
  13256. if (isset($decoded[$type][$package])) {
  13257. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  13258. $links = preg_replace('{"'.$packageRegex.'"(\s*:\s*)'.self::$JSON_STRING.'}i', addcslashes(JsonFile::encode($package).'${1}"'.$constraint.'"', '\\'), $links);
  13259. } else {
  13260. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  13261. $links = preg_replace(
  13262. '{'.preg_quote($match[1]).'$}',
  13263. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\'),
  13264. $links
  13265. );
  13266. } else {
  13267. $links = '{' . $this->newline .
  13268. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  13269. $this->indent . '}';
  13270. }
  13271. }
  13272. if (true === $sortPackages) {
  13273. $requirements = json_decode($links, true);
  13274. $this->sortPackages($requirements);
  13275. $links = $this->format($requirements);
  13276. }
  13277. $this->contents = $matches[1] . $matches[2] . $links . $matches[4];
  13278. return true;
  13279. }
  13280. private function sortPackages(array &$packages = array())
  13281. {
  13282. $prefix = function ($requirement) {
  13283. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  13284. return preg_replace(
  13285. array(
  13286. '/^php/',
  13287. '/^hhvm/',
  13288. '/^ext/',
  13289. '/^lib/',
  13290. '/^\D/',
  13291. ),
  13292. array(
  13293. '0-$0',
  13294. '1-$0',
  13295. '2-$0',
  13296. '3-$0',
  13297. '4-$0',
  13298. ),
  13299. $requirement
  13300. );
  13301. }
  13302. return '5-'.$requirement;
  13303. };
  13304. uksort($packages, function ($a, $b) use ($prefix) {
  13305. return strnatcmp($prefix($a), $prefix($b));
  13306. });
  13307. }
  13308. public function addRepository($name, $config)
  13309. {
  13310. return $this->addSubNode('repositories', $name, $config);
  13311. }
  13312. public function removeRepository($name)
  13313. {
  13314. return $this->removeSubNode('repositories', $name);
  13315. }
  13316. public function addConfigSetting($name, $value)
  13317. {
  13318. return $this->addSubNode('config', $name, $value);
  13319. }
  13320. public function removeConfigSetting($name)
  13321. {
  13322. return $this->removeSubNode('config', $name);
  13323. }
  13324. public function addSubNode($mainNode, $name, $value)
  13325. {
  13326. $decoded = JsonFile::parseJson($this->contents);
  13327. $subName = null;
  13328. if (in_array($mainNode, array('config', 'repositories')) && false !== strpos($name, '.')) {
  13329. list($name, $subName) = explode('.', $name, 2);
  13330. }
  13331. if (!isset($decoded[$mainNode])) {
  13332. if ($subName !== null) {
  13333. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  13334. } else {
  13335. $this->addMainKey($mainNode, array($name => $value));
  13336. }
  13337. return true;
  13338. }
  13339. $nodeRegex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
  13340. '('.preg_quote(JsonFile::encode($mainNode)).'\s*:\s*\{)('.self::$RECURSE_BLOCKS.')(\})(.*)}s';
  13341. try {
  13342. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  13343. return false;
  13344. }
  13345. } catch (\RuntimeException $e) {
  13346. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  13347. return false;
  13348. }
  13349. throw $e;
  13350. }
  13351. $children = $match[3];
  13352. if (!@json_decode('{'.$children.'}')) {
  13353. return false;
  13354. }
  13355. $that = $this;
  13356. if ($this->pregMatch('{("'.preg_quote($name).'"\s*:\s*)('.self::$JSON_VALUE.')(,?)}', $children, $matches)) {
  13357. $children = preg_replace_callback('{("'.preg_quote($name).'"\s*:\s*)('.self::$JSON_VALUE.')(,?)}', function ($matches) use ($name, $subName, $value, $that) {
  13358. if ($subName !== null) {
  13359. $curVal = json_decode($matches[2], true);
  13360. $curVal[$subName] = $value;
  13361. $value = $curVal;
  13362. }
  13363. return $matches[1] . $that->format($value, 1) . $matches[3];
  13364. }, $children);
  13365. } elseif ($this->pregMatch('#[^\s](\s*)$#', $children, $match)) {
  13366. if ($subName !== null) {
  13367. $value = array($subName => $value);
  13368. }
  13369. $children = preg_replace(
  13370. '#'.$match[1].'$#',
  13371. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $match[1], '\\'),
  13372. $children
  13373. );
  13374. } else {
  13375. if ($subName !== null) {
  13376. $value = array($subName => $value);
  13377. }
  13378. $children = $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $children;
  13379. }
  13380. $this->contents = preg_replace($nodeRegex, addcslashes('${1}${2}'.$children.'${4}${5}', '\\'), $this->contents);
  13381. return true;
  13382. }
  13383. public function removeSubNode($mainNode, $name)
  13384. {
  13385. $decoded = JsonFile::parseJson($this->contents);
  13386. if (empty($decoded[$mainNode])) {
  13387. return true;
  13388. }
  13389. $nodeRegex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
  13390. '('.preg_quote(JsonFile::encode($mainNode)).'\s*:\s*\{)('.self::$RECURSE_BLOCKS.')(\})(.*)}s';
  13391. try {
  13392. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  13393. return false;
  13394. }
  13395. } catch (\RuntimeException $e) {
  13396. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  13397. return false;
  13398. }
  13399. throw $e;
  13400. }
  13401. $children = $match[3];
  13402. if (!@json_decode('{'.$children.'}', true)) {
  13403. return false;
  13404. }
  13405. $subName = null;
  13406. if (in_array($mainNode, array('config', 'repositories')) && false !== strpos($name, '.')) {
  13407. list($name, $subName) = explode('.', $name, 2);
  13408. }
  13409. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  13410. return true;
  13411. }
  13412. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  13413. if (preg_match_all('{"'.preg_quote($name).'"\s*:\s*(?:'.self::$JSON_VALUE.')}', $children, $matches)) {
  13414. $bestMatch = '';
  13415. foreach ($matches[0] as $match) {
  13416. if (strlen($bestMatch) < strlen($match)) {
  13417. $bestMatch = $match;
  13418. }
  13419. }
  13420. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  13421. if (1 !== $count) {
  13422. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  13423. if (1 !== $count) {
  13424. return false;
  13425. }
  13426. }
  13427. }
  13428. } else {
  13429. $childrenClean = $children;
  13430. }
  13431. if (!trim($childrenClean)) {
  13432. $this->contents = preg_replace($nodeRegex, '$1$2'.$this->newline.$this->indent.'$4$5', $this->contents);
  13433. if ($subName !== null) {
  13434. $curVal = json_decode('{'.$children.'}', true);
  13435. unset($curVal[$name][$subName]);
  13436. $this->addSubNode($mainNode, $name, $curVal[$name]);
  13437. }
  13438. return true;
  13439. }
  13440. $that = $this;
  13441. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  13442. if ($subName !== null) {
  13443. $curVal = json_decode('{'.$matches[3].'}', true);
  13444. unset($curVal[$name][$subName]);
  13445. $childrenClean = substr($that->format($curVal, 0), 1, -1);
  13446. }
  13447. return $matches[1] . $matches[2] . $childrenClean . $matches[4] . $matches[5];
  13448. }, $this->contents);
  13449. return true;
  13450. }
  13451. public function addMainKey($key, $content)
  13452. {
  13453. $decoded = JsonFile::parseJson($this->contents);
  13454. $content = $this->format($content);
  13455. $regex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
  13456. '('.preg_quote(JsonFile::encode($key)).'\s*:\s*'.self::$JSON_VALUE.')(.*)}s';
  13457. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  13458. if (!@json_decode('{'.$matches[2].'}')) {
  13459. return false;
  13460. }
  13461. $this->contents = $matches[1] . JsonFile::encode($key).': '.$content . $matches[3];
  13462. return true;
  13463. }
  13464. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  13465. $this->contents = preg_replace(
  13466. '#'.$match[1].'\}$#',
  13467. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\'),
  13468. $this->contents
  13469. );
  13470. return true;
  13471. }
  13472. $this->contents = preg_replace(
  13473. '#\}$#',
  13474. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\'),
  13475. $this->contents
  13476. );
  13477. return true;
  13478. }
  13479. public function format($data, $depth = 0)
  13480. {
  13481. if (is_array($data)) {
  13482. reset($data);
  13483. if (is_numeric(key($data))) {
  13484. foreach ($data as $key => $val) {
  13485. $data[$key] = $this->format($val, $depth + 1);
  13486. }
  13487. return '['.implode(', ', $data).']';
  13488. }
  13489. $out = '{' . $this->newline;
  13490. $elems = array();
  13491. foreach ($data as $key => $val) {
  13492. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  13493. }
  13494. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  13495. }
  13496. return JsonFile::encode($data);
  13497. }
  13498. protected function detectIndenting()
  13499. {
  13500. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  13501. $this->indent = $match[1];
  13502. } else {
  13503. $this->indent = ' ';
  13504. }
  13505. }
  13506. protected function pregMatch($re, $str, &$matches = array())
  13507. {
  13508. $count = preg_match($re, $str, $matches);
  13509. if ($count === false) {
  13510. switch (preg_last_error()) {
  13511. case PREG_NO_ERROR:
  13512. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  13513. case PREG_INTERNAL_ERROR:
  13514. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  13515. case PREG_BACKTRACK_LIMIT_ERROR:
  13516. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  13517. case PREG_RECURSION_LIMIT_ERROR:
  13518. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  13519. case PREG_BAD_UTF8_ERROR:
  13520. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  13521. case PREG_BAD_UTF8_OFFSET_ERROR:
  13522. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  13523. default:
  13524. throw new \RuntimeException('Failed to execute regex: Unknown error');
  13525. }
  13526. }
  13527. return $count;
  13528. }
  13529. }
  13530. <?php
  13531. namespace Composer\Json;
  13532. use Exception;
  13533. class JsonValidationException extends Exception
  13534. {
  13535. protected $errors;
  13536. public function __construct($message, $errors = array(), Exception $previous = null)
  13537. {
  13538. $this->errors = $errors;
  13539. parent::__construct($message, 0, $previous);
  13540. }
  13541. public function getErrors()
  13542. {
  13543. return $this->errors;
  13544. }
  13545. }
  13546. <?php
  13547. namespace Composer\Package;
  13548. use Composer\Semver\Constraint\Constraint;
  13549. use Composer\Package\Version\VersionParser;
  13550. class AliasPackage extends BasePackage implements CompletePackageInterface
  13551. {
  13552. protected $version;
  13553. protected $prettyVersion;
  13554. protected $dev;
  13555. protected $aliasOf;
  13556. protected $rootPackageAlias = false;
  13557. protected $stability;
  13558. protected $requires;
  13559. protected $devRequires;
  13560. protected $conflicts;
  13561. protected $provides;
  13562. protected $replaces;
  13563. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  13564. {
  13565. parent::__construct($aliasOf->getName());
  13566. $this->version = $version;
  13567. $this->prettyVersion = $prettyVersion;
  13568. $this->aliasOf = $aliasOf;
  13569. $this->stability = VersionParser::parseStability($version);
  13570. $this->dev = $this->stability === 'dev';
  13571. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  13572. $links = $aliasOf->{'get' . ucfirst($type)}();
  13573. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  13574. }
  13575. }
  13576. public function getAliasOf()
  13577. {
  13578. return $this->aliasOf;
  13579. }
  13580. public function getVersion()
  13581. {
  13582. return $this->version;
  13583. }
  13584. public function getStability()
  13585. {
  13586. return $this->stability;
  13587. }
  13588. public function getPrettyVersion()
  13589. {
  13590. return $this->prettyVersion;
  13591. }
  13592. public function isDev()
  13593. {
  13594. return $this->dev;
  13595. }
  13596. public function getRequires()
  13597. {
  13598. return $this->requires;
  13599. }
  13600. public function getConflicts()
  13601. {
  13602. return $this->conflicts;
  13603. }
  13604. public function getProvides()
  13605. {
  13606. return $this->provides;
  13607. }
  13608. public function getReplaces()
  13609. {
  13610. return $this->replaces;
  13611. }
  13612. public function getDevRequires()
  13613. {
  13614. return $this->devRequires;
  13615. }
  13616. public function setRootPackageAlias($value)
  13617. {
  13618. return $this->rootPackageAlias = $value;
  13619. }
  13620. public function isRootPackageAlias()
  13621. {
  13622. return $this->rootPackageAlias;
  13623. }
  13624. protected function replaceSelfVersionDependencies(array $links, $linkType)
  13625. {
  13626. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  13627. $newLinks = array();
  13628. foreach ($links as $link) {
  13629. if ('self.version' === $link->getPrettyConstraint()) {
  13630. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  13631. }
  13632. }
  13633. $links = array_merge($links, $newLinks);
  13634. } else {
  13635. foreach ($links as $index => $link) {
  13636. if ('self.version' === $link->getPrettyConstraint()) {
  13637. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  13638. }
  13639. }
  13640. }
  13641. return $links;
  13642. }
  13643. public function getType()
  13644. {
  13645. return $this->aliasOf->getType();
  13646. }
  13647. public function getTargetDir()
  13648. {
  13649. return $this->aliasOf->getTargetDir();
  13650. }
  13651. public function getExtra()
  13652. {
  13653. return $this->aliasOf->getExtra();
  13654. }
  13655. public function setInstallationSource($type)
  13656. {
  13657. $this->aliasOf->setInstallationSource($type);
  13658. }
  13659. public function getInstallationSource()
  13660. {
  13661. return $this->aliasOf->getInstallationSource();
  13662. }
  13663. public function getSourceType()
  13664. {
  13665. return $this->aliasOf->getSourceType();
  13666. }
  13667. public function getSourceUrl()
  13668. {
  13669. return $this->aliasOf->getSourceUrl();
  13670. }
  13671. public function getSourceUrls()
  13672. {
  13673. return $this->aliasOf->getSourceUrls();
  13674. }
  13675. public function getSourceReference()
  13676. {
  13677. return $this->aliasOf->getSourceReference();
  13678. }
  13679. public function setSourceReference($reference)
  13680. {
  13681. return $this->aliasOf->setSourceReference($reference);
  13682. }
  13683. public function setSourceMirrors($mirrors)
  13684. {
  13685. return $this->aliasOf->setSourceMirrors($mirrors);
  13686. }
  13687. public function getSourceMirrors()
  13688. {
  13689. return $this->aliasOf->getSourceMirrors();
  13690. }
  13691. public function getDistType()
  13692. {
  13693. return $this->aliasOf->getDistType();
  13694. }
  13695. public function getDistUrl()
  13696. {
  13697. return $this->aliasOf->getDistUrl();
  13698. }
  13699. public function getDistUrls()
  13700. {
  13701. return $this->aliasOf->getDistUrls();
  13702. }
  13703. public function getDistReference()
  13704. {
  13705. return $this->aliasOf->getDistReference();
  13706. }
  13707. public function setDistReference($reference)
  13708. {
  13709. return $this->aliasOf->setDistReference($reference);
  13710. }
  13711. public function getDistSha1Checksum()
  13712. {
  13713. return $this->aliasOf->getDistSha1Checksum();
  13714. }
  13715. public function setTransportOptions(array $options)
  13716. {
  13717. return $this->aliasOf->setTransportOptions($options);
  13718. }
  13719. public function getTransportOptions()
  13720. {
  13721. return $this->aliasOf->getTransportOptions();
  13722. }
  13723. public function setDistMirrors($mirrors)
  13724. {
  13725. return $this->aliasOf->setDistMirrors($mirrors);
  13726. }
  13727. public function getDistMirrors()
  13728. {
  13729. return $this->aliasOf->getDistMirrors();
  13730. }
  13731. public function getScripts()
  13732. {
  13733. return $this->aliasOf->getScripts();
  13734. }
  13735. public function getLicense()
  13736. {
  13737. return $this->aliasOf->getLicense();
  13738. }
  13739. public function getAutoload()
  13740. {
  13741. return $this->aliasOf->getAutoload();
  13742. }
  13743. public function getDevAutoload()
  13744. {
  13745. return $this->aliasOf->getDevAutoload();
  13746. }
  13747. public function getIncludePaths()
  13748. {
  13749. return $this->aliasOf->getIncludePaths();
  13750. }
  13751. public function getRepositories()
  13752. {
  13753. return $this->aliasOf->getRepositories();
  13754. }
  13755. public function getReleaseDate()
  13756. {
  13757. return $this->aliasOf->getReleaseDate();
  13758. }
  13759. public function getBinaries()
  13760. {
  13761. return $this->aliasOf->getBinaries();
  13762. }
  13763. public function getKeywords()
  13764. {
  13765. return $this->aliasOf->getKeywords();
  13766. }
  13767. public function getDescription()
  13768. {
  13769. return $this->aliasOf->getDescription();
  13770. }
  13771. public function getHomepage()
  13772. {
  13773. return $this->aliasOf->getHomepage();
  13774. }
  13775. public function getSuggests()
  13776. {
  13777. return $this->aliasOf->getSuggests();
  13778. }
  13779. public function getAuthors()
  13780. {
  13781. return $this->aliasOf->getAuthors();
  13782. }
  13783. public function getSupport()
  13784. {
  13785. return $this->aliasOf->getSupport();
  13786. }
  13787. public function getNotificationUrl()
  13788. {
  13789. return $this->aliasOf->getNotificationUrl();
  13790. }
  13791. public function getArchiveExcludes()
  13792. {
  13793. return $this->aliasOf->getArchiveExcludes();
  13794. }
  13795. public function isAbandoned()
  13796. {
  13797. return $this->aliasOf->isAbandoned();
  13798. }
  13799. public function getReplacementPackage()
  13800. {
  13801. return $this->aliasOf->getReplacementPackage();
  13802. }
  13803. public function __toString()
  13804. {
  13805. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  13806. }
  13807. }
  13808. <?php
  13809. namespace Composer\Package\Archiver;
  13810. use Composer\Util\Filesystem;
  13811. use Symfony\Component\Finder\Finder;
  13812. class ArchivableFilesFinder extends \FilterIterator
  13813. {
  13814. protected $finder;
  13815. public function __construct($sources, array $excludes)
  13816. {
  13817. $fs = new Filesystem();
  13818. $sources = $fs->normalizePath($sources);
  13819. $filters = array(
  13820. new HgExcludeFilter($sources),
  13821. new GitExcludeFilter($sources),
  13822. new ComposerExcludeFilter($sources, $excludes),
  13823. );
  13824. $this->finder = new Finder();
  13825. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  13826. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  13827. return false;
  13828. }
  13829. $relativePath = preg_replace(
  13830. '#^'.preg_quote($sources, '#').'#',
  13831. '',
  13832. $fs->normalizePath($file->getRealPath())
  13833. );
  13834. $exclude = false;
  13835. foreach ($filters as $filter) {
  13836. $exclude = $filter->filter($relativePath, $exclude);
  13837. }
  13838. return !$exclude;
  13839. };
  13840. if (method_exists($filter, 'bindTo')) {
  13841. $filter = $filter->bindTo(null);
  13842. }
  13843. $this->finder
  13844. ->in($sources)
  13845. ->filter($filter)
  13846. ->ignoreVCS(true)
  13847. ->ignoreDotFiles(false);
  13848. parent::__construct($this->finder->getIterator());
  13849. }
  13850. public function accept()
  13851. {
  13852. return !$this->getInnerIterator()->current()->isDir();
  13853. }
  13854. }
  13855. <?php
  13856. namespace Composer\Package\Archiver;
  13857. use Composer\Downloader\DownloadManager;
  13858. use Composer\Package\PackageInterface;
  13859. use Composer\Package\RootPackageInterface;
  13860. use Composer\Util\Filesystem;
  13861. use Composer\Json\JsonFile;
  13862. class ArchiveManager
  13863. {
  13864. protected $downloadManager;
  13865. protected $archivers = array();
  13866. protected $overwriteFiles = true;
  13867. public function __construct(DownloadManager $downloadManager)
  13868. {
  13869. $this->downloadManager = $downloadManager;
  13870. }
  13871. public function addArchiver(ArchiverInterface $archiver)
  13872. {
  13873. $this->archivers[] = $archiver;
  13874. }
  13875. public function setOverwriteFiles($overwriteFiles)
  13876. {
  13877. $this->overwriteFiles = $overwriteFiles;
  13878. return $this;
  13879. }
  13880. public function getPackageFilename(PackageInterface $package)
  13881. {
  13882. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  13883. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  13884. $nameParts = array_merge($nameParts, array($package->getDistReference(), $package->getDistType()));
  13885. } else {
  13886. $nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference()));
  13887. }
  13888. if ($package->getSourceReference()) {
  13889. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  13890. }
  13891. $name = implode('-', array_filter($nameParts, function ($p) {
  13892. return !empty($p);
  13893. }));
  13894. return str_replace('/', '-', $name);
  13895. }
  13896. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null)
  13897. {
  13898. if (empty($format)) {
  13899. throw new \InvalidArgumentException('Format must be specified');
  13900. }
  13901. $usableArchiver = null;
  13902. foreach ($this->archivers as $archiver) {
  13903. if ($archiver->supports($format, $package->getSourceType())) {
  13904. $usableArchiver = $archiver;
  13905. break;
  13906. }
  13907. }
  13908. if (null === $usableArchiver) {
  13909. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  13910. }
  13911. $filesystem = new Filesystem();
  13912. if (null === $fileName) {
  13913. $packageName = $this->getPackageFilename($package);
  13914. } else {
  13915. $packageName = $fileName;
  13916. }
  13917. $filesystem->ensureDirectoryExists($targetDir);
  13918. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  13919. $filesystem->ensureDirectoryExists(dirname($target));
  13920. if (!$this->overwriteFiles && file_exists($target)) {
  13921. return $target;
  13922. }
  13923. if ($package instanceof RootPackageInterface) {
  13924. $sourcePath = realpath('.');
  13925. } else {
  13926. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  13927. $filesystem->ensureDirectoryExists($sourcePath);
  13928. $this->downloadManager->download($package, $sourcePath);
  13929. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  13930. $jsonFile = new JsonFile($composerJsonPath);
  13931. $jsonData = $jsonFile->read();
  13932. if (!empty($jsonData['archive']['exclude'])) {
  13933. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  13934. }
  13935. }
  13936. }
  13937. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  13938. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  13939. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes());
  13940. rename($archivePath, $target);
  13941. if (!$package instanceof RootPackageInterface) {
  13942. $filesystem->removeDirectory($sourcePath);
  13943. }
  13944. $filesystem->remove($tempTarget);
  13945. return $target;
  13946. }
  13947. }
  13948. <?php
  13949. namespace Composer\Package\Archiver;
  13950. interface ArchiverInterface
  13951. {
  13952. public function archive($sources, $target, $format, array $excludes = array());
  13953. public function supports($format, $sourceType);
  13954. }
  13955. <?php
  13956. namespace Composer\Package\Archiver;
  13957. use Symfony\Component\Finder;
  13958. abstract class BaseExcludeFilter
  13959. {
  13960. protected $sourcePath;
  13961. protected $excludePatterns;
  13962. public function __construct($sourcePath)
  13963. {
  13964. $this->sourcePath = $sourcePath;
  13965. $this->excludePatterns = array();
  13966. }
  13967. public function filter($relativePath, $exclude)
  13968. {
  13969. foreach ($this->excludePatterns as $patternData) {
  13970. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  13971. if ($stripLeadingSlash) {
  13972. $path = substr($relativePath, 1);
  13973. } else {
  13974. $path = $relativePath;
  13975. }
  13976. if (preg_match($pattern, $path)) {
  13977. $exclude = !$negate;
  13978. }
  13979. }
  13980. return $exclude;
  13981. }
  13982. protected function parseLines(array $lines, $lineParser)
  13983. {
  13984. return array_filter(
  13985. array_map(
  13986. function ($line) use ($lineParser) {
  13987. $line = trim($line);
  13988. if (!$line || 0 === strpos($line, '#')) {
  13989. return;
  13990. }
  13991. return call_user_func($lineParser, $line);
  13992. },
  13993. $lines
  13994. ),
  13995. function ($pattern) {
  13996. return $pattern !== null;
  13997. }
  13998. );
  13999. }
  14000. protected function generatePatterns($rules)
  14001. {
  14002. $patterns = array();
  14003. foreach ($rules as $rule) {
  14004. $patterns[] = $this->generatePattern($rule);
  14005. }
  14006. return $patterns;
  14007. }
  14008. protected function generatePattern($rule)
  14009. {
  14010. $negate = false;
  14011. $pattern = '{';
  14012. if (strlen($rule) && $rule[0] === '!') {
  14013. $negate = true;
  14014. $rule = substr($rule, 1);
  14015. }
  14016. if (strlen($rule) && $rule[0] === '/') {
  14017. $pattern .= '^/';
  14018. $rule = substr($rule, 1);
  14019. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  14020. $pattern .= '/';
  14021. $rule = substr($rule, 0, -1);
  14022. } elseif (false === strpos($rule, '/')) {
  14023. $pattern .= '/';
  14024. }
  14025. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  14026. return array($pattern . '}', $negate, false);
  14027. }
  14028. }
  14029. <?php
  14030. namespace Composer\Package\Archiver;
  14031. class ComposerExcludeFilter extends BaseExcludeFilter
  14032. {
  14033. public function __construct($sourcePath, array $excludeRules)
  14034. {
  14035. parent::__construct($sourcePath);
  14036. $this->excludePatterns = $this->generatePatterns($excludeRules);
  14037. }
  14038. }
  14039. <?php
  14040. namespace Composer\Package\Archiver;
  14041. class GitExcludeFilter extends BaseExcludeFilter
  14042. {
  14043. public function __construct($sourcePath)
  14044. {
  14045. parent::__construct($sourcePath);
  14046. if (file_exists($sourcePath.'/.gitignore')) {
  14047. $this->excludePatterns = $this->parseLines(
  14048. file($sourcePath.'/.gitignore'),
  14049. array($this, 'parseGitIgnoreLine')
  14050. );
  14051. }
  14052. if (file_exists($sourcePath.'/.gitattributes')) {
  14053. $this->excludePatterns = array_merge(
  14054. $this->excludePatterns,
  14055. $this->parseLines(
  14056. file($sourcePath.'/.gitattributes'),
  14057. array($this, 'parseGitAttributesLine')
  14058. ));
  14059. }
  14060. }
  14061. public function parseGitIgnoreLine($line)
  14062. {
  14063. return $this->generatePattern($line);
  14064. }
  14065. public function parseGitAttributesLine($line)
  14066. {
  14067. $parts = preg_split('#\s+#', $line);
  14068. if (count($parts) != 2) {
  14069. return null;
  14070. }
  14071. if ($parts[1] === 'export-ignore') {
  14072. return $this->generatePattern($parts[0]);
  14073. }
  14074. }
  14075. }
  14076. <?php
  14077. namespace Composer\Package\Archiver;
  14078. use Symfony\Component\Finder;
  14079. class HgExcludeFilter extends BaseExcludeFilter
  14080. {
  14081. const HG_IGNORE_REGEX = 1;
  14082. const HG_IGNORE_GLOB = 2;
  14083. protected $patternMode;
  14084. public function __construct($sourcePath)
  14085. {
  14086. parent::__construct($sourcePath);
  14087. $this->patternMode = self::HG_IGNORE_REGEX;
  14088. if (file_exists($sourcePath.'/.hgignore')) {
  14089. $this->excludePatterns = $this->parseLines(
  14090. file($sourcePath.'/.hgignore'),
  14091. array($this, 'parseHgIgnoreLine')
  14092. );
  14093. }
  14094. }
  14095. public function parseHgIgnoreLine($line)
  14096. {
  14097. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  14098. if ($matches[1] === 'glob') {
  14099. $this->patternMode = self::HG_IGNORE_GLOB;
  14100. } else {
  14101. $this->patternMode = self::HG_IGNORE_REGEX;
  14102. }
  14103. return null;
  14104. }
  14105. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  14106. return $this->patternFromGlob($line);
  14107. } else {
  14108. return $this->patternFromRegex($line);
  14109. }
  14110. }
  14111. protected function patternFromGlob($line)
  14112. {
  14113. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  14114. $pattern = str_replace('[^/]*', '.*', $pattern);
  14115. return array($pattern, false, true);
  14116. }
  14117. public function patternFromRegex($line)
  14118. {
  14119. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  14120. return array($pattern, false, true);
  14121. }
  14122. }
  14123. <?php
  14124. namespace Composer\Package\Archiver;
  14125. class PharArchiver implements ArchiverInterface
  14126. {
  14127. protected static $formats = array(
  14128. 'zip' => \Phar::ZIP,
  14129. 'tar' => \Phar::TAR,
  14130. 'tar.gz' => \Phar::TAR,
  14131. 'tar.bz2' => \Phar::TAR
  14132. );
  14133. protected static $compressFormats = array(
  14134. 'tar.gz' => \Phar::GZ,
  14135. 'tar.bz2' => \Phar::BZ2
  14136. );
  14137. public function archive($sources, $target, $format, array $excludes = array())
  14138. {
  14139. $sources = realpath($sources);
  14140. if (file_exists($target)) {
  14141. unlink($target);
  14142. }
  14143. try {
  14144. $filename = substr($target, 0, strrpos($target, $format) - 1);
  14145. if (isset(static::$compressFormats[$format])) {
  14146. $target = $filename . '.tar';
  14147. }
  14148. $phar = new \PharData($target, null, null, static::$formats[$format]);
  14149. $files = new ArchivableFilesFinder($sources, $excludes);
  14150. $phar->buildFromIterator($files, $sources);
  14151. if (isset(static::$compressFormats[$format])) {
  14152. if (!$phar->canCompress(static::$compressFormats[$format])) {
  14153. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  14154. }
  14155. unlink($target);
  14156. $phar->compress(static::$compressFormats[$format]);
  14157. $target = $filename . '.' . $format;
  14158. }
  14159. return $target;
  14160. } catch (\UnexpectedValueException $e) {
  14161. $message = sprintf("Could not create archive '%s' from '%s': %s",
  14162. $target,
  14163. $sources,
  14164. $e->getMessage()
  14165. );
  14166. throw new \RuntimeException($message, $e->getCode(), $e);
  14167. }
  14168. }
  14169. public function supports($format, $sourceType)
  14170. {
  14171. return isset(static::$formats[$format]);
  14172. }
  14173. }
  14174. <?php
  14175. namespace Composer\Package\Archiver;
  14176. use ZipArchive;
  14177. class ZipArchiver implements ArchiverInterface
  14178. {
  14179. protected static $formats = array(
  14180. 'zip' => 1
  14181. );
  14182. public function archive($sources, $target, $format, array $excludes = array())
  14183. {
  14184. $sources = realpath($sources);
  14185. $zip = new ZipArchive();
  14186. $res = $zip->open($target, ZipArchive::CREATE);
  14187. if ($res === true) {
  14188. $files = new ArchivableFilesFinder($sources, $excludes);
  14189. foreach($files as $file) {
  14190. $filepath = $file->getPath()."/".$file->getFilename();
  14191. $localname = str_replace($sources."/", '', $filepath);
  14192. $zip->addFile($filepath, $localname);
  14193. }
  14194. if ($zip->close()) {
  14195. return $target;
  14196. }
  14197. }
  14198. $message = sprintf("Could not create archive '%s' from '%s': %s",
  14199. $target,
  14200. $sources,
  14201. $zip->getStatusString()
  14202. );
  14203. throw new \RuntimeException($message);
  14204. }
  14205. public function supports($format, $sourceType)
  14206. {
  14207. return isset(static::$formats[$format]) && $this->compressionAvailable();
  14208. }
  14209. private function compressionAvailable() {
  14210. return class_exists('ZipArchive');
  14211. }
  14212. }
  14213. <?php
  14214. namespace Composer\Package;
  14215. use Composer\Repository\RepositoryInterface;
  14216. use Composer\Repository\PlatformRepository;
  14217. abstract class BasePackage implements PackageInterface
  14218. {
  14219. public static $supportedLinkTypes = array(
  14220. 'require' => array('description' => 'requires', 'method' => 'requires'),
  14221. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  14222. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  14223. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  14224. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  14225. );
  14226. const STABILITY_STABLE = 0;
  14227. const STABILITY_RC = 5;
  14228. const STABILITY_BETA = 10;
  14229. const STABILITY_ALPHA = 15;
  14230. const STABILITY_DEV = 20;
  14231. public static $stabilities = array(
  14232. 'stable' => self::STABILITY_STABLE,
  14233. 'RC' => self::STABILITY_RC,
  14234. 'beta' => self::STABILITY_BETA,
  14235. 'alpha' => self::STABILITY_ALPHA,
  14236. 'dev' => self::STABILITY_DEV,
  14237. );
  14238. public $id;
  14239. protected $name;
  14240. protected $prettyName;
  14241. protected $repository;
  14242. protected $transportOptions;
  14243. public function __construct($name)
  14244. {
  14245. $this->prettyName = $name;
  14246. $this->name = strtolower($name);
  14247. $this->id = -1;
  14248. $this->transportOptions = array();
  14249. }
  14250. public function getName()
  14251. {
  14252. return $this->name;
  14253. }
  14254. public function getPrettyName()
  14255. {
  14256. return $this->prettyName;
  14257. }
  14258. public function getNames()
  14259. {
  14260. $names = array(
  14261. $this->getName() => true,
  14262. );
  14263. foreach ($this->getProvides() as $link) {
  14264. $names[$link->getTarget()] = true;
  14265. }
  14266. foreach ($this->getReplaces() as $link) {
  14267. $names[$link->getTarget()] = true;
  14268. }
  14269. return array_keys($names);
  14270. }
  14271. public function setId($id)
  14272. {
  14273. $this->id = $id;
  14274. }
  14275. public function getId()
  14276. {
  14277. return $this->id;
  14278. }
  14279. public function setRepository(RepositoryInterface $repository)
  14280. {
  14281. if ($this->repository && $repository !== $this->repository) {
  14282. throw new \LogicException('A package can only be added to one repository');
  14283. }
  14284. $this->repository = $repository;
  14285. }
  14286. public function getRepository()
  14287. {
  14288. return $this->repository;
  14289. }
  14290. public function getTransportOptions()
  14291. {
  14292. return $this->transportOptions;
  14293. }
  14294. public function setTransportOptions(array $options)
  14295. {
  14296. $this->transportOptions = $options;
  14297. }
  14298. public function isPlatform()
  14299. {
  14300. return $this->getRepository() instanceof PlatformRepository;
  14301. }
  14302. public function getUniqueName()
  14303. {
  14304. return $this->getName().'-'.$this->getVersion();
  14305. }
  14306. public function equals(PackageInterface $package)
  14307. {
  14308. $self = $this;
  14309. if ($this instanceof AliasPackage) {
  14310. $self = $this->getAliasOf();
  14311. }
  14312. if ($package instanceof AliasPackage) {
  14313. $package = $package->getAliasOf();
  14314. }
  14315. return $package === $self;
  14316. }
  14317. public function __toString()
  14318. {
  14319. return $this->getUniqueName();
  14320. }
  14321. public function getPrettyString()
  14322. {
  14323. return $this->getPrettyName().' '.$this->getPrettyVersion();
  14324. }
  14325. public function getFullPrettyVersion($truncate = true)
  14326. {
  14327. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  14328. return $this->getPrettyVersion();
  14329. }
  14330. if ($truncate && strlen($this->getSourceReference()) === 40) {
  14331. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  14332. }
  14333. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  14334. }
  14335. public function getStabilityPriority()
  14336. {
  14337. return self::$stabilities[$this->getStability()];
  14338. }
  14339. public function __clone()
  14340. {
  14341. $this->repository = null;
  14342. $this->id = -1;
  14343. }
  14344. }
  14345. <?php
  14346. namespace Composer\Package;
  14347. class CompletePackage extends Package implements CompletePackageInterface
  14348. {
  14349. protected $repositories;
  14350. protected $license = array();
  14351. protected $keywords;
  14352. protected $authors;
  14353. protected $description;
  14354. protected $homepage;
  14355. protected $scripts = array();
  14356. protected $support = array();
  14357. protected $abandoned = false;
  14358. public function setScripts(array $scripts)
  14359. {
  14360. $this->scripts = $scripts;
  14361. }
  14362. public function getScripts()
  14363. {
  14364. return $this->scripts;
  14365. }
  14366. public function setRepositories($repositories)
  14367. {
  14368. $this->repositories = $repositories;
  14369. }
  14370. public function getRepositories()
  14371. {
  14372. return $this->repositories;
  14373. }
  14374. public function setLicense(array $license)
  14375. {
  14376. $this->license = $license;
  14377. }
  14378. public function getLicense()
  14379. {
  14380. return $this->license;
  14381. }
  14382. public function setKeywords(array $keywords)
  14383. {
  14384. $this->keywords = $keywords;
  14385. }
  14386. public function getKeywords()
  14387. {
  14388. return $this->keywords;
  14389. }
  14390. public function setAuthors(array $authors)
  14391. {
  14392. $this->authors = $authors;
  14393. }
  14394. public function getAuthors()
  14395. {
  14396. return $this->authors;
  14397. }
  14398. public function setDescription($description)
  14399. {
  14400. $this->description = $description;
  14401. }
  14402. public function getDescription()
  14403. {
  14404. return $this->description;
  14405. }
  14406. public function setHomepage($homepage)
  14407. {
  14408. $this->homepage = $homepage;
  14409. }
  14410. public function getHomepage()
  14411. {
  14412. return $this->homepage;
  14413. }
  14414. public function setSupport(array $support)
  14415. {
  14416. $this->support = $support;
  14417. }
  14418. public function getSupport()
  14419. {
  14420. return $this->support;
  14421. }
  14422. public function isAbandoned()
  14423. {
  14424. return (boolean) $this->abandoned;
  14425. }
  14426. public function setAbandoned($abandoned)
  14427. {
  14428. $this->abandoned = $abandoned;
  14429. }
  14430. public function getReplacementPackage()
  14431. {
  14432. return is_string($this->abandoned) ? $this->abandoned : null;
  14433. }
  14434. }
  14435. <?php
  14436. namespace Composer\Package;
  14437. interface CompletePackageInterface extends PackageInterface
  14438. {
  14439. public function getScripts();
  14440. public function getRepositories();
  14441. public function getLicense();
  14442. public function getKeywords();
  14443. public function getDescription();
  14444. public function getHomepage();
  14445. public function getAuthors();
  14446. public function getSupport();
  14447. public function isAbandoned();
  14448. public function getReplacementPackage();
  14449. }
  14450. <?php
  14451. namespace Composer\Package\Dumper;
  14452. use Composer\Package\BasePackage;
  14453. use Composer\Package\PackageInterface;
  14454. use Composer\Package\CompletePackageInterface;
  14455. use Composer\Package\RootPackageInterface;
  14456. class ArrayDumper
  14457. {
  14458. public function dump(PackageInterface $package)
  14459. {
  14460. $keys = array(
  14461. 'binaries' => 'bin',
  14462. 'type',
  14463. 'extra',
  14464. 'installationSource' => 'installation-source',
  14465. 'autoload',
  14466. 'devAutoload' => 'autoload-dev',
  14467. 'notificationUrl' => 'notification-url',
  14468. 'includePaths' => 'include-path',
  14469. );
  14470. $data = array();
  14471. $data['name'] = $package->getPrettyName();
  14472. $data['version'] = $package->getPrettyVersion();
  14473. $data['version_normalized'] = $package->getVersion();
  14474. if ($package->getTargetDir()) {
  14475. $data['target-dir'] = $package->getTargetDir();
  14476. }
  14477. if ($package->getSourceType()) {
  14478. $data['source']['type'] = $package->getSourceType();
  14479. $data['source']['url'] = $package->getSourceUrl();
  14480. $data['source']['reference'] = $package->getSourceReference();
  14481. if ($mirrors = $package->getSourceMirrors()) {
  14482. $data['source']['mirrors'] = $mirrors;
  14483. }
  14484. }
  14485. if ($package->getDistType()) {
  14486. $data['dist']['type'] = $package->getDistType();
  14487. $data['dist']['url'] = $package->getDistUrl();
  14488. $data['dist']['reference'] = $package->getDistReference();
  14489. $data['dist']['shasum'] = $package->getDistSha1Checksum();
  14490. if ($mirrors = $package->getDistMirrors()) {
  14491. $data['dist']['mirrors'] = $mirrors;
  14492. }
  14493. }
  14494. if ($package->getArchiveExcludes()) {
  14495. $data['archive']['exclude'] = $package->getArchiveExcludes();
  14496. }
  14497. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  14498. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  14499. foreach ($links as $link) {
  14500. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  14501. }
  14502. ksort($data[$type]);
  14503. }
  14504. }
  14505. if ($packages = $package->getSuggests()) {
  14506. ksort($packages);
  14507. $data['suggest'] = $packages;
  14508. }
  14509. if ($package->getReleaseDate()) {
  14510. $data['time'] = $package->getReleaseDate()->format('Y-m-d H:i:s');
  14511. }
  14512. $data = $this->dumpValues($package, $keys, $data);
  14513. if ($package instanceof CompletePackageInterface) {
  14514. $keys = array(
  14515. 'scripts',
  14516. 'license',
  14517. 'authors',
  14518. 'description',
  14519. 'homepage',
  14520. 'keywords',
  14521. 'repositories',
  14522. 'support',
  14523. );
  14524. $data = $this->dumpValues($package, $keys, $data);
  14525. if (isset($data['keywords']) && is_array($data['keywords'])) {
  14526. sort($data['keywords']);
  14527. }
  14528. if ($package->isAbandoned()) {
  14529. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  14530. }
  14531. }
  14532. if ($package instanceof RootPackageInterface) {
  14533. $minimumStability = $package->getMinimumStability();
  14534. if ($minimumStability) {
  14535. $data['minimum-stability'] = $minimumStability;
  14536. }
  14537. }
  14538. if (count($package->getTransportOptions()) > 0) {
  14539. $data['transport-options'] = $package->getTransportOptions();
  14540. }
  14541. return $data;
  14542. }
  14543. private function dumpValues(PackageInterface $package, array $keys, array $data)
  14544. {
  14545. foreach ($keys as $method => $key) {
  14546. if (is_numeric($method)) {
  14547. $method = $key;
  14548. }
  14549. $getter = 'get'.ucfirst($method);
  14550. $value = $package->$getter();
  14551. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  14552. $data[$key] = $value;
  14553. }
  14554. }
  14555. return $data;
  14556. }
  14557. }
  14558. <?php
  14559. namespace Composer\Package;
  14560. use Composer\Semver\Constraint\ConstraintInterface;
  14561. class Link
  14562. {
  14563. protected $source;
  14564. protected $target;
  14565. protected $constraint;
  14566. protected $description;
  14567. protected $prettyConstraint;
  14568. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  14569. {
  14570. $this->source = strtolower($source);
  14571. $this->target = strtolower($target);
  14572. $this->constraint = $constraint;
  14573. $this->description = $description;
  14574. $this->prettyConstraint = $prettyConstraint;
  14575. }
  14576. public function getDescription()
  14577. {
  14578. return $this->description;
  14579. }
  14580. public function getSource()
  14581. {
  14582. return $this->source;
  14583. }
  14584. public function getTarget()
  14585. {
  14586. return $this->target;
  14587. }
  14588. public function getConstraint()
  14589. {
  14590. return $this->constraint;
  14591. }
  14592. public function getPrettyConstraint()
  14593. {
  14594. if (null === $this->prettyConstraint) {
  14595. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  14596. }
  14597. return $this->prettyConstraint;
  14598. }
  14599. public function __toString()
  14600. {
  14601. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  14602. }
  14603. public function getPrettyString(PackageInterface $sourcePackage)
  14604. {
  14605. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  14606. }
  14607. }
  14608. <?php
  14609. namespace Composer\Package\LinkConstraint;
  14610. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  14611. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  14612. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  14613. {
  14614. }
  14615. <?php
  14616. namespace Composer\Package\LinkConstraint;
  14617. use Composer\Semver\Constraint\ConstraintInterface;
  14618. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  14619. interface LinkConstraintInterface extends ConstraintInterface
  14620. {
  14621. }
  14622. <?php
  14623. namespace Composer\Package\LinkConstraint;
  14624. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  14625. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  14626. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  14627. {
  14628. }
  14629. <?php
  14630. namespace Composer\Package\LinkConstraint;
  14631. use Composer\Semver\Constraint\AbstractConstraint;
  14632. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  14633. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  14634. {
  14635. }
  14636. <?php
  14637. namespace Composer\Package\LinkConstraint;
  14638. use Composer\Semver\Constraint\Constraint;
  14639. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  14640. class VersionConstraint extends Constraint implements LinkConstraintInterface
  14641. {
  14642. }
  14643. <?php
  14644. namespace Composer\Package\Loader;
  14645. use Composer\Package;
  14646. use Composer\Package\AliasPackage;
  14647. use Composer\Package\Link;
  14648. use Composer\Package\RootAliasPackage;
  14649. use Composer\Package\RootPackageInterface;
  14650. use Composer\Package\Version\VersionParser;
  14651. use Composer\Semver\VersionParser as SemverVersionParser;
  14652. class ArrayLoader implements LoaderInterface
  14653. {
  14654. protected $versionParser;
  14655. protected $loadOptions;
  14656. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  14657. {
  14658. if (!$parser) {
  14659. $parser = new VersionParser;
  14660. }
  14661. $this->versionParser = $parser;
  14662. $this->loadOptions = $loadOptions;
  14663. }
  14664. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  14665. {
  14666. if (!isset($config['name'])) {
  14667. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  14668. }
  14669. if (!isset($config['version'])) {
  14670. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  14671. }
  14672. if (isset($config['version_normalized'])) {
  14673. $version = $config['version_normalized'];
  14674. } else {
  14675. $version = $this->versionParser->normalize($config['version']);
  14676. }
  14677. $package = new $class($config['name'], $version, $config['version']);
  14678. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  14679. if (isset($config['target-dir'])) {
  14680. $package->setTargetDir($config['target-dir']);
  14681. }
  14682. if (isset($config['extra']) && is_array($config['extra'])) {
  14683. $package->setExtra($config['extra']);
  14684. }
  14685. if (isset($config['bin'])) {
  14686. if (!is_array($config['bin'])) {
  14687. throw new \UnexpectedValueException('Package '.$config['name'].'\'s bin key should be an array, '.gettype($config['bin']).' given.');
  14688. }
  14689. foreach ($config['bin'] as $key => $bin) {
  14690. $config['bin'][$key] = ltrim($bin, '/');
  14691. }
  14692. $package->setBinaries($config['bin']);
  14693. }
  14694. if (isset($config['installation-source'])) {
  14695. $package->setInstallationSource($config['installation-source']);
  14696. }
  14697. if (isset($config['source'])) {
  14698. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  14699. throw new \UnexpectedValueException(sprintf(
  14700. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  14701. $config['name'],
  14702. json_encode($config['source'])
  14703. ));
  14704. }
  14705. $package->setSourceType($config['source']['type']);
  14706. $package->setSourceUrl($config['source']['url']);
  14707. $package->setSourceReference($config['source']['reference']);
  14708. if (isset($config['source']['mirrors'])) {
  14709. $package->setSourceMirrors($config['source']['mirrors']);
  14710. }
  14711. }
  14712. if (isset($config['dist'])) {
  14713. if (!isset($config['dist']['type'])
  14714. || !isset($config['dist']['url'])) {
  14715. throw new \UnexpectedValueException(sprintf(
  14716. "Package %s's dist key should be specified as ".
  14717. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  14718. $config['name'],
  14719. json_encode($config['dist'])
  14720. ));
  14721. }
  14722. $package->setDistType($config['dist']['type']);
  14723. $package->setDistUrl($config['dist']['url']);
  14724. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  14725. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  14726. if (isset($config['dist']['mirrors'])) {
  14727. $package->setDistMirrors($config['dist']['mirrors']);
  14728. }
  14729. }
  14730. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  14731. if (isset($config[$type])) {
  14732. $method = 'set'.ucfirst($opts['method']);
  14733. $package->{$method}(
  14734. $this->parseLinks(
  14735. $package->getName(),
  14736. $package->getPrettyVersion(),
  14737. $opts['description'],
  14738. $config[$type]
  14739. )
  14740. );
  14741. }
  14742. }
  14743. if (isset($config['suggest']) && is_array($config['suggest'])) {
  14744. foreach ($config['suggest'] as $target => $reason) {
  14745. if ('self.version' === trim($reason)) {
  14746. $config['suggest'][$target] = $package->getPrettyVersion();
  14747. }
  14748. }
  14749. $package->setSuggests($config['suggest']);
  14750. }
  14751. if (isset($config['autoload'])) {
  14752. $package->setAutoload($config['autoload']);
  14753. }
  14754. if (isset($config['autoload-dev'])) {
  14755. $package->setDevAutoload($config['autoload-dev']);
  14756. }
  14757. if (isset($config['include-path'])) {
  14758. $package->setIncludePaths($config['include-path']);
  14759. }
  14760. if (!empty($config['time'])) {
  14761. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  14762. try {
  14763. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  14764. $package->setReleaseDate($date);
  14765. } catch (\Exception $e) {
  14766. }
  14767. }
  14768. if (!empty($config['notification-url'])) {
  14769. $package->setNotificationUrl($config['notification-url']);
  14770. }
  14771. if (!empty($config['archive']['exclude'])) {
  14772. $package->setArchiveExcludes($config['archive']['exclude']);
  14773. }
  14774. if ($package instanceof Package\CompletePackageInterface) {
  14775. if (isset($config['scripts']) && is_array($config['scripts'])) {
  14776. foreach ($config['scripts'] as $event => $listeners) {
  14777. $config['scripts'][$event] = (array) $listeners;
  14778. }
  14779. $package->setScripts($config['scripts']);
  14780. }
  14781. if (!empty($config['description']) && is_string($config['description'])) {
  14782. $package->setDescription($config['description']);
  14783. }
  14784. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  14785. $package->setHomepage($config['homepage']);
  14786. }
  14787. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  14788. $package->setKeywords($config['keywords']);
  14789. }
  14790. if (!empty($config['license'])) {
  14791. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  14792. }
  14793. if (!empty($config['authors']) && is_array($config['authors'])) {
  14794. $package->setAuthors($config['authors']);
  14795. }
  14796. if (isset($config['support'])) {
  14797. $package->setSupport($config['support']);
  14798. }
  14799. if (isset($config['abandoned'])) {
  14800. $package->setAbandoned($config['abandoned']);
  14801. }
  14802. }
  14803. if ($aliasNormalized = $this->getBranchAlias($config)) {
  14804. if ($package instanceof RootPackageInterface) {
  14805. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  14806. } else {
  14807. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  14808. }
  14809. }
  14810. if ($this->loadOptions && isset($config['transport-options'])) {
  14811. $package->setTransportOptions($config['transport-options']);
  14812. }
  14813. return $package;
  14814. }
  14815. public function parseLinks($source, $sourceVersion, $description, $links)
  14816. {
  14817. $res = array();
  14818. foreach ($links as $target => $constraint) {
  14819. if ('self.version' === $constraint) {
  14820. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  14821. } else {
  14822. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  14823. }
  14824. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  14825. }
  14826. return $res;
  14827. }
  14828. public function getBranchAlias(array $config)
  14829. {
  14830. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  14831. || !isset($config['extra']['branch-alias'])
  14832. || !is_array($config['extra']['branch-alias'])
  14833. ) {
  14834. return;
  14835. }
  14836. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  14837. if ('-dev' !== substr($targetBranch, -4)) {
  14838. continue;
  14839. }
  14840. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  14841. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  14842. continue;
  14843. }
  14844. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  14845. continue;
  14846. }
  14847. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  14848. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  14849. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  14850. ) {
  14851. continue;
  14852. }
  14853. return $validatedTargetBranch;
  14854. }
  14855. }
  14856. }
  14857. <?php
  14858. namespace Composer\Package\Loader;
  14859. class InvalidPackageException extends \Exception
  14860. {
  14861. private $errors;
  14862. private $warnings;
  14863. private $data;
  14864. public function __construct(array $errors, array $warnings, array $data)
  14865. {
  14866. $this->errors = $errors;
  14867. $this->warnings = $warnings;
  14868. $this->data = $data;
  14869. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  14870. }
  14871. public function getData()
  14872. {
  14873. return $this->data;
  14874. }
  14875. public function getErrors()
  14876. {
  14877. return $this->errors;
  14878. }
  14879. public function getWarnings()
  14880. {
  14881. return $this->warnings;
  14882. }
  14883. }
  14884. <?php
  14885. namespace Composer\Package\Loader;
  14886. use Composer\Json\JsonFile;
  14887. class JsonLoader
  14888. {
  14889. private $loader;
  14890. public function __construct(LoaderInterface $loader)
  14891. {
  14892. $this->loader = $loader;
  14893. }
  14894. public function load($json)
  14895. {
  14896. if ($json instanceof JsonFile) {
  14897. $config = $json->read();
  14898. } elseif (file_exists($json)) {
  14899. $config = JsonFile::parseJson(file_get_contents($json), $json);
  14900. } elseif (is_string($json)) {
  14901. $config = JsonFile::parseJson($json);
  14902. }
  14903. return $this->loader->load($config);
  14904. }
  14905. }
  14906. <?php
  14907. namespace Composer\Package\Loader;
  14908. interface LoaderInterface
  14909. {
  14910. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  14911. }
  14912. <?php
  14913. namespace Composer\Package\Loader;
  14914. use Composer\Package\BasePackage;
  14915. use Composer\Package\PackageInterface;
  14916. use Composer\Package\AliasPackage;
  14917. use Composer\Config;
  14918. use Composer\Factory;
  14919. use Composer\Package\Version\VersionGuesser;
  14920. use Composer\Package\Version\VersionParser;
  14921. use Composer\Repository\RepositoryManager;
  14922. use Composer\Util\ProcessExecutor;
  14923. class RootPackageLoader extends ArrayLoader
  14924. {
  14925. private $manager;
  14926. private $config;
  14927. private $versionGuesser;
  14928. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null)
  14929. {
  14930. parent::__construct($parser);
  14931. $this->manager = $manager;
  14932. $this->config = $config;
  14933. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  14934. }
  14935. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  14936. {
  14937. if (!isset($config['name'])) {
  14938. $config['name'] = '__root__';
  14939. }
  14940. $autoVersioned = false;
  14941. if (!isset($config['version'])) {
  14942. if (getenv('COMPOSER_ROOT_VERSION')) {
  14943. $version = getenv('COMPOSER_ROOT_VERSION');
  14944. } else {
  14945. $version = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  14946. }
  14947. if (!$version) {
  14948. $version = '1.0.0';
  14949. $autoVersioned = true;
  14950. }
  14951. $config['version'] = $version;
  14952. }
  14953. $realPackage = $package = parent::load($config, $class);
  14954. if ($realPackage instanceof AliasPackage) {
  14955. $realPackage = $package->getAliasOf();
  14956. }
  14957. if ($autoVersioned) {
  14958. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  14959. }
  14960. if (isset($config['minimum-stability'])) {
  14961. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  14962. }
  14963. $aliases = array();
  14964. $stabilityFlags = array();
  14965. $references = array();
  14966. foreach (array('require', 'require-dev') as $linkType) {
  14967. if (isset($config[$linkType])) {
  14968. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  14969. $method = 'get'.ucfirst($linkInfo['method']);
  14970. $links = array();
  14971. foreach ($realPackage->$method() as $link) {
  14972. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  14973. }
  14974. $aliases = $this->extractAliases($links, $aliases);
  14975. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  14976. $references = $this->extractReferences($links, $references);
  14977. }
  14978. }
  14979. if (isset($links[$config['name']])) {
  14980. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  14981. 'Did you accidentally name your root package after an external package?', $config['name']));
  14982. }
  14983. $realPackage->setAliases($aliases);
  14984. $realPackage->setStabilityFlags($stabilityFlags);
  14985. $realPackage->setReferences($references);
  14986. if (isset($config['prefer-stable'])) {
  14987. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  14988. }
  14989. $repos = Factory::createDefaultRepositories(null, $this->config, $this->manager);
  14990. foreach ($repos as $repo) {
  14991. $this->manager->addRepository($repo);
  14992. }
  14993. $realPackage->setRepositories($this->config->getRepositories());
  14994. return $package;
  14995. }
  14996. private function extractAliases(array $requires, array $aliases)
  14997. {
  14998. foreach ($requires as $reqName => $reqVersion) {
  14999. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  15000. $aliases[] = array(
  15001. 'package' => strtolower($reqName),
  15002. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  15003. 'alias' => $match[2],
  15004. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  15005. );
  15006. }
  15007. }
  15008. return $aliases;
  15009. }
  15010. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  15011. {
  15012. $stabilities = BasePackage::$stabilities;
  15013. $minimumStability = $stabilities[$minimumStability];
  15014. foreach ($requires as $reqName => $reqVersion) {
  15015. $constraints = array();
  15016. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  15017. foreach ($orSplit as $constraint) {
  15018. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraint);
  15019. foreach ($andSplit as $constraint) {
  15020. $constraints[] = $constraint;
  15021. }
  15022. }
  15023. $match = false;
  15024. foreach ($constraints as $constraint) {
  15025. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  15026. $name = strtolower($reqName);
  15027. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  15028. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  15029. continue;
  15030. }
  15031. $stabilityFlags[$name] = $stability;
  15032. $match = true;
  15033. }
  15034. }
  15035. if ($match) {
  15036. continue;
  15037. }
  15038. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  15039. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  15040. $name = strtolower($reqName);
  15041. $stability = $stabilities[$stabilityName];
  15042. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  15043. continue;
  15044. }
  15045. $stabilityFlags[$name] = $stability;
  15046. }
  15047. }
  15048. return $stabilityFlags;
  15049. }
  15050. private function extractReferences(array $requires, array $references)
  15051. {
  15052. foreach ($requires as $reqName => $reqVersion) {
  15053. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  15054. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === ($stabilityName = VersionParser::parseStability($reqVersion))) {
  15055. $name = strtolower($reqName);
  15056. $references[$name] = $match[1];
  15057. }
  15058. }
  15059. return $references;
  15060. }
  15061. }
  15062. <?php
  15063. namespace Composer\Package\Loader;
  15064. use Composer\Package;
  15065. use Composer\Package\BasePackage;
  15066. use Composer\Semver\Constraint\Constraint;
  15067. use Composer\Package\Version\VersionParser;
  15068. use Composer\Repository\PlatformRepository;
  15069. class ValidatingArrayLoader implements LoaderInterface
  15070. {
  15071. const CHECK_ALL = 1;
  15072. const CHECK_UNBOUND_CONSTRAINTS = 1;
  15073. private $loader;
  15074. private $versionParser;
  15075. private $errors;
  15076. private $warnings;
  15077. private $config;
  15078. private $strictName;
  15079. private $flags;
  15080. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  15081. {
  15082. $this->loader = $loader;
  15083. $this->versionParser = $parser ?: new VersionParser();
  15084. $this->strictName = $strictName;
  15085. $this->flags = $flags;
  15086. }
  15087. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  15088. {
  15089. $this->errors = array();
  15090. $this->warnings = array();
  15091. $this->config = $config;
  15092. if ($this->strictName) {
  15093. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  15094. } else {
  15095. $this->validateString('name', true);
  15096. }
  15097. if (!empty($this->config['version'])) {
  15098. try {
  15099. $this->versionParser->normalize($this->config['version']);
  15100. } catch (\Exception $e) {
  15101. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  15102. unset($this->config['version']);
  15103. }
  15104. }
  15105. $this->validateRegex('type', '[A-Za-z0-9-]+');
  15106. $this->validateString('target-dir');
  15107. $this->validateArray('extra');
  15108. $this->validateFlatArray('bin');
  15109. $this->validateArray('scripts');
  15110. $this->validateString('description');
  15111. $this->validateUrl('homepage');
  15112. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  15113. if (isset($this->config['license'])) {
  15114. if (is_string($this->config['license'])) {
  15115. $this->validateRegex('license', '[A-Za-z0-9+. ()-]+');
  15116. } else {
  15117. $this->validateFlatArray('license', '[A-Za-z0-9+. ()-]+');
  15118. }
  15119. }
  15120. $this->validateString('time');
  15121. if (!empty($this->config['time'])) {
  15122. try {
  15123. $date = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  15124. } catch (\Exception $e) {
  15125. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  15126. unset($this->config['time']);
  15127. }
  15128. }
  15129. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  15130. foreach ($this->config['authors'] as $key => $author) {
  15131. if (!is_array($author)) {
  15132. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  15133. unset($this->config['authors'][$key]);
  15134. continue;
  15135. }
  15136. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  15137. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  15138. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  15139. unset($this->config['authors'][$key][$authorData]);
  15140. }
  15141. }
  15142. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  15143. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  15144. unset($this->config['authors'][$key]['homepage']);
  15145. }
  15146. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  15147. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  15148. unset($this->config['authors'][$key]['email']);
  15149. }
  15150. if (empty($this->config['authors'][$key])) {
  15151. unset($this->config['authors'][$key]);
  15152. }
  15153. }
  15154. if (empty($this->config['authors'])) {
  15155. unset($this->config['authors']);
  15156. }
  15157. }
  15158. if ($this->validateArray('support') && !empty($this->config['support'])) {
  15159. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs') as $key) {
  15160. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  15161. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  15162. unset($this->config['support'][$key]);
  15163. }
  15164. }
  15165. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  15166. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  15167. unset($this->config['support']['email']);
  15168. }
  15169. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  15170. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  15171. unset($this->config['support']['irc']);
  15172. }
  15173. foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) {
  15174. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  15175. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  15176. unset($this->config['support'][$key]);
  15177. }
  15178. }
  15179. if (empty($this->config['support'])) {
  15180. unset($this->config['support']);
  15181. }
  15182. }
  15183. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  15184. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  15185. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  15186. foreach ($this->config[$linkType] as $package => $constraint) {
  15187. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  15188. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  15189. }
  15190. if (!is_string($constraint)) {
  15191. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  15192. unset($this->config[$linkType][$package]);
  15193. } elseif ('self.version' !== $constraint) {
  15194. try {
  15195. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  15196. } catch (\Exception $e) {
  15197. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  15198. unset($this->config[$linkType][$package]);
  15199. continue;
  15200. }
  15201. if (
  15202. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  15203. && 'require' === $linkType
  15204. && $linkConstraint->matches($unboundConstraint)
  15205. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  15206. ) {
  15207. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  15208. }
  15209. }
  15210. }
  15211. }
  15212. }
  15213. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  15214. foreach ($this->config['suggest'] as $package => $description) {
  15215. if (!is_string($description)) {
  15216. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  15217. unset($this->config['suggest'][$package]);
  15218. }
  15219. }
  15220. }
  15221. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  15222. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  15223. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  15224. unset($this->config['minimum-stability']);
  15225. }
  15226. }
  15227. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  15228. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  15229. foreach ($this->config['autoload'] as $type => $typeConfig) {
  15230. if (!in_array($type, $types)) {
  15231. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  15232. unset($this->config['autoload'][$type]);
  15233. }
  15234. if ($type === 'psr-4') {
  15235. foreach ($typeConfig as $namespace => $dirs) {
  15236. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  15237. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  15238. }
  15239. }
  15240. }
  15241. }
  15242. }
  15243. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  15244. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  15245. unset($this->config['autoload']['psr-4']);
  15246. }
  15247. $this->validateFlatArray('include-path');
  15248. $this->validateArray('transport-options');
  15249. if (isset($this->config['extra']['branch-alias'])) {
  15250. if (!is_array($this->config['extra']['branch-alias'])) {
  15251. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  15252. } else {
  15253. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  15254. if ('-dev' !== substr($targetBranch, -4)) {
  15255. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  15256. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  15257. continue;
  15258. }
  15259. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  15260. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  15261. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  15262. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  15263. continue;
  15264. }
  15265. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  15266. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  15267. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  15268. ) {
  15269. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  15270. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  15271. }
  15272. }
  15273. }
  15274. }
  15275. if ($this->errors) {
  15276. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  15277. }
  15278. $package = $this->loader->load($this->config, $class);
  15279. $this->config = null;
  15280. return $package;
  15281. }
  15282. public function getWarnings()
  15283. {
  15284. return $this->warnings;
  15285. }
  15286. public function getErrors()
  15287. {
  15288. return $this->errors;
  15289. }
  15290. private function validateRegex($property, $regex, $mandatory = false)
  15291. {
  15292. if (!$this->validateString($property, $mandatory)) {
  15293. return false;
  15294. }
  15295. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  15296. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  15297. if ($mandatory) {
  15298. $this->errors[] = $message;
  15299. } else {
  15300. $this->warnings[] = $message;
  15301. }
  15302. unset($this->config[$property]);
  15303. return false;
  15304. }
  15305. return true;
  15306. }
  15307. private function validateString($property, $mandatory = false)
  15308. {
  15309. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  15310. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  15311. unset($this->config[$property]);
  15312. return false;
  15313. }
  15314. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  15315. if ($mandatory) {
  15316. $this->errors[] = $property.' : must be present';
  15317. }
  15318. unset($this->config[$property]);
  15319. return false;
  15320. }
  15321. return true;
  15322. }
  15323. private function validateArray($property, $mandatory = false)
  15324. {
  15325. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  15326. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  15327. unset($this->config[$property]);
  15328. return false;
  15329. }
  15330. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  15331. if ($mandatory) {
  15332. $this->errors[] = $property.' : must be present and contain at least one element';
  15333. }
  15334. unset($this->config[$property]);
  15335. return false;
  15336. }
  15337. return true;
  15338. }
  15339. private function validateFlatArray($property, $regex = null, $mandatory = false)
  15340. {
  15341. if (!$this->validateArray($property, $mandatory)) {
  15342. return false;
  15343. }
  15344. $pass = true;
  15345. foreach ($this->config[$property] as $key => $value) {
  15346. if (!is_string($value) && !is_numeric($value)) {
  15347. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  15348. unset($this->config[$property][$key]);
  15349. $pass = false;
  15350. continue;
  15351. }
  15352. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  15353. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  15354. unset($this->config[$property][$key]);
  15355. $pass = false;
  15356. }
  15357. }
  15358. return $pass;
  15359. }
  15360. private function validateUrl($property, $mandatory = false)
  15361. {
  15362. if (!$this->validateString($property, $mandatory)) {
  15363. return false;
  15364. }
  15365. if (!$this->filterUrl($this->config[$property])) {
  15366. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  15367. unset($this->config[$property]);
  15368. return false;
  15369. }
  15370. return true;
  15371. }
  15372. private function filterUrl($value, array $schemes = array('http', 'https'))
  15373. {
  15374. if ($value === '') {
  15375. return true;
  15376. }
  15377. $bits = parse_url($value);
  15378. if (empty($bits['scheme']) || empty($bits['host'])) {
  15379. return false;
  15380. }
  15381. if (!in_array($bits['scheme'], $schemes, true)) {
  15382. return false;
  15383. }
  15384. return true;
  15385. }
  15386. }
  15387. <?php
  15388. namespace Composer\Package;
  15389. use Composer\Json\JsonFile;
  15390. use Composer\Installer\InstallationManager;
  15391. use Composer\Repository\RepositoryManager;
  15392. use Composer\Util\ProcessExecutor;
  15393. use Composer\Repository\ArrayRepository;
  15394. use Composer\Package\Dumper\ArrayDumper;
  15395. use Composer\Package\Loader\ArrayLoader;
  15396. use Composer\Util\Git as GitUtil;
  15397. use Composer\IO\IOInterface;
  15398. use Seld\JsonLint\ParsingException;
  15399. class Locker
  15400. {
  15401. private $lockFile;
  15402. private $repositoryManager;
  15403. private $installationManager;
  15404. private $hash;
  15405. private $contentHash;
  15406. private $loader;
  15407. private $dumper;
  15408. private $process;
  15409. private $lockDataCache;
  15410. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  15411. {
  15412. $this->lockFile = $lockFile;
  15413. $this->repositoryManager = $repositoryManager;
  15414. $this->installationManager = $installationManager;
  15415. $this->hash = md5($composerFileContents);
  15416. $this->contentHash = self::getContentHash($composerFileContents);
  15417. $this->loader = new ArrayLoader(null, true);
  15418. $this->dumper = new ArrayDumper();
  15419. $this->process = new ProcessExecutor($io);
  15420. }
  15421. public static function getContentHash($composerFileContents)
  15422. {
  15423. $content = json_decode($composerFileContents, true);
  15424. $relevantKeys = array(
  15425. 'name',
  15426. 'version',
  15427. 'require',
  15428. 'require-dev',
  15429. 'conflict',
  15430. 'replace',
  15431. 'provide',
  15432. 'minimum-stability',
  15433. 'prefer-stable',
  15434. 'repositories',
  15435. 'extra',
  15436. );
  15437. $relevantContent = array();
  15438. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  15439. $relevantContent[$key] = $content[$key];
  15440. }
  15441. if (isset($content['config']['platform'])) {
  15442. $relevantContent['config']['platform'] = $content['config']['platform'];
  15443. }
  15444. ksort($relevantContent);
  15445. return md5(json_encode($relevantContent));
  15446. }
  15447. public function isLocked()
  15448. {
  15449. if (!$this->lockFile->exists()) {
  15450. return false;
  15451. }
  15452. $data = $this->getLockData();
  15453. return isset($data['packages']);
  15454. }
  15455. public function isFresh()
  15456. {
  15457. $lock = $this->lockFile->read();
  15458. if (!empty($lock['content-hash'])) {
  15459. return $this->contentHash === $lock['content-hash'];
  15460. }
  15461. return $this->hash === $lock['hash'];
  15462. }
  15463. public function getLockedRepository($withDevReqs = false)
  15464. {
  15465. $lockData = $this->getLockData();
  15466. $packages = new ArrayRepository();
  15467. $lockedPackages = $lockData['packages'];
  15468. if ($withDevReqs) {
  15469. if (isset($lockData['packages-dev'])) {
  15470. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  15471. } else {
  15472. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  15473. }
  15474. }
  15475. if (empty($lockedPackages)) {
  15476. return $packages;
  15477. }
  15478. if (isset($lockedPackages[0]['name'])) {
  15479. foreach ($lockedPackages as $info) {
  15480. $packages->addPackage($this->loader->load($info));
  15481. }
  15482. return $packages;
  15483. }
  15484. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  15485. }
  15486. public function getPlatformRequirements($withDevReqs = false)
  15487. {
  15488. $lockData = $this->getLockData();
  15489. $requirements = array();
  15490. if (!empty($lockData['platform'])) {
  15491. $requirements = $this->loader->parseLinks(
  15492. '__ROOT__',
  15493. '1.0.0',
  15494. 'requires',
  15495. isset($lockData['platform']) ? $lockData['platform'] : array()
  15496. );
  15497. }
  15498. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  15499. $devRequirements = $this->loader->parseLinks(
  15500. '__ROOT__',
  15501. '1.0.0',
  15502. 'requires',
  15503. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  15504. );
  15505. $requirements = array_merge($requirements, $devRequirements);
  15506. }
  15507. return $requirements;
  15508. }
  15509. public function getMinimumStability()
  15510. {
  15511. $lockData = $this->getLockData();
  15512. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  15513. }
  15514. public function getStabilityFlags()
  15515. {
  15516. $lockData = $this->getLockData();
  15517. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  15518. }
  15519. public function getPreferStable()
  15520. {
  15521. $lockData = $this->getLockData();
  15522. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  15523. }
  15524. public function getPreferLowest()
  15525. {
  15526. $lockData = $this->getLockData();
  15527. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  15528. }
  15529. public function getPlatformOverrides()
  15530. {
  15531. $lockData = $this->getLockData();
  15532. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  15533. }
  15534. public function getAliases()
  15535. {
  15536. $lockData = $this->getLockData();
  15537. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  15538. }
  15539. public function getLockData()
  15540. {
  15541. if (null !== $this->lockDataCache) {
  15542. return $this->lockDataCache;
  15543. }
  15544. if (!$this->lockFile->exists()) {
  15545. throw new \LogicException('No lockfile found. Unable to read locked packages');
  15546. }
  15547. return $this->lockDataCache = $this->lockFile->read();
  15548. }
  15549. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  15550. {
  15551. $lock = array(
  15552. '_readme' => array('This file locks the dependencies of your project to a known state',
  15553. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
  15554. 'This file is @gener'.'ated automatically', ),
  15555. 'hash' => $this->hash,
  15556. 'content-hash' => $this->contentHash,
  15557. 'packages' => null,
  15558. 'packages-dev' => null,
  15559. 'aliases' => array(),
  15560. 'minimum-stability' => $minimumStability,
  15561. 'stability-flags' => $stabilityFlags,
  15562. 'prefer-stable' => $preferStable,
  15563. 'prefer-lowest' => $preferLowest,
  15564. );
  15565. foreach ($aliases as $package => $versions) {
  15566. foreach ($versions as $version => $alias) {
  15567. $lock['aliases'][] = array(
  15568. 'alias' => $alias['alias'],
  15569. 'alias_normalized' => $alias['alias_normalized'],
  15570. 'version' => $version,
  15571. 'package' => $package,
  15572. );
  15573. }
  15574. }
  15575. $lock['packages'] = $this->lockPackages($packages);
  15576. if (null !== $devPackages) {
  15577. $lock['packages-dev'] = $this->lockPackages($devPackages);
  15578. }
  15579. $lock['platform'] = $platformReqs;
  15580. $lock['platform-dev'] = $platformDevReqs;
  15581. if ($platformOverrides) {
  15582. $lock['platform-overrides'] = $platformOverrides;
  15583. }
  15584. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  15585. if ($this->lockFile->exists()) {
  15586. unlink($this->lockFile->getPath());
  15587. }
  15588. return false;
  15589. }
  15590. try {
  15591. $isLocked = $this->isLocked();
  15592. } catch (ParsingException $e) {
  15593. $isLocked = false;
  15594. }
  15595. if (!$isLocked || $lock !== $this->getLockData()) {
  15596. $this->lockFile->write($lock);
  15597. $this->lockDataCache = null;
  15598. return true;
  15599. }
  15600. return false;
  15601. }
  15602. private function lockPackages(array $packages)
  15603. {
  15604. $locked = array();
  15605. foreach ($packages as $package) {
  15606. if ($package instanceof AliasPackage) {
  15607. continue;
  15608. }
  15609. $name = $package->getPrettyName();
  15610. $version = $package->getPrettyVersion();
  15611. if (!$name || !$version) {
  15612. throw new \LogicException(sprintf(
  15613. 'Package "%s" has no version or name and can not be locked', $package
  15614. ));
  15615. }
  15616. $spec = $this->dumper->dump($package);
  15617. unset($spec['version_normalized']);
  15618. $time = isset($spec['time']) ? $spec['time'] : null;
  15619. unset($spec['time']);
  15620. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  15621. $time = $this->getPackageTime($package) ?: $time;
  15622. }
  15623. if (null !== $time) {
  15624. $spec['time'] = $time;
  15625. }
  15626. unset($spec['installation-source']);
  15627. $locked[] = $spec;
  15628. }
  15629. usort($locked, function ($a, $b) {
  15630. $comparison = strcmp($a['name'], $b['name']);
  15631. if (0 !== $comparison) {
  15632. return $comparison;
  15633. }
  15634. return strcmp($a['version'], $b['version']);
  15635. });
  15636. return $locked;
  15637. }
  15638. private function getPackageTime(PackageInterface $package)
  15639. {
  15640. if (!function_exists('proc_open')) {
  15641. return null;
  15642. }
  15643. $path = realpath($this->installationManager->getInstallPath($package));
  15644. $sourceType = $package->getSourceType();
  15645. $datetime = null;
  15646. if ($path && in_array($sourceType, array('git', 'hg'))) {
  15647. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  15648. switch ($sourceType) {
  15649. case 'git':
  15650. GitUtil::cleanEnv();
  15651. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  15652. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  15653. }
  15654. break;
  15655. case 'hg':
  15656. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  15657. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  15658. }
  15659. break;
  15660. }
  15661. }
  15662. return $datetime ? $datetime->format('Y-m-d H:i:s') : null;
  15663. }
  15664. }
  15665. <?php
  15666. namespace Composer\Package;
  15667. use Composer\Package\Version\VersionParser;
  15668. use Composer\Util\ComposerMirror;
  15669. class Package extends BasePackage
  15670. {
  15671. protected $type;
  15672. protected $targetDir;
  15673. protected $installationSource;
  15674. protected $sourceType;
  15675. protected $sourceUrl;
  15676. protected $sourceReference;
  15677. protected $sourceMirrors;
  15678. protected $distType;
  15679. protected $distUrl;
  15680. protected $distReference;
  15681. protected $distSha1Checksum;
  15682. protected $distMirrors;
  15683. protected $version;
  15684. protected $prettyVersion;
  15685. protected $releaseDate;
  15686. protected $extra = array();
  15687. protected $binaries = array();
  15688. protected $dev;
  15689. protected $stability;
  15690. protected $notificationUrl;
  15691. protected $requires = array();
  15692. protected $conflicts = array();
  15693. protected $provides = array();
  15694. protected $replaces = array();
  15695. protected $devRequires = array();
  15696. protected $suggests = array();
  15697. protected $autoload = array();
  15698. protected $devAutoload = array();
  15699. protected $includePaths = array();
  15700. protected $archiveExcludes = array();
  15701. public function __construct($name, $version, $prettyVersion)
  15702. {
  15703. parent::__construct($name);
  15704. $this->version = $version;
  15705. $this->prettyVersion = $prettyVersion;
  15706. $this->stability = VersionParser::parseStability($version);
  15707. $this->dev = $this->stability === 'dev';
  15708. }
  15709. public function isDev()
  15710. {
  15711. return $this->dev;
  15712. }
  15713. public function setType($type)
  15714. {
  15715. $this->type = $type;
  15716. }
  15717. public function getType()
  15718. {
  15719. return $this->type ?: 'library';
  15720. }
  15721. public function getStability()
  15722. {
  15723. return $this->stability;
  15724. }
  15725. public function setTargetDir($targetDir)
  15726. {
  15727. $this->targetDir = $targetDir;
  15728. }
  15729. public function getTargetDir()
  15730. {
  15731. if (null === $this->targetDir) {
  15732. return;
  15733. }
  15734. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  15735. }
  15736. public function setExtra(array $extra)
  15737. {
  15738. $this->extra = $extra;
  15739. }
  15740. public function getExtra()
  15741. {
  15742. return $this->extra;
  15743. }
  15744. public function setBinaries(array $binaries)
  15745. {
  15746. $this->binaries = $binaries;
  15747. }
  15748. public function getBinaries()
  15749. {
  15750. return $this->binaries;
  15751. }
  15752. public function setInstallationSource($type)
  15753. {
  15754. $this->installationSource = $type;
  15755. }
  15756. public function getInstallationSource()
  15757. {
  15758. return $this->installationSource;
  15759. }
  15760. public function setSourceType($type)
  15761. {
  15762. $this->sourceType = $type;
  15763. }
  15764. public function getSourceType()
  15765. {
  15766. return $this->sourceType;
  15767. }
  15768. public function setSourceUrl($url)
  15769. {
  15770. $this->sourceUrl = $url;
  15771. }
  15772. public function getSourceUrl()
  15773. {
  15774. return $this->sourceUrl;
  15775. }
  15776. public function setSourceReference($reference)
  15777. {
  15778. $this->sourceReference = $reference;
  15779. }
  15780. public function getSourceReference()
  15781. {
  15782. return $this->sourceReference;
  15783. }
  15784. public function setSourceMirrors($mirrors)
  15785. {
  15786. $this->sourceMirrors = $mirrors;
  15787. }
  15788. public function getSourceMirrors()
  15789. {
  15790. return $this->sourceMirrors;
  15791. }
  15792. public function getSourceUrls()
  15793. {
  15794. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  15795. }
  15796. public function setDistType($type)
  15797. {
  15798. $this->distType = $type;
  15799. }
  15800. public function getDistType()
  15801. {
  15802. return $this->distType;
  15803. }
  15804. public function setDistUrl($url)
  15805. {
  15806. $this->distUrl = $url;
  15807. }
  15808. public function getDistUrl()
  15809. {
  15810. return $this->distUrl;
  15811. }
  15812. public function setDistReference($reference)
  15813. {
  15814. $this->distReference = $reference;
  15815. }
  15816. public function getDistReference()
  15817. {
  15818. return $this->distReference;
  15819. }
  15820. public function setDistSha1Checksum($sha1checksum)
  15821. {
  15822. $this->distSha1Checksum = $sha1checksum;
  15823. }
  15824. public function getDistSha1Checksum()
  15825. {
  15826. return $this->distSha1Checksum;
  15827. }
  15828. public function setDistMirrors($mirrors)
  15829. {
  15830. $this->distMirrors = $mirrors;
  15831. }
  15832. public function getDistMirrors()
  15833. {
  15834. return $this->distMirrors;
  15835. }
  15836. public function getDistUrls()
  15837. {
  15838. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  15839. }
  15840. public function getVersion()
  15841. {
  15842. return $this->version;
  15843. }
  15844. public function getPrettyVersion()
  15845. {
  15846. return $this->prettyVersion;
  15847. }
  15848. public function setReleaseDate(\DateTime $releaseDate)
  15849. {
  15850. $this->releaseDate = $releaseDate;
  15851. }
  15852. public function getReleaseDate()
  15853. {
  15854. return $this->releaseDate;
  15855. }
  15856. public function setRequires(array $requires)
  15857. {
  15858. $this->requires = $requires;
  15859. }
  15860. public function getRequires()
  15861. {
  15862. return $this->requires;
  15863. }
  15864. public function setConflicts(array $conflicts)
  15865. {
  15866. $this->conflicts = $conflicts;
  15867. }
  15868. public function getConflicts()
  15869. {
  15870. return $this->conflicts;
  15871. }
  15872. public function setProvides(array $provides)
  15873. {
  15874. $this->provides = $provides;
  15875. }
  15876. public function getProvides()
  15877. {
  15878. return $this->provides;
  15879. }
  15880. public function setReplaces(array $replaces)
  15881. {
  15882. $this->replaces = $replaces;
  15883. }
  15884. public function getReplaces()
  15885. {
  15886. return $this->replaces;
  15887. }
  15888. public function setDevRequires(array $devRequires)
  15889. {
  15890. $this->devRequires = $devRequires;
  15891. }
  15892. public function getDevRequires()
  15893. {
  15894. return $this->devRequires;
  15895. }
  15896. public function setSuggests(array $suggests)
  15897. {
  15898. $this->suggests = $suggests;
  15899. }
  15900. public function getSuggests()
  15901. {
  15902. return $this->suggests;
  15903. }
  15904. public function setAutoload(array $autoload)
  15905. {
  15906. $this->autoload = $autoload;
  15907. }
  15908. public function getAutoload()
  15909. {
  15910. return $this->autoload;
  15911. }
  15912. public function setDevAutoload(array $devAutoload)
  15913. {
  15914. $this->devAutoload = $devAutoload;
  15915. }
  15916. public function getDevAutoload()
  15917. {
  15918. return $this->devAutoload;
  15919. }
  15920. public function setIncludePaths(array $includePaths)
  15921. {
  15922. $this->includePaths = $includePaths;
  15923. }
  15924. public function getIncludePaths()
  15925. {
  15926. return $this->includePaths;
  15927. }
  15928. public function setNotificationUrl($notificationUrl)
  15929. {
  15930. $this->notificationUrl = $notificationUrl;
  15931. }
  15932. public function getNotificationUrl()
  15933. {
  15934. return $this->notificationUrl;
  15935. }
  15936. public function setArchiveExcludes(array $excludes)
  15937. {
  15938. $this->archiveExcludes = $excludes;
  15939. }
  15940. public function getArchiveExcludes()
  15941. {
  15942. return $this->archiveExcludes;
  15943. }
  15944. public function replaceVersion($version, $prettyVersion)
  15945. {
  15946. $this->version = $version;
  15947. $this->prettyVersion = $prettyVersion;
  15948. $this->stability = VersionParser::parseStability($version);
  15949. $this->dev = $this->stability === 'dev';
  15950. }
  15951. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  15952. {
  15953. if (!$url) {
  15954. return array();
  15955. }
  15956. $urls = array($url);
  15957. if ($mirrors) {
  15958. foreach ($mirrors as $mirror) {
  15959. if ($urlType === 'dist') {
  15960. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  15961. } elseif ($urlType === 'source' && $type === 'git') {
  15962. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  15963. } elseif ($urlType === 'source' && $type === 'hg') {
  15964. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  15965. }
  15966. if (!in_array($mirrorUrl, $urls)) {
  15967. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  15968. $func($urls, $mirrorUrl);
  15969. }
  15970. }
  15971. }
  15972. return $urls;
  15973. }
  15974. }
  15975. <?php
  15976. namespace Composer\Package;
  15977. use Composer\Repository\RepositoryInterface;
  15978. interface PackageInterface
  15979. {
  15980. public function getName();
  15981. public function getPrettyName();
  15982. public function getNames();
  15983. public function setId($id);
  15984. public function getId();
  15985. public function isDev();
  15986. public function getType();
  15987. public function getTargetDir();
  15988. public function getExtra();
  15989. public function setInstallationSource($type);
  15990. public function getInstallationSource();
  15991. public function getSourceType();
  15992. public function getSourceUrl();
  15993. public function getSourceUrls();
  15994. public function getSourceReference();
  15995. public function getSourceMirrors();
  15996. public function getDistType();
  15997. public function getDistUrl();
  15998. public function getDistUrls();
  15999. public function getDistReference();
  16000. public function getDistSha1Checksum();
  16001. public function getDistMirrors();
  16002. public function getVersion();
  16003. public function getPrettyVersion();
  16004. public function getFullPrettyVersion($truncate = true);
  16005. public function getReleaseDate();
  16006. public function getStability();
  16007. public function getRequires();
  16008. public function getConflicts();
  16009. public function getProvides();
  16010. public function getReplaces();
  16011. public function getDevRequires();
  16012. public function getSuggests();
  16013. public function getAutoload();
  16014. public function getDevAutoload();
  16015. public function getIncludePaths();
  16016. public function setRepository(RepositoryInterface $repository);
  16017. public function getRepository();
  16018. public function getBinaries();
  16019. public function getUniqueName();
  16020. public function getNotificationUrl();
  16021. public function __toString();
  16022. public function getPrettyString();
  16023. public function getArchiveExcludes();
  16024. public function getTransportOptions();
  16025. }
  16026. <?php
  16027. namespace Composer\Package;
  16028. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  16029. {
  16030. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  16031. {
  16032. parent::__construct($aliasOf, $version, $prettyVersion);
  16033. }
  16034. public function getAliases()
  16035. {
  16036. return $this->aliasOf->getAliases();
  16037. }
  16038. public function getMinimumStability()
  16039. {
  16040. return $this->aliasOf->getMinimumStability();
  16041. }
  16042. public function getStabilityFlags()
  16043. {
  16044. return $this->aliasOf->getStabilityFlags();
  16045. }
  16046. public function getReferences()
  16047. {
  16048. return $this->aliasOf->getReferences();
  16049. }
  16050. public function getPreferStable()
  16051. {
  16052. return $this->aliasOf->getPreferStable();
  16053. }
  16054. public function setRequires(array $require)
  16055. {
  16056. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  16057. $this->aliasOf->setRequires($require);
  16058. }
  16059. public function setDevRequires(array $devRequire)
  16060. {
  16061. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  16062. $this->aliasOf->setDevRequires($devRequire);
  16063. }
  16064. public function setConflicts(array $conflicts)
  16065. {
  16066. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  16067. $this->aliasOf->setConflicts($conflicts);
  16068. }
  16069. public function setProvides(array $provides)
  16070. {
  16071. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  16072. $this->aliasOf->setProvides($provides);
  16073. }
  16074. public function setReplaces(array $replaces)
  16075. {
  16076. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  16077. $this->aliasOf->setReplaces($replaces);
  16078. }
  16079. public function setRepositories($repositories)
  16080. {
  16081. $this->aliasOf->setRepositories($repositories);
  16082. }
  16083. public function setAutoload(array $autoload)
  16084. {
  16085. $this->aliasOf->setAutoload($autoload);
  16086. }
  16087. public function setDevAutoload(array $devAutoload)
  16088. {
  16089. $this->aliasOf->setDevAutoload($devAutoload);
  16090. }
  16091. public function setStabilityFlags(array $stabilityFlags)
  16092. {
  16093. $this->aliasOf->setStabilityFlags($stabilityFlags);
  16094. }
  16095. public function setSuggests(array $suggests)
  16096. {
  16097. $this->aliasOf->setSuggests($suggests);
  16098. }
  16099. public function setExtra(array $extra)
  16100. {
  16101. $this->aliasOf->setExtra($extra);
  16102. }
  16103. public function __clone()
  16104. {
  16105. parent::__clone();
  16106. $this->aliasOf = clone $this->aliasOf;
  16107. }
  16108. }
  16109. <?php
  16110. namespace Composer\Package;
  16111. class RootPackage extends CompletePackage implements RootPackageInterface
  16112. {
  16113. protected $minimumStability = 'stable';
  16114. protected $preferStable = false;
  16115. protected $stabilityFlags = array();
  16116. protected $references = array();
  16117. protected $aliases = array();
  16118. public function setMinimumStability($minimumStability)
  16119. {
  16120. $this->minimumStability = $minimumStability;
  16121. }
  16122. public function getMinimumStability()
  16123. {
  16124. return $this->minimumStability;
  16125. }
  16126. public function setStabilityFlags(array $stabilityFlags)
  16127. {
  16128. $this->stabilityFlags = $stabilityFlags;
  16129. }
  16130. public function getStabilityFlags()
  16131. {
  16132. return $this->stabilityFlags;
  16133. }
  16134. public function setPreferStable($preferStable)
  16135. {
  16136. $this->preferStable = $preferStable;
  16137. }
  16138. public function getPreferStable()
  16139. {
  16140. return $this->preferStable;
  16141. }
  16142. public function setReferences(array $references)
  16143. {
  16144. $this->references = $references;
  16145. }
  16146. public function getReferences()
  16147. {
  16148. return $this->references;
  16149. }
  16150. public function setAliases(array $aliases)
  16151. {
  16152. $this->aliases = $aliases;
  16153. }
  16154. public function getAliases()
  16155. {
  16156. return $this->aliases;
  16157. }
  16158. }
  16159. <?php
  16160. namespace Composer\Package;
  16161. interface RootPackageInterface extends CompletePackageInterface
  16162. {
  16163. public function getAliases();
  16164. public function getMinimumStability();
  16165. public function getStabilityFlags();
  16166. public function getReferences();
  16167. public function getPreferStable();
  16168. public function setRequires(array $requires);
  16169. public function setDevRequires(array $devRequires);
  16170. public function setConflicts(array $conflicts);
  16171. public function setProvides(array $provides);
  16172. public function setReplaces(array $replaces);
  16173. public function setRepositories($repositories);
  16174. public function setAutoload(array $autoload);
  16175. public function setDevAutoload(array $devAutoload);
  16176. public function setStabilityFlags(array $stabilityFlags);
  16177. public function setSuggests(array $suggests);
  16178. public function setExtra(array $extra);
  16179. }
  16180. <?php
  16181. namespace Composer\Package\Version;
  16182. use Composer\Config;
  16183. use Composer\Repository\Vcs\HgDriver;
  16184. use Composer\IO\NullIO;
  16185. use Composer\Semver\VersionParser as SemverVersionParser;
  16186. use Composer\Util\Git as GitUtil;
  16187. use Composer\Util\ProcessExecutor;
  16188. use Composer\Util\Svn as SvnUtil;
  16189. class VersionGuesser
  16190. {
  16191. private $config;
  16192. private $process;
  16193. private $versionParser;
  16194. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  16195. {
  16196. $this->config = $config;
  16197. $this->process = $process;
  16198. $this->versionParser = $versionParser;
  16199. }
  16200. public function guessVersion(array $packageConfig, $path)
  16201. {
  16202. if (function_exists('proc_open')) {
  16203. $version = $this->guessGitVersion($packageConfig, $path);
  16204. if (null !== $version) {
  16205. return $version;
  16206. }
  16207. $version = $this->guessHgVersion($packageConfig, $path);
  16208. if (null !== $version) {
  16209. return $version;
  16210. }
  16211. return $this->guessSvnVersion($packageConfig, $path);
  16212. }
  16213. }
  16214. private function guessGitVersion(array $packageConfig, $path)
  16215. {
  16216. GitUtil::cleanEnv();
  16217. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  16218. try {
  16219. return $this->versionParser->normalize(trim($output));
  16220. } catch (\Exception $e) {
  16221. }
  16222. }
  16223. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  16224. $branches = array();
  16225. $isFeatureBranch = false;
  16226. $version = null;
  16227. foreach ($this->process->splitLines($output) as $branch) {
  16228. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  16229. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ') {
  16230. $version = 'dev-'.$match[2];
  16231. $isFeatureBranch = true;
  16232. } else {
  16233. $version = $this->versionParser->normalizeBranch($match[1]);
  16234. $isFeatureBranch = 0 === strpos($version, 'dev-');
  16235. if ('9999999-dev' === $version) {
  16236. $version = 'dev-'.$match[1];
  16237. }
  16238. }
  16239. }
  16240. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  16241. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  16242. $branches[] = $match[1];
  16243. }
  16244. }
  16245. }
  16246. if (!$isFeatureBranch) {
  16247. return $version;
  16248. }
  16249. $version = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  16250. return $version;
  16251. }
  16252. }
  16253. private function guessHgVersion(array $packageConfig, $path)
  16254. {
  16255. if (0 === $this->process->execute('hg branch', $output, $path)) {
  16256. $branch = trim($output);
  16257. $version = $this->versionParser->normalizeBranch($branch);
  16258. $isFeatureBranch = 0 === strpos($version, 'dev-');
  16259. if ('9999999-dev' === $version) {
  16260. $version = 'dev-'.$branch;
  16261. }
  16262. if (!$isFeatureBranch) {
  16263. return $version;
  16264. }
  16265. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  16266. $branches = array_keys($driver->getBranches());
  16267. $version = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  16268. return $version;
  16269. }
  16270. }
  16271. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  16272. {
  16273. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  16274. || strpos(json_encode($packageConfig), '"self.version"')
  16275. ) {
  16276. $branch = preg_replace('{^dev-}', '', $version);
  16277. $length = PHP_INT_MAX;
  16278. $nonFeatureBranches = '';
  16279. if (!empty($packageConfig['non-feature-branches'])) {
  16280. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  16281. }
  16282. foreach ($branches as $candidate) {
  16283. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  16284. return $version;
  16285. }
  16286. if ($candidate === $branch || !preg_match('{^(master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  16287. continue;
  16288. }
  16289. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  16290. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  16291. continue;
  16292. }
  16293. if (strlen($output) < $length) {
  16294. $length = strlen($output);
  16295. $version = $this->versionParser->normalizeBranch($candidate);
  16296. if ('9999999-dev' === $version) {
  16297. $version = 'dev-'.$match[1];
  16298. }
  16299. }
  16300. }
  16301. }
  16302. return $version;
  16303. }
  16304. private function guessSvnVersion(array $packageConfig, $path)
  16305. {
  16306. SvnUtil::cleanEnv();
  16307. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  16308. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  16309. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  16310. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  16311. $urlPattern = '#<url>.*/('.$trunkPath.'|('.$branchesPath.'|'. $tagsPath .')/(.*))</url>#';
  16312. if (preg_match($urlPattern, $output, $matches)) {
  16313. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  16314. $version = $this->versionParser->normalizeBranch($matches[3]);
  16315. if ('9999999-dev' === $version) {
  16316. $version = 'dev-'.$matches[3];
  16317. }
  16318. return $version;
  16319. }
  16320. return $this->versionParser->normalize(trim($matches[1]));
  16321. }
  16322. }
  16323. }
  16324. }
  16325. <?php
  16326. namespace Composer\Package\Version;
  16327. use Composer\Semver\VersionParser as SemverVersionParser;
  16328. class VersionParser extends SemverVersionParser
  16329. {
  16330. private static $constraints = array();
  16331. public function parseConstraints($constraints)
  16332. {
  16333. if (!isset(self::$constraints[$constraints])) {
  16334. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  16335. }
  16336. return self::$constraints[$constraints];
  16337. }
  16338. public function parseNameVersionPairs(array $pairs)
  16339. {
  16340. $pairs = array_values($pairs);
  16341. $result = array();
  16342. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  16343. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  16344. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/')) {
  16345. $pair .= ' '.$pairs[$i + 1];
  16346. $i++;
  16347. }
  16348. if (strpos($pair, ' ')) {
  16349. list($name, $version) = explode(" ", $pair, 2);
  16350. $result[] = array('name' => $name, 'version' => $version);
  16351. } else {
  16352. $result[] = array('name' => $pair);
  16353. }
  16354. }
  16355. return $result;
  16356. }
  16357. }
  16358. <?php
  16359. namespace Composer\Package\Version;
  16360. use Composer\DependencyResolver\Pool;
  16361. use Composer\Package\BasePackage;
  16362. use Composer\Package\PackageInterface;
  16363. use Composer\Package\Loader\ArrayLoader;
  16364. use Composer\Package\Dumper\ArrayDumper;
  16365. use Composer\Semver\Semver;
  16366. use Composer\Semver\Constraint\Constraint;
  16367. class VersionSelector
  16368. {
  16369. private $pool;
  16370. private $parser;
  16371. public function __construct(Pool $pool)
  16372. {
  16373. $this->pool = $pool;
  16374. }
  16375. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  16376. {
  16377. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  16378. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  16379. if ($targetPhpVersion) {
  16380. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  16381. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  16382. $reqs = $pkg->getRequires();
  16383. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  16384. });
  16385. }
  16386. if (!$candidates) {
  16387. return false;
  16388. }
  16389. $package = reset($candidates);
  16390. $minPriority = BasePackage::$stabilities[$preferredStability];
  16391. foreach ($candidates as $candidate) {
  16392. $candidatePriority = $candidate->getStabilityPriority();
  16393. $currentPriority = $package->getStabilityPriority();
  16394. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  16395. continue;
  16396. }
  16397. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  16398. $package = $candidate;
  16399. continue;
  16400. }
  16401. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  16402. $package = $candidate;
  16403. }
  16404. }
  16405. return $package;
  16406. }
  16407. public function findRecommendedRequireVersion(PackageInterface $package)
  16408. {
  16409. $version = $package->getVersion();
  16410. if (!$package->isDev()) {
  16411. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  16412. }
  16413. $loader = new ArrayLoader($this->getParser());
  16414. $dumper = new ArrayDumper();
  16415. $extra = $loader->getBranchAlias($dumper->dump($package));
  16416. if ($extra) {
  16417. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  16418. if ($count) {
  16419. $extra = str_replace('.9999999', '.0', $extra);
  16420. return $this->transformVersion($extra, $extra, 'dev');
  16421. }
  16422. }
  16423. return $package->getPrettyVersion();
  16424. }
  16425. private function transformVersion($version, $prettyVersion, $stability)
  16426. {
  16427. $semanticVersionParts = explode('.', $version);
  16428. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  16429. if ($semanticVersionParts[0] === '0') {
  16430. unset($semanticVersionParts[3]);
  16431. } else {
  16432. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  16433. }
  16434. $version = implode('.', $semanticVersionParts);
  16435. } else {
  16436. return $prettyVersion;
  16437. }
  16438. if ($stability != 'stable') {
  16439. $version .= '@'.$stability;
  16440. }
  16441. return '^' . $version;
  16442. }
  16443. private function getParser()
  16444. {
  16445. if ($this->parser === null) {
  16446. $this->parser = new VersionParser();
  16447. }
  16448. return $this->parser;
  16449. }
  16450. }
  16451. <?php
  16452. namespace Composer\Plugin\Capability;
  16453. interface Capability
  16454. {
  16455. }
  16456. <?php
  16457. namespace Composer\Plugin;
  16458. interface Capable
  16459. {
  16460. public function getCapabilities();
  16461. }
  16462. <?php
  16463. namespace Composer\Plugin;
  16464. use Composer\EventDispatcher\Event;
  16465. use Symfony\Component\Console\Input\InputInterface;
  16466. use Symfony\Component\Console\Output\OutputInterface;
  16467. class CommandEvent extends Event
  16468. {
  16469. private $commandName;
  16470. private $input;
  16471. private $output;
  16472. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  16473. {
  16474. parent::__construct($name, $args, $flags);
  16475. $this->commandName = $commandName;
  16476. $this->input = $input;
  16477. $this->output = $output;
  16478. }
  16479. public function getInput()
  16480. {
  16481. return $this->input;
  16482. }
  16483. public function getOutput()
  16484. {
  16485. return $this->output;
  16486. }
  16487. public function getCommandName()
  16488. {
  16489. return $this->commandName;
  16490. }
  16491. }
  16492. <?php
  16493. namespace Composer\Plugin;
  16494. class PluginEvents
  16495. {
  16496. const COMMAND = 'command';
  16497. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  16498. }
  16499. <?php
  16500. namespace Composer\Plugin;
  16501. use Composer\Composer;
  16502. use Composer\IO\IOInterface;
  16503. interface PluginInterface
  16504. {
  16505. const PLUGIN_API_VERSION = '1.0.0';
  16506. public function activate(Composer $composer, IOInterface $io);
  16507. }
  16508. <?php
  16509. namespace Composer\Plugin;
  16510. use Composer\Composer;
  16511. use Composer\EventDispatcher\EventSubscriberInterface;
  16512. use Composer\IO\IOInterface;
  16513. use Composer\Package\Package;
  16514. use Composer\Package\Version\VersionParser;
  16515. use Composer\Repository\RepositoryInterface;
  16516. use Composer\Package\AliasPackage;
  16517. use Composer\Package\PackageInterface;
  16518. use Composer\Package\Link;
  16519. use Composer\Semver\Constraint\Constraint;
  16520. use Composer\DependencyResolver\Pool;
  16521. use Composer\Plugin\Capability\Capability;
  16522. class PluginManager
  16523. {
  16524. protected $composer;
  16525. protected $io;
  16526. protected $globalComposer;
  16527. protected $versionParser;
  16528. protected $disablePlugins = false;
  16529. protected $plugins = array();
  16530. protected $registeredPlugins = array();
  16531. private static $classCounter = 0;
  16532. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  16533. {
  16534. $this->io = $io;
  16535. $this->composer = $composer;
  16536. $this->globalComposer = $globalComposer;
  16537. $this->versionParser = new VersionParser();
  16538. $this->disablePlugins = $disablePlugins;
  16539. }
  16540. public function loadInstalledPlugins()
  16541. {
  16542. if ($this->disablePlugins) {
  16543. return;
  16544. }
  16545. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  16546. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  16547. if ($repo) {
  16548. $this->loadRepository($repo);
  16549. }
  16550. if ($globalRepo) {
  16551. $this->loadRepository($globalRepo);
  16552. }
  16553. }
  16554. public function getPlugins()
  16555. {
  16556. return $this->plugins;
  16557. }
  16558. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  16559. {
  16560. if ($this->disablePlugins) {
  16561. return;
  16562. }
  16563. if ($package->getType() === 'composer-plugin') {
  16564. $requiresComposer = null;
  16565. foreach ($package->getRequires() as $link) {
  16566. if ('composer-plugin-api' === $link->getTarget()) {
  16567. $requiresComposer = $link->getConstraint();
  16568. break;
  16569. }
  16570. }
  16571. if (!$requiresComposer) {
  16572. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  16573. }
  16574. $currentPluginApiVersion = $this->getPluginApiVersion();
  16575. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  16576. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  16577. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  16578. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  16579. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  16580. return;
  16581. }
  16582. }
  16583. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  16584. if (in_array($package->getName(), $this->registeredPlugins)) {
  16585. return;
  16586. }
  16587. $extra = $package->getExtra();
  16588. if (empty($extra['class'])) {
  16589. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  16590. }
  16591. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  16592. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  16593. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  16594. $pool = new Pool('dev');
  16595. $pool->addRepository($localRepo);
  16596. if ($globalRepo) {
  16597. $pool->addRepository($globalRepo);
  16598. }
  16599. $autoloadPackages = array($package->getName() => $package);
  16600. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  16601. $generator = $this->composer->getAutoloadGenerator();
  16602. $autoloads = array();
  16603. foreach ($autoloadPackages as $autoloadPackage) {
  16604. $downloadPath = $this->getInstallPath($autoloadPackage, ($globalRepo && $globalRepo->hasPackage($autoloadPackage)));
  16605. $autoloads[] = array($autoloadPackage, $downloadPath);
  16606. }
  16607. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  16608. $classLoader = $generator->createLoader($map);
  16609. $classLoader->register();
  16610. foreach ($classes as $class) {
  16611. if (class_exists($class, false)) {
  16612. $code = file_get_contents($classLoader->findFile($class));
  16613. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+(\S+)}mi', '$1class $2_composer_tmp'.self::$classCounter, $code);
  16614. eval('?>'.$code);
  16615. $class .= '_composer_tmp'.self::$classCounter;
  16616. self::$classCounter++;
  16617. }
  16618. if ($oldInstallerPlugin) {
  16619. $installer = new $class($this->io, $this->composer);
  16620. $this->composer->getInstallationManager()->addInstaller($installer);
  16621. } elseif (class_exists($class)) {
  16622. $plugin = new $class();
  16623. $this->addPlugin($plugin);
  16624. $this->registeredPlugins[] = $package->getName();
  16625. } elseif ($failOnMissingClasses) {
  16626. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  16627. }
  16628. }
  16629. }
  16630. protected function getPluginApiVersion()
  16631. {
  16632. return PluginInterface::PLUGIN_API_VERSION;
  16633. }
  16634. private function addPlugin(PluginInterface $plugin)
  16635. {
  16636. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  16637. $this->plugins[] = $plugin;
  16638. $plugin->activate($this->composer, $this->io);
  16639. if ($plugin instanceof EventSubscriberInterface) {
  16640. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  16641. }
  16642. }
  16643. private function loadRepository(RepositoryInterface $repo)
  16644. {
  16645. foreach ($repo->getPackages() as $package) {
  16646. if ($package instanceof AliasPackage) {
  16647. continue;
  16648. }
  16649. if ('composer-plugin' === $package->getType()) {
  16650. $this->registerPackage($package);
  16651. } elseif ('composer-installer' === $package->getType()) {
  16652. $this->registerPackage($package);
  16653. }
  16654. }
  16655. }
  16656. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  16657. {
  16658. $requires = array_merge(
  16659. $package->getRequires(),
  16660. $package->getDevRequires()
  16661. );
  16662. foreach ($requires as $requireLink) {
  16663. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  16664. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  16665. $collected[$requiredPackage->getName()] = $requiredPackage;
  16666. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  16667. }
  16668. }
  16669. return $collected;
  16670. }
  16671. private function lookupInstalledPackage(Pool $pool, Link $link)
  16672. {
  16673. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  16674. return (!empty($packages)) ? $packages[0] : null;
  16675. }
  16676. private function getInstallPath(PackageInterface $package, $global = false)
  16677. {
  16678. if (!$global) {
  16679. return $this->composer->getInstallationManager()->getInstallPath($package);
  16680. }
  16681. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  16682. }
  16683. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  16684. {
  16685. if (!($plugin instanceof Capable)) {
  16686. return null;
  16687. }
  16688. $capabilities = (array) $plugin->getCapabilities();
  16689. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  16690. return trim($capabilities[$capability]);
  16691. }
  16692. if (
  16693. array_key_exists($capability, $capabilities)
  16694. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  16695. ) {
  16696. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  16697. }
  16698. }
  16699. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  16700. {
  16701. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  16702. if (!class_exists($capabilityClass)) {
  16703. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  16704. }
  16705. $capabilityObj = new $capabilityClass($ctorArgs);
  16706. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  16707. throw new \RuntimeException(
  16708. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  16709. );
  16710. }
  16711. return $capabilityObj;
  16712. }
  16713. }
  16714. }
  16715. <?php
  16716. namespace Composer\Plugin;
  16717. use Composer\EventDispatcher\Event;
  16718. use Composer\Util\RemoteFilesystem;
  16719. class PreFileDownloadEvent extends Event
  16720. {
  16721. private $rfs;
  16722. private $processedUrl;
  16723. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  16724. {
  16725. parent::__construct($name);
  16726. $this->rfs = $rfs;
  16727. $this->processedUrl = $processedUrl;
  16728. }
  16729. public function getRemoteFilesystem()
  16730. {
  16731. return $this->rfs;
  16732. }
  16733. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  16734. {
  16735. $this->rfs = $rfs;
  16736. }
  16737. public function getProcessedUrl()
  16738. {
  16739. return $this->processedUrl;
  16740. }
  16741. }
  16742. <?php
  16743. namespace Composer\Repository;
  16744. use Composer\Package\AliasPackage;
  16745. use Composer\Package\PackageInterface;
  16746. use Composer\Package\CompletePackageInterface;
  16747. use Composer\Package\Version\VersionParser;
  16748. use Composer\Semver\Constraint\ConstraintInterface;
  16749. use Composer\Semver\Constraint\Constraint;
  16750. class ArrayRepository extends BaseRepository
  16751. {
  16752. protected $packages;
  16753. public function __construct(array $packages = array())
  16754. {
  16755. foreach ($packages as $package) {
  16756. $this->addPackage($package);
  16757. }
  16758. }
  16759. public function findPackage($name, $constraint)
  16760. {
  16761. $name = strtolower($name);
  16762. if (!$constraint instanceof ConstraintInterface) {
  16763. $versionParser = new VersionParser();
  16764. $constraint = $versionParser->parseConstraints($constraint);
  16765. }
  16766. foreach ($this->getPackages() as $package) {
  16767. if ($name === $package->getName()) {
  16768. $pkgConstraint = new Constraint('==', $package->getVersion());
  16769. if ($constraint->matches($pkgConstraint)) {
  16770. return $package;
  16771. }
  16772. }
  16773. }
  16774. }
  16775. public function findPackages($name, $constraint = null)
  16776. {
  16777. $name = strtolower($name);
  16778. $packages = array();
  16779. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  16780. $versionParser = new VersionParser();
  16781. $constraint = $versionParser->parseConstraints($constraint);
  16782. }
  16783. foreach ($this->getPackages() as $package) {
  16784. if ($name === $package->getName()) {
  16785. $pkgConstraint = new Constraint('==', $package->getVersion());
  16786. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  16787. $packages[] = $package;
  16788. }
  16789. }
  16790. }
  16791. return $packages;
  16792. }
  16793. public function search($query, $mode = 0)
  16794. {
  16795. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  16796. $matches = array();
  16797. foreach ($this->getPackages() as $package) {
  16798. $name = $package->getName();
  16799. if (isset($matches[$name])) {
  16800. continue;
  16801. }
  16802. if (preg_match($regex, $name)
  16803. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  16804. ) {
  16805. $matches[$name] = array(
  16806. 'name' => $package->getPrettyName(),
  16807. 'description' => $package->getDescription(),
  16808. );
  16809. }
  16810. }
  16811. return array_values($matches);
  16812. }
  16813. public function hasPackage(PackageInterface $package)
  16814. {
  16815. $packageId = $package->getUniqueName();
  16816. foreach ($this->getPackages() as $repoPackage) {
  16817. if ($packageId === $repoPackage->getUniqueName()) {
  16818. return true;
  16819. }
  16820. }
  16821. return false;
  16822. }
  16823. public function addPackage(PackageInterface $package)
  16824. {
  16825. if (null === $this->packages) {
  16826. $this->initialize();
  16827. }
  16828. $package->setRepository($this);
  16829. $this->packages[] = $package;
  16830. if ($package instanceof AliasPackage) {
  16831. $aliasedPackage = $package->getAliasOf();
  16832. if (null === $aliasedPackage->getRepository()) {
  16833. $this->addPackage($aliasedPackage);
  16834. }
  16835. }
  16836. }
  16837. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  16838. {
  16839. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  16840. }
  16841. public function removePackage(PackageInterface $package)
  16842. {
  16843. $packageId = $package->getUniqueName();
  16844. foreach ($this->getPackages() as $key => $repoPackage) {
  16845. if ($packageId === $repoPackage->getUniqueName()) {
  16846. array_splice($this->packages, $key, 1);
  16847. return;
  16848. }
  16849. }
  16850. }
  16851. public function getPackages()
  16852. {
  16853. if (null === $this->packages) {
  16854. $this->initialize();
  16855. }
  16856. return $this->packages;
  16857. }
  16858. public function count()
  16859. {
  16860. return count($this->packages);
  16861. }
  16862. protected function initialize()
  16863. {
  16864. $this->packages = array();
  16865. }
  16866. }
  16867. <?php
  16868. namespace Composer\Repository;
  16869. use Composer\IO\IOInterface;
  16870. use Composer\Json\JsonFile;
  16871. use Composer\Package\Loader\ArrayLoader;
  16872. use Composer\Package\Loader\LoaderInterface;
  16873. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  16874. {
  16875. protected $loader;
  16876. protected $lookup;
  16877. protected $repoConfig;
  16878. public function __construct(array $repoConfig, IOInterface $io)
  16879. {
  16880. if (!extension_loaded('zip')) {
  16881. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  16882. }
  16883. $this->loader = new ArrayLoader();
  16884. $this->lookup = $repoConfig['url'];
  16885. $this->io = $io;
  16886. $this->repoConfig = $repoConfig;
  16887. }
  16888. public function getRepoConfig()
  16889. {
  16890. return $this->repoConfig;
  16891. }
  16892. protected function initialize()
  16893. {
  16894. parent::initialize();
  16895. $this->scanDirectory($this->lookup);
  16896. }
  16897. private function scanDirectory($path)
  16898. {
  16899. $io = $this->io;
  16900. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  16901. $iterator = new \RecursiveIteratorIterator($directory);
  16902. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  16903. foreach ($regex as $file) {
  16904. if (!$file->isFile()) {
  16905. continue;
  16906. }
  16907. $package = $this->getComposerInformation($file);
  16908. if (!$package) {
  16909. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  16910. continue;
  16911. }
  16912. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  16913. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  16914. $this->addPackage($package);
  16915. }
  16916. }
  16917. private function locateFile(\ZipArchive $zip, $filename)
  16918. {
  16919. $indexOfShortestMatch = false;
  16920. $lengthOfShortestMatch = -1;
  16921. for ($i = 0; $i < $zip->numFiles; $i++) {
  16922. $stat = $zip->statIndex($i);
  16923. if (strcmp(basename($stat['name']), $filename) === 0) {
  16924. $directoryName = dirname($stat['name']);
  16925. if ($directoryName == '.') {
  16926. return $i;
  16927. }
  16928. if (strpos($directoryName, '\\') !== false ||
  16929. strpos($directoryName, '/') !== false) {
  16930. continue;
  16931. }
  16932. $length = strlen($stat['name']);
  16933. if ($indexOfShortestMatch == false || $length < $lengthOfShortestMatch) {
  16934. $contents = $zip->getFromIndex($i);
  16935. if ($contents !== false) {
  16936. $indexOfShortestMatch = $i;
  16937. $lengthOfShortestMatch = $length;
  16938. }
  16939. }
  16940. }
  16941. }
  16942. return $indexOfShortestMatch;
  16943. }
  16944. private function getComposerInformation(\SplFileInfo $file)
  16945. {
  16946. $zip = new \ZipArchive();
  16947. $zip->open($file->getPathname());
  16948. if (0 == $zip->numFiles) {
  16949. return false;
  16950. }
  16951. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  16952. if (false === $foundFileIndex) {
  16953. return false;
  16954. }
  16955. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  16956. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  16957. $json = file_get_contents($composerFile);
  16958. $package = JsonFile::parseJson($json, $composerFile);
  16959. $package['dist'] = array(
  16960. 'type' => 'zip',
  16961. 'url' => strtr($file->getPathname(), '\\', '/'),
  16962. 'shasum' => sha1_file($file->getRealPath()),
  16963. );
  16964. $package = $this->loader->load($package);
  16965. return $package;
  16966. }
  16967. }
  16968. <?php
  16969. namespace Composer\Repository;
  16970. use Composer\Package\RootPackageInterface;
  16971. use Composer\Semver\Constraint\ConstraintInterface;
  16972. abstract class BaseRepository implements RepositoryInterface
  16973. {
  16974. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true)
  16975. {
  16976. $needles = (array) $needle;
  16977. $results = array();
  16978. foreach ($this->getPackages() as $package) {
  16979. $links = $package->getRequires();
  16980. if (!$invert) {
  16981. $links += $package->getReplaces();
  16982. }
  16983. if ($package instanceof RootPackageInterface) {
  16984. $links += $package->getDevRequires();
  16985. }
  16986. foreach ($links as $link) {
  16987. foreach ($needles as $needle) {
  16988. if ($link->getTarget() === $needle) {
  16989. if (is_null($constraint) || (($link->getConstraint()->matches($constraint) === !$invert))) {
  16990. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true) : array();
  16991. $results[$link->getSource()] = array($package, $link, $dependents);
  16992. }
  16993. }
  16994. }
  16995. }
  16996. }
  16997. ksort($results);
  16998. return $results;
  16999. }
  17000. }
  17001. <?php
  17002. namespace Composer\Repository;
  17003. use Composer\Package\Loader\ArrayLoader;
  17004. use Composer\Package\PackageInterface;
  17005. use Composer\Package\AliasPackage;
  17006. use Composer\Package\Version\VersionParser;
  17007. use Composer\DependencyResolver\Pool;
  17008. use Composer\Json\JsonFile;
  17009. use Composer\Cache;
  17010. use Composer\Config;
  17011. use Composer\Factory;
  17012. use Composer\IO\IOInterface;
  17013. use Composer\Util\RemoteFilesystem;
  17014. use Composer\Plugin\PluginEvents;
  17015. use Composer\Plugin\PreFileDownloadEvent;
  17016. use Composer\EventDispatcher\EventDispatcher;
  17017. use Composer\Downloader\TransportException;
  17018. use Composer\Semver\Constraint\ConstraintInterface;
  17019. use Composer\Semver\Constraint\Constraint;
  17020. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  17021. {
  17022. protected $config;
  17023. protected $repoConfig;
  17024. protected $options;
  17025. protected $url;
  17026. protected $baseUrl;
  17027. protected $io;
  17028. protected $rfs;
  17029. protected $cache;
  17030. protected $notifyUrl;
  17031. protected $searchUrl;
  17032. protected $hasProviders = false;
  17033. protected $providersUrl;
  17034. protected $lazyProvidersUrl;
  17035. protected $providerListing;
  17036. protected $providers = array();
  17037. protected $providersByUid = array();
  17038. protected $loader;
  17039. protected $rootAliases;
  17040. protected $allowSslDowngrade = false;
  17041. protected $eventDispatcher;
  17042. protected $sourceMirrors;
  17043. protected $distMirrors;
  17044. private $degradedMode = false;
  17045. private $rootData;
  17046. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  17047. {
  17048. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  17049. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  17050. }
  17051. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  17052. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  17053. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  17054. }
  17055. $urlBits = parse_url($repoConfig['url']);
  17056. if ($urlBits === false || empty($urlBits['scheme'])) {
  17057. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  17058. }
  17059. if (!isset($repoConfig['options'])) {
  17060. $repoConfig['options'] = array();
  17061. }
  17062. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  17063. $this->allowSslDowngrade = true;
  17064. }
  17065. $this->config = $config;
  17066. $this->options = $repoConfig['options'];
  17067. $this->url = $repoConfig['url'];
  17068. $this->baseUrl = rtrim(preg_replace('{^(.*)(?:/[^/\\]+.json)?(?:[?#].*)?$}', '$1', $this->url), '/');
  17069. $this->io = $io;
  17070. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  17071. $this->loader = new ArrayLoader();
  17072. if ($rfs && $this->options) {
  17073. $rfs = clone $rfs;
  17074. $rfs->setOptions($this->options);
  17075. }
  17076. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  17077. $this->eventDispatcher = $eventDispatcher;
  17078. $this->repoConfig = $repoConfig;
  17079. }
  17080. public function getRepoConfig()
  17081. {
  17082. return $this->repoConfig;
  17083. }
  17084. public function setRootAliases(array $rootAliases)
  17085. {
  17086. $this->rootAliases = $rootAliases;
  17087. }
  17088. public function findPackage($name, $constraint)
  17089. {
  17090. if (!$this->hasProviders()) {
  17091. return parent::findPackage($name, $constraint);
  17092. }
  17093. $name = strtolower($name);
  17094. if (!$constraint instanceof ConstraintInterface) {
  17095. $versionParser = new VersionParser();
  17096. $constraint = $versionParser->parseConstraints($constraint);
  17097. }
  17098. foreach ($this->getProviderNames() as $providerName) {
  17099. if ($name === $providerName) {
  17100. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  17101. foreach ($packages as $package) {
  17102. if ($name === $package->getName()) {
  17103. $pkgConstraint = new Constraint('==', $package->getVersion());
  17104. if ($constraint->matches($pkgConstraint)) {
  17105. return $package;
  17106. }
  17107. }
  17108. }
  17109. break;
  17110. }
  17111. }
  17112. }
  17113. public function findPackages($name, $constraint = null)
  17114. {
  17115. if (!$this->hasProviders()) {
  17116. return parent::findPackages($name, $constraint);
  17117. }
  17118. $name = strtolower($name);
  17119. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  17120. $versionParser = new VersionParser();
  17121. $constraint = $versionParser->parseConstraints($constraint);
  17122. }
  17123. $packages = array();
  17124. foreach ($this->getProviderNames() as $providerName) {
  17125. if ($name === $providerName) {
  17126. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  17127. foreach ($candidates as $package) {
  17128. if ($name === $package->getName()) {
  17129. $pkgConstraint = new Constraint('==', $package->getVersion());
  17130. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  17131. $packages[] = $package;
  17132. }
  17133. }
  17134. }
  17135. break;
  17136. }
  17137. }
  17138. return $packages;
  17139. }
  17140. public function getPackages()
  17141. {
  17142. if ($this->hasProviders()) {
  17143. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  17144. }
  17145. return parent::getPackages();
  17146. }
  17147. public function search($query, $mode = 0)
  17148. {
  17149. $this->loadRootServerFile();
  17150. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  17151. $url = str_replace('%query%', $query, $this->searchUrl);
  17152. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  17153. $json = $this->rfs->getContents($hostname, $url, false);
  17154. $results = JsonFile::parseJson($json, $url);
  17155. return $results['results'];
  17156. }
  17157. if ($this->hasProviders()) {
  17158. $results = array();
  17159. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  17160. foreach ($this->getProviderNames() as $name) {
  17161. if (preg_match($regex, $name)) {
  17162. $results[] = array('name' => $name);
  17163. }
  17164. }
  17165. return $results;
  17166. }
  17167. return parent::search($query, $mode);
  17168. }
  17169. public function getProviderNames()
  17170. {
  17171. $this->loadRootServerFile();
  17172. if (null === $this->providerListing) {
  17173. $this->loadProviderListings($this->loadRootServerFile());
  17174. }
  17175. if ($this->lazyProvidersUrl) {
  17176. return array();
  17177. }
  17178. if ($this->providersUrl) {
  17179. return array_keys($this->providerListing);
  17180. }
  17181. return array();
  17182. }
  17183. protected function configurePackageTransportOptions(PackageInterface $package)
  17184. {
  17185. foreach ($package->getDistUrls() as $url) {
  17186. if (strpos($url, $this->baseUrl) === 0) {
  17187. $package->setTransportOptions($this->options);
  17188. return;
  17189. }
  17190. }
  17191. }
  17192. public function hasProviders()
  17193. {
  17194. $this->loadRootServerFile();
  17195. return $this->hasProviders;
  17196. }
  17197. public function resetPackageIds()
  17198. {
  17199. foreach ($this->providersByUid as $package) {
  17200. if ($package instanceof AliasPackage) {
  17201. $package->getAliasOf()->setId(-1);
  17202. }
  17203. $package->setId(-1);
  17204. }
  17205. }
  17206. public function whatProvides(Pool $pool, $name)
  17207. {
  17208. if (isset($this->providers[$name])) {
  17209. return $this->providers[$name];
  17210. }
  17211. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name) {
  17212. return array();
  17213. }
  17214. if (null === $this->providerListing) {
  17215. $this->loadProviderListings($this->loadRootServerFile());
  17216. }
  17217. $useLastModifiedCheck = false;
  17218. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  17219. $hash = null;
  17220. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  17221. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  17222. $useLastModifiedCheck = true;
  17223. } elseif ($this->providersUrl) {
  17224. if (!isset($this->providerListing[$name])) {
  17225. return array();
  17226. }
  17227. $hash = $this->providerListing[$name]['sha256'];
  17228. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  17229. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  17230. } else {
  17231. return array();
  17232. }
  17233. $packages = null;
  17234. if ($cacheKey) {
  17235. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  17236. $packages = json_decode($this->cache->read($cacheKey), true);
  17237. } elseif ($useLastModifiedCheck) {
  17238. if ($contents = $this->cache->read($cacheKey)) {
  17239. $contents = json_decode($contents, true);
  17240. if (isset($contents['last-modified'])) {
  17241. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  17242. if (true === $response) {
  17243. $packages = $contents;
  17244. } elseif ($response) {
  17245. $packages = $response;
  17246. }
  17247. }
  17248. }
  17249. }
  17250. }
  17251. if (!$packages) {
  17252. try {
  17253. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  17254. } catch (TransportException $e) {
  17255. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  17256. $packages = array('packages' => array());
  17257. } else {
  17258. throw $e;
  17259. }
  17260. }
  17261. }
  17262. $this->providers[$name] = array();
  17263. foreach ($packages['packages'] as $versions) {
  17264. foreach ($versions as $version) {
  17265. if (isset($this->providersByUid[$version['uid']])) {
  17266. if (!isset($this->providers[$name][$version['uid']])) {
  17267. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  17268. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  17269. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  17270. } else {
  17271. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  17272. }
  17273. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  17274. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  17275. }
  17276. }
  17277. } else {
  17278. if (!$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  17279. continue;
  17280. }
  17281. $package = $this->createPackage($version, 'Composer\Package\Package');
  17282. $package->setRepository($this);
  17283. if ($package instanceof AliasPackage) {
  17284. $aliased = $package->getAliasOf();
  17285. $aliased->setRepository($this);
  17286. $this->providers[$name][$version['uid']] = $aliased;
  17287. $this->providers[$name][$version['uid'].'-alias'] = $package;
  17288. $this->providersByUid[$version['uid']] = $package;
  17289. } else {
  17290. $this->providers[$name][$version['uid']] = $package;
  17291. $this->providersByUid[$version['uid']] = $package;
  17292. }
  17293. unset($rootAliasData);
  17294. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  17295. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  17296. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  17297. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  17298. }
  17299. if (isset($rootAliasData)) {
  17300. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  17301. $alias->setRepository($this);
  17302. $this->providers[$name][$version['uid'].'-root'] = $alias;
  17303. $this->providersByUid[$version['uid'].'-root'] = $alias;
  17304. }
  17305. }
  17306. }
  17307. }
  17308. return $this->providers[$name];
  17309. }
  17310. protected function initialize()
  17311. {
  17312. parent::initialize();
  17313. $repoData = $this->loadDataFromServer();
  17314. foreach ($repoData as $package) {
  17315. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  17316. }
  17317. }
  17318. public function addPackage(PackageInterface $package)
  17319. {
  17320. parent::addPackage($package);
  17321. $this->configurePackageTransportOptions($package);
  17322. }
  17323. protected function loadRootServerFile()
  17324. {
  17325. if (null !== $this->rootData) {
  17326. return $this->rootData;
  17327. }
  17328. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  17329. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  17330. }
  17331. $jsonUrlParts = parse_url($this->url);
  17332. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  17333. $jsonUrl = $this->url;
  17334. } else {
  17335. $jsonUrl = $this->url . '/packages.json';
  17336. }
  17337. $data = $this->fetchFile($jsonUrl, 'packages.json');
  17338. if (!empty($data['notify-batch'])) {
  17339. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  17340. } elseif (!empty($data['notify'])) {
  17341. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  17342. }
  17343. if (!empty($data['search'])) {
  17344. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  17345. }
  17346. if (!empty($data['mirrors'])) {
  17347. foreach ($data['mirrors'] as $mirror) {
  17348. if (!empty($mirror['git-url'])) {
  17349. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  17350. }
  17351. if (!empty($mirror['hg-url'])) {
  17352. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  17353. }
  17354. if (!empty($mirror['dist-url'])) {
  17355. $this->distMirrors[] = array('url' => $mirror['dist-url'], 'preferred' => !empty($mirror['preferred']));
  17356. }
  17357. }
  17358. }
  17359. if (!empty($data['warning'])) {
  17360. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  17361. }
  17362. if (!empty($data['providers-lazy-url'])) {
  17363. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  17364. $this->hasProviders = true;
  17365. }
  17366. if ($this->allowSslDowngrade) {
  17367. $this->url = str_replace('https://', 'http://', $this->url);
  17368. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  17369. }
  17370. if (!empty($data['providers-url'])) {
  17371. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  17372. $this->hasProviders = true;
  17373. }
  17374. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  17375. $this->hasProviders = true;
  17376. }
  17377. if (preg_match('{^https?://packagist.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  17378. $this->url = 'https://packagist.org';
  17379. $this->baseUrl = 'https://packagist.org';
  17380. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://packagist.org/p/%package%.json');
  17381. $this->providersUrl = null;
  17382. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  17383. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  17384. $this->providersUrl = null;
  17385. }
  17386. return $this->rootData = $data;
  17387. }
  17388. protected function canonicalizeUrl($url)
  17389. {
  17390. if ('/' === $url[0]) {
  17391. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  17392. }
  17393. return $url;
  17394. }
  17395. protected function loadDataFromServer()
  17396. {
  17397. $data = $this->loadRootServerFile();
  17398. return $this->loadIncludes($data);
  17399. }
  17400. protected function loadProviderListings($data)
  17401. {
  17402. if (isset($data['providers'])) {
  17403. if (!is_array($this->providerListing)) {
  17404. $this->providerListing = array();
  17405. }
  17406. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  17407. }
  17408. if ($this->providersUrl && isset($data['provider-includes'])) {
  17409. $includes = $data['provider-includes'];
  17410. foreach ($includes as $include => $metadata) {
  17411. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  17412. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  17413. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  17414. $includedData = json_decode($this->cache->read($cacheKey), true);
  17415. } else {
  17416. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  17417. }
  17418. $this->loadProviderListings($includedData);
  17419. }
  17420. }
  17421. }
  17422. protected function loadIncludes($data)
  17423. {
  17424. $packages = array();
  17425. if (!isset($data['packages']) && !isset($data['includes'])) {
  17426. foreach ($data as $pkg) {
  17427. foreach ($pkg['versions'] as $metadata) {
  17428. $packages[] = $metadata;
  17429. }
  17430. }
  17431. return $packages;
  17432. }
  17433. if (isset($data['packages'])) {
  17434. foreach ($data['packages'] as $package => $versions) {
  17435. foreach ($versions as $version => $metadata) {
  17436. $packages[] = $metadata;
  17437. }
  17438. }
  17439. }
  17440. if (isset($data['includes'])) {
  17441. foreach ($data['includes'] as $include => $metadata) {
  17442. if ($this->cache->sha1($include) === $metadata['sha1']) {
  17443. $includedData = json_decode($this->cache->read($include), true);
  17444. } else {
  17445. $includedData = $this->fetchFile($include);
  17446. }
  17447. $packages = array_merge($packages, $this->loadIncludes($includedData));
  17448. }
  17449. }
  17450. return $packages;
  17451. }
  17452. protected function createPackage(array $data, $class)
  17453. {
  17454. try {
  17455. if (!isset($data['notification-url'])) {
  17456. $data['notification-url'] = $this->notifyUrl;
  17457. }
  17458. $package = $this->loader->load($data, 'Composer\Package\CompletePackage');
  17459. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  17460. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  17461. }
  17462. $package->setDistMirrors($this->distMirrors);
  17463. $this->configurePackageTransportOptions($package);
  17464. return $package;
  17465. } catch (\Exception $e) {
  17466. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  17467. }
  17468. }
  17469. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  17470. {
  17471. if (null === $cacheKey) {
  17472. $cacheKey = $filename;
  17473. $filename = $this->baseUrl.'/'.$filename;
  17474. }
  17475. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  17476. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  17477. }
  17478. $retries = 3;
  17479. while ($retries--) {
  17480. try {
  17481. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  17482. if ($this->eventDispatcher) {
  17483. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  17484. }
  17485. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  17486. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  17487. $json = $rfs->getContents($hostname, $filename, false);
  17488. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  17489. if ($retries) {
  17490. usleep(100000);
  17491. continue;
  17492. }
  17493. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This should indicate a man-in-the-middle attack. Try running composer again and report this if you think it is a mistake.');
  17494. }
  17495. $data = JsonFile::parseJson($json, $filename);
  17496. if ($cacheKey) {
  17497. if ($storeLastModifiedTime) {
  17498. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  17499. if ($lastModifiedDate) {
  17500. $data['last-modified'] = $lastModifiedDate;
  17501. $json = json_encode($data);
  17502. }
  17503. }
  17504. $this->cache->write($cacheKey, $json);
  17505. }
  17506. break;
  17507. } catch (\Exception $e) {
  17508. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  17509. throw $e;
  17510. }
  17511. if ($retries) {
  17512. usleep(100000);
  17513. continue;
  17514. }
  17515. if ($e instanceof RepositorySecurityException) {
  17516. throw $e;
  17517. }
  17518. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  17519. if (!$this->degradedMode) {
  17520. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  17521. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  17522. }
  17523. $this->degradedMode = true;
  17524. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  17525. break;
  17526. }
  17527. throw $e;
  17528. }
  17529. }
  17530. return $data;
  17531. }
  17532. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  17533. {
  17534. $retries = 3;
  17535. while ($retries--) {
  17536. try {
  17537. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  17538. if ($this->eventDispatcher) {
  17539. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  17540. }
  17541. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  17542. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  17543. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  17544. $json = $rfs->getContents($hostname, $filename, false, $options);
  17545. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  17546. return true;
  17547. }
  17548. $data = JsonFile::parseJson($json, $filename);
  17549. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  17550. if ($lastModifiedDate) {
  17551. $data['last-modified'] = $lastModifiedDate;
  17552. $json = json_encode($data);
  17553. }
  17554. $this->cache->write($cacheKey, $json);
  17555. return $data;
  17556. } catch (\Exception $e) {
  17557. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  17558. throw $e;
  17559. }
  17560. if ($retries) {
  17561. usleep(100000);
  17562. continue;
  17563. }
  17564. if (!$this->degradedMode) {
  17565. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  17566. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  17567. }
  17568. $this->degradedMode = true;
  17569. return true;
  17570. }
  17571. }
  17572. }
  17573. }
  17574. <?php
  17575. namespace Composer\Repository;
  17576. use Composer\Package\PackageInterface;
  17577. class CompositeRepository extends BaseRepository
  17578. {
  17579. private $repositories;
  17580. public function __construct(array $repositories)
  17581. {
  17582. $this->repositories = array();
  17583. foreach ($repositories as $repo) {
  17584. $this->addRepository($repo);
  17585. }
  17586. }
  17587. public function getRepositories()
  17588. {
  17589. return $this->repositories;
  17590. }
  17591. public function hasPackage(PackageInterface $package)
  17592. {
  17593. foreach ($this->repositories as $repository) {
  17594. if ($repository->hasPackage($package)) {
  17595. return true;
  17596. }
  17597. }
  17598. return false;
  17599. }
  17600. public function findPackage($name, $constraint)
  17601. {
  17602. foreach ($this->repositories as $repository) {
  17603. $package = $repository->findPackage($name, $constraint);
  17604. if (null !== $package) {
  17605. return $package;
  17606. }
  17607. }
  17608. return null;
  17609. }
  17610. public function findPackages($name, $constraint = null)
  17611. {
  17612. $packages = array();
  17613. foreach ($this->repositories as $repository) {
  17614. $packages[] = $repository->findPackages($name, $constraint);
  17615. }
  17616. return $packages ? call_user_func_array('array_merge', $packages) : array();
  17617. }
  17618. public function search($query, $mode = 0)
  17619. {
  17620. $matches = array();
  17621. foreach ($this->repositories as $repository) {
  17622. $matches[] = $repository->search($query, $mode);
  17623. }
  17624. return $matches ? call_user_func_array('array_merge', $matches) : array();
  17625. }
  17626. public function getPackages()
  17627. {
  17628. $packages = array();
  17629. foreach ($this->repositories as $repository) {
  17630. $packages[] = $repository->getPackages();
  17631. }
  17632. return $packages ? call_user_func_array('array_merge', $packages) : array();
  17633. }
  17634. public function removePackage(PackageInterface $package)
  17635. {
  17636. foreach ($this->repositories as $repository) {
  17637. $repository->removePackage($package);
  17638. }
  17639. }
  17640. public function count()
  17641. {
  17642. $total = 0;
  17643. foreach ($this->repositories as $repository) {
  17644. $total += $repository->count();
  17645. }
  17646. return $total;
  17647. }
  17648. public function addRepository(RepositoryInterface $repository)
  17649. {
  17650. if ($repository instanceof self) {
  17651. foreach ($repository->getRepositories() as $repo) {
  17652. $this->addRepository($repo);
  17653. }
  17654. } else {
  17655. $this->repositories[] = $repository;
  17656. }
  17657. }
  17658. }
  17659. <?php
  17660. namespace Composer\Repository;
  17661. interface ConfigurableRepositoryInterface
  17662. {
  17663. public function getRepoConfig();
  17664. }
  17665. <?php
  17666. namespace Composer\Repository;
  17667. use Composer\Json\JsonFile;
  17668. use Composer\Package\Loader\ArrayLoader;
  17669. use Composer\Package\Dumper\ArrayDumper;
  17670. class FilesystemRepository extends WritableArrayRepository
  17671. {
  17672. private $file;
  17673. public function __construct(JsonFile $repositoryFile)
  17674. {
  17675. $this->file = $repositoryFile;
  17676. }
  17677. protected function initialize()
  17678. {
  17679. parent::initialize();
  17680. if (!$this->file->exists()) {
  17681. return;
  17682. }
  17683. try {
  17684. $packages = $this->file->read();
  17685. if (!is_array($packages)) {
  17686. throw new \UnexpectedValueException('Could not parse package list from the repository');
  17687. }
  17688. } catch (\Exception $e) {
  17689. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  17690. }
  17691. $loader = new ArrayLoader(null, true);
  17692. foreach ($packages as $packageData) {
  17693. $package = $loader->load($packageData);
  17694. $this->addPackage($package);
  17695. }
  17696. }
  17697. public function reload()
  17698. {
  17699. $this->packages = null;
  17700. $this->initialize();
  17701. }
  17702. public function write()
  17703. {
  17704. $data = array();
  17705. $dumper = new ArrayDumper();
  17706. foreach ($this->getCanonicalPackages() as $package) {
  17707. $data[] = $dumper->dump($package);
  17708. }
  17709. $this->file->write($data);
  17710. }
  17711. }
  17712. <?php
  17713. namespace Composer\Repository;
  17714. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  17715. {
  17716. }
  17717. <?php
  17718. namespace Composer\Repository;
  17719. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  17720. {
  17721. }
  17722. <?php
  17723. namespace Composer\Repository;
  17724. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  17725. {
  17726. }
  17727. <?php
  17728. namespace Composer\Repository;
  17729. class InvalidRepositoryException extends \Exception
  17730. {
  17731. }
  17732. <?php
  17733. namespace Composer\Repository;
  17734. use Composer\Package\Loader\ArrayLoader;
  17735. use Composer\Package\Loader\ValidatingArrayLoader;
  17736. class PackageRepository extends ArrayRepository
  17737. {
  17738. private $config;
  17739. public function __construct(array $config)
  17740. {
  17741. $this->config = $config['package'];
  17742. if (!is_numeric(key($this->config))) {
  17743. $this->config = array($this->config);
  17744. }
  17745. }
  17746. protected function initialize()
  17747. {
  17748. parent::initialize();
  17749. $loader = new ValidatingArrayLoader(new ArrayLoader, false);
  17750. foreach ($this->config as $package) {
  17751. try {
  17752. $package = $loader->load($package);
  17753. } catch (\Exception $e) {
  17754. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  17755. }
  17756. $this->addPackage($package);
  17757. }
  17758. }
  17759. }
  17760. <?php
  17761. namespace Composer\Repository;
  17762. use Composer\Config;
  17763. use Composer\IO\IOInterface;
  17764. use Composer\Json\JsonFile;
  17765. use Composer\Package\Loader\ArrayLoader;
  17766. use Composer\Package\Locker;
  17767. use Composer\Package\Version\VersionGuesser;
  17768. use Composer\Package\Version\VersionParser;
  17769. use Composer\Util\ProcessExecutor;
  17770. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  17771. {
  17772. private $loader;
  17773. private $versionGuesser;
  17774. private $url;
  17775. private $repoConfig;
  17776. private $process;
  17777. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  17778. {
  17779. if (!isset($repoConfig['url'])) {
  17780. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  17781. }
  17782. $this->loader = new ArrayLoader();
  17783. $this->url = $repoConfig['url'];
  17784. $this->process = new ProcessExecutor($io);
  17785. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  17786. $this->repoConfig = $repoConfig;
  17787. parent::__construct();
  17788. }
  17789. public function getRepoConfig()
  17790. {
  17791. return $this->repoConfig;
  17792. }
  17793. protected function initialize()
  17794. {
  17795. parent::initialize();
  17796. foreach ($this->getUrlMatches() as $url) {
  17797. $path = realpath($url) . DIRECTORY_SEPARATOR;
  17798. $composerFilePath = $path.'composer.json';
  17799. if (!file_exists($composerFilePath)) {
  17800. continue;
  17801. }
  17802. $json = file_get_contents($composerFilePath);
  17803. $package = JsonFile::parseJson($json, $composerFilePath);
  17804. $package['dist'] = array(
  17805. 'type' => 'path',
  17806. 'url' => $url,
  17807. 'reference' => sha1($json),
  17808. );
  17809. if (!isset($package['version'])) {
  17810. $package['version'] = $this->versionGuesser->guessVersion($package, $path) ?: 'dev-master';
  17811. }
  17812. $output = '';
  17813. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  17814. $package['dist']['reference'] = trim($output);
  17815. }
  17816. $package = $this->loader->load($package);
  17817. $this->addPackage($package);
  17818. }
  17819. }
  17820. private function getUrlMatches()
  17821. {
  17822. return array_map(function ($val) {
  17823. return str_replace(DIRECTORY_SEPARATOR, '/', $val);
  17824. }, glob($this->url, GLOB_MARK | GLOB_ONLYDIR));
  17825. }
  17826. }
  17827. <?php
  17828. namespace Composer\Repository\Pear;
  17829. use Composer\Util\RemoteFilesystem;
  17830. abstract class BaseChannelReader
  17831. {
  17832. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  17833. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  17834. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  17835. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  17836. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  17837. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  17838. private $rfs;
  17839. protected function __construct(RemoteFilesystem $rfs)
  17840. {
  17841. $this->rfs = $rfs;
  17842. }
  17843. protected function requestContent($origin, $path)
  17844. {
  17845. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  17846. $content = $this->rfs->getContents($origin, $url, false);
  17847. if (!$content) {
  17848. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  17849. }
  17850. return $content;
  17851. }
  17852. protected function requestXml($origin, $path)
  17853. {
  17854. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  17855. if (false == $xml) {
  17856. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  17857. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  17858. }
  17859. return $xml;
  17860. }
  17861. }
  17862. <?php
  17863. namespace Composer\Repository\Pear;
  17864. class ChannelInfo
  17865. {
  17866. private $name;
  17867. private $alias;
  17868. private $packages;
  17869. public function __construct($name, $alias, array $packages)
  17870. {
  17871. $this->name = $name;
  17872. $this->alias = $alias;
  17873. $this->packages = $packages;
  17874. }
  17875. public function getName()
  17876. {
  17877. return $this->name;
  17878. }
  17879. public function getAlias()
  17880. {
  17881. return $this->alias;
  17882. }
  17883. public function getPackages()
  17884. {
  17885. return $this->packages;
  17886. }
  17887. }
  17888. <?php
  17889. namespace Composer\Repository\Pear;
  17890. use Composer\Util\RemoteFilesystem;
  17891. class ChannelReader extends BaseChannelReader
  17892. {
  17893. private $readerMap;
  17894. public function __construct(RemoteFilesystem $rfs)
  17895. {
  17896. parent::__construct($rfs);
  17897. $rest10reader = new ChannelRest10Reader($rfs);
  17898. $rest11reader = new ChannelRest11Reader($rfs);
  17899. $this->readerMap = array(
  17900. 'REST1.3' => $rest11reader,
  17901. 'REST1.2' => $rest11reader,
  17902. 'REST1.1' => $rest11reader,
  17903. 'REST1.0' => $rest10reader,
  17904. );
  17905. }
  17906. public function read($url)
  17907. {
  17908. $xml = $this->requestXml($url, "/channel.xml");
  17909. $channelName = (string) $xml->name;
  17910. $channelSummary = (string) $xml->summary;
  17911. $channelAlias = (string) $xml->suggestedalias;
  17912. $supportedVersions = array_keys($this->readerMap);
  17913. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  17914. if (!$selectedRestVersion) {
  17915. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  17916. }
  17917. $reader = $this->readerMap[$selectedRestVersion['version']];
  17918. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  17919. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  17920. }
  17921. private function selectRestVersion($channelXml, $supportedVersions)
  17922. {
  17923. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  17924. foreach ($supportedVersions as $version) {
  17925. $xpathTest = "ns:servers/ns:primary/ns:rest/ns:baseurl[@type='{$version}']";
  17926. $testResult = $channelXml->xpath($xpathTest);
  17927. if (count($testResult) > 0) {
  17928. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  17929. }
  17930. }
  17931. return null;
  17932. }
  17933. }
  17934. <?php
  17935. namespace Composer\Repository\Pear;
  17936. use Composer\Downloader\TransportException;
  17937. class ChannelRest10Reader extends BaseChannelReader
  17938. {
  17939. private $dependencyReader;
  17940. public function __construct($rfs)
  17941. {
  17942. parent::__construct($rfs);
  17943. $this->dependencyReader = new PackageDependencyParser();
  17944. }
  17945. public function read($baseUrl)
  17946. {
  17947. return $this->readPackages($baseUrl);
  17948. }
  17949. private function readPackages($baseUrl)
  17950. {
  17951. $result = array();
  17952. $xmlPath = '/p/packages.xml';
  17953. $xml = $this->requestXml($baseUrl, $xmlPath);
  17954. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  17955. foreach ($xml->xpath('ns:p') as $node) {
  17956. $packageName = (string) $node;
  17957. $packageInfo = $this->readPackage($baseUrl, $packageName);
  17958. $result[] = $packageInfo;
  17959. }
  17960. return $result;
  17961. }
  17962. private function readPackage($baseUrl, $packageName)
  17963. {
  17964. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  17965. $xml = $this->requestXml($baseUrl, $xmlPath);
  17966. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  17967. $channelName = (string) $xml->c;
  17968. $packageName = (string) $xml->n;
  17969. $license = (string) $xml->l;
  17970. $shortDescription = (string) $xml->s;
  17971. $description = (string) $xml->d;
  17972. return new PackageInfo(
  17973. $channelName,
  17974. $packageName,
  17975. $license,
  17976. $shortDescription,
  17977. $description,
  17978. $this->readPackageReleases($baseUrl, $packageName)
  17979. );
  17980. }
  17981. private function readPackageReleases($baseUrl, $packageName)
  17982. {
  17983. $result = array();
  17984. try {
  17985. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  17986. $xml = $this->requestXml($baseUrl, $xmlPath);
  17987. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  17988. foreach ($xml->xpath('ns:r') as $node) {
  17989. $releaseVersion = (string) $node->v;
  17990. $releaseStability = (string) $node->s;
  17991. try {
  17992. $result[$releaseVersion] = new ReleaseInfo(
  17993. $releaseStability,
  17994. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  17995. );
  17996. } catch (TransportException $exception) {
  17997. if ($exception->getCode() != 404) {
  17998. throw $exception;
  17999. }
  18000. }
  18001. }
  18002. } catch (TransportException $exception) {
  18003. if ($exception->getCode() != 404) {
  18004. throw $exception;
  18005. }
  18006. }
  18007. return $result;
  18008. }
  18009. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  18010. {
  18011. $dependencyReader = new PackageDependencyParser();
  18012. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  18013. $content = $this->requestContent($baseUrl, $depthPath);
  18014. $dependencyArray = unserialize($content);
  18015. $result = $dependencyReader->buildDependencyInfo($dependencyArray);
  18016. return $result;
  18017. }
  18018. }
  18019. <?php
  18020. namespace Composer\Repository\Pear;
  18021. class ChannelRest11Reader extends BaseChannelReader
  18022. {
  18023. private $dependencyReader;
  18024. public function __construct($rfs)
  18025. {
  18026. parent::__construct($rfs);
  18027. $this->dependencyReader = new PackageDependencyParser();
  18028. }
  18029. public function read($baseUrl)
  18030. {
  18031. return $this->readChannelPackages($baseUrl);
  18032. }
  18033. private function readChannelPackages($baseUrl)
  18034. {
  18035. $result = array();
  18036. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  18037. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  18038. foreach ($xml->xpath('ns:c') as $node) {
  18039. $categoryName = (string) $node;
  18040. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  18041. $result = array_merge($result, $categoryPackages);
  18042. }
  18043. return $result;
  18044. }
  18045. private function readCategoryPackages($baseUrl, $categoryName)
  18046. {
  18047. $result = array();
  18048. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  18049. $xml = $this->requestXml($baseUrl, $categoryPath);
  18050. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  18051. foreach ($xml->xpath('ns:pi') as $node) {
  18052. $packageInfo = $this->parsePackage($node);
  18053. $result[] = $packageInfo;
  18054. }
  18055. return $result;
  18056. }
  18057. private function parsePackage($packageInfo)
  18058. {
  18059. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  18060. $channelName = (string) $packageInfo->p->c;
  18061. $packageName = (string) $packageInfo->p->n;
  18062. $license = (string) $packageInfo->p->l;
  18063. $shortDescription = (string) $packageInfo->p->s;
  18064. $description = (string) $packageInfo->p->d;
  18065. $dependencies = array();
  18066. foreach ($packageInfo->xpath('ns:deps') as $node) {
  18067. $dependencyVersion = (string) $node->v;
  18068. $dependencyArray = unserialize((string) $node->d);
  18069. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  18070. $dependencies[$dependencyVersion] = $dependencyInfo;
  18071. }
  18072. $releases = array();
  18073. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  18074. if ($releasesInfo) {
  18075. foreach ($releasesInfo as $node) {
  18076. $releaseVersion = (string) $node->v;
  18077. $releaseStability = (string) $node->s;
  18078. $releases[$releaseVersion] = new ReleaseInfo(
  18079. $releaseStability,
  18080. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  18081. );
  18082. }
  18083. }
  18084. return new PackageInfo(
  18085. $channelName,
  18086. $packageName,
  18087. $license,
  18088. $shortDescription,
  18089. $description,
  18090. $releases
  18091. );
  18092. }
  18093. }
  18094. <?php
  18095. namespace Composer\Repository\Pear;
  18096. class DependencyConstraint
  18097. {
  18098. private $type;
  18099. private $constraint;
  18100. private $channelName;
  18101. private $packageName;
  18102. public function __construct($type, $constraint, $channelName, $packageName)
  18103. {
  18104. $this->type = $type;
  18105. $this->constraint = $constraint;
  18106. $this->channelName = $channelName;
  18107. $this->packageName = $packageName;
  18108. }
  18109. public function getChannelName()
  18110. {
  18111. return $this->channelName;
  18112. }
  18113. public function getConstraint()
  18114. {
  18115. return $this->constraint;
  18116. }
  18117. public function getPackageName()
  18118. {
  18119. return $this->packageName;
  18120. }
  18121. public function getType()
  18122. {
  18123. return $this->type;
  18124. }
  18125. }
  18126. <?php
  18127. namespace Composer\Repository\Pear;
  18128. class DependencyInfo
  18129. {
  18130. private $requires;
  18131. private $optionals;
  18132. public function __construct($requires, $optionals)
  18133. {
  18134. $this->requires = $requires;
  18135. $this->optionals = $optionals;
  18136. }
  18137. public function getRequires()
  18138. {
  18139. return $this->requires;
  18140. }
  18141. public function getOptionals()
  18142. {
  18143. return $this->optionals;
  18144. }
  18145. }
  18146. <?php
  18147. namespace Composer\Repository\Pear;
  18148. class PackageDependencyParser
  18149. {
  18150. public function buildDependencyInfo($depArray)
  18151. {
  18152. if (!is_array($depArray)) {
  18153. return new DependencyInfo(array(), array());
  18154. }
  18155. if (!$this->isHash($depArray)) {
  18156. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  18157. }
  18158. return $this->buildDependency20Info($depArray);
  18159. }
  18160. private function buildDependency10Info($depArray)
  18161. {
  18162. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  18163. $result = array();
  18164. foreach ($depArray as $depItem) {
  18165. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  18166. continue;
  18167. }
  18168. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  18169. ? 'optional'
  18170. : 'required';
  18171. $depType = 'not' == $depItem['rel']
  18172. ? 'conflicts'
  18173. : $depType;
  18174. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  18175. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  18176. ? '*'
  18177. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  18178. switch ($depItem['type']) {
  18179. case 'php':
  18180. $depChannelName = 'php';
  18181. $depPackageName = '';
  18182. break;
  18183. case 'pkg':
  18184. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  18185. $depPackageName = $depItem['name'];
  18186. break;
  18187. case 'ext':
  18188. $depChannelName = 'ext';
  18189. $depPackageName = $depItem['name'];
  18190. break;
  18191. case 'os':
  18192. case 'sapi':
  18193. $depChannelName = '';
  18194. $depPackageName = '';
  18195. break;
  18196. default:
  18197. $depChannelName = '';
  18198. $depPackageName = '';
  18199. break;
  18200. }
  18201. if ('' != $depChannelName) {
  18202. $result[] = new DependencyConstraint(
  18203. $depType,
  18204. $depVersionConstraint,
  18205. $depChannelName,
  18206. $depPackageName
  18207. );
  18208. }
  18209. }
  18210. return $result;
  18211. }
  18212. private function buildDependency20Info($depArray)
  18213. {
  18214. $result = array();
  18215. $optionals = array();
  18216. $defaultOptionals = array();
  18217. foreach ($depArray as $depType => $depTypeGroup) {
  18218. if (!is_array($depTypeGroup)) {
  18219. continue;
  18220. }
  18221. if ('required' == $depType || 'optional' == $depType) {
  18222. foreach ($depTypeGroup as $depItemType => $depItem) {
  18223. switch ($depItemType) {
  18224. case 'php':
  18225. $result[] = new DependencyConstraint(
  18226. $depType,
  18227. $this->parse20VersionConstraint($depItem),
  18228. 'php',
  18229. ''
  18230. );
  18231. break;
  18232. case 'package':
  18233. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  18234. $result = array_merge($result, $deps);
  18235. break;
  18236. case 'extension':
  18237. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  18238. $result = array_merge($result, $deps);
  18239. break;
  18240. case 'subpackage':
  18241. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  18242. $defaultOptionals += $deps;
  18243. break;
  18244. case 'os':
  18245. case 'pearinstaller':
  18246. break;
  18247. default:
  18248. break;
  18249. }
  18250. }
  18251. } elseif ('group' == $depType) {
  18252. if ($this->isHash($depTypeGroup)) {
  18253. $depTypeGroup = array($depTypeGroup);
  18254. }
  18255. foreach ($depTypeGroup as $depItem) {
  18256. $groupName = $depItem['attribs']['name'];
  18257. if (!isset($optionals[$groupName])) {
  18258. $optionals[$groupName] = array();
  18259. }
  18260. if (isset($depItem['subpackage'])) {
  18261. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  18262. } else {
  18263. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  18264. }
  18265. }
  18266. }
  18267. }
  18268. if (count($defaultOptionals) > 0) {
  18269. $optionals['*'] = $defaultOptionals;
  18270. }
  18271. return new DependencyInfo($result, $optionals);
  18272. }
  18273. private function buildDepExtensionConstraints($depItem, $depType)
  18274. {
  18275. if ($this->isHash($depItem)) {
  18276. $depItem = array($depItem);
  18277. }
  18278. $result = array();
  18279. foreach ($depItem as $subDepItem) {
  18280. $depChannelName = 'ext';
  18281. $depPackageName = $subDepItem['name'];
  18282. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  18283. $result[] = new DependencyConstraint(
  18284. $depType,
  18285. $depVersionConstraint,
  18286. $depChannelName,
  18287. $depPackageName
  18288. );
  18289. }
  18290. return $result;
  18291. }
  18292. private function buildDepPackageConstraints($depItem, $depType)
  18293. {
  18294. if ($this->isHash($depItem)) {
  18295. $depItem = array($depItem);
  18296. }
  18297. $result = array();
  18298. foreach ($depItem as $subDepItem) {
  18299. $depChannelName = $subDepItem['channel'];
  18300. $depPackageName = $subDepItem['name'];
  18301. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  18302. if (isset($subDepItem['conflicts'])) {
  18303. $depType = 'conflicts';
  18304. }
  18305. $result[] = new DependencyConstraint(
  18306. $depType,
  18307. $depVersionConstraint,
  18308. $depChannelName,
  18309. $depPackageName
  18310. );
  18311. }
  18312. return $result;
  18313. }
  18314. private function parse20VersionConstraint(array $data)
  18315. {
  18316. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  18317. $versions = array();
  18318. $values = array_intersect_key($data, $dep20toOperatorMap);
  18319. if (0 == count($values)) {
  18320. return '*';
  18321. }
  18322. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  18323. $versions[] = '>' . $this->parseVersion($values['min']);
  18324. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  18325. $versions[] = '<' . $this->parseVersion($values['max']);
  18326. } else {
  18327. foreach ($values as $op => $version) {
  18328. if ('exclude' == $op && is_array($version)) {
  18329. foreach ($version as $versionPart) {
  18330. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  18331. }
  18332. } else {
  18333. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  18334. }
  18335. }
  18336. }
  18337. return implode(',', $versions);
  18338. }
  18339. private function parseVersion($version)
  18340. {
  18341. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  18342. $version = $matches[1]
  18343. .(!empty($matches[2]) ? $matches[2] : '.0')
  18344. .(!empty($matches[3]) ? $matches[3] : '.0')
  18345. .(!empty($matches[4]) ? $matches[4] : '.0');
  18346. return $version;
  18347. }
  18348. return null;
  18349. }
  18350. private function isHash(array $array)
  18351. {
  18352. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  18353. }
  18354. }
  18355. <?php
  18356. namespace Composer\Repository\Pear;
  18357. class PackageInfo
  18358. {
  18359. private $channelName;
  18360. private $packageName;
  18361. private $license;
  18362. private $shortDescription;
  18363. private $description;
  18364. private $releases;
  18365. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  18366. {
  18367. $this->channelName = $channelName;
  18368. $this->packageName = $packageName;
  18369. $this->license = $license;
  18370. $this->shortDescription = $shortDescription;
  18371. $this->description = $description;
  18372. $this->releases = $releases;
  18373. }
  18374. public function getChannelName()
  18375. {
  18376. return $this->channelName;
  18377. }
  18378. public function getPackageName()
  18379. {
  18380. return $this->packageName;
  18381. }
  18382. public function getDescription()
  18383. {
  18384. return $this->description;
  18385. }
  18386. public function getShortDescription()
  18387. {
  18388. return $this->shortDescription;
  18389. }
  18390. public function getLicense()
  18391. {
  18392. return $this->license;
  18393. }
  18394. public function getReleases()
  18395. {
  18396. return $this->releases;
  18397. }
  18398. }
  18399. <?php
  18400. namespace Composer\Repository\Pear;
  18401. class ReleaseInfo
  18402. {
  18403. private $stability;
  18404. private $dependencyInfo;
  18405. public function __construct($stability, $dependencyInfo)
  18406. {
  18407. $this->stability = $stability;
  18408. $this->dependencyInfo = $dependencyInfo;
  18409. }
  18410. public function getDependencyInfo()
  18411. {
  18412. return $this->dependencyInfo;
  18413. }
  18414. public function getStability()
  18415. {
  18416. return $this->stability;
  18417. }
  18418. }
  18419. <?php
  18420. namespace Composer\Repository;
  18421. use Composer\IO\IOInterface;
  18422. use Composer\Semver\VersionParser as SemverVersionParser;
  18423. use Composer\Package\Version\VersionParser;
  18424. use Composer\Repository\Pear\ChannelReader;
  18425. use Composer\Package\CompletePackage;
  18426. use Composer\Repository\Pear\ChannelInfo;
  18427. use Composer\EventDispatcher\EventDispatcher;
  18428. use Composer\Package\Link;
  18429. use Composer\Semver\Constraint\Constraint;
  18430. use Composer\Util\RemoteFilesystem;
  18431. use Composer\Config;
  18432. use Composer\Factory;
  18433. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  18434. {
  18435. private $url;
  18436. private $io;
  18437. private $rfs;
  18438. private $versionParser;
  18439. private $repoConfig;
  18440. private $vendorAlias;
  18441. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  18442. {
  18443. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  18444. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  18445. }
  18446. $urlBits = parse_url($repoConfig['url']);
  18447. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  18448. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  18449. }
  18450. $this->url = rtrim($repoConfig['url'], '/');
  18451. $this->io = $io;
  18452. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  18453. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  18454. $this->versionParser = new VersionParser();
  18455. $this->repoConfig = $repoConfig;
  18456. }
  18457. public function getRepoConfig()
  18458. {
  18459. return $this->repoConfig;
  18460. }
  18461. protected function initialize()
  18462. {
  18463. parent::initialize();
  18464. $this->io->writeError('Initializing PEAR repository '.$this->url);
  18465. $reader = new ChannelReader($this->rfs);
  18466. try {
  18467. $channelInfo = $reader->read($this->url);
  18468. } catch (\Exception $e) {
  18469. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  18470. return;
  18471. }
  18472. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  18473. foreach ($packages as $package) {
  18474. $this->addPackage($package);
  18475. }
  18476. }
  18477. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  18478. {
  18479. $result = array();
  18480. foreach ($channelInfo->getPackages() as $packageDefinition) {
  18481. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  18482. try {
  18483. $normalizedVersion = $versionParser->normalize($version);
  18484. } catch (\UnexpectedValueException $e) {
  18485. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  18486. continue;
  18487. }
  18488. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  18489. $urlBits = parse_url($this->url);
  18490. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  18491. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  18492. $requires = array();
  18493. $suggests = array();
  18494. $conflicts = array();
  18495. $replaces = array();
  18496. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  18497. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  18498. $aliasConstraint = new Constraint('==', $normalizedVersion);
  18499. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  18500. }
  18501. if (!empty($this->vendorAlias)
  18502. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  18503. ) {
  18504. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  18505. $aliasConstraint = new Constraint('==', $normalizedVersion);
  18506. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  18507. }
  18508. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  18509. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  18510. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  18511. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  18512. switch ($dependencyConstraint->getType()) {
  18513. case 'required':
  18514. $requires[] = $link;
  18515. break;
  18516. case 'conflicts':
  18517. $conflicts[] = $link;
  18518. break;
  18519. case 'replaces':
  18520. $replaces[] = $link;
  18521. break;
  18522. }
  18523. }
  18524. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  18525. foreach ($dependencyConstraints as $dependencyConstraint) {
  18526. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  18527. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  18528. }
  18529. }
  18530. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  18531. $package->setType('pear-library');
  18532. $package->setDescription($packageDefinition->getDescription());
  18533. $package->setLicense(array($packageDefinition->getLicense()));
  18534. $package->setDistType('file');
  18535. $package->setDistUrl($distUrl);
  18536. $package->setAutoload(array('classmap' => array('')));
  18537. $package->setIncludePaths(array('/'));
  18538. $package->setRequires($requires);
  18539. $package->setConflicts($conflicts);
  18540. $package->setSuggests($suggests);
  18541. $package->setReplaces($replaces);
  18542. $result[] = $package;
  18543. }
  18544. }
  18545. return $result;
  18546. }
  18547. private function buildComposerPackageName($channelName, $packageName)
  18548. {
  18549. if ('php' === $channelName) {
  18550. return "php";
  18551. }
  18552. if ('ext' === $channelName) {
  18553. return "ext-{$packageName}";
  18554. }
  18555. return "pear-{$channelName}/{$packageName}";
  18556. }
  18557. }
  18558. <?php
  18559. namespace Composer\Repository;
  18560. use Composer\Config;
  18561. use Composer\Package\PackageInterface;
  18562. use Composer\Package\CompletePackage;
  18563. use Composer\Package\Version\VersionParser;
  18564. use Composer\Plugin\PluginInterface;
  18565. class PlatformRepository extends ArrayRepository
  18566. {
  18567. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit)?|hhvm|(?:ext|lib)-[^/]+)$}i';
  18568. private $overrides = array();
  18569. public function __construct(array $packages = array(), array $overrides = array())
  18570. {
  18571. foreach ($overrides as $name => $version) {
  18572. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  18573. }
  18574. parent::__construct($packages);
  18575. }
  18576. protected function initialize()
  18577. {
  18578. parent::initialize();
  18579. $versionParser = new VersionParser();
  18580. foreach ($this->overrides as $override) {
  18581. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  18582. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  18583. }
  18584. $version = $versionParser->normalize($override['version']);
  18585. $package = new CompletePackage($override['name'], $version, $override['version']);
  18586. $package->setDescription('Package overridden via config.platform');
  18587. $package->setExtra(array('config.platform' => true));
  18588. parent::addPackage($package);
  18589. }
  18590. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  18591. $version = $versionParser->normalize($prettyVersion);
  18592. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  18593. $composerPluginApi->setDescription('The Composer Plugin API');
  18594. $this->addPackage($composerPluginApi);
  18595. try {
  18596. $prettyVersion = PHP_VERSION;
  18597. $version = $versionParser->normalize($prettyVersion);
  18598. } catch (\UnexpectedValueException $e) {
  18599. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  18600. $version = $versionParser->normalize($prettyVersion);
  18601. }
  18602. $php = new CompletePackage('php', $version, $prettyVersion);
  18603. $php->setDescription('The PHP interpreter');
  18604. $this->addPackage($php);
  18605. if (PHP_INT_SIZE === 8) {
  18606. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  18607. $php64->setDescription('The PHP interpreter, 64bit');
  18608. $this->addPackage($php64);
  18609. }
  18610. $loadedExtensions = get_loaded_extensions();
  18611. foreach ($loadedExtensions as $name) {
  18612. if (in_array($name, array('standard', 'Core'))) {
  18613. continue;
  18614. }
  18615. $reflExt = new \ReflectionExtension($name);
  18616. try {
  18617. $prettyVersion = $reflExt->getVersion();
  18618. $version = $versionParser->normalize($prettyVersion);
  18619. } catch (\UnexpectedValueException $e) {
  18620. $prettyVersion = '0';
  18621. $version = $versionParser->normalize($prettyVersion);
  18622. }
  18623. $packageName = $this->buildPackageName($name);
  18624. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  18625. $ext->setDescription('The '.$name.' PHP extension');
  18626. $this->addPackage($ext);
  18627. }
  18628. foreach ($loadedExtensions as $name) {
  18629. $prettyVersion = null;
  18630. $description = 'The '.$name.' PHP library';
  18631. switch ($name) {
  18632. case 'curl':
  18633. $curlVersion = curl_version();
  18634. $prettyVersion = $curlVersion['version'];
  18635. break;
  18636. case 'iconv':
  18637. $prettyVersion = ICONV_VERSION;
  18638. break;
  18639. case 'intl':
  18640. $name = 'ICU';
  18641. if (defined('INTL_ICU_VERSION')) {
  18642. $prettyVersion = INTL_ICU_VERSION;
  18643. } else {
  18644. $reflector = new \ReflectionExtension('intl');
  18645. ob_start();
  18646. $reflector->info();
  18647. $output = ob_get_clean();
  18648. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  18649. $prettyVersion = $matches[1];
  18650. }
  18651. break;
  18652. case 'libxml':
  18653. $prettyVersion = LIBXML_DOTTED_VERSION;
  18654. break;
  18655. case 'openssl':
  18656. $prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]*).*}', function ($match) {
  18657. if (empty($match[2])) {
  18658. return $match[1];
  18659. }
  18660. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  18661. return 0;
  18662. }
  18663. $len = strlen($match[2]);
  18664. $patchVersion = ($len - 1) * 26;
  18665. $patchVersion += ord($match[2][$len - 1]) - 96;
  18666. return $match[1].'.'.$patchVersion;
  18667. }, OPENSSL_VERSION_TEXT);
  18668. $description = OPENSSL_VERSION_TEXT;
  18669. break;
  18670. case 'pcre':
  18671. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  18672. break;
  18673. case 'uuid':
  18674. $prettyVersion = phpversion('uuid');
  18675. break;
  18676. case 'xsl':
  18677. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  18678. break;
  18679. default:
  18680. continue 2;
  18681. }
  18682. try {
  18683. $version = $versionParser->normalize($prettyVersion);
  18684. } catch (\UnexpectedValueException $e) {
  18685. continue;
  18686. }
  18687. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  18688. $lib->setDescription($description);
  18689. $this->addPackage($lib);
  18690. }
  18691. if (defined('HHVM_VERSION')) {
  18692. try {
  18693. $prettyVersion = HHVM_VERSION;
  18694. $version = $versionParser->normalize($prettyVersion);
  18695. } catch (\UnexpectedValueException $e) {
  18696. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
  18697. $version = $versionParser->normalize($prettyVersion);
  18698. }
  18699. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  18700. $hhvm->setDescription('The HHVM Runtime (64bit)');
  18701. $this->addPackage($hhvm);
  18702. }
  18703. }
  18704. public function addPackage(PackageInterface $package)
  18705. {
  18706. if (isset($this->overrides[strtolower($package->getName())])) {
  18707. $overrider = $this->findPackage($package->getName(), '*');
  18708. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  18709. return;
  18710. }
  18711. parent::addPackage($package);
  18712. }
  18713. private function buildPackageName($name)
  18714. {
  18715. return 'ext-' . str_replace(' ', '-', $name);
  18716. }
  18717. }
  18718. <?php
  18719. namespace Composer\Repository;
  18720. use Composer\Package\PackageInterface;
  18721. interface RepositoryInterface extends \Countable
  18722. {
  18723. const SEARCH_FULLTEXT = 0;
  18724. const SEARCH_NAME = 1;
  18725. public function hasPackage(PackageInterface $package);
  18726. public function findPackage($name, $constraint);
  18727. public function findPackages($name, $constraint = null);
  18728. public function getPackages();
  18729. public function search($query, $mode = 0);
  18730. }
  18731. <?php
  18732. namespace Composer\Repository;
  18733. use Composer\IO\IOInterface;
  18734. use Composer\Config;
  18735. use Composer\EventDispatcher\EventDispatcher;
  18736. use Composer\Package\PackageInterface;
  18737. use Composer\Util\RemoteFilesystem;
  18738. class RepositoryManager
  18739. {
  18740. private $localRepository;
  18741. private $repositories = array();
  18742. private $repositoryClasses = array();
  18743. private $io;
  18744. private $config;
  18745. private $eventDispatcher;
  18746. private $rfs;
  18747. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  18748. {
  18749. $this->io = $io;
  18750. $this->config = $config;
  18751. $this->eventDispatcher = $eventDispatcher;
  18752. $this->rfs = $rfs;
  18753. }
  18754. public function findPackage($name, $constraint)
  18755. {
  18756. foreach ($this->repositories as $repository) {
  18757. if ($package = $repository->findPackage($name, $constraint)) {
  18758. return $package;
  18759. }
  18760. }
  18761. }
  18762. public function findPackages($name, $constraint)
  18763. {
  18764. $packages = array();
  18765. foreach ($this->repositories as $repository) {
  18766. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  18767. }
  18768. return $packages;
  18769. }
  18770. public function addRepository(RepositoryInterface $repository)
  18771. {
  18772. $this->repositories[] = $repository;
  18773. }
  18774. public function prependRepository(RepositoryInterface $repository)
  18775. {
  18776. array_unshift($this->repositories, $repository);
  18777. }
  18778. public function createRepository($type, $config)
  18779. {
  18780. if (!isset($this->repositoryClasses[$type])) {
  18781. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  18782. }
  18783. $class = $this->repositoryClasses[$type];
  18784. $reflMethod = new \ReflectionMethod($class, '__construct');
  18785. $params = $reflMethod->getParameters();
  18786. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  18787. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  18788. }
  18789. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  18790. }
  18791. public function setRepositoryClass($type, $class)
  18792. {
  18793. $this->repositoryClasses[$type] = $class;
  18794. }
  18795. public function getRepositories()
  18796. {
  18797. return $this->repositories;
  18798. }
  18799. public function setLocalRepository(WritableRepositoryInterface $repository)
  18800. {
  18801. $this->localRepository = $repository;
  18802. }
  18803. public function getLocalRepository()
  18804. {
  18805. return $this->localRepository;
  18806. }
  18807. }
  18808. <?php
  18809. namespace Composer\Repository;
  18810. class RepositorySecurityException extends \Exception
  18811. {
  18812. }
  18813. <?php
  18814. namespace Composer\Repository\Vcs;
  18815. use Composer\Cache;
  18816. use Composer\Config;
  18817. use Composer\Json\JsonFile;
  18818. use Composer\IO\IOInterface;
  18819. class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
  18820. {
  18821. protected $cache;
  18822. protected $owner;
  18823. protected $repository;
  18824. protected $tags;
  18825. protected $branches;
  18826. protected $rootIdentifier;
  18827. protected $infoCache = array();
  18828. public function initialize()
  18829. {
  18830. preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $this->url, $match);
  18831. $this->owner = $match[1];
  18832. $this->repository = $match[2];
  18833. $this->originUrl = 'bitbucket.org';
  18834. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  18835. }
  18836. public function getRootIdentifier()
  18837. {
  18838. if (null === $this->rootIdentifier) {
  18839. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository;
  18840. $repoData = JsonFile::parseJson($this->getContents($resource), $resource);
  18841. $this->rootIdentifier = !empty($repoData['main_branch']) ? $repoData['main_branch'] : 'master';
  18842. }
  18843. return $this->rootIdentifier;
  18844. }
  18845. public function getUrl()
  18846. {
  18847. return $this->url;
  18848. }
  18849. public function getSource($identifier)
  18850. {
  18851. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  18852. }
  18853. public function getDist($identifier)
  18854. {
  18855. $url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
  18856. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  18857. }
  18858. public function getComposerInformation($identifier)
  18859. {
  18860. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  18861. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  18862. }
  18863. if (!isset($this->infoCache[$identifier])) {
  18864. $resource = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/raw/'.$identifier.'/composer.json';
  18865. $composer = $this->getContents($resource);
  18866. if (!$composer) {
  18867. return;
  18868. }
  18869. $composer = JsonFile::parseJson($composer, $resource);
  18870. if (empty($composer['time'])) {
  18871. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier;
  18872. $changeset = JsonFile::parseJson($this->getContents($resource), $resource);
  18873. $composer['time'] = $changeset['timestamp'];
  18874. }
  18875. if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
  18876. $this->cache->write($identifier, json_encode($composer));
  18877. }
  18878. $this->infoCache[$identifier] = $composer;
  18879. }
  18880. return $this->infoCache[$identifier];
  18881. }
  18882. public function getTags()
  18883. {
  18884. if (null === $this->tags) {
  18885. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
  18886. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  18887. $this->tags = array();
  18888. foreach ($tagsData as $tag => $data) {
  18889. $this->tags[$tag] = $data['raw_node'];
  18890. }
  18891. }
  18892. return $this->tags;
  18893. }
  18894. public function getBranches()
  18895. {
  18896. if (null === $this->branches) {
  18897. $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches';
  18898. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  18899. $this->branches = array();
  18900. foreach ($branchData as $branch => $data) {
  18901. $this->branches[$branch] = $data['raw_node'];
  18902. }
  18903. }
  18904. return $this->branches;
  18905. }
  18906. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  18907. {
  18908. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  18909. return false;
  18910. }
  18911. if (!extension_loaded('openssl')) {
  18912. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  18913. return false;
  18914. }
  18915. return true;
  18916. }
  18917. }
  18918. <?php
  18919. namespace Composer\Repository\Vcs;
  18920. use Composer\Json\JsonFile;
  18921. use Composer\Util\ProcessExecutor;
  18922. use Composer\Util\Filesystem;
  18923. use Composer\Util\Git as GitUtil;
  18924. use Composer\IO\IOInterface;
  18925. use Composer\Cache;
  18926. use Composer\Config;
  18927. class GitDriver extends VcsDriver
  18928. {
  18929. protected $cache;
  18930. protected $tags;
  18931. protected $branches;
  18932. protected $rootIdentifier;
  18933. protected $repoDir;
  18934. protected $infoCache = array();
  18935. public function initialize()
  18936. {
  18937. if (Filesystem::isLocalPath($this->url)) {
  18938. $this->repoDir = $this->url;
  18939. $cacheUrl = realpath($this->url);
  18940. } else {
  18941. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  18942. GitUtil::cleanEnv();
  18943. $fs = new Filesystem();
  18944. $fs->ensureDirectoryExists(dirname($this->repoDir));
  18945. if (!is_writable(dirname($this->repoDir))) {
  18946. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  18947. }
  18948. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  18949. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  18950. }
  18951. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  18952. if (is_dir($this->repoDir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $this->repoDir) && trim($output) === '.') {
  18953. try {
  18954. $commandCallable = function ($url) {
  18955. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  18956. };
  18957. $gitUtil->runCommand($commandCallable, $this->url, $this->repoDir);
  18958. } catch (\Exception $e) {
  18959. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$e->getMessage().')</error>');
  18960. }
  18961. } else {
  18962. $fs->removeDirectory($this->repoDir);
  18963. $repoDir = $this->repoDir;
  18964. $commandCallable = function ($url) use ($repoDir) {
  18965. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  18966. };
  18967. $gitUtil->runCommand($commandCallable, $this->url, $this->repoDir, true);
  18968. }
  18969. $cacheUrl = $this->url;
  18970. }
  18971. $this->getTags();
  18972. $this->getBranches();
  18973. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  18974. }
  18975. public function getRootIdentifier()
  18976. {
  18977. if (null === $this->rootIdentifier) {
  18978. $this->rootIdentifier = 'master';
  18979. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  18980. $branches = $this->process->splitLines($output);
  18981. if (!in_array('* master', $branches)) {
  18982. foreach ($branches as $branch) {
  18983. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  18984. $this->rootIdentifier = $match[1];
  18985. break;
  18986. }
  18987. }
  18988. }
  18989. }
  18990. return $this->rootIdentifier;
  18991. }
  18992. public function getUrl()
  18993. {
  18994. return $this->url;
  18995. }
  18996. public function getSource($identifier)
  18997. {
  18998. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  18999. }
  19000. public function getDist($identifier)
  19001. {
  19002. return null;
  19003. }
  19004. public function getComposerInformation($identifier)
  19005. {
  19006. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  19007. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  19008. }
  19009. if (!isset($this->infoCache[$identifier])) {
  19010. $resource = sprintf('%s:composer.json', ProcessExecutor::escape($identifier));
  19011. $this->process->execute(sprintf('git show %s', $resource), $composer, $this->repoDir);
  19012. if (!trim($composer)) {
  19013. return;
  19014. }
  19015. $composer = JsonFile::parseJson($composer, $resource);
  19016. if (empty($composer['time'])) {
  19017. $this->process->execute(sprintf('git log -1 --format=%%at %s', ProcessExecutor::escape($identifier)), $output, $this->repoDir);
  19018. $date = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  19019. $composer['time'] = $date->format('Y-m-d H:i:s');
  19020. }
  19021. if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
  19022. $this->cache->write($identifier, json_encode($composer));
  19023. }
  19024. $this->infoCache[$identifier] = $composer;
  19025. }
  19026. return $this->infoCache[$identifier];
  19027. }
  19028. public function getTags()
  19029. {
  19030. if (null === $this->tags) {
  19031. $this->tags = array();
  19032. $this->process->execute('git show-ref --tags', $output, $this->repoDir);
  19033. foreach ($output = $this->process->splitLines($output) as $tag) {
  19034. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+)$}', $tag, $match)) {
  19035. $this->tags[$match[2]] = $match[1];
  19036. }
  19037. }
  19038. }
  19039. return $this->tags;
  19040. }
  19041. public function getBranches()
  19042. {
  19043. if (null === $this->branches) {
  19044. $branches = array();
  19045. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  19046. foreach ($this->process->splitLines($output) as $branch) {
  19047. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  19048. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  19049. $branches[$match[1]] = $match[2];
  19050. }
  19051. }
  19052. }
  19053. $this->branches = $branches;
  19054. }
  19055. return $this->branches;
  19056. }
  19057. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  19058. {
  19059. if (preg_match('#(^git://|\.git$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  19060. return true;
  19061. }
  19062. if (Filesystem::isLocalPath($url)) {
  19063. $url = Filesystem::getPlatformPath($url);
  19064. if (!is_dir($url)) {
  19065. return false;
  19066. }
  19067. $process = new ProcessExecutor($io);
  19068. if ($process->execute('git tag', $output, $url) === 0) {
  19069. return true;
  19070. }
  19071. }
  19072. if (!$deep) {
  19073. return false;
  19074. }
  19075. $process = new ProcessExecutor($io);
  19076. if ($process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0) {
  19077. return true;
  19078. }
  19079. return false;
  19080. }
  19081. }
  19082. <?php
  19083. namespace Composer\Repository\Vcs;
  19084. use Composer\Config;
  19085. use Composer\Downloader\TransportException;
  19086. use Composer\Json\JsonFile;
  19087. use Composer\Cache;
  19088. use Composer\IO\IOInterface;
  19089. use Composer\Util\GitHub;
  19090. class GitHubDriver extends VcsDriver
  19091. {
  19092. protected $cache;
  19093. protected $owner;
  19094. protected $repository;
  19095. protected $tags;
  19096. protected $branches;
  19097. protected $rootIdentifier;
  19098. protected $hasIssues;
  19099. protected $infoCache = array();
  19100. protected $isPrivate = false;
  19101. protected $gitDriver;
  19102. public function initialize()
  19103. {
  19104. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  19105. $this->owner = $match[3];
  19106. $this->repository = $match[4];
  19107. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  19108. if ($this->originUrl === 'www.github.com') {
  19109. $this->originUrl = 'github.com';
  19110. }
  19111. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  19112. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  19113. $this->setupGitDriver($this->url);
  19114. return;
  19115. }
  19116. $this->fetchRootIdentifier();
  19117. }
  19118. public function getRepositoryUrl()
  19119. {
  19120. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  19121. }
  19122. public function getRootIdentifier()
  19123. {
  19124. if ($this->gitDriver) {
  19125. return $this->gitDriver->getRootIdentifier();
  19126. }
  19127. return $this->rootIdentifier;
  19128. }
  19129. public function getUrl()
  19130. {
  19131. if ($this->gitDriver) {
  19132. return $this->gitDriver->getUrl();
  19133. }
  19134. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  19135. }
  19136. protected function getApiUrl()
  19137. {
  19138. if ('github.com' === $this->originUrl) {
  19139. $apiUrl = 'api.github.com';
  19140. } else {
  19141. $apiUrl = $this->originUrl . '/api/v3';
  19142. }
  19143. return 'https://' . $apiUrl;
  19144. }
  19145. public function getSource($identifier)
  19146. {
  19147. if ($this->gitDriver) {
  19148. return $this->gitDriver->getSource($identifier);
  19149. }
  19150. if ($this->isPrivate) {
  19151. $url = $this->generateSshUrl();
  19152. } else {
  19153. $url = $this->getUrl();
  19154. }
  19155. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  19156. }
  19157. public function getDist($identifier)
  19158. {
  19159. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  19160. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  19161. }
  19162. public function getComposerInformation($identifier)
  19163. {
  19164. if ($this->gitDriver) {
  19165. return $this->gitDriver->getComposerInformation($identifier);
  19166. }
  19167. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  19168. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  19169. }
  19170. if (!isset($this->infoCache[$identifier])) {
  19171. $notFoundRetries = 2;
  19172. while ($notFoundRetries) {
  19173. try {
  19174. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/composer.json?ref='.urlencode($identifier);
  19175. $resource = JsonFile::parseJson($this->getContents($resource));
  19176. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($composer = base64_decode($resource['content']))) {
  19177. throw new \RuntimeException('Could not retrieve composer.json for '.$identifier);
  19178. }
  19179. break;
  19180. } catch (TransportException $e) {
  19181. if (404 !== $e->getCode()) {
  19182. throw $e;
  19183. }
  19184. $notFoundRetries--;
  19185. $composer = null;
  19186. }
  19187. }
  19188. if ($composer) {
  19189. $composer = JsonFile::parseJson($composer, $resource);
  19190. if (empty($composer['time'])) {
  19191. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  19192. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  19193. $composer['time'] = $commit['commit']['committer']['date'];
  19194. }
  19195. if (!isset($composer['support']['source'])) {
  19196. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  19197. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  19198. }
  19199. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  19200. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  19201. }
  19202. }
  19203. if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
  19204. $this->cache->write($identifier, json_encode($composer));
  19205. }
  19206. $this->infoCache[$identifier] = $composer;
  19207. }
  19208. return $this->infoCache[$identifier];
  19209. }
  19210. public function getTags()
  19211. {
  19212. if ($this->gitDriver) {
  19213. return $this->gitDriver->getTags();
  19214. }
  19215. if (null === $this->tags) {
  19216. $this->tags = array();
  19217. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  19218. do {
  19219. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  19220. foreach ($tagsData as $tag) {
  19221. $this->tags[$tag['name']] = $tag['commit']['sha'];
  19222. }
  19223. $resource = $this->getNextPage();
  19224. } while ($resource);
  19225. }
  19226. return $this->tags;
  19227. }
  19228. public function getBranches()
  19229. {
  19230. if ($this->gitDriver) {
  19231. return $this->gitDriver->getBranches();
  19232. }
  19233. if (null === $this->branches) {
  19234. $this->branches = array();
  19235. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  19236. $branchBlacklist = array('gh-pages');
  19237. do {
  19238. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  19239. foreach ($branchData as $branch) {
  19240. $name = substr($branch['ref'], 11);
  19241. if (!in_array($name, $branchBlacklist)) {
  19242. $this->branches[$name] = $branch['object']['sha'];
  19243. }
  19244. }
  19245. $resource = $this->getNextPage();
  19246. } while ($resource);
  19247. }
  19248. return $this->branches;
  19249. }
  19250. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  19251. {
  19252. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  19253. return false;
  19254. }
  19255. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  19256. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  19257. return false;
  19258. }
  19259. if (!extension_loaded('openssl')) {
  19260. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  19261. return false;
  19262. }
  19263. return true;
  19264. }
  19265. protected function generateSshUrl()
  19266. {
  19267. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  19268. }
  19269. protected function getContents($url, $fetchingRepoData = false)
  19270. {
  19271. try {
  19272. return parent::getContents($url);
  19273. } catch (TransportException $e) {
  19274. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  19275. switch ($e->getCode()) {
  19276. case 401:
  19277. case 404:
  19278. if (!$fetchingRepoData) {
  19279. throw $e;
  19280. }
  19281. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  19282. return parent::getContents($url);
  19283. }
  19284. if (!$this->io->isInteractive()) {
  19285. return $this->attemptCloneFallback();
  19286. }
  19287. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  19288. return parent::getContents($url);
  19289. case 403:
  19290. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  19291. return parent::getContents($url);
  19292. }
  19293. if (!$this->io->isInteractive() && $fetchingRepoData) {
  19294. return $this->attemptCloneFallback();
  19295. }
  19296. $rateLimited = false;
  19297. foreach ($e->getHeaders() as $header) {
  19298. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  19299. $rateLimited = true;
  19300. }
  19301. }
  19302. if (!$this->io->hasAuthentication($this->originUrl)) {
  19303. if (!$this->io->isInteractive()) {
  19304. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  19305. throw $e;
  19306. }
  19307. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  19308. return parent::getContents($url);
  19309. }
  19310. if ($rateLimited) {
  19311. $rateLimit = $this->getRateLimit($e->getHeaders());
  19312. $this->io->writeError(sprintf(
  19313. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  19314. $rateLimit['limit'],
  19315. $rateLimit['reset']
  19316. ));
  19317. }
  19318. throw $e;
  19319. default:
  19320. throw $e;
  19321. }
  19322. }
  19323. }
  19324. protected function getRateLimit(array $headers)
  19325. {
  19326. $rateLimit = array(
  19327. 'limit' => '?',
  19328. 'reset' => '?',
  19329. );
  19330. foreach ($headers as $header) {
  19331. $header = trim($header);
  19332. if (false === strpos($header, 'X-RateLimit-')) {
  19333. continue;
  19334. }
  19335. list($type, $value) = explode(':', $header, 2);
  19336. switch ($type) {
  19337. case 'X-RateLimit-Limit':
  19338. $rateLimit['limit'] = (int) trim($value);
  19339. break;
  19340. case 'X-RateLimit-Reset':
  19341. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  19342. break;
  19343. }
  19344. }
  19345. return $rateLimit;
  19346. }
  19347. protected function fetchRootIdentifier()
  19348. {
  19349. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  19350. $repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  19351. if (null === $repoData && null !== $this->gitDriver) {
  19352. return;
  19353. }
  19354. $this->owner = $repoData['owner']['login'];
  19355. $this->repository = $repoData['name'];
  19356. $this->isPrivate = !empty($repoData['private']);
  19357. if (isset($repoData['default_branch'])) {
  19358. $this->rootIdentifier = $repoData['default_branch'];
  19359. } elseif (isset($repoData['master_branch'])) {
  19360. $this->rootIdentifier = $repoData['master_branch'];
  19361. } else {
  19362. $this->rootIdentifier = 'master';
  19363. }
  19364. $this->hasIssues = !empty($repoData['has_issues']);
  19365. }
  19366. protected function attemptCloneFallback()
  19367. {
  19368. $this->isPrivate = true;
  19369. try {
  19370. $this->setupGitDriver($this->generateSshUrl());
  19371. return;
  19372. } catch (\RuntimeException $e) {
  19373. $this->gitDriver = null;
  19374. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  19375. throw $e;
  19376. }
  19377. }
  19378. protected function setupGitDriver($url)
  19379. {
  19380. $this->gitDriver = new GitDriver(
  19381. array('url' => $url),
  19382. $this->io,
  19383. $this->config,
  19384. $this->process,
  19385. $this->remoteFilesystem
  19386. );
  19387. $this->gitDriver->initialize();
  19388. }
  19389. protected function getNextPage()
  19390. {
  19391. $headers = $this->remoteFilesystem->getLastHeaders();
  19392. foreach ($headers as $header) {
  19393. if (substr($header, 0, 5) === 'Link:') {
  19394. $links = explode(',', substr($header, 5));
  19395. foreach ($links as $link) {
  19396. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  19397. return $match[1];
  19398. }
  19399. }
  19400. }
  19401. }
  19402. }
  19403. }
  19404. <?php
  19405. namespace Composer\Repository\Vcs;
  19406. use Composer\Config;
  19407. use Composer\Cache;
  19408. use Composer\IO\IOInterface;
  19409. use Composer\Json\JsonFile;
  19410. use Composer\Downloader\TransportException;
  19411. use Composer\Util\RemoteFilesystem;
  19412. use Composer\Util\GitLab;
  19413. class GitLabDriver extends VcsDriver
  19414. {
  19415. private $scheme;
  19416. private $owner;
  19417. private $repository;
  19418. private $cache;
  19419. private $infoCache = array();
  19420. private $project;
  19421. private $commits = array();
  19422. private $tags;
  19423. private $branches;
  19424. protected $gitDriver;
  19425. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)/|git@(?P<domain2>[^:]+):)(?P<owner>[^/]+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  19426. public function initialize()
  19427. {
  19428. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  19429. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  19430. }
  19431. $this->scheme = !empty($match['scheme']) ? $match['scheme'] : 'https';
  19432. $this->originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  19433. $this->owner = $match['owner'];
  19434. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  19435. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  19436. $this->fetchProject();
  19437. }
  19438. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  19439. {
  19440. $this->remoteFilesystem = $remoteFilesystem;
  19441. }
  19442. public function getComposerInformation($identifier)
  19443. {
  19444. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  19445. $branches = $this->getBranches();
  19446. if (isset($branches[$identifier])) {
  19447. $identifier = $branches[$identifier];
  19448. }
  19449. }
  19450. if (isset($this->infoCache[$identifier])) {
  19451. return $this->infoCache[$identifier];
  19452. }
  19453. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  19454. return $this->infoCache[$identifier] = JsonFile::parseJson($res, $res);
  19455. }
  19456. try {
  19457. $composer = $this->fetchComposerFile($identifier);
  19458. } catch (TransportException $e) {
  19459. if ($e->getCode() !== 404) {
  19460. throw $e;
  19461. }
  19462. $composer = false;
  19463. }
  19464. if ($composer && !isset($composer['time']) && isset($this->commits[$identifier])) {
  19465. $composer['time'] = $this->commits[$identifier]['committed_date'];
  19466. }
  19467. if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
  19468. $this->cache->write($identifier, json_encode($composer));
  19469. }
  19470. return $this->infoCache[$identifier] = $composer;
  19471. }
  19472. public function getRepositoryUrl()
  19473. {
  19474. return $this->project['ssh_url_to_repo'];
  19475. }
  19476. public function getUrl()
  19477. {
  19478. return $this->project['web_url'];
  19479. }
  19480. public function getDist($identifier)
  19481. {
  19482. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  19483. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  19484. }
  19485. public function getSource($identifier)
  19486. {
  19487. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  19488. }
  19489. public function getRootIdentifier()
  19490. {
  19491. return $this->project['default_branch'];
  19492. }
  19493. public function getBranches()
  19494. {
  19495. if (!$this->branches) {
  19496. $this->branches = $this->getReferences('branches');
  19497. }
  19498. return $this->branches;
  19499. }
  19500. public function getTags()
  19501. {
  19502. if (!$this->tags) {
  19503. $this->tags = $this->getReferences('tags');
  19504. }
  19505. return $this->tags;
  19506. }
  19507. protected function fetchComposerFile($identifier)
  19508. {
  19509. $resource = $this->getApiUrl().'/repository/blobs/'.$identifier.'?filepath=composer.json';
  19510. return JsonFile::parseJson($this->getContents($resource), $resource);
  19511. }
  19512. public function getApiUrl()
  19513. {
  19514. return $this->scheme.'://'.$this->originUrl.'/api/v3/projects/'.$this->owner.'%2F'.$this->repository;
  19515. }
  19516. protected function getReferences($type)
  19517. {
  19518. $resource = $this->getApiUrl().'/repository/'.$type;
  19519. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  19520. $references = array();
  19521. foreach ($data as $datum) {
  19522. $references[$datum['name']] = $datum['commit']['id'];
  19523. $this->commits[$datum['commit']['id']] = $datum['commit'];
  19524. }
  19525. return $references;
  19526. }
  19527. protected function fetchProject()
  19528. {
  19529. $resource = $this->getApiUrl();
  19530. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  19531. }
  19532. protected function attemptCloneFallback()
  19533. {
  19534. try {
  19535. $this->setupGitDriver($this->generateSshUrl());
  19536. return;
  19537. } catch (\RuntimeException $e) {
  19538. $this->gitDriver = null;
  19539. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your credentials</error>');
  19540. throw $e;
  19541. }
  19542. }
  19543. protected function generateSshUrl()
  19544. {
  19545. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  19546. }
  19547. protected function setupGitDriver($url)
  19548. {
  19549. $this->gitDriver = new GitDriver(
  19550. array('url' => $url),
  19551. $this->io,
  19552. $this->config,
  19553. $this->process,
  19554. $this->remoteFilesystem
  19555. );
  19556. $this->gitDriver->initialize();
  19557. }
  19558. protected function getContents($url, $fetchingRepoData = false)
  19559. {
  19560. try {
  19561. return parent::getContents($url);
  19562. } catch (TransportException $e) {
  19563. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  19564. switch ($e->getCode()) {
  19565. case 401:
  19566. case 404:
  19567. if (!$fetchingRepoData) {
  19568. throw $e;
  19569. }
  19570. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  19571. return parent::getContents($url);
  19572. }
  19573. if (!$this->io->isInteractive()) {
  19574. return $this->attemptCloneFallback();
  19575. }
  19576. $this->io->writeError('<warning>Failed to download ' . $this->owner . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  19577. $gitLabUtil->authorizeOAuthInteractively($this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  19578. return parent::getContents($url);
  19579. case 403:
  19580. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  19581. return parent::getContents($url);
  19582. }
  19583. if (!$this->io->isInteractive() && $fetchingRepoData) {
  19584. return $this->attemptCloneFallback();
  19585. }
  19586. throw $e;
  19587. default:
  19588. throw $e;
  19589. }
  19590. }
  19591. }
  19592. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  19593. {
  19594. if (!preg_match(self::URL_REGEX, $url, $match)) {
  19595. return false;
  19596. }
  19597. $scheme = !empty($match['scheme']) ? $match['scheme'] : 'https';
  19598. $originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  19599. if (!in_array($originUrl, (array) $config->get('gitlab-domains'))) {
  19600. return false;
  19601. }
  19602. if ('https' === $scheme && !extension_loaded('openssl')) {
  19603. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  19604. return false;
  19605. }
  19606. return true;
  19607. }
  19608. }
  19609. <?php
  19610. namespace Composer\Repository\Vcs;
  19611. use Composer\Cache;
  19612. use Composer\Config;
  19613. use Composer\Json\JsonFile;
  19614. use Composer\IO\IOInterface;
  19615. class HgBitbucketDriver extends VcsDriver
  19616. {
  19617. protected $cache;
  19618. protected $owner;
  19619. protected $repository;
  19620. protected $tags;
  19621. protected $branches;
  19622. protected $rootIdentifier;
  19623. protected $infoCache = array();
  19624. public function initialize()
  19625. {
  19626. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $this->url, $match);
  19627. $this->owner = $match[1];
  19628. $this->repository = $match[2];
  19629. $this->originUrl = 'bitbucket.org';
  19630. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  19631. }
  19632. public function getRootIdentifier()
  19633. {
  19634. if (null === $this->rootIdentifier) {
  19635. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
  19636. $repoData = JsonFile::parseJson($this->getContents($resource), $resource);
  19637. if (array() === $repoData || !isset($repoData['tip'])) {
  19638. throw new \RuntimeException($this->url.' does not appear to be a mercurial repository, use '.$this->url.'.git if this is a git bitbucket repository');
  19639. }
  19640. $this->rootIdentifier = $repoData['tip']['raw_node'];
  19641. }
  19642. return $this->rootIdentifier;
  19643. }
  19644. public function getUrl()
  19645. {
  19646. return $this->url;
  19647. }
  19648. public function getSource($identifier)
  19649. {
  19650. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  19651. }
  19652. public function getDist($identifier)
  19653. {
  19654. $url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$identifier.'.zip';
  19655. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  19656. }
  19657. public function getComposerInformation($identifier)
  19658. {
  19659. if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
  19660. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  19661. }
  19662. if (!isset($this->infoCache[$identifier])) {
  19663. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/src/'.$identifier.'/composer.json';
  19664. $repoData = JsonFile::parseJson($this->getContents($resource), $resource);
  19665. if (!array_key_exists('data', $repoData)) {
  19666. return;
  19667. }
  19668. $composer = JsonFile::parseJson($repoData['data'], $resource);
  19669. if (empty($composer['time'])) {
  19670. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier;
  19671. $changeset = JsonFile::parseJson($this->getContents($resource), $resource);
  19672. $composer['time'] = $changeset['timestamp'];
  19673. }
  19674. if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
  19675. $this->cache->write($identifier, json_encode($composer));
  19676. }
  19677. $this->infoCache[$identifier] = $composer;
  19678. }
  19679. return $this->infoCache[$identifier];
  19680. }
  19681. public function getTags()
  19682. {
  19683. if (null === $this->tags) {
  19684. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
  19685. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  19686. $this->tags = array();
  19687. foreach ($tagsData as $tag => $data) {
  19688. $this->tags[$tag] = $data['raw_node'];
  19689. }
  19690. unset($this->tags['tip']);
  19691. }
  19692. return $this->tags;
  19693. }
  19694. public function getBranches()
  19695. {
  19696. if (null === $this->branches) {
  19697. $resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches';
  19698. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  19699. $this->branches = array();
  19700. foreach ($branchData as $branch => $data) {
  19701. $this->branches[$branch] = $data['raw_node'];
  19702. }
  19703. }
  19704. return $this->branches;
  19705. }
  19706. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  19707. {
  19708. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  19709. return false;
  19710. }
  19711. if (!extension_loaded('openssl')) {
  19712. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  19713. return false;
  19714. }
  19715. return true;
  19716. }
  19717. }
  19718. <?php
  19719. namespace Composer\Repository\Vcs;
  19720. use Composer\Config;
  19721. use Composer\Json\JsonFile;
  19722. use Composer\Util\ProcessExecutor;
  19723. use Composer\Util\Filesystem;
  19724. use Composer\IO\IOInterface;
  19725. class HgDriver extends VcsDriver
  19726. {
  19727. protected $tags;
  19728. protected $branches;
  19729. protected $rootIdentifier;
  19730. protected $repoDir;
  19731. protected $infoCache = array();
  19732. public function initialize()
  19733. {
  19734. if (Filesystem::isLocalPath($this->url)) {
  19735. $this->repoDir = $this->url;
  19736. } else {
  19737. $cacheDir = $this->config->get('cache-vcs-dir');
  19738. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  19739. $fs = new Filesystem();
  19740. $fs->ensureDirectoryExists($cacheDir);
  19741. if (!is_writable(dirname($this->repoDir))) {
  19742. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  19743. }
  19744. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  19745. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  19746. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  19747. }
  19748. } else {
  19749. $fs->removeDirectory($this->repoDir);
  19750. if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoDir)), $output, $cacheDir)) {
  19751. $output = $this->process->getErrorOutput();
  19752. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  19753. throw new \RuntimeException('Failed to clone '.$this->url.', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  19754. }
  19755. throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
  19756. }
  19757. }
  19758. }
  19759. $this->getTags();
  19760. $this->getBranches();
  19761. }
  19762. public function getRootIdentifier()
  19763. {
  19764. if (null === $this->rootIdentifier) {
  19765. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  19766. $output = $this->process->splitLines($output);
  19767. $this->rootIdentifier = $output[0];
  19768. }
  19769. return $this->rootIdentifier;
  19770. }
  19771. public function getUrl()
  19772. {
  19773. return $this->url;
  19774. }
  19775. public function getSource($identifier)
  19776. {
  19777. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  19778. }
  19779. public function getDist($identifier)
  19780. {
  19781. return null;
  19782. }
  19783. public function getComposerInformation($identifier)
  19784. {
  19785. if (!isset($this->infoCache[$identifier])) {
  19786. $this->process->execute(sprintf('hg cat -r %s composer.json', ProcessExecutor::escape($identifier)), $composer, $this->repoDir);
  19787. if (!trim($composer)) {
  19788. return;
  19789. }
  19790. $composer = JsonFile::parseJson($composer, $identifier);
  19791. if (empty($composer['time'])) {
  19792. $this->process->execute(sprintf('hg log --template "{date|rfc3339date}" -r %s', ProcessExecutor::escape($identifier)), $output, $this->repoDir);
  19793. $date = new \DateTime(trim($output), new \DateTimeZone('UTC'));
  19794. $composer['time'] = $date->format('Y-m-d H:i:s');
  19795. }
  19796. $this->infoCache[$identifier] = $composer;
  19797. }
  19798. return $this->infoCache[$identifier];
  19799. }
  19800. public function getTags()
  19801. {
  19802. if (null === $this->tags) {
  19803. $tags = array();
  19804. $this->process->execute('hg tags', $output, $this->repoDir);
  19805. foreach ($this->process->splitLines($output) as $tag) {
  19806. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  19807. $tags[$match[1]] = $match[2];
  19808. }
  19809. }
  19810. unset($tags['tip']);
  19811. $this->tags = $tags;
  19812. }
  19813. return $this->tags;
  19814. }
  19815. public function getBranches()
  19816. {
  19817. if (null === $this->branches) {
  19818. $branches = array();
  19819. $bookmarks = array();
  19820. $this->process->execute('hg branches', $output, $this->repoDir);
  19821. foreach ($this->process->splitLines($output) as $branch) {
  19822. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  19823. $branches[$match[1]] = $match[2];
  19824. }
  19825. }
  19826. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  19827. foreach ($this->process->splitLines($output) as $branch) {
  19828. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  19829. $bookmarks[$match[1]] = $match[2];
  19830. }
  19831. }
  19832. $this->branches = array_merge($bookmarks, $branches);
  19833. }
  19834. return $this->branches;
  19835. }
  19836. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  19837. {
  19838. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  19839. return true;
  19840. }
  19841. if (Filesystem::isLocalPath($url)) {
  19842. $url = Filesystem::getPlatformPath($url);
  19843. if (!is_dir($url)) {
  19844. return false;
  19845. }
  19846. $process = new ProcessExecutor();
  19847. if ($process->execute('hg summary', $output, $url) === 0) {
  19848. return true;
  19849. }
  19850. }
  19851. if (!$deep) {
  19852. return false;
  19853. }
  19854. $processExecutor = new ProcessExecutor();
  19855. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  19856. return $exit === 0;
  19857. }
  19858. }
  19859. <?php
  19860. namespace Composer\Repository\Vcs;
  19861. use Composer\Config;
  19862. use Composer\IO\IOInterface;
  19863. use Composer\Util\ProcessExecutor;
  19864. use Composer\Util\Perforce;
  19865. class PerforceDriver extends VcsDriver
  19866. {
  19867. protected $depot;
  19868. protected $branch;
  19869. protected $perforce;
  19870. protected $composerInfo;
  19871. protected $composerInfoIdentifier;
  19872. public function initialize()
  19873. {
  19874. $this->depot = $this->repoConfig['depot'];
  19875. $this->branch = '';
  19876. if (!empty($this->repoConfig['branch'])) {
  19877. $this->branch = $this->repoConfig['branch'];
  19878. }
  19879. $this->initPerforce($this->repoConfig);
  19880. $this->perforce->p4Login($this->io);
  19881. $this->perforce->checkStream($this->depot);
  19882. $this->perforce->writeP4ClientSpec();
  19883. $this->perforce->connectClient();
  19884. return true;
  19885. }
  19886. private function initPerforce($repoConfig)
  19887. {
  19888. if (!empty($this->perforce)) {
  19889. return;
  19890. }
  19891. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  19892. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  19893. }
  19894. public function getComposerInformation($identifier)
  19895. {
  19896. if (!empty($this->composerInfoIdentifier)) {
  19897. if (strcmp($identifier, $this->composerInfoIdentifier) === 0) {
  19898. return $this->composerInfo;
  19899. }
  19900. }
  19901. $composer_info = $this->perforce->getComposerInformation($identifier);
  19902. return $composer_info;
  19903. }
  19904. public function getRootIdentifier()
  19905. {
  19906. return $this->branch;
  19907. }
  19908. public function getBranches()
  19909. {
  19910. $branches = $this->perforce->getBranches();
  19911. return $branches;
  19912. }
  19913. public function getTags()
  19914. {
  19915. $tags = $this->perforce->getTags();
  19916. return $tags;
  19917. }
  19918. public function getDist($identifier)
  19919. {
  19920. return null;
  19921. }
  19922. public function getSource($identifier)
  19923. {
  19924. $source = array(
  19925. 'type' => 'perforce',
  19926. 'url' => $this->repoConfig['url'],
  19927. 'reference' => $identifier,
  19928. 'p4user' => $this->perforce->getUser(),
  19929. );
  19930. return $source;
  19931. }
  19932. public function getUrl()
  19933. {
  19934. return $this->url;
  19935. }
  19936. public function hasComposerFile($identifier)
  19937. {
  19938. $this->composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  19939. $this->composerInfoIdentifier = $identifier;
  19940. return !empty($this->composerInfo);
  19941. }
  19942. public function getContents($url)
  19943. {
  19944. return false;
  19945. }
  19946. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  19947. {
  19948. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  19949. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  19950. }
  19951. return false;
  19952. }
  19953. public function cleanup()
  19954. {
  19955. $this->perforce->cleanupClientSpec();
  19956. $this->perforce = null;
  19957. }
  19958. public function getDepot()
  19959. {
  19960. return $this->depot;
  19961. }
  19962. public function getBranch()
  19963. {
  19964. return $this->branch;
  19965. }
  19966. }
  19967. <?php
  19968. namespace Composer\Repository\Vcs;
  19969. use Composer\Cache;
  19970. use Composer\Config;
  19971. use Composer\Json\JsonFile;
  19972. use Composer\Util\ProcessExecutor;
  19973. use Composer\Util\Filesystem;
  19974. use Composer\Util\Svn as SvnUtil;
  19975. use Composer\IO\IOInterface;
  19976. use Composer\Downloader\TransportException;
  19977. class SvnDriver extends VcsDriver
  19978. {
  19979. protected $cache;
  19980. protected $baseUrl;
  19981. protected $tags;
  19982. protected $branches;
  19983. protected $rootIdentifier;
  19984. protected $infoCache = array();
  19985. protected $trunkPath = 'trunk';
  19986. protected $branchesPath = 'branches';
  19987. protected $tagsPath = 'tags';
  19988. protected $packagePath = '';
  19989. protected $cacheCredentials = true;
  19990. private $util;
  19991. public function initialize()
  19992. {
  19993. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  19994. SvnUtil::cleanEnv();
  19995. if (isset($this->repoConfig['trunk-path'])) {
  19996. $this->trunkPath = $this->repoConfig['trunk-path'];
  19997. }
  19998. if (isset($this->repoConfig['branches-path'])) {
  19999. $this->branchesPath = $this->repoConfig['branches-path'];
  20000. }
  20001. if (isset($this->repoConfig['tags-path'])) {
  20002. $this->tagsPath = $this->repoConfig['tags-path'];
  20003. }
  20004. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  20005. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  20006. }
  20007. if (isset($this->repoConfig['package-path'])) {
  20008. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  20009. }
  20010. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  20011. $this->baseUrl = substr($this->url, 0, $pos);
  20012. }
  20013. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  20014. $this->getBranches();
  20015. $this->getTags();
  20016. }
  20017. public function getRootIdentifier()
  20018. {
  20019. return $this->rootIdentifier ?: $this->trunkPath;
  20020. }
  20021. public function getUrl()
  20022. {
  20023. return $this->url;
  20024. }
  20025. public function getSource($identifier)
  20026. {
  20027. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  20028. }
  20029. public function getDist($identifier)
  20030. {
  20031. return null;
  20032. }
  20033. public function getComposerInformation($identifier)
  20034. {
  20035. $identifier = '/' . trim($identifier, '/') . '/';
  20036. if ($res = $this->cache->read($identifier.'.json')) {
  20037. $this->infoCache[$identifier] = JsonFile::parseJson($res);
  20038. }
  20039. if (!isset($this->infoCache[$identifier])) {
  20040. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  20041. if (!empty($match[2])) {
  20042. $path = $match[1];
  20043. $rev = $match[2];
  20044. } else {
  20045. $path = $identifier;
  20046. $rev = '';
  20047. }
  20048. try {
  20049. $resource = $path.'composer.json';
  20050. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  20051. if (!trim($output)) {
  20052. return;
  20053. }
  20054. } catch (\RuntimeException $e) {
  20055. throw new TransportException($e->getMessage());
  20056. }
  20057. $composer = JsonFile::parseJson($output, $this->baseUrl . $resource . $rev);
  20058. if (empty($composer['time'])) {
  20059. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  20060. foreach ($this->process->splitLines($output) as $line) {
  20061. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  20062. $date = new \DateTime($match[1], new \DateTimeZone('UTC'));
  20063. $composer['time'] = $date->format('Y-m-d H:i:s');
  20064. break;
  20065. }
  20066. }
  20067. }
  20068. $this->cache->write($identifier.'.json', json_encode($composer));
  20069. $this->infoCache[$identifier] = $composer;
  20070. }
  20071. return $this->infoCache[$identifier];
  20072. }
  20073. public function getTags()
  20074. {
  20075. if (null === $this->tags) {
  20076. $this->tags = array();
  20077. if ($this->tagsPath !== false) {
  20078. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  20079. if ($output) {
  20080. foreach ($this->process->splitLines($output) as $line) {
  20081. $line = trim($line);
  20082. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  20083. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  20084. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  20085. '/' . $this->tagsPath . '/' . $match[2],
  20086. $match[1]
  20087. );
  20088. }
  20089. }
  20090. }
  20091. }
  20092. }
  20093. }
  20094. return $this->tags;
  20095. }
  20096. public function getBranches()
  20097. {
  20098. if (null === $this->branches) {
  20099. $this->branches = array();
  20100. if (false === $this->trunkPath) {
  20101. $trunkParent = $this->baseUrl . '/';
  20102. } else {
  20103. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  20104. }
  20105. $output = $this->execute('svn ls --verbose', $trunkParent);
  20106. if ($output) {
  20107. foreach ($this->process->splitLines($output) as $line) {
  20108. $line = trim($line);
  20109. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  20110. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  20111. $this->branches['trunk'] = $this->buildIdentifier(
  20112. '/' . $this->trunkPath,
  20113. $match[1]
  20114. );
  20115. $this->rootIdentifier = $this->branches['trunk'];
  20116. break;
  20117. }
  20118. }
  20119. }
  20120. }
  20121. unset($output);
  20122. if ($this->branchesPath !== false) {
  20123. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  20124. if ($output) {
  20125. foreach ($this->process->splitLines(trim($output)) as $line) {
  20126. $line = trim($line);
  20127. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  20128. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  20129. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  20130. '/' . $this->branchesPath . '/' . $match[2],
  20131. $match[1]
  20132. );
  20133. }
  20134. }
  20135. }
  20136. }
  20137. }
  20138. }
  20139. return $this->branches;
  20140. }
  20141. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  20142. {
  20143. $url = self::normalizeUrl($url);
  20144. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  20145. return true;
  20146. }
  20147. if (!$deep && !Filesystem::isLocalPath($url)) {
  20148. return false;
  20149. }
  20150. $processExecutor = new ProcessExecutor();
  20151. $exit = $processExecutor->execute(
  20152. "svn info --non-interactive {$url}",
  20153. $ignoredOutput
  20154. );
  20155. if ($exit === 0) {
  20156. return true;
  20157. }
  20158. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  20159. return true;
  20160. }
  20161. return false;
  20162. }
  20163. protected static function normalizeUrl($url)
  20164. {
  20165. $fs = new Filesystem();
  20166. if ($fs->isAbsolutePath($url)) {
  20167. return 'file://' . strtr($url, '\\', '/');
  20168. }
  20169. return $url;
  20170. }
  20171. protected function execute($command, $url)
  20172. {
  20173. if (null === $this->util) {
  20174. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  20175. $this->util->setCacheCredentials($this->cacheCredentials);
  20176. }
  20177. try {
  20178. return $this->util->execute($command, $url);
  20179. } catch (\RuntimeException $e) {
  20180. if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
  20181. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  20182. }
  20183. throw new \RuntimeException(
  20184. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  20185. );
  20186. }
  20187. }
  20188. protected function buildIdentifier($baseDir, $revision)
  20189. {
  20190. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  20191. }
  20192. }
  20193. <?php
  20194. namespace Composer\Repository\Vcs;
  20195. use Composer\Downloader\TransportException;
  20196. use Composer\Config;
  20197. use Composer\Factory;
  20198. use Composer\IO\IOInterface;
  20199. use Composer\Util\ProcessExecutor;
  20200. use Composer\Util\RemoteFilesystem;
  20201. use Composer\Util\Filesystem;
  20202. abstract class VcsDriver implements VcsDriverInterface
  20203. {
  20204. protected $url;
  20205. protected $originUrl;
  20206. protected $repoConfig;
  20207. protected $io;
  20208. protected $config;
  20209. protected $process;
  20210. protected $remoteFilesystem;
  20211. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  20212. {
  20213. if (Filesystem::isLocalPath($repoConfig['url'])) {
  20214. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  20215. }
  20216. $this->url = $repoConfig['url'];
  20217. $this->originUrl = $repoConfig['url'];
  20218. $this->repoConfig = $repoConfig;
  20219. $this->io = $io;
  20220. $this->config = $config;
  20221. $this->process = $process ?: new ProcessExecutor($io);
  20222. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  20223. }
  20224. public function hasComposerFile($identifier)
  20225. {
  20226. try {
  20227. return (bool) $this->getComposerInformation($identifier);
  20228. } catch (TransportException $e) {
  20229. }
  20230. return false;
  20231. }
  20232. protected function getScheme()
  20233. {
  20234. if (extension_loaded('openssl')) {
  20235. return 'https';
  20236. }
  20237. return 'http';
  20238. }
  20239. protected function getContents($url)
  20240. {
  20241. return $this->remoteFilesystem->getContents($this->originUrl, $url, false);
  20242. }
  20243. public function cleanup()
  20244. {
  20245. return;
  20246. }
  20247. }
  20248. <?php
  20249. namespace Composer\Repository\Vcs;
  20250. use Composer\Config;
  20251. use Composer\IO\IOInterface;
  20252. interface VcsDriverInterface
  20253. {
  20254. public function initialize();
  20255. public function getComposerInformation($identifier);
  20256. public function getRootIdentifier();
  20257. public function getBranches();
  20258. public function getTags();
  20259. public function getDist($identifier);
  20260. public function getSource($identifier);
  20261. public function getUrl();
  20262. public function hasComposerFile($identifier);
  20263. public function cleanup();
  20264. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  20265. }
  20266. <?php
  20267. namespace Composer\Repository;
  20268. use Composer\Downloader\TransportException;
  20269. use Composer\Repository\Vcs\VcsDriverInterface;
  20270. use Composer\Package\Version\VersionParser;
  20271. use Composer\Package\Loader\ArrayLoader;
  20272. use Composer\Package\Loader\ValidatingArrayLoader;
  20273. use Composer\Package\Loader\InvalidPackageException;
  20274. use Composer\Package\Loader\LoaderInterface;
  20275. use Composer\EventDispatcher\EventDispatcher;
  20276. use Composer\IO\IOInterface;
  20277. use Composer\Config;
  20278. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20279. {
  20280. protected $url;
  20281. protected $packageName;
  20282. protected $verbose;
  20283. protected $io;
  20284. protected $config;
  20285. protected $versionParser;
  20286. protected $type;
  20287. protected $loader;
  20288. protected $repoConfig;
  20289. protected $branchErrorOccurred = false;
  20290. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
  20291. {
  20292. $this->drivers = $drivers ?: array(
  20293. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  20294. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  20295. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  20296. 'git' => 'Composer\Repository\Vcs\GitDriver',
  20297. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  20298. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  20299. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  20300. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  20301. );
  20302. $this->url = $repoConfig['url'];
  20303. $this->io = $io;
  20304. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  20305. $this->verbose = $io->isVeryVerbose();
  20306. $this->config = $config;
  20307. $this->repoConfig = $repoConfig;
  20308. }
  20309. public function getRepoConfig()
  20310. {
  20311. return $this->repoConfig;
  20312. }
  20313. public function setLoader(LoaderInterface $loader)
  20314. {
  20315. $this->loader = $loader;
  20316. }
  20317. public function getDriver()
  20318. {
  20319. if (isset($this->drivers[$this->type])) {
  20320. $class = $this->drivers[$this->type];
  20321. $driver = new $class($this->repoConfig, $this->io, $this->config);
  20322. $driver->initialize();
  20323. return $driver;
  20324. }
  20325. foreach ($this->drivers as $driver) {
  20326. if ($driver::supports($this->io, $this->config, $this->url)) {
  20327. $driver = new $driver($this->repoConfig, $this->io, $this->config);
  20328. $driver->initialize();
  20329. return $driver;
  20330. }
  20331. }
  20332. foreach ($this->drivers as $driver) {
  20333. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  20334. $driver = new $driver($this->repoConfig, $this->io, $this->config);
  20335. $driver->initialize();
  20336. return $driver;
  20337. }
  20338. }
  20339. }
  20340. public function hadInvalidBranches()
  20341. {
  20342. return $this->branchErrorOccurred;
  20343. }
  20344. protected function initialize()
  20345. {
  20346. parent::initialize();
  20347. $verbose = $this->verbose;
  20348. $driver = $this->getDriver();
  20349. if (!$driver) {
  20350. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  20351. }
  20352. $this->versionParser = new VersionParser;
  20353. if (!$this->loader) {
  20354. $this->loader = new ArrayLoader($this->versionParser);
  20355. }
  20356. try {
  20357. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  20358. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  20359. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  20360. }
  20361. } catch (\Exception $e) {
  20362. if ($verbose) {
  20363. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  20364. }
  20365. }
  20366. foreach ($driver->getTags() as $tag => $identifier) {
  20367. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  20368. if ($verbose) {
  20369. $this->io->writeError($msg);
  20370. } else {
  20371. $this->io->overwriteError($msg, false);
  20372. }
  20373. $tag = str_replace('release-', '', $tag);
  20374. if (!$parsedTag = $this->validateTag($tag)) {
  20375. if ($verbose) {
  20376. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  20377. }
  20378. continue;
  20379. }
  20380. try {
  20381. if (!$data = $driver->getComposerInformation($identifier)) {
  20382. if ($verbose) {
  20383. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  20384. }
  20385. continue;
  20386. }
  20387. if (isset($data['version'])) {
  20388. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  20389. } else {
  20390. $data['version'] = $tag;
  20391. $data['version_normalized'] = $parsedTag;
  20392. }
  20393. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  20394. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  20395. if ($data['version_normalized'] !== $parsedTag) {
  20396. if ($verbose) {
  20397. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  20398. }
  20399. continue;
  20400. }
  20401. if ($verbose) {
  20402. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  20403. }
  20404. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  20405. } catch (\Exception $e) {
  20406. if ($verbose) {
  20407. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  20408. }
  20409. continue;
  20410. }
  20411. }
  20412. if (!$verbose) {
  20413. $this->io->overwriteError('', false);
  20414. }
  20415. foreach ($driver->getBranches() as $branch => $identifier) {
  20416. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  20417. if ($verbose) {
  20418. $this->io->writeError($msg);
  20419. } else {
  20420. $this->io->overwriteError($msg, false);
  20421. }
  20422. if (!$parsedBranch = $this->validateBranch($branch)) {
  20423. if ($verbose) {
  20424. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  20425. }
  20426. continue;
  20427. }
  20428. try {
  20429. if (!$data = $driver->getComposerInformation($identifier)) {
  20430. if ($verbose) {
  20431. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  20432. }
  20433. continue;
  20434. }
  20435. $data['version'] = $branch;
  20436. $data['version_normalized'] = $parsedBranch;
  20437. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  20438. $data['version'] = 'dev-' . $data['version'];
  20439. } else {
  20440. $data['version'] = preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  20441. }
  20442. if ($verbose) {
  20443. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  20444. }
  20445. $packageData = $this->preProcess($driver, $data, $identifier);
  20446. $package = $this->loader->load($packageData);
  20447. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  20448. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  20449. }
  20450. $this->addPackage($package);
  20451. } catch (TransportException $e) {
  20452. if ($verbose) {
  20453. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  20454. }
  20455. continue;
  20456. } catch (\Exception $e) {
  20457. if (!$verbose) {
  20458. $this->io->writeError('');
  20459. }
  20460. $this->branchErrorOccurred = true;
  20461. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  20462. $this->io->writeError('');
  20463. continue;
  20464. }
  20465. }
  20466. $driver->cleanup();
  20467. if (!$verbose) {
  20468. $this->io->overwriteError('', false);
  20469. }
  20470. if (!$this->getPackages()) {
  20471. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  20472. }
  20473. }
  20474. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  20475. {
  20476. $data['name'] = $this->packageName ?: $data['name'];
  20477. if (!isset($data['dist'])) {
  20478. $data['dist'] = $driver->getDist($identifier);
  20479. }
  20480. if (!isset($data['source'])) {
  20481. $data['source'] = $driver->getSource($identifier);
  20482. }
  20483. return $data;
  20484. }
  20485. private function validateBranch($branch)
  20486. {
  20487. try {
  20488. return $this->versionParser->normalizeBranch($branch);
  20489. } catch (\Exception $e) {
  20490. }
  20491. return false;
  20492. }
  20493. private function validateTag($version)
  20494. {
  20495. try {
  20496. return $this->versionParser->normalize($version);
  20497. } catch (\Exception $e) {
  20498. }
  20499. return false;
  20500. }
  20501. }
  20502. <?php
  20503. namespace Composer\Repository;
  20504. use Composer\Package\AliasPackage;
  20505. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  20506. {
  20507. public function write()
  20508. {
  20509. }
  20510. public function reload()
  20511. {
  20512. }
  20513. public function getCanonicalPackages()
  20514. {
  20515. $packages = $this->getPackages();
  20516. $packagesByName = array();
  20517. foreach ($packages as $package) {
  20518. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  20519. $packagesByName[$package->getName()] = $package;
  20520. }
  20521. }
  20522. $canonicalPackages = array();
  20523. foreach ($packagesByName as $package) {
  20524. while ($package instanceof AliasPackage) {
  20525. $package = $package->getAliasOf();
  20526. }
  20527. $canonicalPackages[] = $package;
  20528. }
  20529. return $canonicalPackages;
  20530. }
  20531. }
  20532. <?php
  20533. namespace Composer\Repository;
  20534. use Composer\Package\PackageInterface;
  20535. interface WritableRepositoryInterface extends RepositoryInterface
  20536. {
  20537. public function write();
  20538. public function addPackage(PackageInterface $package);
  20539. public function removePackage(PackageInterface $package);
  20540. public function getCanonicalPackages();
  20541. public function reload();
  20542. }
  20543. <?php
  20544. namespace Composer\Script;
  20545. class CommandEvent extends Event
  20546. {
  20547. }
  20548. <?php
  20549. namespace Composer\Script;
  20550. use Composer\Composer;
  20551. use Composer\IO\IOInterface;
  20552. use Composer\EventDispatcher\Event as BaseEvent;
  20553. class Event extends BaseEvent
  20554. {
  20555. private $composer;
  20556. private $io;
  20557. private $devMode;
  20558. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  20559. {
  20560. parent::__construct($name, $args, $flags);
  20561. $this->composer = $composer;
  20562. $this->io = $io;
  20563. $this->devMode = $devMode;
  20564. }
  20565. public function getComposer()
  20566. {
  20567. return $this->composer;
  20568. }
  20569. public function getIO()
  20570. {
  20571. return $this->io;
  20572. }
  20573. public function isDevMode()
  20574. {
  20575. return $this->devMode;
  20576. }
  20577. }
  20578. <?php
  20579. namespace Composer\Script;
  20580. use Composer\Installer\PackageEvent as BasePackageEvent;
  20581. class PackageEvent extends BasePackageEvent
  20582. {
  20583. }
  20584. <?php
  20585. namespace Composer\Script;
  20586. class ScriptEvents
  20587. {
  20588. const PRE_INSTALL_CMD = 'pre-install-cmd';
  20589. const POST_INSTALL_CMD = 'post-install-cmd';
  20590. const PRE_UPDATE_CMD = 'pre-update-cmd';
  20591. const POST_UPDATE_CMD = 'post-update-cmd';
  20592. const PRE_STATUS_CMD = 'pre-status-cmd';
  20593. const POST_STATUS_CMD = 'post-status-cmd';
  20594. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  20595. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  20596. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  20597. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  20598. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  20599. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  20600. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  20601. const POST_PACKAGE_INSTALL = 'post-package-install';
  20602. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  20603. const POST_PACKAGE_UPDATE = 'post-package-update';
  20604. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  20605. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  20606. }
  20607. <?php
  20608. namespace Composer\Util;
  20609. use Composer\Config;
  20610. use Composer\IO\IOInterface;
  20611. class AuthHelper
  20612. {
  20613. protected $io;
  20614. protected $config;
  20615. public function __construct(IOInterface $io, Config $config)
  20616. {
  20617. $this->io = $io;
  20618. $this->config = $config;
  20619. }
  20620. public function storeAuth($originUrl, $storeAuth)
  20621. {
  20622. $store = false;
  20623. $configSource = $this->config->getAuthConfigSource();
  20624. if ($storeAuth === true) {
  20625. $store = $configSource;
  20626. } elseif ($storeAuth === 'prompt') {
  20627. $answer = $this->io->askAndValidate(
  20628. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  20629. function ($value) {
  20630. $input = strtolower(substr(trim($value), 0, 1));
  20631. if (in_array($input, array('y','n'))) {
  20632. return $input;
  20633. }
  20634. throw new \RuntimeException('Please answer (y)es or (n)o');
  20635. },
  20636. null,
  20637. 'y'
  20638. );
  20639. if ($answer === 'y') {
  20640. $store = $configSource;
  20641. }
  20642. }
  20643. if ($store) {
  20644. $store->addConfigSetting(
  20645. 'http-basic.'.$originUrl,
  20646. $this->io->getAuthentication($originUrl)
  20647. );
  20648. }
  20649. }
  20650. }
  20651. <?php
  20652. namespace Composer\Util;
  20653. class ComposerMirror
  20654. {
  20655. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  20656. {
  20657. if ($reference) {
  20658. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  20659. }
  20660. $version = strpos($version, '/') === false ? $version : md5($version);
  20661. return str_replace(
  20662. array('%package%', '%version%', '%reference%', '%type%'),
  20663. array($packageName, $version, $reference, $type),
  20664. $mirrorUrl
  20665. );
  20666. }
  20667. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  20668. {
  20669. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  20670. $url = 'gh-'.$match[1].'/'.$match[2];
  20671. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  20672. $url = 'bb-'.$match[1].'/'.$match[2];
  20673. } else {
  20674. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  20675. }
  20676. return str_replace(
  20677. array('%package%', '%normalizedUrl%', '%type%'),
  20678. array($packageName, $url, $type),
  20679. $mirrorUrl
  20680. );
  20681. }
  20682. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  20683. {
  20684. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  20685. }
  20686. }
  20687. <?php
  20688. namespace Composer\Util;
  20689. use Composer\Package\Loader\ArrayLoader;
  20690. use Composer\Package\Loader\ValidatingArrayLoader;
  20691. use Composer\Package\Loader\InvalidPackageException;
  20692. use Composer\Json\JsonValidationException;
  20693. use Composer\IO\IOInterface;
  20694. use Composer\Json\JsonFile;
  20695. use Composer\Spdx\SpdxLicenses;
  20696. class ConfigValidator
  20697. {
  20698. private $io;
  20699. public function __construct(IOInterface $io)
  20700. {
  20701. $this->io = $io;
  20702. }
  20703. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  20704. {
  20705. $errors = array();
  20706. $publishErrors = array();
  20707. $warnings = array();
  20708. $laxValid = false;
  20709. try {
  20710. $json = new JsonFile($file, null, $this->io);
  20711. $manifest = $json->read();
  20712. $json->validateSchema(JsonFile::LAX_SCHEMA);
  20713. $laxValid = true;
  20714. $json->validateSchema();
  20715. } catch (JsonValidationException $e) {
  20716. foreach ($e->getErrors() as $message) {
  20717. if ($laxValid) {
  20718. $publishErrors[] = $message;
  20719. } else {
  20720. $errors[] = $message;
  20721. }
  20722. }
  20723. } catch (\Exception $e) {
  20724. $errors[] = $e->getMessage();
  20725. return array($errors, $publishErrors, $warnings);
  20726. }
  20727. if (!empty($manifest['license'])) {
  20728. if (is_array($manifest['license'])) {
  20729. foreach ($manifest['license'] as $key => $license) {
  20730. if ('proprietary' === $license) {
  20731. unset($manifest['license'][$key]);
  20732. }
  20733. }
  20734. }
  20735. $licenseValidator = new SpdxLicenses();
  20736. if ('proprietary' !== $manifest['license'] && array() !== $manifest['license'] && !$licenseValidator->validate($manifest['license'])) {
  20737. $warnings[] = sprintf(
  20738. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.'
  20739. ."\nIf the software is closed-source, you may use \"proprietary\" as license.",
  20740. json_encode($manifest['license'])
  20741. );
  20742. }
  20743. } else {
  20744. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  20745. }
  20746. if (isset($manifest['version'])) {
  20747. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  20748. }
  20749. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  20750. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  20751. $suggestName = strtolower($suggestName);
  20752. $publishErrors[] = sprintf(
  20753. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  20754. $manifest['name'],
  20755. $suggestName
  20756. );
  20757. }
  20758. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  20759. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  20760. }
  20761. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  20762. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  20763. if (!empty($requireOverrides)) {
  20764. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  20765. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  20766. }
  20767. }
  20768. $require = isset($manifest['require']) ? $manifest['require'] : array();
  20769. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  20770. $packages = array_merge($require, $requireDev);
  20771. foreach ($packages as $package => $version) {
  20772. if (preg_match('/#/', $version) === 1) {
  20773. $warnings[] = sprintf(
  20774. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  20775. $package
  20776. );
  20777. }
  20778. }
  20779. if (isset($manifest['autoload']['psr-0'][''])) {
  20780. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  20781. }
  20782. if (isset($manifest['autoload']['psr-4'][''])) {
  20783. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  20784. }
  20785. try {
  20786. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  20787. if (!isset($manifest['version'])) {
  20788. $manifest['version'] = '1.0.0';
  20789. }
  20790. if (!isset($manifest['name'])) {
  20791. $manifest['name'] = 'dummy/dummy';
  20792. }
  20793. $loader->load($manifest);
  20794. } catch (InvalidPackageException $e) {
  20795. $errors = array_merge($errors, $e->getErrors());
  20796. }
  20797. $warnings = array_merge($warnings, $loader->getWarnings());
  20798. return array($errors, $publishErrors, $warnings);
  20799. }
  20800. }
  20801. <?php
  20802. namespace Composer\Util;
  20803. use Composer\IO\IOInterface;
  20804. class ErrorHandler
  20805. {
  20806. private static $io;
  20807. public static function handle($level, $message, $file, $line)
  20808. {
  20809. if (!(error_reporting() & $level)) {
  20810. return;
  20811. }
  20812. if (ini_get('xdebug.scream')) {
  20813. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  20814. "\na legitimately suppressed error that you were not supposed to see.";
  20815. }
  20816. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  20817. throw new \ErrorException($message, 0, $level, $file, $line);
  20818. }
  20819. if (self::$io) {
  20820. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  20821. if (self::$io->isVerbose()) {
  20822. self::$io->writeError('<warning>Stack trace:</warning>');
  20823. self::$io->writeError(array_filter(array_map(function ($a) {
  20824. if (isset($a['line'], $a['file'])) {
  20825. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  20826. }
  20827. return null;
  20828. }, array_slice(debug_backtrace(), 2))));
  20829. }
  20830. }
  20831. }
  20832. public static function register(IOInterface $io = null)
  20833. {
  20834. set_error_handler(array(__CLASS__, 'handle'));
  20835. error_reporting(E_ALL | E_STRICT);
  20836. self::$io = $io;
  20837. }
  20838. }
  20839. <?php
  20840. namespace Composer\Util;
  20841. use RecursiveDirectoryIterator;
  20842. use RecursiveIteratorIterator;
  20843. use Symfony\Component\Filesystem\Exception\IOException;
  20844. use Symfony\Component\Finder\Finder;
  20845. class Filesystem
  20846. {
  20847. private $processExecutor;
  20848. public function __construct(ProcessExecutor $executor = null)
  20849. {
  20850. $this->processExecutor = $executor ?: new ProcessExecutor();
  20851. }
  20852. public function remove($file)
  20853. {
  20854. if (is_dir($file)) {
  20855. return $this->removeDirectory($file);
  20856. }
  20857. if (file_exists($file)) {
  20858. return $this->unlink($file);
  20859. }
  20860. return false;
  20861. }
  20862. public function isDirEmpty($dir)
  20863. {
  20864. $finder = Finder::create()
  20865. ->ignoreVCS(false)
  20866. ->ignoreDotFiles(false)
  20867. ->depth(0)
  20868. ->in($dir);
  20869. return count($finder) === 0;
  20870. }
  20871. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  20872. {
  20873. if (file_exists($dir) && is_link($dir)) {
  20874. $this->unlink($dir);
  20875. }
  20876. if ($ensureDirectoryExists) {
  20877. $this->ensureDirectoryExists($dir);
  20878. }
  20879. if (is_dir($dir)) {
  20880. $finder = Finder::create()
  20881. ->ignoreVCS(false)
  20882. ->ignoreDotFiles(false)
  20883. ->depth(0)
  20884. ->in($dir);
  20885. foreach ($finder as $path) {
  20886. $this->remove((string) $path);
  20887. }
  20888. }
  20889. }
  20890. public function removeDirectory($directory)
  20891. {
  20892. if ($this->isSymlinkedDirectory($directory)) {
  20893. return $this->unlinkSymlinkedDirectory($directory);
  20894. }
  20895. if ($this->isJunction($directory)) {
  20896. return $this->removeJunction($directory);
  20897. }
  20898. if (!file_exists($directory) || !is_dir($directory)) {
  20899. return true;
  20900. }
  20901. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  20902. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  20903. }
  20904. if (!function_exists('proc_open')) {
  20905. return $this->removeDirectoryPhp($directory);
  20906. }
  20907. if (Platform::isWindows()) {
  20908. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  20909. } else {
  20910. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  20911. }
  20912. $result = $this->getProcess()->execute($cmd, $output) === 0;
  20913. clearstatcache();
  20914. if ($result && !file_exists($directory)) {
  20915. return true;
  20916. }
  20917. return $this->removeDirectoryPhp($directory);
  20918. }
  20919. public function removeDirectoryPhp($directory)
  20920. {
  20921. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  20922. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  20923. foreach ($ri as $file) {
  20924. if ($file->isDir()) {
  20925. $this->rmdir($file->getPathname());
  20926. } else {
  20927. $this->unlink($file->getPathname());
  20928. }
  20929. }
  20930. return $this->rmdir($directory);
  20931. }
  20932. public function ensureDirectoryExists($directory)
  20933. {
  20934. if (!is_dir($directory)) {
  20935. if (file_exists($directory)) {
  20936. throw new \RuntimeException(
  20937. $directory.' exists and is not a directory.'
  20938. );
  20939. }
  20940. if (!@mkdir($directory, 0777, true)) {
  20941. throw new \RuntimeException(
  20942. $directory.' does not exist and could not be created.'
  20943. );
  20944. }
  20945. }
  20946. }
  20947. public function unlink($path)
  20948. {
  20949. if (!@$this->unlinkImplementation($path)) {
  20950. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  20951. $error = error_get_last();
  20952. $message = 'Could not delete '.$path.': ' . @$error['message'];
  20953. if (Platform::isWindows()) {
  20954. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  20955. }
  20956. throw new \RuntimeException($message);
  20957. }
  20958. }
  20959. return true;
  20960. }
  20961. public function rmdir($path)
  20962. {
  20963. if (!@rmdir($path)) {
  20964. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  20965. $error = error_get_last();
  20966. $message = 'Could not delete '.$path.': ' . @$error['message'];
  20967. if (Platform::isWindows()) {
  20968. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  20969. }
  20970. throw new \RuntimeException($message);
  20971. }
  20972. }
  20973. return true;
  20974. }
  20975. public function copyThenRemove($source, $target)
  20976. {
  20977. if (!is_dir($source)) {
  20978. copy($source, $target);
  20979. $this->unlink($source);
  20980. return;
  20981. }
  20982. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  20983. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  20984. $this->ensureDirectoryExists($target);
  20985. foreach ($ri as $file) {
  20986. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  20987. if ($file->isDir()) {
  20988. $this->ensureDirectoryExists($targetPath);
  20989. } else {
  20990. copy($file->getPathname(), $targetPath);
  20991. }
  20992. }
  20993. $this->removeDirectoryPhp($source);
  20994. }
  20995. public function rename($source, $target)
  20996. {
  20997. if (true === @rename($source, $target)) {
  20998. return;
  20999. }
  21000. if (!function_exists('proc_open')) {
  21001. return $this->copyThenRemove($source, $target);
  21002. }
  21003. if (Platform::isWindows()) {
  21004. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  21005. $result = $this->processExecutor->execute($command, $output);
  21006. clearstatcache();
  21007. if (0 === $result) {
  21008. $this->remove($source);
  21009. return;
  21010. }
  21011. } else {
  21012. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  21013. $result = $this->processExecutor->execute($command, $output);
  21014. clearstatcache();
  21015. if (0 === $result) {
  21016. return;
  21017. }
  21018. }
  21019. return $this->copyThenRemove($source, $target);
  21020. }
  21021. public function findShortestPath($from, $to, $directories = false)
  21022. {
  21023. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  21024. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  21025. }
  21026. $from = lcfirst($this->normalizePath($from));
  21027. $to = lcfirst($this->normalizePath($to));
  21028. if ($directories) {
  21029. $from = rtrim($from, '/') . '/dummy_file';
  21030. }
  21031. if (dirname($from) === dirname($to)) {
  21032. return './'.basename($to);
  21033. }
  21034. $commonPath = $to;
  21035. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  21036. $commonPath = strtr(dirname($commonPath), '\\', '/');
  21037. }
  21038. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  21039. return $to;
  21040. }
  21041. $commonPath = rtrim($commonPath, '/') . '/';
  21042. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  21043. $commonPathCode = str_repeat('../', $sourcePathDepth);
  21044. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  21045. }
  21046. public function findShortestPathCode($from, $to, $directories = false)
  21047. {
  21048. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  21049. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  21050. }
  21051. $from = lcfirst($this->normalizePath($from));
  21052. $to = lcfirst($this->normalizePath($to));
  21053. if ($from === $to) {
  21054. return $directories ? '__DIR__' : '__FILE__';
  21055. }
  21056. $commonPath = $to;
  21057. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  21058. $commonPath = strtr(dirname($commonPath), '\\', '/');
  21059. }
  21060. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  21061. return var_export($to, true);
  21062. }
  21063. $commonPath = rtrim($commonPath, '/') . '/';
  21064. if (strpos($to, $from.'/') === 0) {
  21065. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  21066. }
  21067. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  21068. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  21069. $relTarget = substr($to, strlen($commonPath));
  21070. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  21071. }
  21072. public function isAbsolutePath($path)
  21073. {
  21074. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  21075. }
  21076. public function size($path)
  21077. {
  21078. if (!file_exists($path)) {
  21079. throw new \RuntimeException("$path does not exist.");
  21080. }
  21081. if (is_dir($path)) {
  21082. return $this->directorySize($path);
  21083. }
  21084. return filesize($path);
  21085. }
  21086. public function normalizePath($path)
  21087. {
  21088. $parts = array();
  21089. $path = strtr($path, '\\', '/');
  21090. $prefix = '';
  21091. $absolute = false;
  21092. if (preg_match('{^([0-9a-z]+:(?://(?:[a-z]:)?)?)}i', $path, $match)) {
  21093. $prefix = $match[1];
  21094. $path = substr($path, strlen($prefix));
  21095. }
  21096. if (substr($path, 0, 1) === '/') {
  21097. $absolute = true;
  21098. $path = substr($path, 1);
  21099. }
  21100. $up = false;
  21101. foreach (explode('/', $path) as $chunk) {
  21102. if ('..' === $chunk && ($absolute || $up)) {
  21103. array_pop($parts);
  21104. $up = !(empty($parts) || '..' === end($parts));
  21105. } elseif ('.' !== $chunk && '' !== $chunk) {
  21106. $parts[] = $chunk;
  21107. $up = '..' !== $chunk;
  21108. }
  21109. }
  21110. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  21111. }
  21112. public static function isLocalPath($path)
  21113. {
  21114. return (bool) preg_match('{^(file://|/|[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  21115. }
  21116. public static function getPlatformPath($path)
  21117. {
  21118. if (Platform::isWindows()) {
  21119. $path = preg_replace('{^(?:file:///([a-z])/)}i', 'file://$1:/', $path);
  21120. }
  21121. return preg_replace('{^file://}i', '', $path);
  21122. }
  21123. protected function directorySize($directory)
  21124. {
  21125. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  21126. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  21127. $size = 0;
  21128. foreach ($ri as $file) {
  21129. if ($file->isFile()) {
  21130. $size += $file->getSize();
  21131. }
  21132. }
  21133. return $size;
  21134. }
  21135. protected function getProcess()
  21136. {
  21137. return new ProcessExecutor;
  21138. }
  21139. private function unlinkImplementation($path)
  21140. {
  21141. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  21142. return rmdir($path);
  21143. }
  21144. return unlink($path);
  21145. }
  21146. public function relativeSymlink($target, $link)
  21147. {
  21148. $cwd = getcwd();
  21149. $relativePath = $this->findShortestPath($link, $target);
  21150. chdir(dirname($link));
  21151. $result = @symlink($relativePath, $link);
  21152. chdir($cwd);
  21153. return (bool) $result;
  21154. }
  21155. public function isSymlinkedDirectory($directory)
  21156. {
  21157. if (!is_dir($directory)) {
  21158. return false;
  21159. }
  21160. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  21161. return is_link($resolved);
  21162. }
  21163. private function unlinkSymlinkedDirectory($directory)
  21164. {
  21165. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  21166. return $this->unlink($resolved);
  21167. }
  21168. private function resolveSymlinkedDirectorySymlink($pathname)
  21169. {
  21170. if (!is_dir($pathname)) {
  21171. return $pathname;
  21172. }
  21173. $resolved = rtrim($pathname, '/');
  21174. if (!strlen($resolved)) {
  21175. return $pathname;
  21176. }
  21177. return $resolved;
  21178. }
  21179. public function junction($target, $junction)
  21180. {
  21181. if (!Platform::isWindows()) {
  21182. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  21183. }
  21184. if (!is_dir($target)) {
  21185. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  21186. }
  21187. $cmd = sprintf('mklink /J %s %s',
  21188. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  21189. ProcessExecutor::escape(realpath($target)));
  21190. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  21191. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  21192. }
  21193. }
  21194. public function isJunction($junction)
  21195. {
  21196. if (!Platform::isWindows()) {
  21197. return false;
  21198. }
  21199. if (!is_dir($junction) || is_link($junction)) {
  21200. return false;
  21201. }
  21202. $stat = lstat($junction);
  21203. return ($stat['mode'] === 0);
  21204. }
  21205. public function removeJunction($junction)
  21206. {
  21207. if (!Platform::isWindows()) {
  21208. return false;
  21209. }
  21210. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  21211. if (!$this->isJunction($junction)) {
  21212. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  21213. }
  21214. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  21215. return ($this->getProcess()->execute($cmd, $output) === 0);
  21216. }
  21217. }
  21218. <?php
  21219. namespace Composer\Util;
  21220. use Composer\Config;
  21221. use Composer\IO\IOInterface;
  21222. class Git
  21223. {
  21224. protected $io;
  21225. protected $config;
  21226. protected $process;
  21227. protected $filesystem;
  21228. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  21229. {
  21230. $this->io = $io;
  21231. $this->config = $config;
  21232. $this->process = $process;
  21233. $this->filesystem = $fs;
  21234. }
  21235. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  21236. {
  21237. if ($initialClone) {
  21238. $origCwd = $cwd;
  21239. $cwd = null;
  21240. }
  21241. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  21242. throw new \InvalidArgumentException('The source URL '.$url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  21243. }
  21244. if (!$initialClone) {
  21245. $this->process->execute('git remote -v', $output, $cwd);
  21246. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  21247. $this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
  21248. }
  21249. }
  21250. $protocols = $this->config->get('github-protocols');
  21251. if (!is_array($protocols)) {
  21252. throw new \RuntimeException('Config value "github-protocols" must be an array, got '.gettype($protocols));
  21253. }
  21254. if (preg_match('{^(?:https?|git)://'.self::getGitHubDomainsRegex($this->config).'/(.*)}', $url, $match)) {
  21255. $messages = array();
  21256. foreach ($protocols as $protocol) {
  21257. if ('ssh' === $protocol) {
  21258. $url = "git@" . $match[1] . ":" . $match[2];
  21259. } else {
  21260. $url = $protocol ."://" . $match[1] . "/" . $match[2];
  21261. }
  21262. if (0 === $this->process->execute(call_user_func($commandCallable, $url), $ignoredOutput, $cwd)) {
  21263. return;
  21264. }
  21265. $messages[] = '- ' . $url . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  21266. if ($initialClone) {
  21267. $this->filesystem->removeDirectory($origCwd);
  21268. }
  21269. }
  21270. $this->throwException('Failed to clone ' . self::sanitizeUrl($url) .' via '.implode(', ', $protocols).' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  21271. }
  21272. $bypassSshForGitHub = preg_match('{^git@'.self::getGitHubDomainsRegex($this->config).':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  21273. $command = call_user_func($commandCallable, $url);
  21274. $auth = null;
  21275. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  21276. if (preg_match('{^git@'.self::getGitHubDomainsRegex($this->config).':(.+?)\.git$}i', $url, $match)) {
  21277. if (!$this->io->hasAuthentication($match[1])) {
  21278. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  21279. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  21280. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  21281. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  21282. }
  21283. }
  21284. if ($this->io->hasAuthentication($match[1])) {
  21285. $auth = $this->io->getAuthentication($match[1]);
  21286. $url = 'https://'.rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@'.$match[1].'/'.$match[2].'.git';
  21287. $command = call_user_func($commandCallable, $url);
  21288. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  21289. return;
  21290. }
  21291. }
  21292. } elseif ($this->isAuthenticationFailure($url, $match)) {
  21293. if (strpos($match[2], '@')) {
  21294. list($authParts, $match[2]) = explode('@', $match[2], 2);
  21295. }
  21296. $storeAuth = false;
  21297. if ($this->io->hasAuthentication($match[2])) {
  21298. $auth = $this->io->getAuthentication($match[2]);
  21299. } elseif ($this->io->isInteractive()) {
  21300. $defaultUsername = null;
  21301. if (isset($authParts) && $authParts) {
  21302. if (false !== strpos($authParts, ':')) {
  21303. list($defaultUsername, ) = explode(':', $authParts, 2);
  21304. } else {
  21305. $defaultUsername = $authParts;
  21306. }
  21307. }
  21308. $this->io->writeError(' Authentication required (<info>'.parse_url($url, PHP_URL_HOST).'</info>):');
  21309. $auth = array(
  21310. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  21311. 'password' => $this->io->askAndHideAnswer(' Password: '),
  21312. );
  21313. $storeAuth = $this->config->get('store-auths');
  21314. }
  21315. if ($auth) {
  21316. $url = $match[1].rawurlencode($auth['username']).':'.rawurlencode($auth['password']).'@'.$match[2].$match[3];
  21317. $command = call_user_func($commandCallable, $url);
  21318. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  21319. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  21320. $authHelper = new AuthHelper($this->io, $this->config);
  21321. $authHelper->storeAuth($match[2], $storeAuth);
  21322. return;
  21323. }
  21324. }
  21325. }
  21326. if ($initialClone) {
  21327. $this->filesystem->removeDirectory($origCwd);
  21328. }
  21329. $this->throwException('Failed to execute ' . self::sanitizeUrl($command) . "\n\n" . $this->process->getErrorOutput(), $url);
  21330. }
  21331. }
  21332. private function isAuthenticationFailure($url, &$match)
  21333. {
  21334. if (!preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match)) {
  21335. return false;
  21336. }
  21337. $authFailures = array('fatal: Authentication failed', 'remote error: Invalid username or password.');
  21338. foreach ($authFailures as $authFailure) {
  21339. if (strpos($this->process->getErrorOutput(), $authFailure) !== false) {
  21340. return true;
  21341. }
  21342. }
  21343. return false;
  21344. }
  21345. public static function cleanEnv()
  21346. {
  21347. if (ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  21348. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  21349. }
  21350. if (getenv('GIT_ASKPASS') !== 'echo') {
  21351. putenv('GIT_ASKPASS=echo');
  21352. unset($_SERVER['GIT_ASKPASS']);
  21353. }
  21354. if (getenv('GIT_DIR')) {
  21355. putenv('GIT_DIR');
  21356. unset($_SERVER['GIT_DIR']);
  21357. }
  21358. if (getenv('GIT_WORK_TREE')) {
  21359. putenv('GIT_WORK_TREE');
  21360. unset($_SERVER['GIT_WORK_TREE']);
  21361. }
  21362. if (getenv('LANGUAGE') !== 'C') {
  21363. putenv('LANGUAGE=C');
  21364. }
  21365. putenv("DYLD_LIBRARY_PATH");
  21366. unset($_SERVER['DYLD_LIBRARY_PATH']);
  21367. }
  21368. public static function getGitHubDomainsRegex(Config $config)
  21369. {
  21370. return '('.implode('|', array_map('preg_quote', $config->get('github-domains'))).')';
  21371. }
  21372. public static function sanitizeUrl($message)
  21373. {
  21374. return preg_replace('{://([^@]+?):.+?@}', '://$1:***@', $message);
  21375. }
  21376. private function throwException($message, $url)
  21377. {
  21378. clearstatcache();
  21379. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  21380. throw new \RuntimeException('Failed to clone '.self::sanitizeUrl($url).', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  21381. }
  21382. throw new \RuntimeException($message);
  21383. }
  21384. }
  21385. <?php
  21386. namespace Composer\Util;
  21387. use Composer\Factory;
  21388. use Composer\IO\IOInterface;
  21389. use Composer\Config;
  21390. use Composer\Downloader\TransportException;
  21391. class GitHub
  21392. {
  21393. protected $io;
  21394. protected $config;
  21395. protected $process;
  21396. protected $remoteFilesystem;
  21397. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  21398. {
  21399. $this->io = $io;
  21400. $this->config = $config;
  21401. $this->process = $process ?: new ProcessExecutor;
  21402. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  21403. }
  21404. public function authorizeOAuth($originUrl)
  21405. {
  21406. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  21407. return false;
  21408. }
  21409. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  21410. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  21411. return true;
  21412. }
  21413. return false;
  21414. }
  21415. public function authorizeOAuthInteractively($originUrl, $message = null)
  21416. {
  21417. if ($message) {
  21418. $this->io->writeError($message);
  21419. }
  21420. $note = 'Composer';
  21421. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  21422. $note .= ' on ' . trim($output);
  21423. }
  21424. $note .= ' ' . date('Y-m-d Hi');
  21425. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  21426. $this->io->writeError(sprintf('Head to %s', $url));
  21427. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  21428. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  21429. if (!$token) {
  21430. $this->io->writeError('<warning>No token given, aborting.</warning>');
  21431. $this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');
  21432. return false;
  21433. }
  21434. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  21435. try {
  21436. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  21437. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  21438. 'retry-auth-failure' => false,
  21439. ));
  21440. } catch (TransportException $e) {
  21441. if (in_array($e->getCode(), array(403, 401))) {
  21442. $this->io->writeError('<error>Invalid token provided.</error>');
  21443. $this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');
  21444. return false;
  21445. }
  21446. throw $e;
  21447. }
  21448. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  21449. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  21450. $this->io->writeError('<info>Token stored successfully.</info>');
  21451. return true;
  21452. }
  21453. }
  21454. <?php
  21455. namespace Composer\Util;
  21456. use Composer\IO\IOInterface;
  21457. use Composer\Config;
  21458. use Composer\Factory;
  21459. use Composer\Downloader\TransportException;
  21460. use Composer\Json\JsonFile;
  21461. class GitLab
  21462. {
  21463. protected $io;
  21464. protected $config;
  21465. protected $process;
  21466. protected $remoteFilesystem;
  21467. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  21468. {
  21469. $this->io = $io;
  21470. $this->config = $config;
  21471. $this->process = $process ?: new ProcessExecutor();
  21472. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  21473. }
  21474. public function authorizeOAuth($originUrl)
  21475. {
  21476. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  21477. return false;
  21478. }
  21479. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  21480. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  21481. return true;
  21482. }
  21483. return false;
  21484. }
  21485. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  21486. {
  21487. if ($message) {
  21488. $this->io->writeError($message);
  21489. }
  21490. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  21491. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  21492. $attemptCounter = 0;
  21493. while ($attemptCounter++ < 5) {
  21494. try {
  21495. $response = $this->createToken($scheme, $originUrl);
  21496. } catch (TransportException $e) {
  21497. if (in_array($e->getCode(), array(403, 401))) {
  21498. if (401 === $e->getCode()) {
  21499. $this->io->writeError('Bad credentials.');
  21500. } else {
  21501. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  21502. }
  21503. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/applications');
  21504. $this->io->writeError('Add it using "composer config gitlab-oauth.'.$originUrl.' <token>"');
  21505. continue;
  21506. }
  21507. throw $e;
  21508. }
  21509. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  21510. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  21511. return true;
  21512. }
  21513. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  21514. }
  21515. private function createToken($scheme, $originUrl)
  21516. {
  21517. $username = $this->io->ask('Username: ');
  21518. $password = $this->io->askAndHideAnswer('Password: ');
  21519. $headers = array('Content-Type: application/x-www-form-urlencoded');
  21520. $apiUrl = $originUrl;
  21521. $data = http_build_query(array(
  21522. 'username' => $username,
  21523. 'password' => $password,
  21524. 'grant_type' => 'password',
  21525. ));
  21526. $options = array(
  21527. 'retry-auth-failure' => false,
  21528. 'http' => array(
  21529. 'method' => 'POST',
  21530. 'header' => $headers,
  21531. 'content' => $data,
  21532. ),
  21533. );
  21534. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  21535. $this->io->writeError('Token successfully created');
  21536. return JsonFile::parseJson($json);
  21537. }
  21538. }
  21539. <?php
  21540. namespace Composer\Util;
  21541. class Keys
  21542. {
  21543. public static function fingerprint($path)
  21544. {
  21545. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  21546. return implode(' ', array(
  21547. substr($hash, 0, 8),
  21548. substr($hash, 8, 8),
  21549. substr($hash, 16, 8),
  21550. substr($hash, 24, 8),
  21551. '',
  21552. substr($hash, 32, 8),
  21553. substr($hash, 40, 8),
  21554. substr($hash, 48, 8),
  21555. substr($hash, 56, 8),
  21556. ));
  21557. }
  21558. }
  21559. <?php
  21560. namespace Composer\Util;
  21561. class NoProxyPattern
  21562. {
  21563. protected $rules = array();
  21564. public function __construct($pattern)
  21565. {
  21566. $this->rules = preg_split("/[\s,]+/", $pattern);
  21567. }
  21568. public function test($url)
  21569. {
  21570. $host = parse_url($url, PHP_URL_HOST);
  21571. $port = parse_url($url, PHP_URL_PORT);
  21572. if (empty($port)) {
  21573. switch (parse_url($url, PHP_URL_SCHEME)) {
  21574. case 'http':
  21575. $port = 80;
  21576. break;
  21577. case 'https':
  21578. $port = 443;
  21579. break;
  21580. }
  21581. }
  21582. foreach ($this->rules as $rule) {
  21583. if ($rule == '*') {
  21584. return true;
  21585. }
  21586. $match = false;
  21587. list($ruleHost) = explode(':', $rule);
  21588. list($base) = explode('/', $ruleHost);
  21589. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  21590. if (!isset($ip)) {
  21591. $ip = gethostbyname($host);
  21592. }
  21593. if (strpos($ruleHost, '/') === false) {
  21594. $match = $ip === $ruleHost;
  21595. } else {
  21596. if ($ip === $host) {
  21597. $match = false;
  21598. } else {
  21599. $match = self::inCIDRBlock($ruleHost, $ip);
  21600. }
  21601. }
  21602. } else {
  21603. $haystack = '.' . trim($host, '.') . '.';
  21604. $needle = '.'. trim($ruleHost, '.') .'.';
  21605. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  21606. }
  21607. if ($match && strpos($rule, ':') !== false) {
  21608. list(, $rulePort) = explode(':', $rule);
  21609. if (!empty($rulePort) && $port != $rulePort) {
  21610. $match = false;
  21611. }
  21612. }
  21613. if ($match) {
  21614. return true;
  21615. }
  21616. }
  21617. return false;
  21618. }
  21619. private static function inCIDRBlock($cidr, $ip)
  21620. {
  21621. list($base, $bits) = explode('/', $cidr);
  21622. list($a, $b, $c, $d) = explode('.', $base);
  21623. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  21624. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  21625. $low = $i & $mask;
  21626. $high = $i | (~$mask & 0xFFFFFFFF);
  21627. list($a, $b, $c, $d) = explode('.', $ip);
  21628. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  21629. return $check >= $low && $check <= $high;
  21630. }
  21631. }
  21632. <?php
  21633. namespace Composer\Util;
  21634. use Composer\IO\IOInterface;
  21635. use Symfony\Component\Process\Process;
  21636. class Perforce
  21637. {
  21638. protected $path;
  21639. protected $p4Depot;
  21640. protected $p4Client;
  21641. protected $p4User;
  21642. protected $p4Password;
  21643. protected $p4Port;
  21644. protected $p4Stream;
  21645. protected $p4ClientSpec;
  21646. protected $p4DepotType;
  21647. protected $p4Branch;
  21648. protected $process;
  21649. protected $uniquePerforceClientName;
  21650. protected $windowsFlag;
  21651. protected $commandResult;
  21652. protected $io;
  21653. protected $filesystem;
  21654. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  21655. {
  21656. $this->windowsFlag = $isWindows;
  21657. $this->p4Port = $port;
  21658. $this->initializePath($path);
  21659. $this->process = $process;
  21660. $this->initialize($repoConfig);
  21661. $this->io = $io;
  21662. }
  21663. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  21664. {
  21665. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  21666. }
  21667. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  21668. {
  21669. $output = null;
  21670. return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s', $output);
  21671. }
  21672. public function initialize($repoConfig)
  21673. {
  21674. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  21675. if (null == $repoConfig) {
  21676. return;
  21677. }
  21678. if (isset($repoConfig['unique_perforce_client_name'])) {
  21679. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  21680. }
  21681. if (isset($repoConfig['depot'])) {
  21682. $this->p4Depot = $repoConfig['depot'];
  21683. }
  21684. if (isset($repoConfig['branch'])) {
  21685. $this->p4Branch = $repoConfig['branch'];
  21686. }
  21687. if (isset($repoConfig['p4user'])) {
  21688. $this->p4User = $repoConfig['p4user'];
  21689. } else {
  21690. $this->p4User = $this->getP4variable('P4USER');
  21691. }
  21692. if (isset($repoConfig['p4password'])) {
  21693. $this->p4Password = $repoConfig['p4password'];
  21694. }
  21695. }
  21696. public function initializeDepotAndBranch($depot, $branch)
  21697. {
  21698. if (isset($depot)) {
  21699. $this->p4Depot = $depot;
  21700. }
  21701. if (isset($branch)) {
  21702. $this->p4Branch = $branch;
  21703. }
  21704. }
  21705. public function generateUniquePerforceClientName()
  21706. {
  21707. return gethostname() . "_" . time();
  21708. }
  21709. public function cleanupClientSpec()
  21710. {
  21711. $client = $this->getClient();
  21712. $task = 'client -d ' . $client;
  21713. $useP4Client = false;
  21714. $command = $this->generateP4Command($task, $useP4Client);
  21715. $this->executeCommand($command);
  21716. $clientSpec = $this->getP4ClientSpec();
  21717. $fileSystem = $this->getFilesystem();
  21718. $fileSystem->remove($clientSpec);
  21719. }
  21720. protected function executeCommand($command)
  21721. {
  21722. $this->commandResult = "";
  21723. $exit_code = $this->process->execute($command, $this->commandResult);
  21724. return $exit_code;
  21725. }
  21726. public function getClient()
  21727. {
  21728. if (!isset($this->p4Client)) {
  21729. $cleanStreamName = str_replace('@', '', str_replace('/', '_', str_replace('//', '', $this->getStream())));
  21730. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  21731. }
  21732. return $this->p4Client;
  21733. }
  21734. protected function getPath()
  21735. {
  21736. return $this->path;
  21737. }
  21738. public function initializePath($path)
  21739. {
  21740. $this->path = $path;
  21741. $fs = $this->getFilesystem();
  21742. $fs->ensureDirectoryExists($path);
  21743. }
  21744. protected function getPort()
  21745. {
  21746. return $this->p4Port;
  21747. }
  21748. public function setStream($stream)
  21749. {
  21750. $this->p4Stream = $stream;
  21751. $index = strrpos($stream, '/');
  21752. if ($index > 2) {
  21753. $this->p4DepotType = 'stream';
  21754. }
  21755. }
  21756. public function isStream()
  21757. {
  21758. return (strcmp($this->p4DepotType, 'stream') === 0);
  21759. }
  21760. public function getStream()
  21761. {
  21762. if (!isset($this->p4Stream)) {
  21763. if ($this->isStream()) {
  21764. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  21765. } else {
  21766. $this->p4Stream = '//' . $this->p4Depot;
  21767. }
  21768. }
  21769. return $this->p4Stream;
  21770. }
  21771. public function getStreamWithoutLabel($stream)
  21772. {
  21773. $index = strpos($stream, '@');
  21774. if ($index === false) {
  21775. return $stream;
  21776. }
  21777. return substr($stream, 0, $index);
  21778. }
  21779. public function getP4ClientSpec()
  21780. {
  21781. $p4clientSpec = $this->path . '/' . $this->getClient() . '.p4.spec';
  21782. return $p4clientSpec;
  21783. }
  21784. public function getUser()
  21785. {
  21786. return $this->p4User;
  21787. }
  21788. public function setUser($user)
  21789. {
  21790. $this->p4User = $user;
  21791. }
  21792. public function queryP4User()
  21793. {
  21794. $this->getUser();
  21795. if (strlen($this->p4User) > 0) {
  21796. return;
  21797. }
  21798. $this->p4User = $this->getP4variable('P4USER');
  21799. if (strlen($this->p4User) > 0) {
  21800. return;
  21801. }
  21802. $this->p4User = $this->io->ask('Enter P4 User:');
  21803. if ($this->windowsFlag) {
  21804. $command = 'p4 set P4USER=' . $this->p4User;
  21805. } else {
  21806. $command = 'export P4USER=' . $this->p4User;
  21807. }
  21808. $this->executeCommand($command);
  21809. }
  21810. protected function getP4variable($name)
  21811. {
  21812. if ($this->windowsFlag) {
  21813. $command = 'p4 set';
  21814. $this->executeCommand($command);
  21815. $result = trim($this->commandResult);
  21816. $resArray = explode(PHP_EOL, $result);
  21817. foreach ($resArray as $line) {
  21818. $fields = explode('=', $line);
  21819. if (strcmp($name, $fields[0]) == 0) {
  21820. $index = strpos($fields[1], ' ');
  21821. if ($index === false) {
  21822. $value = $fields[1];
  21823. } else {
  21824. $value = substr($fields[1], 0, $index);
  21825. }
  21826. $value = trim($value);
  21827. return $value;
  21828. }
  21829. }
  21830. } else {
  21831. $command = 'echo $' . $name;
  21832. $this->executeCommand($command);
  21833. $result = trim($this->commandResult);
  21834. return $result;
  21835. }
  21836. }
  21837. public function queryP4Password()
  21838. {
  21839. if (isset($this->p4Password)) {
  21840. return $this->p4Password;
  21841. }
  21842. $password = $this->getP4variable('P4PASSWD');
  21843. if (strlen($password) <= 0) {
  21844. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  21845. }
  21846. $this->p4Password = $password;
  21847. return $password;
  21848. }
  21849. public function generateP4Command($command, $useClient = true)
  21850. {
  21851. $p4Command = 'p4 ';
  21852. $p4Command = $p4Command . '-u ' . $this->getUser() . ' ';
  21853. if ($useClient) {
  21854. $p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
  21855. }
  21856. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ';
  21857. $p4Command = $p4Command . $command;
  21858. return $p4Command;
  21859. }
  21860. public function isLoggedIn()
  21861. {
  21862. $command = $this->generateP4Command('login -s', false);
  21863. $exitCode = $this->executeCommand($command);
  21864. if ($exitCode) {
  21865. $errorOutput = $this->process->getErrorOutput();
  21866. $index = strpos($errorOutput, $this->getUser());
  21867. if ($index === false) {
  21868. $index = strpos($errorOutput, 'p4');
  21869. if ($index === false) {
  21870. return false;
  21871. }
  21872. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  21873. }
  21874. throw new \Exception('Invalid user name: ' . $this->getUser());
  21875. }
  21876. return true;
  21877. }
  21878. public function connectClient()
  21879. {
  21880. $p4CreateClientCommand = $this->generateP4Command('client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec()));
  21881. $this->executeCommand($p4CreateClientCommand);
  21882. }
  21883. public function syncCodeBase($sourceReference)
  21884. {
  21885. $prevDir = getcwd();
  21886. chdir($this->path);
  21887. $p4SyncCommand = $this->generateP4Command('sync -f ');
  21888. if (null != $sourceReference) {
  21889. $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
  21890. }
  21891. $this->executeCommand($p4SyncCommand);
  21892. chdir($prevDir);
  21893. }
  21894. public function writeClientSpecToFile($spec)
  21895. {
  21896. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  21897. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  21898. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  21899. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  21900. fwrite($spec, 'Description:' . PHP_EOL);
  21901. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  21902. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  21903. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  21904. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  21905. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  21906. if ($this->isStream()) {
  21907. fwrite($spec, 'Stream:' . PHP_EOL);
  21908. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  21909. } else {
  21910. fwrite(
  21911. $spec,
  21912. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  21913. );
  21914. }
  21915. }
  21916. public function writeP4ClientSpec()
  21917. {
  21918. $clientSpec = $this->getP4ClientSpec();
  21919. $spec = fopen($clientSpec, 'w');
  21920. try {
  21921. $this->writeClientSpecToFile($spec);
  21922. } catch (\Exception $e) {
  21923. fclose($spec);
  21924. throw $e;
  21925. }
  21926. fclose($spec);
  21927. }
  21928. protected function read($pipe, $name)
  21929. {
  21930. if (feof($pipe)) {
  21931. return;
  21932. }
  21933. $line = fgets($pipe);
  21934. while ($line != false) {
  21935. $line = fgets($pipe);
  21936. }
  21937. return;
  21938. }
  21939. public function windowsLogin($password)
  21940. {
  21941. $command = $this->generateP4Command(' login -a');
  21942. $process = new Process($command, null, null, $password);
  21943. return $process->run();
  21944. }
  21945. public function p4Login()
  21946. {
  21947. $this->queryP4User();
  21948. if (!$this->isLoggedIn()) {
  21949. $password = $this->queryP4Password();
  21950. if ($this->windowsFlag) {
  21951. $this->windowsLogin($password);
  21952. } else {
  21953. $command = 'echo ' . $password . ' | ' . $this->generateP4Command(' login -a', false);
  21954. $exitCode = $this->executeCommand($command);
  21955. $result = trim($this->commandResult);
  21956. if ($exitCode) {
  21957. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  21958. }
  21959. }
  21960. }
  21961. }
  21962. public function getComposerInformation($identifier)
  21963. {
  21964. $index = strpos($identifier, '@');
  21965. if ($index === false) {
  21966. $composerJson = $identifier. '/composer.json';
  21967. return $this->getComposerInformationFromPath($composerJson);
  21968. }
  21969. return $this->getComposerInformationFromLabel($identifier, $index);
  21970. }
  21971. public function getComposerInformationFromPath($composerJson)
  21972. {
  21973. $command = $this->generateP4Command(' print ' . $composerJson);
  21974. $this->executeCommand($command);
  21975. $result = $this->commandResult;
  21976. $index = strpos($result, '{');
  21977. if ($index === false) {
  21978. return '';
  21979. }
  21980. if ($index >= 0) {
  21981. $rawData = substr($result, $index);
  21982. $composer_info = json_decode($rawData, true);
  21983. return $composer_info;
  21984. }
  21985. return '';
  21986. }
  21987. public function getComposerInformationFromLabel($identifier, $index)
  21988. {
  21989. $composerJsonPath = substr($identifier, 0, $index) . '/composer.json' . substr($identifier, $index);
  21990. $command = $this->generateP4Command(' files ' . $composerJsonPath, false);
  21991. $this->executeCommand($command);
  21992. $result = $this->commandResult;
  21993. $index2 = strpos($result, 'no such file(s).');
  21994. if ($index2 === false) {
  21995. $index3 = strpos($result, 'change');
  21996. if (!($index3 === false)) {
  21997. $phrase = trim(substr($result, $index3));
  21998. $fields = explode(' ', $phrase);
  21999. $id = $fields[1];
  22000. $composerJson = substr($identifier, 0, $index) . '/composer.json@' . $id;
  22001. return $this->getComposerInformationFromPath($composerJson);
  22002. }
  22003. }
  22004. return "";
  22005. }
  22006. public function getBranches()
  22007. {
  22008. $possibleBranches = array();
  22009. if (!$this->isStream()) {
  22010. $possibleBranches[$this->p4Branch] = $this->getStream();
  22011. } else {
  22012. $command = $this->generateP4Command('streams //' . $this->p4Depot . '/...');
  22013. $this->executeCommand($command);
  22014. $result = $this->commandResult;
  22015. $resArray = explode(PHP_EOL, $result);
  22016. foreach ($resArray as $line) {
  22017. $resBits = explode(' ', $line);
  22018. if (count($resBits) > 4) {
  22019. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  22020. $possibleBranches[$branch] = $resBits[1];
  22021. }
  22022. }
  22023. }
  22024. $command = $this->generateP4Command('changes '. $this->getStream() . '/...', false);
  22025. $this->executeCommand($command);
  22026. $result = $this->commandResult;
  22027. $resArray = explode(PHP_EOL, $result);
  22028. $lastCommit = $resArray[0];
  22029. $lastCommitArr = explode(' ', $lastCommit);
  22030. $lastCommitNum = $lastCommitArr[1];
  22031. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  22032. return $branches;
  22033. }
  22034. public function getTags()
  22035. {
  22036. $command = $this->generateP4Command('labels');
  22037. $this->executeCommand($command);
  22038. $result = $this->commandResult;
  22039. $resArray = explode(PHP_EOL, $result);
  22040. $tags = array();
  22041. foreach ($resArray as $line) {
  22042. $index = strpos($line, 'Label');
  22043. if (!($index === false)) {
  22044. $fields = explode(' ', $line);
  22045. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  22046. }
  22047. }
  22048. return $tags;
  22049. }
  22050. public function checkStream()
  22051. {
  22052. $command = $this->generateP4Command('depots', false);
  22053. $this->executeCommand($command);
  22054. $result = $this->commandResult;
  22055. $resArray = explode(PHP_EOL, $result);
  22056. foreach ($resArray as $line) {
  22057. $index = strpos($line, 'Depot');
  22058. if (!($index === false)) {
  22059. $fields = explode(' ', $line);
  22060. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  22061. $this->p4DepotType = $fields[3];
  22062. return $this->isStream();
  22063. }
  22064. }
  22065. }
  22066. return false;
  22067. }
  22068. protected function getChangeList($reference)
  22069. {
  22070. $index = strpos($reference, '@');
  22071. if ($index === false) {
  22072. return;
  22073. }
  22074. $label = substr($reference, $index);
  22075. $command = $this->generateP4Command(' changes -m1 ' . $label);
  22076. $this->executeCommand($command);
  22077. $changes = $this->commandResult;
  22078. if (strpos($changes, 'Change') !== 0) {
  22079. return;
  22080. }
  22081. $fields = explode(' ', $changes);
  22082. $changeList = $fields[1];
  22083. return $changeList;
  22084. }
  22085. public function getCommitLogs($fromReference, $toReference)
  22086. {
  22087. $fromChangeList = $this->getChangeList($fromReference);
  22088. if ($fromChangeList == null) {
  22089. return;
  22090. }
  22091. $toChangeList = $this->getChangeList($toReference);
  22092. if ($toChangeList == null) {
  22093. return;
  22094. }
  22095. $index = strpos($fromReference, '@');
  22096. $main = substr($fromReference, 0, $index) . '/...';
  22097. $command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
  22098. $this->executeCommand($command);
  22099. $result = $this->commandResult;
  22100. return $result;
  22101. }
  22102. public function getFilesystem()
  22103. {
  22104. if (empty($this->filesystem)) {
  22105. $this->filesystem = new Filesystem($this->process);
  22106. }
  22107. return $this->filesystem;
  22108. }
  22109. public function setFilesystem(Filesystem $fs)
  22110. {
  22111. $this->filesystem = $fs;
  22112. }
  22113. }
  22114. <?php
  22115. namespace Composer\Util;
  22116. class Platform
  22117. {
  22118. public static function isWindows()
  22119. {
  22120. return defined('PHP_WINDOWS_VERSION_BUILD');
  22121. }
  22122. }
  22123. <?php
  22124. namespace Composer\Util;
  22125. use Symfony\Component\Process\Process;
  22126. use Symfony\Component\Process\ProcessUtils;
  22127. use Composer\IO\IOInterface;
  22128. class ProcessExecutor
  22129. {
  22130. protected static $timeout = 300;
  22131. protected $captureOutput;
  22132. protected $errorOutput;
  22133. protected $io;
  22134. public function __construct(IOInterface $io = null)
  22135. {
  22136. $this->io = $io;
  22137. }
  22138. public function execute($command, &$output = null, $cwd = null)
  22139. {
  22140. if ($this->io && $this->io->isDebug()) {
  22141. $safeCommand = preg_replace('{(://[^:/\s]+:)[^@\s/]+}i', '$1****', $command);
  22142. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  22143. }
  22144. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  22145. $cwd = realpath(getcwd());
  22146. }
  22147. $this->captureOutput = count(func_get_args()) > 1;
  22148. $this->errorOutput = null;
  22149. $process = new Process($command, $cwd, null, null, static::getTimeout());
  22150. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  22151. $process->run($callback);
  22152. if ($this->captureOutput && !is_callable($output)) {
  22153. $output = $process->getOutput();
  22154. }
  22155. $this->errorOutput = $process->getErrorOutput();
  22156. return $process->getExitCode();
  22157. }
  22158. public function splitLines($output)
  22159. {
  22160. $output = trim($output);
  22161. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  22162. }
  22163. public function getErrorOutput()
  22164. {
  22165. return $this->errorOutput;
  22166. }
  22167. public function outputHandler($type, $buffer)
  22168. {
  22169. if ($this->captureOutput) {
  22170. return;
  22171. }
  22172. echo $buffer;
  22173. }
  22174. public static function getTimeout()
  22175. {
  22176. return static::$timeout;
  22177. }
  22178. public static function setTimeout($timeout)
  22179. {
  22180. static::$timeout = $timeout;
  22181. }
  22182. public static function escape($argument)
  22183. {
  22184. return ProcessUtils::escapeArgument($argument);
  22185. }
  22186. }
  22187. <?php
  22188. namespace Composer\Util;
  22189. use Composer\Config;
  22190. use Composer\IO\IOInterface;
  22191. use Composer\Downloader\TransportException;
  22192. class RemoteFilesystem
  22193. {
  22194. private $io;
  22195. private $config;
  22196. private $bytesMax;
  22197. private $originUrl;
  22198. private $fileUrl;
  22199. private $fileName;
  22200. private $retry;
  22201. private $progress;
  22202. private $lastProgress;
  22203. private $options = array();
  22204. private $peerCertificateMap = array();
  22205. private $disableTls = false;
  22206. private $retryAuthFailure;
  22207. private $lastHeaders;
  22208. private $storeAuth;
  22209. private $degradedMode = false;
  22210. private $redirects;
  22211. private $maxRedirects = 20;
  22212. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  22213. {
  22214. $this->io = $io;
  22215. if ($disableTls === false) {
  22216. $this->options = $this->getTlsDefaults($options);
  22217. } else {
  22218. $this->disableTls = true;
  22219. }
  22220. $this->options = array_replace_recursive($this->options, $options);
  22221. $this->config = $config;
  22222. }
  22223. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  22224. {
  22225. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  22226. }
  22227. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  22228. {
  22229. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  22230. }
  22231. public function getOptions()
  22232. {
  22233. return $this->options;
  22234. }
  22235. public function setOptions(array $options)
  22236. {
  22237. $this->options = array_replace_recursive($this->options, $options);
  22238. }
  22239. public function isTlsDisabled()
  22240. {
  22241. return $this->disableTls === true;
  22242. }
  22243. public function getLastHeaders()
  22244. {
  22245. return $this->lastHeaders;
  22246. }
  22247. public function findHeaderValue(array $headers, $name)
  22248. {
  22249. $value = null;
  22250. foreach ($headers as $header) {
  22251. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  22252. $value = $match[1];
  22253. } elseif (preg_match('{^HTTP/}i', $header)) {
  22254. $value = null;
  22255. }
  22256. }
  22257. return $value;
  22258. }
  22259. public function findStatusCode(array $headers)
  22260. {
  22261. $value = null;
  22262. foreach ($headers as $header) {
  22263. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  22264. $value = (int) $match[1];
  22265. }
  22266. }
  22267. return $value;
  22268. }
  22269. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  22270. {
  22271. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  22272. $originUrl = 'github.com';
  22273. }
  22274. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  22275. $this->bytesMax = 0;
  22276. $this->originUrl = $originUrl;
  22277. $this->fileUrl = $fileUrl;
  22278. $this->fileName = $fileName;
  22279. $this->progress = $progress;
  22280. $this->lastProgress = null;
  22281. $this->retryAuthFailure = true;
  22282. $this->lastHeaders = array();
  22283. $this->redirects = 1;
  22284. if (preg_match('{^https?://(.+):(.+)@([^/]+)}i', $fileUrl, $match)) {
  22285. $this->io->setAuthentication($originUrl, urldecode($match[1]), urldecode($match[2]));
  22286. }
  22287. $tempAdditionalOptions = $additionalOptions;
  22288. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  22289. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  22290. unset($tempAdditionalOptions['retry-auth-failure']);
  22291. }
  22292. $isRedirect = false;
  22293. if (isset($tempAdditionalOptions['redirects'])) {
  22294. $this->redirects = $tempAdditionalOptions['redirects'];
  22295. $isRedirect = true;
  22296. unset($tempAdditionalOptions['redirects']);
  22297. }
  22298. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  22299. unset($tempAdditionalOptions);
  22300. $userlandFollow = isset($options['http']['follow_location']) && !$options['http']['follow_location'];
  22301. $this->io->writeError((substr($fileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $fileUrl, true, IOInterface::DEBUG);
  22302. if (isset($options['github-token'])) {
  22303. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  22304. unset($options['github-token']);
  22305. }
  22306. if (isset($options['gitlab-token'])) {
  22307. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  22308. unset($options['gitlab-token']);
  22309. }
  22310. if (isset($options['http'])) {
  22311. $options['http']['ignore_errors'] = true;
  22312. }
  22313. if ($this->degradedMode && substr($fileUrl, 0, 21) === 'http://packagist.org/') {
  22314. $fileUrl = 'http://' . gethostbyname('packagist.org') . substr($fileUrl, 20);
  22315. }
  22316. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  22317. if ($this->progress && !$isRedirect) {
  22318. $this->io->writeError(" Downloading: <comment>Connecting...</comment>", false);
  22319. }
  22320. $errorMessage = '';
  22321. $errorCode = 0;
  22322. $result = false;
  22323. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  22324. if ($errorMessage) {
  22325. $errorMessage .= "\n";
  22326. }
  22327. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  22328. });
  22329. try {
  22330. $result = file_get_contents($fileUrl, false, $ctx);
  22331. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  22332. $params = stream_context_get_params($ctx);
  22333. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  22334. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  22335. if ($expectedPeerFingerprint !== $peerFingerprint) {
  22336. throw new TransportException('Peer fingerprint did not match');
  22337. }
  22338. }
  22339. } catch (\Exception $e) {
  22340. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  22341. $e->setHeaders($http_response_header);
  22342. $e->setStatusCode($this->findStatusCode($http_response_header));
  22343. }
  22344. if ($e instanceof TransportException && $result !== false) {
  22345. $e->setResponse($result);
  22346. }
  22347. $result = false;
  22348. }
  22349. if ($errorMessage && !ini_get('allow_url_fopen')) {
  22350. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  22351. }
  22352. restore_error_handler();
  22353. if (isset($e) && !$this->retry) {
  22354. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  22355. $this->degradedMode = true;
  22356. $this->io->writeError(array(
  22357. '<error>'.$e->getMessage().'</error>',
  22358. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  22359. ));
  22360. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  22361. }
  22362. throw $e;
  22363. }
  22364. $statusCode = null;
  22365. if (!empty($http_response_header[0])) {
  22366. $statusCode = $this->findStatusCode($http_response_header);
  22367. }
  22368. $hasFollowedRedirect = false;
  22369. if ($userlandFollow && $statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  22370. $hasFollowedRedirect = true;
  22371. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  22372. }
  22373. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  22374. if (!$this->retry) {
  22375. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  22376. $e->setHeaders($http_response_header);
  22377. $e->setResponse($result);
  22378. $e->setStatusCode($statusCode);
  22379. throw $e;
  22380. }
  22381. $result = false;
  22382. }
  22383. if ($this->progress && !$this->retry && !$isRedirect) {
  22384. $this->io->overwriteError(" Downloading: <comment>100%</comment>");
  22385. }
  22386. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  22387. $decode = 'gzip' === strtolower($this->findHeaderValue($http_response_header, 'content-encoding'));
  22388. if ($decode) {
  22389. try {
  22390. if (PHP_VERSION_ID >= 50400) {
  22391. $result = zlib_decode($result);
  22392. } else {
  22393. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  22394. }
  22395. if (!$result) {
  22396. throw new TransportException('Failed to decode zlib stream');
  22397. }
  22398. } catch (\Exception $e) {
  22399. if ($this->degradedMode) {
  22400. throw $e;
  22401. }
  22402. $this->degradedMode = true;
  22403. $this->io->writeError(array(
  22404. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  22405. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  22406. ));
  22407. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  22408. }
  22409. }
  22410. }
  22411. if (false !== $result && null !== $fileName && !$isRedirect) {
  22412. if ('' === $result) {
  22413. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  22414. }
  22415. $errorMessage = '';
  22416. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  22417. if ($errorMessage) {
  22418. $errorMessage .= "\n";
  22419. }
  22420. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  22421. });
  22422. $result = (bool) file_put_contents($fileName, $result);
  22423. restore_error_handler();
  22424. if (false === $result) {
  22425. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  22426. }
  22427. }
  22428. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  22429. if (TlsHelper::isOpensslParseSafe()) {
  22430. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  22431. if ($certDetails) {
  22432. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  22433. $this->retry = true;
  22434. }
  22435. } else {
  22436. $this->io->writeError(sprintf(
  22437. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  22438. PHP_VERSION
  22439. ));
  22440. }
  22441. }
  22442. if ($this->retry) {
  22443. $this->retry = false;
  22444. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  22445. if ($this->storeAuth && $this->config) {
  22446. $authHelper = new AuthHelper($this->io, $this->config);
  22447. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  22448. $this->storeAuth = false;
  22449. }
  22450. return $result;
  22451. }
  22452. if (false === $result) {
  22453. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  22454. if (!empty($http_response_header[0])) {
  22455. $e->setHeaders($http_response_header);
  22456. }
  22457. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  22458. $this->degradedMode = true;
  22459. $this->io->writeError(array(
  22460. '<error>'.$e->getMessage().'</error>',
  22461. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  22462. ));
  22463. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  22464. }
  22465. throw $e;
  22466. }
  22467. if (!empty($http_response_header[0])) {
  22468. $this->lastHeaders = $http_response_header;
  22469. }
  22470. return $result;
  22471. }
  22472. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  22473. {
  22474. switch ($notificationCode) {
  22475. case STREAM_NOTIFY_FAILURE:
  22476. if (400 === $messageCode) {
  22477. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  22478. }
  22479. case STREAM_NOTIFY_AUTH_REQUIRED:
  22480. if (401 === $messageCode) {
  22481. if (!$this->retryAuthFailure) {
  22482. break;
  22483. }
  22484. $this->promptAuthAndRetry($messageCode);
  22485. }
  22486. break;
  22487. case STREAM_NOTIFY_AUTH_RESULT:
  22488. if (403 === $messageCode) {
  22489. if (!$this->retryAuthFailure) {
  22490. break;
  22491. }
  22492. $this->promptAuthAndRetry($messageCode, $message);
  22493. }
  22494. break;
  22495. case STREAM_NOTIFY_FILE_SIZE_IS:
  22496. if ($this->bytesMax < $bytesMax) {
  22497. $this->bytesMax = $bytesMax;
  22498. }
  22499. break;
  22500. case STREAM_NOTIFY_PROGRESS:
  22501. if ($this->bytesMax > 0 && $this->progress) {
  22502. $progression = round($bytesTransferred / $this->bytesMax * 100);
  22503. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  22504. $this->lastProgress = $progression;
  22505. $this->io->overwriteError(" Downloading: <comment>$progression%</comment>", false);
  22506. }
  22507. }
  22508. break;
  22509. default:
  22510. break;
  22511. }
  22512. }
  22513. protected function promptAuthAndRetry($httpStatus, $reason = null)
  22514. {
  22515. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  22516. $message = "\n".'Could not fetch '.$this->fileUrl.', please create a GitHub OAuth token '.($httpStatus === 404 ? 'to access private repos' : 'to go over the API rate limit');
  22517. $gitHubUtil = new GitHub($this->io, $this->config, null);
  22518. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  22519. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  22520. ) {
  22521. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  22522. }
  22523. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  22524. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  22525. $gitLabUtil = new GitLab($this->io, $this->config, null);
  22526. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  22527. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  22528. ) {
  22529. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  22530. }
  22531. } else {
  22532. if ($httpStatus === 404) {
  22533. return;
  22534. }
  22535. if (!$this->io->isInteractive()) {
  22536. if ($httpStatus === 401) {
  22537. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  22538. }
  22539. if ($httpStatus === 403) {
  22540. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  22541. }
  22542. throw new TransportException($message, $httpStatus);
  22543. }
  22544. if ($this->io->hasAuthentication($this->originUrl)) {
  22545. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  22546. }
  22547. $this->io->overwriteError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  22548. $username = $this->io->ask(' Username: ');
  22549. $password = $this->io->askAndHideAnswer(' Password: ');
  22550. $this->io->setAuthentication($this->originUrl, $username, $password);
  22551. $this->storeAuth = $this->config->get('store-auths');
  22552. }
  22553. $this->retry = true;
  22554. throw new TransportException('RETRY');
  22555. }
  22556. protected function getOptionsForUrl($originUrl, $additionalOptions)
  22557. {
  22558. $tlsOptions = array();
  22559. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  22560. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  22561. if (PHP_VERSION_ID >= 50304) {
  22562. $userlandFollow = true;
  22563. } else {
  22564. if ($host === 'github.com' || $host === 'api.github.com') {
  22565. $host = '*.github.com';
  22566. }
  22567. }
  22568. $tlsOptions['ssl']['CN_match'] = $host;
  22569. $tlsOptions['ssl']['SNI_server_name'] = $host;
  22570. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  22571. if (isset($this->peerCertificateMap[$urlAuthority])) {
  22572. $certMap = $this->peerCertificateMap[$urlAuthority];
  22573. $this->io->writeError(sprintf(
  22574. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  22575. $certMap['cn'],
  22576. $urlAuthority
  22577. ), true, IOInterface::DEBUG);
  22578. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  22579. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  22580. }
  22581. }
  22582. $headers = array();
  22583. if (extension_loaded('zlib')) {
  22584. $headers[] = 'Accept-Encoding: gzip';
  22585. }
  22586. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  22587. if (!$this->degradedMode) {
  22588. $options['http']['protocol_version'] = 1.1;
  22589. $headers[] = 'Connection: close';
  22590. }
  22591. if (isset($userlandFollow)) {
  22592. $options['http']['follow_location'] = 0;
  22593. }
  22594. if ($this->io->hasAuthentication($originUrl)) {
  22595. $auth = $this->io->getAuthentication($originUrl);
  22596. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  22597. $options['github-token'] = $auth['username'];
  22598. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  22599. if ($auth['password'] === 'oauth2') {
  22600. $headers[] = 'Authorization: Bearer '.$auth['username'];
  22601. }
  22602. } else {
  22603. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  22604. $headers[] = 'Authorization: Basic '.$authStr;
  22605. }
  22606. }
  22607. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  22608. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  22609. }
  22610. foreach ($headers as $header) {
  22611. $options['http']['header'][] = $header;
  22612. }
  22613. return $options;
  22614. }
  22615. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  22616. {
  22617. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  22618. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  22619. $targetUrl = $locationHeader;
  22620. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  22621. $targetUrl = $this->scheme.':'.$locationHeader;
  22622. } elseif ('/' === $locationHeader[0]) {
  22623. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  22624. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  22625. } else {
  22626. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  22627. }
  22628. }
  22629. if (!empty($targetUrl)) {
  22630. $this->redirects++;
  22631. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  22632. $additionalOptions['redirects'] = $this->redirects;
  22633. return $this->get($this->originUrl, $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  22634. }
  22635. if (!$this->retry) {
  22636. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  22637. $e->setHeaders($http_response_header);
  22638. $e->setResponse($result);
  22639. throw $e;
  22640. }
  22641. return false;
  22642. }
  22643. private function getTlsDefaults(array $options)
  22644. {
  22645. $ciphers = implode(':', array(
  22646. 'ECDHE-RSA-AES128-GCM-SHA256',
  22647. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  22648. 'ECDHE-RSA-AES256-GCM-SHA384',
  22649. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  22650. 'DHE-RSA-AES128-GCM-SHA256',
  22651. 'DHE-DSS-AES128-GCM-SHA256',
  22652. 'kEDH+AESGCM',
  22653. 'ECDHE-RSA-AES128-SHA256',
  22654. 'ECDHE-ECDSA-AES128-SHA256',
  22655. 'ECDHE-RSA-AES128-SHA',
  22656. 'ECDHE-ECDSA-AES128-SHA',
  22657. 'ECDHE-RSA-AES256-SHA384',
  22658. 'ECDHE-ECDSA-AES256-SHA384',
  22659. 'ECDHE-RSA-AES256-SHA',
  22660. 'ECDHE-ECDSA-AES256-SHA',
  22661. 'DHE-RSA-AES128-SHA256',
  22662. 'DHE-RSA-AES128-SHA',
  22663. 'DHE-DSS-AES128-SHA256',
  22664. 'DHE-RSA-AES256-SHA256',
  22665. 'DHE-DSS-AES256-SHA',
  22666. 'DHE-RSA-AES256-SHA',
  22667. 'AES128-GCM-SHA256',
  22668. 'AES256-GCM-SHA384',
  22669. 'ECDHE-RSA-RC4-SHA',
  22670. 'ECDHE-ECDSA-RC4-SHA',
  22671. 'AES128',
  22672. 'AES256',
  22673. 'RC4-SHA',
  22674. 'HIGH',
  22675. '!aNULL',
  22676. '!eNULL',
  22677. '!EXPORT',
  22678. '!DES',
  22679. '!3DES',
  22680. '!MD5',
  22681. '!PSK',
  22682. ));
  22683. $defaults = array(
  22684. 'ssl' => array(
  22685. 'ciphers' => $ciphers,
  22686. 'verify_peer' => true,
  22687. 'verify_depth' => 7,
  22688. 'SNI_enabled' => true,
  22689. 'capture_peer_cert' => true,
  22690. ),
  22691. );
  22692. if (isset($options['ssl'])) {
  22693. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  22694. }
  22695. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  22696. $result = $this->getSystemCaRootBundlePath();
  22697. if (preg_match('{^phar://}', $result)) {
  22698. $hash = hash_file('sha256', $result);
  22699. $targetPath = rtrim(sys_get_temp_dir(), '\\/') . '/composer-cacert-' . $hash . '.pem';
  22700. if (!file_exists($targetPath) || $hash !== hash_file('sha256', $targetPath)) {
  22701. $this->streamCopy($result, $targetPath);
  22702. chmod($targetPath, 0666);
  22703. }
  22704. $defaults['ssl']['cafile'] = $targetPath;
  22705. } elseif (is_dir($result)) {
  22706. $defaults['ssl']['capath'] = $result;
  22707. } else {
  22708. $defaults['ssl']['cafile'] = $result;
  22709. }
  22710. }
  22711. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !$this->validateCaFile($defaults['ssl']['cafile']))) {
  22712. throw new TransportException('The configured cafile was not valid or could not be read.');
  22713. }
  22714. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  22715. throw new TransportException('The configured capath was not valid or could not be read.');
  22716. }
  22717. if (PHP_VERSION_ID >= 50413) {
  22718. $defaults['ssl']['disable_compression'] = true;
  22719. }
  22720. return $defaults;
  22721. }
  22722. private function getSystemCaRootBundlePath()
  22723. {
  22724. static $caPath = null;
  22725. if ($caPath !== null) {
  22726. return $caPath;
  22727. }
  22728. $envCertFile = getenv('SSL_CERT_FILE');
  22729. if ($envCertFile && is_readable($envCertFile) && $this->validateCaFile($envCertFile)) {
  22730. return $caPath = $envCertFile;
  22731. }
  22732. $configured = ini_get('openssl.cafile');
  22733. if ($configured && strlen($configured) > 0 && is_readable($configured) && $this->validateCaFile($configured)) {
  22734. return $caPath = $configured;
  22735. }
  22736. $caBundlePaths = array(
  22737. '/etc/pki/tls/certs/ca-bundle.crt',
  22738. '/etc/ssl/certs/ca-certificates.crt',
  22739. '/etc/ssl/ca-bundle.pem',
  22740. '/usr/local/share/certs/ca-root-nss.crt',
  22741. '/usr/ssl/certs/ca-bundle.crt',
  22742. '/opt/local/share/curl/curl-ca-bundle.crt',
  22743. '/usr/local/share/curl/curl-ca-bundle.crt',
  22744. '/usr/share/ssl/certs/ca-bundle.crt',
  22745. '/etc/ssl/cert.pem',
  22746. '/usr/local/etc/ssl/cert.pem',
  22747. );
  22748. foreach ($caBundlePaths as $caBundle) {
  22749. if (Silencer::call('is_readable', $caBundle) && $this->validateCaFile($caBundle)) {
  22750. return $caPath = $caBundle;
  22751. }
  22752. }
  22753. foreach ($caBundlePaths as $caBundle) {
  22754. $caBundle = dirname($caBundle);
  22755. if (is_dir($caBundle) && glob($caBundle.'/*')) {
  22756. return $caPath = $caBundle;
  22757. }
  22758. }
  22759. return $caPath = __DIR__.'/../../../res/cacert.pem';
  22760. }
  22761. private function validateCaFile($filename)
  22762. {
  22763. static $files = array();
  22764. if (isset($files[$filename])) {
  22765. return $files[$filename];
  22766. }
  22767. $this->io->writeError('Checking CA file '.realpath($filename), true, IOInterface::DEBUG);
  22768. $contents = file_get_contents($filename);
  22769. if (!TlsHelper::isOpensslParseSafe()) {
  22770. $this->io->writeError(sprintf(
  22771. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  22772. PHP_VERSION
  22773. ));
  22774. return $files[$filename] = !empty($contents);
  22775. }
  22776. return $files[$filename] = (bool) openssl_x509_parse($contents);
  22777. }
  22778. private function streamCopy($source, $target)
  22779. {
  22780. $source = fopen($source, 'r');
  22781. $target = fopen($target, 'w+');
  22782. stream_copy_to_stream($source, $target);
  22783. fclose($source);
  22784. fclose($target);
  22785. unset($source, $target);
  22786. }
  22787. private function getCertificateCnAndFp($url, $options)
  22788. {
  22789. if (PHP_VERSION_ID >= 50600) {
  22790. throw new \BadMethodCallException(sprintf(
  22791. '%s must not be used on PHP >= 5.6',
  22792. __METHOD__
  22793. ));
  22794. }
  22795. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  22796. 'ssl' => array(
  22797. 'capture_peer_cert' => true,
  22798. 'verify_peer' => false,
  22799. ), ),
  22800. ));
  22801. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  22802. return;
  22803. }
  22804. fclose($handle);
  22805. $handle = null;
  22806. $params = stream_context_get_params($context);
  22807. if (!empty($params['options']['ssl']['peer_certificate'])) {
  22808. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  22809. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  22810. return array(
  22811. 'cn' => $commonName,
  22812. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  22813. );
  22814. }
  22815. }
  22816. }
  22817. private function getUrlAuthority($url)
  22818. {
  22819. $defaultPorts = array(
  22820. 'ftp' => 21,
  22821. 'http' => 80,
  22822. 'https' => 443,
  22823. 'ssh2.sftp' => 22,
  22824. 'ssh2.scp' => 22,
  22825. );
  22826. $scheme = parse_url($url, PHP_URL_SCHEME);
  22827. if (!isset($defaultPorts[$scheme])) {
  22828. throw new \InvalidArgumentException(sprintf(
  22829. 'Could not get default port for unknown scheme: %s',
  22830. $scheme
  22831. ));
  22832. }
  22833. $defaultPort = $defaultPorts[$scheme];
  22834. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  22835. return parse_url($url, PHP_URL_HOST).':'.$port;
  22836. }
  22837. }
  22838. <?php
  22839. namespace Composer\Util;
  22840. class Silencer
  22841. {
  22842. private static $stack = array();
  22843. public static function suppress($mask = null)
  22844. {
  22845. if (!isset($mask)) {
  22846. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  22847. }
  22848. $old = error_reporting();
  22849. array_push(self::$stack, $old);
  22850. error_reporting($old & ~$mask);
  22851. return $old;
  22852. }
  22853. public static function restore()
  22854. {
  22855. if (!empty(self::$stack)) {
  22856. error_reporting(array_pop(self::$stack));
  22857. }
  22858. }
  22859. public static function call($callable )
  22860. {
  22861. try {
  22862. self::suppress();
  22863. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  22864. self::restore();
  22865. return $result;
  22866. } catch (\Exception $e) {
  22867. self::restore();
  22868. throw $e;
  22869. }
  22870. }
  22871. }
  22872. <?php
  22873. namespace Composer\Util;
  22874. use Composer\Spdx\SpdxLicenses;
  22875. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  22876. class SpdxLicense extends SpdxLicenses
  22877. {
  22878. }
  22879. <?php
  22880. namespace Composer\Util;
  22881. use Composer\Composer;
  22882. final class StreamContextFactory
  22883. {
  22884. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  22885. {
  22886. $options = array('http' => array(
  22887. 'follow_location' => 1,
  22888. 'max_redirects' => 20,
  22889. ));
  22890. if (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy'])) {
  22891. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  22892. }
  22893. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  22894. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  22895. }
  22896. if (!empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  22897. $pattern = new NoProxyPattern($_SERVER['no_proxy']);
  22898. if ($pattern->test($url)) {
  22899. unset($proxy);
  22900. }
  22901. }
  22902. if (!empty($proxy)) {
  22903. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  22904. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  22905. if (isset($proxy['port'])) {
  22906. $proxyURL .= ":" . $proxy['port'];
  22907. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  22908. $proxyURL .= ":80";
  22909. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  22910. $proxyURL .= ":443";
  22911. }
  22912. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  22913. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  22914. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  22915. }
  22916. $options['http']['proxy'] = $proxyURL;
  22917. switch (parse_url($url, PHP_URL_SCHEME)) {
  22918. case 'http':
  22919. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  22920. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  22921. $options['http']['request_fulluri'] = true;
  22922. }
  22923. break;
  22924. case 'https':
  22925. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  22926. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  22927. $options['http']['request_fulluri'] = true;
  22928. }
  22929. break;
  22930. }
  22931. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  22932. $options['ssl']['SNI_enabled'] = true;
  22933. if (PHP_VERSION_ID < 50600) {
  22934. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  22935. }
  22936. }
  22937. if (isset($proxy['user'])) {
  22938. $auth = urldecode($proxy['user']);
  22939. if (isset($proxy['pass'])) {
  22940. $auth .= ':' . urldecode($proxy['pass']);
  22941. }
  22942. $auth = base64_encode($auth);
  22943. if (isset($defaultOptions['http']['header'])) {
  22944. if (is_string($defaultOptions['http']['header'])) {
  22945. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  22946. }
  22947. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  22948. } else {
  22949. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  22950. }
  22951. }
  22952. }
  22953. $options = array_replace_recursive($options, $defaultOptions);
  22954. if (isset($options['http']['header'])) {
  22955. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  22956. }
  22957. if (defined('HHVM_VERSION')) {
  22958. $phpVersion = 'HHVM ' . HHVM_VERSION;
  22959. } else {
  22960. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  22961. }
  22962. if (!isset($options['http']['header']) || false === strpos(strtolower(implode('', $options['http']['header'])), 'user-agent')) {
  22963. $options['http']['header'][] = sprintf(
  22964. 'User-Agent: Composer/%s (%s; %s; %s)',
  22965. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  22966. php_uname('s'),
  22967. php_uname('r'),
  22968. $phpVersion
  22969. );
  22970. }
  22971. return stream_context_create($options, $defaultParams);
  22972. }
  22973. private static function fixHttpHeaderField($header)
  22974. {
  22975. if (!is_array($header)) {
  22976. $header = explode("\r\n", $header);
  22977. }
  22978. uasort($header, function ($el) {
  22979. return preg_match('{^content-type}i', $el) ? 1 : -1;
  22980. });
  22981. return $header;
  22982. }
  22983. }
  22984. <?php
  22985. namespace Composer\Util;
  22986. use Composer\Config;
  22987. use Composer\IO\IOInterface;
  22988. class Svn
  22989. {
  22990. const MAX_QTY_AUTH_TRIES = 5;
  22991. protected $credentials;
  22992. protected $hasAuth;
  22993. protected $io;
  22994. protected $url;
  22995. protected $cacheCredentials = true;
  22996. protected $process;
  22997. protected $qtyAuthTries = 0;
  22998. protected $config;
  22999. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  23000. {
  23001. $this->url = $url;
  23002. $this->io = $io;
  23003. $this->config = $config;
  23004. $this->process = $process ?: new ProcessExecutor;
  23005. }
  23006. public static function cleanEnv()
  23007. {
  23008. putenv("DYLD_LIBRARY_PATH");
  23009. unset($_SERVER['DYLD_LIBRARY_PATH']);
  23010. }
  23011. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  23012. {
  23013. $svnCommand = $this->getCommand($command, $url, $path);
  23014. $output = null;
  23015. $io = $this->io;
  23016. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  23017. if ($type !== 'out') {
  23018. return;
  23019. }
  23020. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  23021. return;
  23022. }
  23023. $output .= $buffer;
  23024. if ($verbose) {
  23025. $io->writeError($buffer, false);
  23026. }
  23027. };
  23028. $status = $this->process->execute($svnCommand, $handler, $cwd);
  23029. if (0 === $status) {
  23030. return $output;
  23031. }
  23032. $errorOutput = $this->process->getErrorOutput();
  23033. $fullOutput = implode("\n", array($output, $errorOutput));
  23034. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  23035. && false === stripos($fullOutput, 'authorization failed')
  23036. && false === stripos($fullOutput, 'svn: E170001:')
  23037. && false === stripos($fullOutput, 'svn: E215004:')) {
  23038. throw new \RuntimeException($fullOutput);
  23039. }
  23040. if (!$this->hasAuth()) {
  23041. $this->doAuthDance();
  23042. }
  23043. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  23044. return $this->execute($command, $url, $cwd, $path, $verbose);
  23045. }
  23046. throw new \RuntimeException(
  23047. 'wrong credentials provided ('.$fullOutput.')'
  23048. );
  23049. }
  23050. public function setCacheCredentials($cacheCredentials)
  23051. {
  23052. $this->cacheCredentials = $cacheCredentials;
  23053. }
  23054. protected function doAuthDance()
  23055. {
  23056. if (!$this->io->isInteractive()) {
  23057. throw new \RuntimeException(
  23058. 'can not ask for authentication in non interactive mode'
  23059. );
  23060. }
  23061. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  23062. $this->hasAuth = true;
  23063. $this->credentials['username'] = $this->io->ask("Username: ");
  23064. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  23065. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  23066. return $this;
  23067. }
  23068. protected function getCommand($cmd, $url, $path = null)
  23069. {
  23070. $cmd = sprintf('%s %s%s %s',
  23071. $cmd,
  23072. '--non-interactive ',
  23073. $this->getCredentialString(),
  23074. ProcessExecutor::escape($url)
  23075. );
  23076. if ($path) {
  23077. $cmd .= ' ' . ProcessExecutor::escape($path);
  23078. }
  23079. return $cmd;
  23080. }
  23081. protected function getCredentialString()
  23082. {
  23083. if (!$this->hasAuth()) {
  23084. return '';
  23085. }
  23086. return sprintf(
  23087. ' %s--username %s --password %s ',
  23088. $this->getAuthCache(),
  23089. ProcessExecutor::escape($this->getUsername()),
  23090. ProcessExecutor::escape($this->getPassword())
  23091. );
  23092. }
  23093. protected function getPassword()
  23094. {
  23095. if ($this->credentials === null) {
  23096. throw new \LogicException("No svn auth detected.");
  23097. }
  23098. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  23099. }
  23100. protected function getUsername()
  23101. {
  23102. if ($this->credentials === null) {
  23103. throw new \LogicException("No svn auth detected.");
  23104. }
  23105. return $this->credentials['username'];
  23106. }
  23107. protected function hasAuth()
  23108. {
  23109. if (null !== $this->hasAuth) {
  23110. return $this->hasAuth;
  23111. }
  23112. if (false === $this->createAuthFromConfig()) {
  23113. $this->createAuthFromUrl();
  23114. }
  23115. return $this->hasAuth;
  23116. }
  23117. protected function getAuthCache()
  23118. {
  23119. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  23120. }
  23121. private function createAuthFromConfig()
  23122. {
  23123. if (!$this->config->has('http-basic')) {
  23124. return $this->hasAuth = false;
  23125. }
  23126. $authConfig = $this->config->get('http-basic');
  23127. $host = parse_url($this->url, PHP_URL_HOST);
  23128. if (isset($authConfig[$host])) {
  23129. $this->credentials['username'] = $authConfig[$host]['username'];
  23130. $this->credentials['password'] = $authConfig[$host]['password'];
  23131. return $this->hasAuth = true;
  23132. }
  23133. return $this->hasAuth = false;
  23134. }
  23135. private function createAuthFromUrl()
  23136. {
  23137. $uri = parse_url($this->url);
  23138. if (empty($uri['user'])) {
  23139. return $this->hasAuth = false;
  23140. }
  23141. $this->credentials['username'] = $uri['user'];
  23142. if (!empty($uri['pass'])) {
  23143. $this->credentials['password'] = $uri['pass'];
  23144. }
  23145. return $this->hasAuth = true;
  23146. }
  23147. }
  23148. <?php
  23149. namespace Composer\Util;
  23150. use Symfony\Component\Process\PhpProcess;
  23151. final class TlsHelper
  23152. {
  23153. private static $useOpensslParse;
  23154. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  23155. {
  23156. $names = self::getCertificateNames($certificate);
  23157. if (empty($names)) {
  23158. return false;
  23159. }
  23160. $combinedNames = array_merge($names['san'], array($names['cn']));
  23161. $hostname = strtolower($hostname);
  23162. foreach ($combinedNames as $certName) {
  23163. $matcher = self::certNameMatcher($certName);
  23164. if ($matcher && $matcher($hostname)) {
  23165. $cn = $names['cn'];
  23166. return true;
  23167. }
  23168. }
  23169. return false;
  23170. }
  23171. public static function getCertificateNames($certificate)
  23172. {
  23173. if (is_array($certificate)) {
  23174. $info = $certificate;
  23175. } elseif (self::isOpensslParseSafe()) {
  23176. $info = openssl_x509_parse($certificate, false);
  23177. }
  23178. if (!isset($info['subject']['commonName'])) {
  23179. return;
  23180. }
  23181. $commonName = strtolower($info['subject']['commonName']);
  23182. $subjectAltNames = array();
  23183. if (isset($info['extensions']['subjectAltName'])) {
  23184. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  23185. $subjectAltNames = array_filter(array_map(function ($name) {
  23186. if (0 === strpos($name, 'DNS:')) {
  23187. return strtolower(ltrim(substr($name, 4)));
  23188. }
  23189. }, $subjectAltNames));
  23190. $subjectAltNames = array_values($subjectAltNames);
  23191. }
  23192. return array(
  23193. 'cn' => $commonName,
  23194. 'san' => $subjectAltNames,
  23195. );
  23196. }
  23197. public static function getCertificateFingerprint($certificate)
  23198. {
  23199. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  23200. $pubkeypem = $pubkeydetails['key'];
  23201. $start = '-----BEGIN PUBLIC KEY-----';
  23202. $end = '-----END PUBLIC KEY-----';
  23203. $pemtrim = substr($pubkeypem, (strpos($pubkeypem, $start) + strlen($start)), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  23204. $der = base64_decode($pemtrim);
  23205. return sha1($der);
  23206. }
  23207. public static function isOpensslParseSafe()
  23208. {
  23209. if (null !== self::$useOpensslParse) {
  23210. return self::$useOpensslParse;
  23211. }
  23212. if (PHP_VERSION_ID >= 50600) {
  23213. return self::$useOpensslParse = true;
  23214. }
  23215. if (
  23216. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  23217. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  23218. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  23219. ) {
  23220. return self::$useOpensslParse = true;
  23221. }
  23222. if (Platform::isWindows()) {
  23223. return self::$useOpensslParse = false;
  23224. }
  23225. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  23226. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  23227. if (preg_match($regex, PHP_VERSION, $m)) {
  23228. return ((int) $m[1]) >= $fixedVersion;
  23229. }
  23230. return false;
  23231. };
  23232. if (
  23233. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  23234. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  23235. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  23236. ) {
  23237. return self::$useOpensslParse = true;
  23238. }
  23239. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  23240. $script = <<<'EOT'
  23241. error_reporting(-1);
  23242. $info = openssl_x509_parse(base64_decode('%s'));
  23243. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  23244. EOT;
  23245. $script = '<'."?php\n".sprintf($script, $cert);
  23246. try {
  23247. $process = new PhpProcess($script);
  23248. $process->mustRun();
  23249. } catch (\Exception $e) {
  23250. return self::$useOpensslParse = false;
  23251. }
  23252. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  23253. $errorOutput = trim($process->getErrorOutput());
  23254. if (
  23255. count($output) === 3
  23256. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  23257. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  23258. && $output[2] === 'int(-1)'
  23259. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  23260. ) {
  23261. return self::$useOpensslParse = true;
  23262. }
  23263. return self::$useOpensslParse = false;
  23264. }
  23265. private static function certNameMatcher($certName)
  23266. {
  23267. $wildcards = substr_count($certName, '*');
  23268. if (0 === $wildcards) {
  23269. return function ($hostname) use ($certName) {
  23270. return $hostname === $certName;
  23271. };
  23272. }
  23273. if (1 === $wildcards) {
  23274. $components = explode('.', $certName);
  23275. if (3 > count($components)) {
  23276. return;
  23277. }
  23278. $firstComponent = $components[0];
  23279. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  23280. return;
  23281. }
  23282. $wildcardRegex = preg_quote($certName);
  23283. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  23284. $wildcardRegex = "{^{$wildcardRegex}$}";
  23285. return function ($hostname) use ($wildcardRegex) {
  23286. return 1 === preg_match($wildcardRegex, $hostname);
  23287. };
  23288. }
  23289. }
  23290. }
  23291. <?php
  23292. function includeIfExists($file)
  23293. {
  23294. return file_exists($file) ? include $file : false;
  23295. }
  23296. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  23297. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  23298. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  23299. exit(1);
  23300. }
  23301. return $loader;
  23302. <?php
  23303. /*
  23304. * This file is part of Composer.
  23305. *
  23306. * (c) Nils Adermann <naderman@naderman.de>
  23307. * Jordi Boggiano <j.boggiano@seld.be>
  23308. *
  23309. * For the full copyright and license information, please view the LICENSE
  23310. * file that was distributed with this source code.
  23311. */
  23312. namespace Composer\Autoload;
  23313. /**
  23314. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  23315. *
  23316. * $loader = new \Composer\Autoload\ClassLoader();
  23317. *
  23318. * // register classes with namespaces
  23319. * $loader->add('Symfony\Component', __DIR__.'/component');
  23320. * $loader->add('Symfony', __DIR__.'/framework');
  23321. *
  23322. * // activate the autoloader
  23323. * $loader->register();
  23324. *
  23325. * // to enable searching the include path (eg. for PEAR packages)
  23326. * $loader->setUseIncludePath(true);
  23327. *
  23328. * In this example, if you try to use a class in the Symfony\Component
  23329. * namespace or one of its children (Symfony\Component\Console for instance),
  23330. * the autoloader will first look for the class under the component/
  23331. * directory, and it will then fallback to the framework/ directory if not
  23332. * found before giving up.
  23333. *
  23334. * This class is loosely based on the Symfony UniversalClassLoader.
  23335. *
  23336. * @author Fabien Potencier <fabien@symfony.com>
  23337. * @author Jordi Boggiano <j.boggiano@seld.be>
  23338. * @see http://www.php-fig.org/psr/psr-0/
  23339. * @see http://www.php-fig.org/psr/psr-4/
  23340. */
  23341. class ClassLoader
  23342. {
  23343. // PSR-4
  23344. private $prefixLengthsPsr4 = array();
  23345. private $prefixDirsPsr4 = array();
  23346. private $fallbackDirsPsr4 = array();
  23347. // PSR-0
  23348. private $prefixesPsr0 = array();
  23349. private $fallbackDirsPsr0 = array();
  23350. private $useIncludePath = false;
  23351. private $classMap = array();
  23352. private $classMapAuthoritative = false;
  23353. public function getPrefixes()
  23354. {
  23355. if (!empty($this->prefixesPsr0)) {
  23356. return call_user_func_array('array_merge', $this->prefixesPsr0);
  23357. }
  23358. return array();
  23359. }
  23360. public function getPrefixesPsr4()
  23361. {
  23362. return $this->prefixDirsPsr4;
  23363. }
  23364. public function getFallbackDirs()
  23365. {
  23366. return $this->fallbackDirsPsr0;
  23367. }
  23368. public function getFallbackDirsPsr4()
  23369. {
  23370. return $this->fallbackDirsPsr4;
  23371. }
  23372. public function getClassMap()
  23373. {
  23374. return $this->classMap;
  23375. }
  23376. /**
  23377. * @param array $classMap Class to filename map
  23378. */
  23379. public function addClassMap(array $classMap)
  23380. {
  23381. if ($this->classMap) {
  23382. $this->classMap = array_merge($this->classMap, $classMap);
  23383. } else {
  23384. $this->classMap = $classMap;
  23385. }
  23386. }
  23387. /**
  23388. * Registers a set of PSR-0 directories for a given prefix, either
  23389. * appending or prepending to the ones previously set for this prefix.
  23390. *
  23391. * @param string $prefix The prefix
  23392. * @param array|string $paths The PSR-0 root directories
  23393. * @param bool $prepend Whether to prepend the directories
  23394. */
  23395. public function add($prefix, $paths, $prepend = false)
  23396. {
  23397. if (!$prefix) {
  23398. if ($prepend) {
  23399. $this->fallbackDirsPsr0 = array_merge(
  23400. (array) $paths,
  23401. $this->fallbackDirsPsr0
  23402. );
  23403. } else {
  23404. $this->fallbackDirsPsr0 = array_merge(
  23405. $this->fallbackDirsPsr0,
  23406. (array) $paths
  23407. );
  23408. }
  23409. return;
  23410. }
  23411. $first = $prefix[0];
  23412. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  23413. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  23414. return;
  23415. }
  23416. if ($prepend) {
  23417. $this->prefixesPsr0[$first][$prefix] = array_merge(
  23418. (array) $paths,
  23419. $this->prefixesPsr0[$first][$prefix]
  23420. );
  23421. } else {
  23422. $this->prefixesPsr0[$first][$prefix] = array_merge(
  23423. $this->prefixesPsr0[$first][$prefix],
  23424. (array) $paths
  23425. );
  23426. }
  23427. }
  23428. /**
  23429. * Registers a set of PSR-4 directories for a given namespace, either
  23430. * appending or prepending to the ones previously set for this namespace.
  23431. *
  23432. * @param string $prefix The prefix/namespace, with trailing '\\'
  23433. * @param array|string $paths The PSR-4 base directories
  23434. * @param bool $prepend Whether to prepend the directories
  23435. *
  23436. * @throws \InvalidArgumentException
  23437. */
  23438. public function addPsr4($prefix, $paths, $prepend = false)
  23439. {
  23440. if (!$prefix) {
  23441. // Register directories for the root namespace.
  23442. if ($prepend) {
  23443. $this->fallbackDirsPsr4 = array_merge(
  23444. (array) $paths,
  23445. $this->fallbackDirsPsr4
  23446. );
  23447. } else {
  23448. $this->fallbackDirsPsr4 = array_merge(
  23449. $this->fallbackDirsPsr4,
  23450. (array) $paths
  23451. );
  23452. }
  23453. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  23454. // Register directories for a new namespace.
  23455. $length = strlen($prefix);
  23456. if ('\\' !== $prefix[$length - 1]) {
  23457. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  23458. }
  23459. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  23460. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  23461. } elseif ($prepend) {
  23462. // Prepend directories for an already registered namespace.
  23463. $this->prefixDirsPsr4[$prefix] = array_merge(
  23464. (array) $paths,
  23465. $this->prefixDirsPsr4[$prefix]
  23466. );
  23467. } else {
  23468. // Append directories for an already registered namespace.
  23469. $this->prefixDirsPsr4[$prefix] = array_merge(
  23470. $this->prefixDirsPsr4[$prefix],
  23471. (array) $paths
  23472. );
  23473. }
  23474. }
  23475. /**
  23476. * Registers a set of PSR-0 directories for a given prefix,
  23477. * replacing any others previously set for this prefix.
  23478. *
  23479. * @param string $prefix The prefix
  23480. * @param array|string $paths The PSR-0 base directories
  23481. */
  23482. public function set($prefix, $paths)
  23483. {
  23484. if (!$prefix) {
  23485. $this->fallbackDirsPsr0 = (array) $paths;
  23486. } else {
  23487. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  23488. }
  23489. }
  23490. /**
  23491. * Registers a set of PSR-4 directories for a given namespace,
  23492. * replacing any others previously set for this namespace.
  23493. *
  23494. * @param string $prefix The prefix/namespace, with trailing '\\'
  23495. * @param array|string $paths The PSR-4 base directories
  23496. *
  23497. * @throws \InvalidArgumentException
  23498. */
  23499. public function setPsr4($prefix, $paths)
  23500. {
  23501. if (!$prefix) {
  23502. $this->fallbackDirsPsr4 = (array) $paths;
  23503. } else {
  23504. $length = strlen($prefix);
  23505. if ('\\' !== $prefix[$length - 1]) {
  23506. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  23507. }
  23508. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  23509. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  23510. }
  23511. }
  23512. /**
  23513. * Turns on searching the include path for class files.
  23514. *
  23515. * @param bool $useIncludePath
  23516. */
  23517. public function setUseIncludePath($useIncludePath)
  23518. {
  23519. $this->useIncludePath = $useIncludePath;
  23520. }
  23521. /**
  23522. * Can be used to check if the autoloader uses the include path to check
  23523. * for classes.
  23524. *
  23525. * @return bool
  23526. */
  23527. public function getUseIncludePath()
  23528. {
  23529. return $this->useIncludePath;
  23530. }
  23531. /**
  23532. * Turns off searching the prefix and fallback directories for classes
  23533. * that have not been registered with the class map.
  23534. *
  23535. * @param bool $classMapAuthoritative
  23536. */
  23537. public function setClassMapAuthoritative($classMapAuthoritative)
  23538. {
  23539. $this->classMapAuthoritative = $classMapAuthoritative;
  23540. }
  23541. /**
  23542. * Should class lookup fail if not found in the current class map?
  23543. *
  23544. * @return bool
  23545. */
  23546. public function isClassMapAuthoritative()
  23547. {
  23548. return $this->classMapAuthoritative;
  23549. }
  23550. /**
  23551. * Registers this instance as an autoloader.
  23552. *
  23553. * @param bool $prepend Whether to prepend the autoloader or not
  23554. */
  23555. public function register($prepend = false)
  23556. {
  23557. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  23558. }
  23559. /**
  23560. * Unregisters this instance as an autoloader.
  23561. */
  23562. public function unregister()
  23563. {
  23564. spl_autoload_unregister(array($this, 'loadClass'));
  23565. }
  23566. /**
  23567. * Loads the given class or interface.
  23568. *
  23569. * @param string $class The name of the class
  23570. * @return bool|null True if loaded, null otherwise
  23571. */
  23572. public function loadClass($class)
  23573. {
  23574. if ($file = $this->findFile($class)) {
  23575. includeFile($file);
  23576. return true;
  23577. }
  23578. }
  23579. /**
  23580. * Finds the path to the file where the class is defined.
  23581. *
  23582. * @param string $class The name of the class
  23583. *
  23584. * @return string|false The path if found, false otherwise
  23585. */
  23586. public function findFile($class)
  23587. {
  23588. // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
  23589. if ('\\' == $class[0]) {
  23590. $class = substr($class, 1);
  23591. }
  23592. // class map lookup
  23593. if (isset($this->classMap[$class])) {
  23594. return $this->classMap[$class];
  23595. }
  23596. if ($this->classMapAuthoritative) {
  23597. return false;
  23598. }
  23599. $file = $this->findFileWithExtension($class, '.php');
  23600. // Search for Hack files if we are running on HHVM
  23601. if ($file === null && defined('HHVM_VERSION')) {
  23602. $file = $this->findFileWithExtension($class, '.hh');
  23603. }
  23604. if ($file === null) {
  23605. // Remember that this class does not exist.
  23606. return $this->classMap[$class] = false;
  23607. }
  23608. return $file;
  23609. }
  23610. private function findFileWithExtension($class, $ext)
  23611. {
  23612. // PSR-4 lookup
  23613. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  23614. $first = $class[0];
  23615. if (isset($this->prefixLengthsPsr4[$first])) {
  23616. foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
  23617. if (0 === strpos($class, $prefix)) {
  23618. foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
  23619. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
  23620. return $file;
  23621. }
  23622. }
  23623. }
  23624. }
  23625. }
  23626. // PSR-4 fallback dirs
  23627. foreach ($this->fallbackDirsPsr4 as $dir) {
  23628. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  23629. return $file;
  23630. }
  23631. }
  23632. // PSR-0 lookup
  23633. if (false !== $pos = strrpos($class, '\\')) {
  23634. // namespaced class name
  23635. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  23636. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  23637. } else {
  23638. // PEAR-like class name
  23639. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  23640. }
  23641. if (isset($this->prefixesPsr0[$first])) {
  23642. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  23643. if (0 === strpos($class, $prefix)) {
  23644. foreach ($dirs as $dir) {
  23645. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  23646. return $file;
  23647. }
  23648. }
  23649. }
  23650. }
  23651. }
  23652. // PSR-0 fallback dirs
  23653. foreach ($this->fallbackDirsPsr0 as $dir) {
  23654. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  23655. return $file;
  23656. }
  23657. }
  23658. // PSR-0 include paths.
  23659. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  23660. return $file;
  23661. }
  23662. }
  23663. }
  23664. /**
  23665. * Scope isolated include.
  23666. *
  23667. * Prevents access to $this/self from included files.
  23668. */
  23669. function includeFile($file)
  23670. {
  23671. include $file;
  23672. }
  23673. {
  23674. "$schema": "http://json-schema.org/draft-04/schema#",
  23675. "name": "Package",
  23676. "type": "object",
  23677. "additionalProperties": false,
  23678. "required": [ "name", "description" ],
  23679. "properties": {
  23680. "name": {
  23681. "type": "string",
  23682. "description": "Package name, including 'vendor-name/' prefix."
  23683. },
  23684. "type": {
  23685. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  23686. "type": "string"
  23687. },
  23688. "target-dir": {
  23689. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  23690. "type": "string"
  23691. },
  23692. "description": {
  23693. "type": "string",
  23694. "description": "Short package description."
  23695. },
  23696. "keywords": {
  23697. "type": "array",
  23698. "items": {
  23699. "type": "string",
  23700. "description": "A tag/keyword that this package relates to."
  23701. }
  23702. },
  23703. "homepage": {
  23704. "type": "string",
  23705. "description": "Homepage URL for the project.",
  23706. "format": "uri"
  23707. },
  23708. "version": {
  23709. "type": "string",
  23710. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  23711. },
  23712. "time": {
  23713. "type": "string",
  23714. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  23715. },
  23716. "license": {
  23717. "type": ["string", "array"],
  23718. "description": "License name. Or an array of license names."
  23719. },
  23720. "authors": {
  23721. "type": "array",
  23722. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  23723. "items": {
  23724. "type": "object",
  23725. "additionalProperties": false,
  23726. "required": [ "name"],
  23727. "properties": {
  23728. "name": {
  23729. "type": "string",
  23730. "description": "Full name of the author."
  23731. },
  23732. "email": {
  23733. "type": "string",
  23734. "description": "Email address of the author.",
  23735. "format": "email"
  23736. },
  23737. "homepage": {
  23738. "type": "string",
  23739. "description": "Homepage URL for the author.",
  23740. "format": "uri"
  23741. },
  23742. "role": {
  23743. "type": "string",
  23744. "description": "Author's role in the project."
  23745. }
  23746. }
  23747. }
  23748. },
  23749. "require": {
  23750. "type": "object",
  23751. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  23752. "additionalProperties": true
  23753. },
  23754. "replace": {
  23755. "type": "object",
  23756. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  23757. "additionalProperties": true
  23758. },
  23759. "conflict": {
  23760. "type": "object",
  23761. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  23762. "additionalProperties": true
  23763. },
  23764. "provide": {
  23765. "type": "object",
  23766. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  23767. "additionalProperties": true
  23768. },
  23769. "require-dev": {
  23770. "type": "object",
  23771. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  23772. "additionalProperties": true
  23773. },
  23774. "suggest": {
  23775. "type": "object",
  23776. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  23777. "additionalProperties": true
  23778. },
  23779. "config": {
  23780. "type": "object",
  23781. "description": "Composer options.",
  23782. "properties": {
  23783. "process-timeout": {
  23784. "type": "integer",
  23785. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  23786. },
  23787. "use-include-path": {
  23788. "type": "boolean",
  23789. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  23790. },
  23791. "preferred-install": {
  23792. "type": "string",
  23793. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist or auto."
  23794. },
  23795. "notify-on-install": {
  23796. "type": "boolean",
  23797. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  23798. },
  23799. "github-protocols": {
  23800. "type": "array",
  23801. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  23802. "items": {
  23803. "type": "string"
  23804. }
  23805. },
  23806. "github-oauth": {
  23807. "type": "object",
  23808. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  23809. "additionalProperties": true
  23810. },
  23811. "gitlab-oauth": {
  23812. "type": "object",
  23813. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  23814. "additionalProperties": true
  23815. },
  23816. "disable-tls": {
  23817. "type": "boolean",
  23818. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  23819. },
  23820. "cafile": {
  23821. "type": "string",
  23822. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  23823. },
  23824. "capath": {
  23825. "type": "string",
  23826. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  23827. },
  23828. "http-basic": {
  23829. "type": "object",
  23830. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  23831. "additionalProperties": true
  23832. },
  23833. "store-auths": {
  23834. "type": ["string", "boolean"],
  23835. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  23836. },
  23837. "platform": {
  23838. "type": "object",
  23839. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  23840. "additionalProperties": true
  23841. },
  23842. "vendor-dir": {
  23843. "type": "string",
  23844. "description": "The location where all packages are installed, defaults to \"vendor\"."
  23845. },
  23846. "bin-dir": {
  23847. "type": "string",
  23848. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  23849. },
  23850. "data-dir": {
  23851. "type": "string",
  23852. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  23853. },
  23854. "cache-dir": {
  23855. "type": "string",
  23856. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  23857. },
  23858. "cache-files-dir": {
  23859. "type": "string",
  23860. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  23861. },
  23862. "cache-repo-dir": {
  23863. "type": "string",
  23864. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  23865. },
  23866. "cache-vcs-dir": {
  23867. "type": "string",
  23868. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  23869. },
  23870. "cache-ttl": {
  23871. "type": "integer",
  23872. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  23873. },
  23874. "cache-files-ttl": {
  23875. "type": "integer",
  23876. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  23877. },
  23878. "cache-files-maxsize": {
  23879. "type": ["string", "integer"],
  23880. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  23881. },
  23882. "bin-compat": {
  23883. "enum": ["auto", "full"],
  23884. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  23885. },
  23886. "discard-changes": {
  23887. "type": ["string", "boolean"],
  23888. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  23889. },
  23890. "autoloader-suffix": {
  23891. "type": "string",
  23892. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  23893. },
  23894. "optimize-autoloader": {
  23895. "type": "boolean",
  23896. "description": "Always optimize when dumping the autoloader."
  23897. },
  23898. "prepend-autoloader": {
  23899. "type": "boolean",
  23900. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  23901. },
  23902. "classmap-authoritative": {
  23903. "type": "boolean",
  23904. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  23905. },
  23906. "github-domains": {
  23907. "type": "array",
  23908. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  23909. "items": {
  23910. "type": "string"
  23911. }
  23912. },
  23913. "github-expose-hostname": {
  23914. "type": "boolean",
  23915. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  23916. },
  23917. "gitlab-domains": {
  23918. "type": "array",
  23919. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  23920. "items": {
  23921. "type": "string"
  23922. }
  23923. },
  23924. "archive-format": {
  23925. "type": "string",
  23926. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  23927. },
  23928. "archive-dir": {
  23929. "type": "string",
  23930. "description": "The default archive path when not provided on cli, defaults to \".\"."
  23931. }
  23932. }
  23933. },
  23934. "extra": {
  23935. "type": ["object", "array"],
  23936. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  23937. "additionalProperties": true
  23938. },
  23939. "autoload": {
  23940. "type": "object",
  23941. "description": "Description of how the package can be autoloaded.",
  23942. "properties": {
  23943. "psr-0": {
  23944. "type": "object",
  23945. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  23946. "additionalProperties": true
  23947. },
  23948. "psr-4": {
  23949. "type": "object",
  23950. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  23951. "additionalProperties": true
  23952. },
  23953. "classmap": {
  23954. "type": "array",
  23955. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  23956. },
  23957. "files": {
  23958. "type": "array",
  23959. "description": "This is an array of files that are always required on every request."
  23960. },
  23961. "exclude-from-classmap": {
  23962. "type": "array",
  23963. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  23964. }
  23965. }
  23966. },
  23967. "autoload-dev": {
  23968. "type": "object",
  23969. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  23970. "properties": {
  23971. "psr-0": {
  23972. "type": "object",
  23973. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  23974. "additionalProperties": true
  23975. },
  23976. "psr-4": {
  23977. "type": "object",
  23978. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  23979. "additionalProperties": true
  23980. },
  23981. "classmap": {
  23982. "type": "array",
  23983. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  23984. },
  23985. "files": {
  23986. "type": "array",
  23987. "description": "This is an array of files that are always required on every request."
  23988. }
  23989. }
  23990. },
  23991. "archive": {
  23992. "type": ["object"],
  23993. "description": "Options for creating package archives for distribution.",
  23994. "properties": {
  23995. "exclude": {
  23996. "type": "array",
  23997. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  23998. }
  23999. }
  24000. },
  24001. "repositories": {
  24002. "type": ["object", "array"],
  24003. "description": "A set of additional repositories where packages can be found.",
  24004. "additionalProperties": true
  24005. },
  24006. "minimum-stability": {
  24007. "type": ["string"],
  24008. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  24009. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  24010. },
  24011. "prefer-stable": {
  24012. "type": ["boolean"],
  24013. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  24014. },
  24015. "bin": {
  24016. "type": ["array"],
  24017. "description": "A set of files that should be treated as binaries and symlinked into bin-dir (from config).",
  24018. "items": {
  24019. "type": "string"
  24020. }
  24021. },
  24022. "include-path": {
  24023. "type": ["array"],
  24024. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  24025. "items": {
  24026. "type": "string"
  24027. }
  24028. },
  24029. "scripts": {
  24030. "type": ["object"],
  24031. "description": "Scripts listeners that will be executed before/after some events.",
  24032. "properties": {
  24033. "pre-install-cmd": {
  24034. "type": ["array", "string"],
  24035. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  24036. },
  24037. "post-install-cmd": {
  24038. "type": ["array", "string"],
  24039. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  24040. },
  24041. "pre-update-cmd": {
  24042. "type": ["array", "string"],
  24043. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  24044. },
  24045. "post-update-cmd": {
  24046. "type": ["array", "string"],
  24047. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  24048. },
  24049. "pre-status-cmd": {
  24050. "type": ["array", "string"],
  24051. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  24052. },
  24053. "post-status-cmd": {
  24054. "type": ["array", "string"],
  24055. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  24056. },
  24057. "pre-package-install": {
  24058. "type": ["array", "string"],
  24059. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  24060. },
  24061. "post-package-install": {
  24062. "type": ["array", "string"],
  24063. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  24064. },
  24065. "pre-package-update": {
  24066. "type": ["array", "string"],
  24067. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  24068. },
  24069. "post-package-update": {
  24070. "type": ["array", "string"],
  24071. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  24072. },
  24073. "pre-package-uninstall": {
  24074. "type": ["array", "string"],
  24075. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  24076. },
  24077. "post-package-uninstall": {
  24078. "type": ["array", "string"],
  24079. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  24080. },
  24081. "pre-autoload-dump": {
  24082. "type": ["array", "string"],
  24083. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  24084. },
  24085. "post-autoload-dump": {
  24086. "type": ["array", "string"],
  24087. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  24088. },
  24089. "post-root-package-install": {
  24090. "type": ["array", "string"],
  24091. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  24092. },
  24093. "post-create-project-cmd": {
  24094. "type": ["array", "string"],
  24095. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  24096. }
  24097. }
  24098. },
  24099. "support": {
  24100. "type": "object",
  24101. "properties": {
  24102. "email": {
  24103. "type": "string",
  24104. "description": "Email address for support.",
  24105. "format": "email"
  24106. },
  24107. "issues": {
  24108. "type": "string",
  24109. "description": "URL to the issue tracker.",
  24110. "format": "uri"
  24111. },
  24112. "forum": {
  24113. "type": "string",
  24114. "description": "URL to the forum.",
  24115. "format": "uri"
  24116. },
  24117. "wiki": {
  24118. "type": "string",
  24119. "description": "URL to the wiki.",
  24120. "format": "uri"
  24121. },
  24122. "irc": {
  24123. "type": "string",
  24124. "description": "IRC channel for support, as irc://server/channel.",
  24125. "format": "uri"
  24126. },
  24127. "source": {
  24128. "type": "string",
  24129. "description": "URL to browse or download the sources.",
  24130. "format": "uri"
  24131. },
  24132. "docs": {
  24133. "type": "string",
  24134. "description": "URL to the documentation.",
  24135. "format": "uri"
  24136. }
  24137. }
  24138. },
  24139. "non-feature-branches": {
  24140. "type": ["array"],
  24141. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  24142. "items": {
  24143. "type": "string"
  24144. }
  24145. },
  24146. "abandoned": {
  24147. "type": ["boolean", "string"],
  24148. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  24149. }
  24150. }
  24151. }
  24152. {
  24153. "389-exception": [
  24154. "389 Directory Server\nException"
  24155. ],
  24156. "Autoconf-exception-2.0": [
  24157. "Autoconf exception 2.0"
  24158. ],
  24159. "Autoconf-exception-3.0": [
  24160. "Autoconf exception 3.0"
  24161. ],
  24162. "Bison-exception-2.2": [
  24163. "Bison exception 2.2"
  24164. ],
  24165. "Classpath-exception-2.0": [
  24166. "Classpath exception 2.0"
  24167. ],
  24168. "CLISP-exception-2.0": [
  24169. "CLISP exception 2.0"
  24170. ],
  24171. "DigiRule-FOSS-exception": [
  24172. "DigiRule FOSS License Exception"
  24173. ],
  24174. "eCos-exception-2.0": [
  24175. "eCos exception 2.0"
  24176. ],
  24177. "Fawkes-Runtime-exception": [
  24178. "Fawkes Runtime Exception"
  24179. ],
  24180. "FLTK-exception": [
  24181. "FLTK exception"
  24182. ],
  24183. "Font-exception-2.0": [
  24184. "Font exception 2.0"
  24185. ],
  24186. "freertos-exception-2.0": [
  24187. "FreeRTOS Exception 2.0"
  24188. ],
  24189. "GCC-exception-2.0": [
  24190. "GCC Runtime Library exception 2.0"
  24191. ],
  24192. "GCC-exception-3.1": [
  24193. "GCC Runtime Library exception 3.1"
  24194. ],
  24195. "gnu-javamail-exception": [
  24196. "GNU JavaMail exception"
  24197. ],
  24198. "i2p-gpl-java-exception": [
  24199. "i2p GPL+Java Exception"
  24200. ],
  24201. "Libtool-exception": [
  24202. "Libtool Exception"
  24203. ],
  24204. "LZMA-exception": [
  24205. "LZMA exception"
  24206. ],
  24207. "mif-exception": [
  24208. "Macros and Inline Functions Exception"
  24209. ],
  24210. "Nokia-Qt-exception-1.1": [
  24211. "Nokia Qt LGPL exception 1.1"
  24212. ],
  24213. "openvpn-openssl-exception": [
  24214. "OpenVPN OpenSSL Exception"
  24215. ],
  24216. "Qwt-exception-1.0": [
  24217. "Qwt exception 1.0"
  24218. ],
  24219. "u-boot-exception-2.0": [
  24220. "U-Boot exception 2.0"
  24221. ],
  24222. "WxWindows-exception-3.1": [
  24223. "WxWindows Library Exception 3.1"
  24224. ]
  24225. }{
  24226. "0BSD": [
  24227. "BSD Zero Clause License",
  24228. false
  24229. ],
  24230. "AAL": [
  24231. "Attribution Assurance License",
  24232. true
  24233. ],
  24234. "Abstyles": [
  24235. "Abstyles License",
  24236. false
  24237. ],
  24238. "Adobe-2006": [
  24239. "Adobe Systems Incorporated Source Code License Agreement",
  24240. false
  24241. ],
  24242. "Adobe-Glyph": [
  24243. "Adobe Glyph List License",
  24244. false
  24245. ],
  24246. "ADSL": [
  24247. "Amazon Digital Services License",
  24248. false
  24249. ],
  24250. "AFL-1.1": [
  24251. "Academic Free License v1.1",
  24252. true
  24253. ],
  24254. "AFL-1.2": [
  24255. "Academic Free License v1.2",
  24256. true
  24257. ],
  24258. "AFL-2.0": [
  24259. "Academic Free License v2.0",
  24260. true
  24261. ],
  24262. "AFL-2.1": [
  24263. "Academic Free License v2.1",
  24264. true
  24265. ],
  24266. "AFL-3.0": [
  24267. "Academic Free License v3.0",
  24268. true
  24269. ],
  24270. "Afmparse": [
  24271. "Afmparse License",
  24272. false
  24273. ],
  24274. "AGPL-1.0": [
  24275. "Affero General Public License v1.0",
  24276. false
  24277. ],
  24278. "AGPL-3.0": [
  24279. "GNU Affero General Public License v3.0",
  24280. true
  24281. ],
  24282. "Aladdin": [
  24283. "Aladdin Free Public License",
  24284. false
  24285. ],
  24286. "AMDPLPA": [
  24287. "AMD's plpa_map.c License",
  24288. false
  24289. ],
  24290. "AML": [
  24291. "Apple MIT License",
  24292. false
  24293. ],
  24294. "AMPAS": [
  24295. "Academy of Motion Picture Arts and Sciences BSD",
  24296. false
  24297. ],
  24298. "ANTLR-PD": [
  24299. "ANTLR Software Rights Notice",
  24300. false
  24301. ],
  24302. "Apache-1.0": [
  24303. "Apache License 1.0",
  24304. false
  24305. ],
  24306. "Apache-1.1": [
  24307. "Apache License 1.1",
  24308. true
  24309. ],
  24310. "Apache-2.0": [
  24311. "Apache License 2.0",
  24312. true
  24313. ],
  24314. "APAFML": [
  24315. "Adobe Postscript AFM License",
  24316. false
  24317. ],
  24318. "APL-1.0": [
  24319. "Adaptive Public License 1.0",
  24320. true
  24321. ],
  24322. "APSL-1.0": [
  24323. "Apple Public Source License 1.0",
  24324. true
  24325. ],
  24326. "APSL-1.1": [
  24327. "Apple Public Source License 1.1",
  24328. true
  24329. ],
  24330. "APSL-1.2": [
  24331. "Apple Public Source License 1.2",
  24332. true
  24333. ],
  24334. "APSL-2.0": [
  24335. "Apple Public Source License 2.0",
  24336. true
  24337. ],
  24338. "Artistic-1.0": [
  24339. "Artistic License 1.0",
  24340. true
  24341. ],
  24342. "Artistic-1.0-cl8": [
  24343. "Artistic License 1.0 w/clause 8",
  24344. true
  24345. ],
  24346. "Artistic-1.0-Perl": [
  24347. "Artistic License 1.0 (Perl)",
  24348. true
  24349. ],
  24350. "Artistic-2.0": [
  24351. "Artistic License 2.0",
  24352. true
  24353. ],
  24354. "Bahyph": [
  24355. "Bahyph License",
  24356. false
  24357. ],
  24358. "Barr": [
  24359. "Barr License",
  24360. false
  24361. ],
  24362. "Beerware": [
  24363. "Beerware License",
  24364. false
  24365. ],
  24366. "BitTorrent-1.0": [
  24367. "BitTorrent Open Source License v1.0",
  24368. false
  24369. ],
  24370. "BitTorrent-1.1": [
  24371. "BitTorrent Open Source License v1.1",
  24372. false
  24373. ],
  24374. "Borceux": [
  24375. "Borceux license",
  24376. false
  24377. ],
  24378. "BSD-2-Clause": [
  24379. "BSD 2-clause \"Simplified\" License",
  24380. true
  24381. ],
  24382. "BSD-2-Clause-FreeBSD": [
  24383. "BSD 2-clause FreeBSD License",
  24384. false
  24385. ],
  24386. "BSD-2-Clause-NetBSD": [
  24387. "BSD 2-clause NetBSD License",
  24388. false
  24389. ],
  24390. "BSD-3-Clause": [
  24391. "BSD 3-clause \"New\" or \"Revised\" License",
  24392. true
  24393. ],
  24394. "BSD-3-Clause-Attribution": [
  24395. "BSD with attribution",
  24396. false
  24397. ],
  24398. "BSD-3-Clause-Clear": [
  24399. "BSD 3-clause Clear License",
  24400. false
  24401. ],
  24402. "BSD-3-Clause-LBNL": [
  24403. "Lawrence Berkeley National Labs BSD variant license",
  24404. false
  24405. ],
  24406. "BSD-4-Clause": [
  24407. "BSD 4-clause \"Original\" or \"Old\" License",
  24408. false
  24409. ],
  24410. "BSD-4-Clause-UC": [
  24411. "BSD-4-Clause (University of California-Specific)",
  24412. false
  24413. ],
  24414. "BSD-Protection": [
  24415. "BSD Protection License",
  24416. false
  24417. ],
  24418. "BSL-1.0": [
  24419. "Boost Software License 1.0",
  24420. true
  24421. ],
  24422. "bzip2-1.0.5": [
  24423. "bzip2 and libbzip2 License v1.0.5",
  24424. false
  24425. ],
  24426. "bzip2-1.0.6": [
  24427. "bzip2 and libbzip2 License v1.0.6",
  24428. false
  24429. ],
  24430. "Caldera": [
  24431. "Caldera License",
  24432. false
  24433. ],
  24434. "CATOSL-1.1": [
  24435. "Computer Associates Trusted Open Source License 1.1",
  24436. true
  24437. ],
  24438. "CC-BY-1.0": [
  24439. "Creative Commons Attribution 1.0",
  24440. false
  24441. ],
  24442. "CC-BY-2.0": [
  24443. "Creative Commons Attribution 2.0",
  24444. false
  24445. ],
  24446. "CC-BY-2.5": [
  24447. "Creative Commons Attribution 2.5",
  24448. false
  24449. ],
  24450. "CC-BY-3.0": [
  24451. "Creative Commons Attribution 3.0",
  24452. false
  24453. ],
  24454. "CC-BY-4.0": [
  24455. "Creative Commons Attribution 4.0",
  24456. false
  24457. ],
  24458. "CC-BY-NC-1.0": [
  24459. "Creative Commons Attribution Non Commercial 1.0",
  24460. false
  24461. ],
  24462. "CC-BY-NC-2.0": [
  24463. "Creative Commons Attribution Non Commercial 2.0",
  24464. false
  24465. ],
  24466. "CC-BY-NC-2.5": [
  24467. "Creative Commons Attribution Non Commercial 2.5",
  24468. false
  24469. ],
  24470. "CC-BY-NC-3.0": [
  24471. "Creative Commons Attribution Non Commercial 3.0",
  24472. false
  24473. ],
  24474. "CC-BY-NC-4.0": [
  24475. "Creative Commons Attribution Non Commercial 4.0",
  24476. false
  24477. ],
  24478. "CC-BY-NC-ND-1.0": [
  24479. "Creative Commons Attribution Non Commercial No Derivatives 1.0",
  24480. false
  24481. ],
  24482. "CC-BY-NC-ND-2.0": [
  24483. "Creative Commons Attribution Non Commercial No Derivatives 2.0",
  24484. false
  24485. ],
  24486. "CC-BY-NC-ND-2.5": [
  24487. "Creative Commons Attribution Non Commercial No Derivatives 2.5",
  24488. false
  24489. ],
  24490. "CC-BY-NC-ND-3.0": [
  24491. "Creative Commons Attribution Non Commercial No Derivatives 3.0",
  24492. false
  24493. ],
  24494. "CC-BY-NC-ND-4.0": [
  24495. "Creative Commons Attribution Non Commercial No Derivatives 4.0",
  24496. false
  24497. ],
  24498. "CC-BY-NC-SA-1.0": [
  24499. "Creative Commons Attribution Non Commercial Share Alike 1.0",
  24500. false
  24501. ],
  24502. "CC-BY-NC-SA-2.0": [
  24503. "Creative Commons Attribution Non Commercial Share Alike 2.0",
  24504. false
  24505. ],
  24506. "CC-BY-NC-SA-2.5": [
  24507. "Creative Commons Attribution Non Commercial Share Alike 2.5",
  24508. false
  24509. ],
  24510. "CC-BY-NC-SA-3.0": [
  24511. "Creative Commons Attribution Non Commercial Share Alike 3.0",
  24512. false
  24513. ],
  24514. "CC-BY-NC-SA-4.0": [
  24515. "Creative Commons Attribution Non Commercial Share Alike 4.0",
  24516. false
  24517. ],
  24518. "CC-BY-ND-1.0": [
  24519. "Creative Commons Attribution No Derivatives 1.0",
  24520. false
  24521. ],
  24522. "CC-BY-ND-2.0": [
  24523. "Creative Commons Attribution No Derivatives 2.0",
  24524. false
  24525. ],
  24526. "CC-BY-ND-2.5": [
  24527. "Creative Commons Attribution No Derivatives 2.5",
  24528. false
  24529. ],
  24530. "CC-BY-ND-3.0": [
  24531. "Creative Commons Attribution No Derivatives 3.0",
  24532. false
  24533. ],
  24534. "CC-BY-ND-4.0": [
  24535. "Creative Commons Attribution No Derivatives 4.0",
  24536. false
  24537. ],
  24538. "CC-BY-SA-1.0": [
  24539. "Creative Commons Attribution Share Alike 1.0",
  24540. false
  24541. ],
  24542. "CC-BY-SA-2.0": [
  24543. "Creative Commons Attribution Share Alike 2.0",
  24544. false
  24545. ],
  24546. "CC-BY-SA-2.5": [
  24547. "Creative Commons Attribution Share Alike 2.5",
  24548. false
  24549. ],
  24550. "CC-BY-SA-3.0": [
  24551. "Creative Commons Attribution Share Alike 3.0",
  24552. false
  24553. ],
  24554. "CC-BY-SA-4.0": [
  24555. "Creative Commons Attribution Share Alike 4.0",
  24556. false
  24557. ],
  24558. "CC0-1.0": [
  24559. "Creative Commons Zero v1.0 Universal",
  24560. false
  24561. ],
  24562. "CDDL-1.0": [
  24563. "Common Development and Distribution License 1.0",
  24564. true
  24565. ],
  24566. "CDDL-1.1": [
  24567. "Common Development and Distribution License 1.1",
  24568. false
  24569. ],
  24570. "CECILL-1.0": [
  24571. "CeCILL Free Software License Agreement v1.0",
  24572. false
  24573. ],
  24574. "CECILL-1.1": [
  24575. "CeCILL Free Software License Agreement v1.1",
  24576. false
  24577. ],
  24578. "CECILL-2.0": [
  24579. "CeCILL Free Software License Agreement v2.0",
  24580. false
  24581. ],
  24582. "CECILL-2.1": [
  24583. "CeCILL Free Software License Agreement v2.1",
  24584. true
  24585. ],
  24586. "CECILL-B": [
  24587. "CeCILL-B Free Software License Agreement",
  24588. false
  24589. ],
  24590. "CECILL-C": [
  24591. "CeCILL-C Free Software License Agreement",
  24592. false
  24593. ],
  24594. "ClArtistic": [
  24595. "Clarified Artistic License",
  24596. false
  24597. ],
  24598. "CNRI-Jython": [
  24599. "CNRI Jython License",
  24600. false
  24601. ],
  24602. "CNRI-Python": [
  24603. "CNRI Python License",
  24604. true
  24605. ],
  24606. "CNRI-Python-GPL-Compatible": [
  24607. "CNRI Python Open Source GPL Compatible License Agreement",
  24608. false
  24609. ],
  24610. "Condor-1.1": [
  24611. "Condor Public License v1.1",
  24612. false
  24613. ],
  24614. "CPAL-1.0": [
  24615. "Common Public Attribution License 1.0",
  24616. true
  24617. ],
  24618. "CPL-1.0": [
  24619. "Common Public License 1.0",
  24620. true
  24621. ],
  24622. "CPOL-1.02": [
  24623. "Code Project Open License 1.02",
  24624. false
  24625. ],
  24626. "Crossword": [
  24627. "Crossword License",
  24628. false
  24629. ],
  24630. "CrystalStacker": [
  24631. "CrystalStacker License",
  24632. false
  24633. ],
  24634. "CUA-OPL-1.0": [
  24635. "CUA Office Public License v1.0",
  24636. true
  24637. ],
  24638. "Cube": [
  24639. "Cube License",
  24640. false
  24641. ],
  24642. "D-FSL-1.0": [
  24643. "Deutsche Freie Software Lizenz",
  24644. false
  24645. ],
  24646. "diffmark": [
  24647. "diffmark license",
  24648. false
  24649. ],
  24650. "DOC": [
  24651. "DOC License",
  24652. false
  24653. ],
  24654. "Dotseqn": [
  24655. "Dotseqn License",
  24656. false
  24657. ],
  24658. "DSDP": [
  24659. "DSDP License",
  24660. false
  24661. ],
  24662. "dvipdfm": [
  24663. "dvipdfm License",
  24664. false
  24665. ],
  24666. "ECL-1.0": [
  24667. "Educational Community License v1.0",
  24668. true
  24669. ],
  24670. "ECL-2.0": [
  24671. "Educational Community License v2.0",
  24672. true
  24673. ],
  24674. "EFL-1.0": [
  24675. "Eiffel Forum License v1.0",
  24676. true
  24677. ],
  24678. "EFL-2.0": [
  24679. "Eiffel Forum License v2.0",
  24680. true
  24681. ],
  24682. "eGenix": [
  24683. "eGenix.com Public License 1.1.0",
  24684. false
  24685. ],
  24686. "Entessa": [
  24687. "Entessa Public License v1.0",
  24688. true
  24689. ],
  24690. "EPL-1.0": [
  24691. "Eclipse Public License 1.0",
  24692. true
  24693. ],
  24694. "ErlPL-1.1": [
  24695. "Erlang Public License v1.1",
  24696. false
  24697. ],
  24698. "EUDatagrid": [
  24699. "EU DataGrid Software License",
  24700. true
  24701. ],
  24702. "EUPL-1.0": [
  24703. "European Union Public License 1.0",
  24704. false
  24705. ],
  24706. "EUPL-1.1": [
  24707. "European Union Public License 1.1",
  24708. true
  24709. ],
  24710. "Eurosym": [
  24711. "Eurosym License",
  24712. false
  24713. ],
  24714. "Fair": [
  24715. "Fair License",
  24716. true
  24717. ],
  24718. "Frameworx-1.0": [
  24719. "Frameworx Open License 1.0",
  24720. true
  24721. ],
  24722. "FreeImage": [
  24723. "FreeImage Public License v1.0",
  24724. false
  24725. ],
  24726. "FSFUL": [
  24727. "FSF Unlimited License",
  24728. false
  24729. ],
  24730. "FSFULLR": [
  24731. "FSF Unlimited License (with License Retention)",
  24732. false
  24733. ],
  24734. "FTL": [
  24735. "Freetype Project License",
  24736. false
  24737. ],
  24738. "GFDL-1.1": [
  24739. "GNU Free Documentation License v1.1",
  24740. false
  24741. ],
  24742. "GFDL-1.2": [
  24743. "GNU Free Documentation License v1.2",
  24744. false
  24745. ],
  24746. "GFDL-1.3": [
  24747. "GNU Free Documentation License v1.3",
  24748. false
  24749. ],
  24750. "Giftware": [
  24751. "Giftware License",
  24752. false
  24753. ],
  24754. "GL2PS": [
  24755. "GL2PS License",
  24756. false
  24757. ],
  24758. "Glide": [
  24759. "3dfx Glide License",
  24760. false
  24761. ],
  24762. "Glulxe": [
  24763. "Glulxe License",
  24764. false
  24765. ],
  24766. "gnuplot": [
  24767. "gnuplot License",
  24768. false
  24769. ],
  24770. "GPL-1.0": [
  24771. "GNU General Public License v1.0 only",
  24772. false
  24773. ],
  24774. "GPL-2.0": [
  24775. "GNU General Public License v2.0 only",
  24776. true
  24777. ],
  24778. "GPL-3.0": [
  24779. "GNU General Public License v3.0 only",
  24780. true
  24781. ],
  24782. "gSOAP-1.3b": [
  24783. "gSOAP Public License v1.3b",
  24784. false
  24785. ],
  24786. "HaskellReport": [
  24787. "Haskell Language Report License",
  24788. false
  24789. ],
  24790. "HPND": [
  24791. "Historic Permission Notice and Disclaimer",
  24792. true
  24793. ],
  24794. "IBM-pibs": [
  24795. "IBM PowerPC Initialization and Boot Software",
  24796. false
  24797. ],
  24798. "ICU": [
  24799. "ICU License",
  24800. false
  24801. ],
  24802. "IJG": [
  24803. "Independent JPEG Group License",
  24804. false
  24805. ],
  24806. "ImageMagick": [
  24807. "ImageMagick License",
  24808. false
  24809. ],
  24810. "iMatix": [
  24811. "iMatix Standard Function Library Agreement",
  24812. false
  24813. ],
  24814. "Imlib2": [
  24815. "Imlib2 License",
  24816. false
  24817. ],
  24818. "Intel": [
  24819. "Intel Open Source License",
  24820. true
  24821. ],
  24822. "Intel-ACPI": [
  24823. "Intel ACPI Software License Agreement",
  24824. false
  24825. ],
  24826. "Interbase-1.0": [
  24827. "Interbase Public License v1.0",
  24828. false
  24829. ],
  24830. "IPA": [
  24831. "IPA Font License",
  24832. true
  24833. ],
  24834. "IPL-1.0": [
  24835. "IBM Public License v1.0",
  24836. true
  24837. ],
  24838. "ISC": [
  24839. "ISC License",
  24840. true
  24841. ],
  24842. "JasPer-2.0": [
  24843. "JasPer License",
  24844. false
  24845. ],
  24846. "JSON": [
  24847. "JSON License",
  24848. false
  24849. ],
  24850. "Latex2e": [
  24851. "Latex2e License",
  24852. false
  24853. ],
  24854. "Leptonica": [
  24855. "Leptonica License",
  24856. false
  24857. ],
  24858. "LGPL-2.0": [
  24859. "GNU Library General Public License v2 only",
  24860. true
  24861. ],
  24862. "LGPL-2.1": [
  24863. "GNU Lesser General Public License v2.1 only",
  24864. true
  24865. ],
  24866. "LGPL-3.0": [
  24867. "GNU Lesser General Public License v3.0 only",
  24868. true
  24869. ],
  24870. "LGPLLR": [
  24871. "Lesser General Public License For Linguistic Resources",
  24872. false
  24873. ],
  24874. "Libpng": [
  24875. "libpng License",
  24876. false
  24877. ],
  24878. "libtiff": [
  24879. "libtiff License",
  24880. false
  24881. ],
  24882. "LPL-1.0": [
  24883. "Lucent Public License Version 1.0",
  24884. true
  24885. ],
  24886. "LPL-1.02": [
  24887. "Lucent Public License v1.02",
  24888. true
  24889. ],
  24890. "LPPL-1.0": [
  24891. "LaTeX Project Public License v1.0",
  24892. false
  24893. ],
  24894. "LPPL-1.1": [
  24895. "LaTeX Project Public License v1.1",
  24896. false
  24897. ],
  24898. "LPPL-1.2": [
  24899. "LaTeX Project Public License v1.2",
  24900. false
  24901. ],
  24902. "LPPL-1.3a": [
  24903. "LaTeX Project Public License 1.3a",
  24904. false
  24905. ],
  24906. "LPPL-1.3c": [
  24907. "LaTeX Project Public License v1.3c",
  24908. true
  24909. ],
  24910. "MakeIndex": [
  24911. "MakeIndex License",
  24912. false
  24913. ],
  24914. "MirOS": [
  24915. "MirOS Licence",
  24916. true
  24917. ],
  24918. "MIT": [
  24919. "MIT License",
  24920. true
  24921. ],
  24922. "MIT-advertising": [
  24923. "Enlightenment License (e16)",
  24924. false
  24925. ],
  24926. "MIT-CMU": [
  24927. "CMU License",
  24928. false
  24929. ],
  24930. "MIT-enna": [
  24931. "enna License",
  24932. false
  24933. ],
  24934. "MIT-feh": [
  24935. "feh License",
  24936. false
  24937. ],
  24938. "MITNFA": [
  24939. "MIT +no-false-attribs license",
  24940. false
  24941. ],
  24942. "Motosoto": [
  24943. "Motosoto License",
  24944. true
  24945. ],
  24946. "mpich2": [
  24947. "mpich2 License",
  24948. false
  24949. ],
  24950. "MPL-1.0": [
  24951. "Mozilla Public License 1.0",
  24952. true
  24953. ],
  24954. "MPL-1.1": [
  24955. "Mozilla Public License 1.1",
  24956. true
  24957. ],
  24958. "MPL-2.0": [
  24959. "Mozilla Public License 2.0",
  24960. true
  24961. ],
  24962. "MPL-2.0-no-copyleft-exception": [
  24963. "Mozilla Public License 2.0 (no copyleft exception)",
  24964. true
  24965. ],
  24966. "MS-PL": [
  24967. "Microsoft Public License",
  24968. true
  24969. ],
  24970. "MS-RL": [
  24971. "Microsoft Reciprocal License",
  24972. true
  24973. ],
  24974. "MTLL": [
  24975. "Matrix Template Library License",
  24976. false
  24977. ],
  24978. "Multics": [
  24979. "Multics License",
  24980. true
  24981. ],
  24982. "Mup": [
  24983. "Mup License",
  24984. false
  24985. ],
  24986. "NASA-1.3": [
  24987. "NASA Open Source Agreement 1.3",
  24988. true
  24989. ],
  24990. "Naumen": [
  24991. "Naumen Public License",
  24992. true
  24993. ],
  24994. "NBPL-1.0": [
  24995. "Net Boolean Public License v1",
  24996. false
  24997. ],
  24998. "NCSA": [
  24999. "University of Illinois/NCSA Open Source License",
  25000. true
  25001. ],
  25002. "NetCDF": [
  25003. "NetCDF license",
  25004. false
  25005. ],
  25006. "Newsletr": [
  25007. "Newsletr License",
  25008. false
  25009. ],
  25010. "NGPL": [
  25011. "Nethack General Public License",
  25012. true
  25013. ],
  25014. "NLPL": [
  25015. "No Limit Public License",
  25016. false
  25017. ],
  25018. "Nokia": [
  25019. "Nokia Open Source License",
  25020. true
  25021. ],
  25022. "NOSL": [
  25023. "Netizen Open Source License",
  25024. false
  25025. ],
  25026. "Noweb": [
  25027. "Noweb License",
  25028. false
  25029. ],
  25030. "NPL-1.0": [
  25031. "Netscape Public License v1.0",
  25032. false
  25033. ],
  25034. "NPL-1.1": [
  25035. "Netscape Public License v1.1",
  25036. false
  25037. ],
  25038. "NPOSL-3.0": [
  25039. "Non-Profit Open Software License 3.0",
  25040. true
  25041. ],
  25042. "NRL": [
  25043. "NRL License",
  25044. false
  25045. ],
  25046. "NTP": [
  25047. "NTP License",
  25048. true
  25049. ],
  25050. "Nunit": [
  25051. "Nunit License",
  25052. false
  25053. ],
  25054. "OCLC-2.0": [
  25055. "OCLC Research Public License 2.0",
  25056. true
  25057. ],
  25058. "ODbL-1.0": [
  25059. "ODC Open Database License v1.0",
  25060. false
  25061. ],
  25062. "OFL-1.0": [
  25063. "SIL Open Font License 1.0",
  25064. false
  25065. ],
  25066. "OFL-1.1": [
  25067. "SIL Open Font License 1.1",
  25068. true
  25069. ],
  25070. "OGTSL": [
  25071. "Open Group Test Suite License",
  25072. true
  25073. ],
  25074. "OLDAP-1.1": [
  25075. "Open LDAP Public License v1.1",
  25076. false
  25077. ],
  25078. "OLDAP-1.2": [
  25079. "Open LDAP Public License v1.2",
  25080. false
  25081. ],
  25082. "OLDAP-1.3": [
  25083. "Open LDAP Public License v1.3",
  25084. false
  25085. ],
  25086. "OLDAP-1.4": [
  25087. "Open LDAP Public License v1.4",
  25088. false
  25089. ],
  25090. "OLDAP-2.0": [
  25091. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  25092. false
  25093. ],
  25094. "OLDAP-2.0.1": [
  25095. "Open LDAP Public License v2.0.1",
  25096. false
  25097. ],
  25098. "OLDAP-2.1": [
  25099. "Open LDAP Public License v2.1",
  25100. false
  25101. ],
  25102. "OLDAP-2.2": [
  25103. "Open LDAP Public License v2.2",
  25104. false
  25105. ],
  25106. "OLDAP-2.2.1": [
  25107. "Open LDAP Public License v2.2.1",
  25108. false
  25109. ],
  25110. "OLDAP-2.2.2": [
  25111. "Open LDAP Public License 2.2.2",
  25112. false
  25113. ],
  25114. "OLDAP-2.3": [
  25115. "Open LDAP Public License v2.3",
  25116. false
  25117. ],
  25118. "OLDAP-2.4": [
  25119. "Open LDAP Public License v2.4",
  25120. false
  25121. ],
  25122. "OLDAP-2.5": [
  25123. "Open LDAP Public License v2.5",
  25124. false
  25125. ],
  25126. "OLDAP-2.6": [
  25127. "Open LDAP Public License v2.6",
  25128. false
  25129. ],
  25130. "OLDAP-2.7": [
  25131. "Open LDAP Public License v2.7",
  25132. false
  25133. ],
  25134. "OLDAP-2.8": [
  25135. "Open LDAP Public License v2.8",
  25136. false
  25137. ],
  25138. "OML": [
  25139. "Open Market License",
  25140. false
  25141. ],
  25142. "OpenSSL": [
  25143. "OpenSSL License",
  25144. false
  25145. ],
  25146. "OPL-1.0": [
  25147. "Open Public License v1.0",
  25148. false
  25149. ],
  25150. "OSL-1.0": [
  25151. "Open Software License 1.0",
  25152. true
  25153. ],
  25154. "OSL-1.1": [
  25155. "Open Software License 1.1",
  25156. false
  25157. ],
  25158. "OSL-2.0": [
  25159. "Open Software License 2.0",
  25160. true
  25161. ],
  25162. "OSL-2.1": [
  25163. "Open Software License 2.1",
  25164. true
  25165. ],
  25166. "OSL-3.0": [
  25167. "Open Software License 3.0",
  25168. true
  25169. ],
  25170. "PDDL-1.0": [
  25171. "ODC Public Domain Dedication & License 1.0",
  25172. false
  25173. ],
  25174. "PHP-3.0": [
  25175. "PHP License v3.0",
  25176. true
  25177. ],
  25178. "PHP-3.01": [
  25179. "PHP License v3.01",
  25180. false
  25181. ],
  25182. "Plexus": [
  25183. "Plexus Classworlds License",
  25184. false
  25185. ],
  25186. "PostgreSQL": [
  25187. "PostgreSQL License",
  25188. true
  25189. ],
  25190. "psfrag": [
  25191. "psfrag License",
  25192. false
  25193. ],
  25194. "psutils": [
  25195. "psutils License",
  25196. false
  25197. ],
  25198. "Python-2.0": [
  25199. "Python License 2.0",
  25200. true
  25201. ],
  25202. "Qhull": [
  25203. "Qhull License",
  25204. false
  25205. ],
  25206. "QPL-1.0": [
  25207. "Q Public License 1.0",
  25208. true
  25209. ],
  25210. "Rdisc": [
  25211. "Rdisc License",
  25212. false
  25213. ],
  25214. "RHeCos-1.1": [
  25215. "Red Hat eCos Public License v1.1",
  25216. false
  25217. ],
  25218. "RPL-1.1": [
  25219. "Reciprocal Public License 1.1",
  25220. true
  25221. ],
  25222. "RPL-1.5": [
  25223. "Reciprocal Public License 1.5",
  25224. true
  25225. ],
  25226. "RPSL-1.0": [
  25227. "RealNetworks Public Source License v1.0",
  25228. true
  25229. ],
  25230. "RSA-MD": [
  25231. "RSA Message-Digest License",
  25232. false
  25233. ],
  25234. "RSCPL": [
  25235. "Ricoh Source Code Public License",
  25236. true
  25237. ],
  25238. "Ruby": [
  25239. "Ruby License",
  25240. false
  25241. ],
  25242. "SAX-PD": [
  25243. "Sax Public Domain Notice",
  25244. false
  25245. ],
  25246. "Saxpath": [
  25247. "Saxpath License",
  25248. false
  25249. ],
  25250. "SCEA": [
  25251. "SCEA Shared Source License",
  25252. false
  25253. ],
  25254. "Sendmail": [
  25255. "Sendmail License",
  25256. false
  25257. ],
  25258. "SGI-B-1.0": [
  25259. "SGI Free Software License B v1.0",
  25260. false
  25261. ],
  25262. "SGI-B-1.1": [
  25263. "SGI Free Software License B v1.1",
  25264. false
  25265. ],
  25266. "SGI-B-2.0": [
  25267. "SGI Free Software License B v2.0",
  25268. false
  25269. ],
  25270. "SimPL-2.0": [
  25271. "Simple Public License 2.0",
  25272. true
  25273. ],
  25274. "SISSL": [
  25275. "Sun Industry Standards Source License v1.1",
  25276. true
  25277. ],
  25278. "SISSL-1.2": [
  25279. "Sun Industry Standards Source License v1.2",
  25280. false
  25281. ],
  25282. "Sleepycat": [
  25283. "Sleepycat License",
  25284. true
  25285. ],
  25286. "SMLNJ": [
  25287. "Standard ML of New Jersey License",
  25288. false
  25289. ],
  25290. "SNIA": [
  25291. "SNIA Public License 1.1",
  25292. false
  25293. ],
  25294. "Spencer-86": [
  25295. "Spencer License 86",
  25296. false
  25297. ],
  25298. "Spencer-94": [
  25299. "Spencer License 94",
  25300. false
  25301. ],
  25302. "Spencer-99": [
  25303. "Spencer License 99",
  25304. false
  25305. ],
  25306. "SPL-1.0": [
  25307. "Sun Public License v1.0",
  25308. true
  25309. ],
  25310. "SugarCRM-1.1.3": [
  25311. "SugarCRM Public License v1.1.3",
  25312. false
  25313. ],
  25314. "SWL": [
  25315. "Scheme Widget Library (SWL) Software License Agreement",
  25316. false
  25317. ],
  25318. "TCL": [
  25319. "TCL/TK License",
  25320. false
  25321. ],
  25322. "TMate": [
  25323. "TMate Open Source License",
  25324. false
  25325. ],
  25326. "TORQUE-1.1": [
  25327. "TORQUE v2.5+ Software License v1.1",
  25328. false
  25329. ],
  25330. "TOSL": [
  25331. "Trusster Open Source License",
  25332. false
  25333. ],
  25334. "Unicode-TOU": [
  25335. "Unicode Terms of Use",
  25336. false
  25337. ],
  25338. "Unlicense": [
  25339. "The Unlicense",
  25340. false
  25341. ],
  25342. "UPL-1.0": [
  25343. "Universal Permissive License v1.0",
  25344. true
  25345. ],
  25346. "Vim": [
  25347. "Vim License",
  25348. false
  25349. ],
  25350. "VOSTROM": [
  25351. "VOSTROM Public License for Open Source",
  25352. false
  25353. ],
  25354. "VSL-1.0": [
  25355. "Vovida Software License v1.0",
  25356. true
  25357. ],
  25358. "W3C": [
  25359. "W3C Software Notice and License (2002-12-31)",
  25360. true
  25361. ],
  25362. "W3C-19980720": [
  25363. "W3C Software Notice and License (1998-07-20)",
  25364. false
  25365. ],
  25366. "Watcom-1.0": [
  25367. "Sybase Open Watcom Public License 1.0",
  25368. true
  25369. ],
  25370. "Wsuipa": [
  25371. "Wsuipa License",
  25372. false
  25373. ],
  25374. "WTFPL": [
  25375. "Do What The F*ck You Want To Public License",
  25376. false
  25377. ],
  25378. "X11": [
  25379. "X11 License",
  25380. false
  25381. ],
  25382. "Xerox": [
  25383. "Xerox License",
  25384. false
  25385. ],
  25386. "XFree86-1.1": [
  25387. "XFree86 License 1.1",
  25388. false
  25389. ],
  25390. "xinetd": [
  25391. "xinetd License",
  25392. false
  25393. ],
  25394. "Xnet": [
  25395. "X.Net License",
  25396. true
  25397. ],
  25398. "xpp": [
  25399. "XPP License",
  25400. false
  25401. ],
  25402. "XSkat": [
  25403. "XSkat License",
  25404. false
  25405. ],
  25406. "YPL-1.0": [
  25407. "Yahoo! Public License v1.0",
  25408. false
  25409. ],
  25410. "YPL-1.1": [
  25411. "Yahoo! Public License v1.1",
  25412. false
  25413. ],
  25414. "Zed": [
  25415. "Zed License",
  25416. false
  25417. ],
  25418. "Zend-2.0": [
  25419. "Zend License v2.0",
  25420. false
  25421. ],
  25422. "Zimbra-1.3": [
  25423. "Zimbra Public License v1.3",
  25424. false
  25425. ],
  25426. "Zimbra-1.4": [
  25427. "Zimbra Public License v1.4",
  25428. false
  25429. ],
  25430. "Zlib": [
  25431. "zlib License",
  25432. true
  25433. ],
  25434. "zlib-acknowledgement": [
  25435. "zlib/libpng License with Acknowledgement",
  25436. false
  25437. ],
  25438. "ZPL-1.1": [
  25439. "Zope Public License 1.1",
  25440. false
  25441. ],
  25442. "ZPL-2.0": [
  25443. "Zope Public License 2.0",
  25444. true
  25445. ],
  25446. "ZPL-2.1": [
  25447. "Zope Public License 2.1",
  25448. false
  25449. ]
  25450. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  25451. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  25452. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  25453. ����������������� ��`.rdata����� ���
  25454. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  25455. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  25456. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  25457. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  25458. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  25459. <security>
  25460. <requestedPrivileges>
  25461. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  25462. </requestedPrivileges>
  25463. </security>
  25464. </trustInfo>
  25465. <dependency>
  25466. <dependentAssembly>
  25467. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  25468. </dependentAssembly>
  25469. </dependency>
  25470. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  25471. namespace Symfony\Component\Console;
  25472. use Symfony\Component\Console\Descriptor\TextDescriptor;
  25473. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  25474. use Symfony\Component\Console\Exception\ExceptionInterface;
  25475. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  25476. use Symfony\Component\Console\Helper\ProcessHelper;
  25477. use Symfony\Component\Console\Helper\QuestionHelper;
  25478. use Symfony\Component\Console\Input\InputInterface;
  25479. use Symfony\Component\Console\Input\ArgvInput;
  25480. use Symfony\Component\Console\Input\ArrayInput;
  25481. use Symfony\Component\Console\Input\InputDefinition;
  25482. use Symfony\Component\Console\Input\InputOption;
  25483. use Symfony\Component\Console\Input\InputArgument;
  25484. use Symfony\Component\Console\Input\InputAwareInterface;
  25485. use Symfony\Component\Console\Output\BufferedOutput;
  25486. use Symfony\Component\Console\Output\OutputInterface;
  25487. use Symfony\Component\Console\Output\ConsoleOutput;
  25488. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  25489. use Symfony\Component\Console\Command\Command;
  25490. use Symfony\Component\Console\Command\HelpCommand;
  25491. use Symfony\Component\Console\Command\ListCommand;
  25492. use Symfony\Component\Console\Helper\HelperSet;
  25493. use Symfony\Component\Console\Helper\FormatterHelper;
  25494. use Symfony\Component\Console\Helper\DialogHelper;
  25495. use Symfony\Component\Console\Helper\ProgressHelper;
  25496. use Symfony\Component\Console\Helper\TableHelper;
  25497. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  25498. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  25499. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  25500. use Symfony\Component\Console\Exception\CommandNotFoundException;
  25501. use Symfony\Component\Console\Exception\LogicException;
  25502. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  25503. class Application
  25504. {
  25505. private $commands = array();
  25506. private $wantHelps = false;
  25507. private $runningCommand;
  25508. private $name;
  25509. private $version;
  25510. private $catchExceptions = true;
  25511. private $autoExit = true;
  25512. private $definition;
  25513. private $helperSet;
  25514. private $dispatcher;
  25515. private $terminalDimensions;
  25516. private $defaultCommand;
  25517. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  25518. {
  25519. $this->name = $name;
  25520. $this->version = $version;
  25521. $this->defaultCommand = 'list';
  25522. $this->helperSet = $this->getDefaultHelperSet();
  25523. $this->definition = $this->getDefaultInputDefinition();
  25524. foreach ($this->getDefaultCommands() as $command) {
  25525. $this->add($command);
  25526. }
  25527. }
  25528. public function setDispatcher(EventDispatcherInterface $dispatcher)
  25529. {
  25530. $this->dispatcher = $dispatcher;
  25531. }
  25532. public function run(InputInterface $input = null, OutputInterface $output = null)
  25533. {
  25534. if (null === $input) {
  25535. $input = new ArgvInput();
  25536. }
  25537. if (null === $output) {
  25538. $output = new ConsoleOutput();
  25539. }
  25540. $this->configureIO($input, $output);
  25541. try {
  25542. $exitCode = $this->doRun($input, $output);
  25543. } catch (\Exception $e) {
  25544. if (!$this->catchExceptions) {
  25545. throw $e;
  25546. }
  25547. if ($output instanceof ConsoleOutputInterface) {
  25548. $this->renderException($e, $output->getErrorOutput());
  25549. } else {
  25550. $this->renderException($e, $output);
  25551. }
  25552. $exitCode = $e->getCode();
  25553. if (is_numeric($exitCode)) {
  25554. $exitCode = (int) $exitCode;
  25555. if (0 === $exitCode) {
  25556. $exitCode = 1;
  25557. }
  25558. } else {
  25559. $exitCode = 1;
  25560. }
  25561. }
  25562. if ($this->autoExit) {
  25563. if ($exitCode > 255) {
  25564. $exitCode = 255;
  25565. }
  25566. exit($exitCode);
  25567. }
  25568. return $exitCode;
  25569. }
  25570. public function doRun(InputInterface $input, OutputInterface $output)
  25571. {
  25572. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  25573. $output->writeln($this->getLongVersion());
  25574. return 0;
  25575. }
  25576. $name = $this->getCommandName($input);
  25577. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  25578. if (!$name) {
  25579. $name = 'help';
  25580. $input = new ArrayInput(array('command' => 'help'));
  25581. } else {
  25582. $this->wantHelps = true;
  25583. }
  25584. }
  25585. if (!$name) {
  25586. $name = $this->defaultCommand;
  25587. $input = new ArrayInput(array('command' => $this->defaultCommand));
  25588. }
  25589. $command = $this->find($name);
  25590. $this->runningCommand = $command;
  25591. $exitCode = $this->doRunCommand($command, $input, $output);
  25592. $this->runningCommand = null;
  25593. return $exitCode;
  25594. }
  25595. public function setHelperSet(HelperSet $helperSet)
  25596. {
  25597. $this->helperSet = $helperSet;
  25598. }
  25599. public function getHelperSet()
  25600. {
  25601. return $this->helperSet;
  25602. }
  25603. public function setDefinition(InputDefinition $definition)
  25604. {
  25605. $this->definition = $definition;
  25606. }
  25607. public function getDefinition()
  25608. {
  25609. return $this->definition;
  25610. }
  25611. public function getHelp()
  25612. {
  25613. return $this->getLongVersion();
  25614. }
  25615. public function setCatchExceptions($boolean)
  25616. {
  25617. $this->catchExceptions = (bool) $boolean;
  25618. }
  25619. public function setAutoExit($boolean)
  25620. {
  25621. $this->autoExit = (bool) $boolean;
  25622. }
  25623. public function getName()
  25624. {
  25625. return $this->name;
  25626. }
  25627. public function setName($name)
  25628. {
  25629. $this->name = $name;
  25630. }
  25631. public function getVersion()
  25632. {
  25633. return $this->version;
  25634. }
  25635. public function setVersion($version)
  25636. {
  25637. $this->version = $version;
  25638. }
  25639. public function getLongVersion()
  25640. {
  25641. if ('UNKNOWN' !== $this->getName()) {
  25642. if ('UNKNOWN' !== $this->getVersion()) {
  25643. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  25644. }
  25645. return sprintf('<info>%s</info>', $this->getName());
  25646. }
  25647. return '<info>Console Tool</info>';
  25648. }
  25649. public function register($name)
  25650. {
  25651. return $this->add(new Command($name));
  25652. }
  25653. public function addCommands(array $commands)
  25654. {
  25655. foreach ($commands as $command) {
  25656. $this->add($command);
  25657. }
  25658. }
  25659. public function add(Command $command)
  25660. {
  25661. $command->setApplication($this);
  25662. if (!$command->isEnabled()) {
  25663. $command->setApplication(null);
  25664. return;
  25665. }
  25666. if (null === $command->getDefinition()) {
  25667. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
  25668. }
  25669. $this->commands[$command->getName()] = $command;
  25670. foreach ($command->getAliases() as $alias) {
  25671. $this->commands[$alias] = $command;
  25672. }
  25673. return $command;
  25674. }
  25675. public function get($name)
  25676. {
  25677. if (!isset($this->commands[$name])) {
  25678. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  25679. }
  25680. $command = $this->commands[$name];
  25681. if ($this->wantHelps) {
  25682. $this->wantHelps = false;
  25683. $helpCommand = $this->get('help');
  25684. $helpCommand->setCommand($command);
  25685. return $helpCommand;
  25686. }
  25687. return $command;
  25688. }
  25689. public function has($name)
  25690. {
  25691. return isset($this->commands[$name]);
  25692. }
  25693. public function getNamespaces()
  25694. {
  25695. $namespaces = array();
  25696. foreach ($this->commands as $command) {
  25697. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  25698. foreach ($command->getAliases() as $alias) {
  25699. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  25700. }
  25701. }
  25702. return array_values(array_unique(array_filter($namespaces)));
  25703. }
  25704. public function findNamespace($namespace)
  25705. {
  25706. $allNamespaces = $this->getNamespaces();
  25707. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  25708. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  25709. if (empty($namespaces)) {
  25710. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  25711. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  25712. if (1 == count($alternatives)) {
  25713. $message .= "\n\nDid you mean this?\n ";
  25714. } else {
  25715. $message .= "\n\nDid you mean one of these?\n ";
  25716. }
  25717. $message .= implode("\n ", $alternatives);
  25718. }
  25719. throw new CommandNotFoundException($message, $alternatives);
  25720. }
  25721. $exact = in_array($namespace, $namespaces, true);
  25722. if (count($namespaces) > 1 && !$exact) {
  25723. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  25724. }
  25725. return $exact ? $namespace : reset($namespaces);
  25726. }
  25727. public function find($name)
  25728. {
  25729. $allCommands = array_keys($this->commands);
  25730. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  25731. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  25732. if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  25733. if (false !== $pos = strrpos($name, ':')) {
  25734. $this->findNamespace(substr($name, 0, $pos));
  25735. }
  25736. $message = sprintf('Command "%s" is not defined.', $name);
  25737. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  25738. if (1 == count($alternatives)) {
  25739. $message .= "\n\nDid you mean this?\n ";
  25740. } else {
  25741. $message .= "\n\nDid you mean one of these?\n ";
  25742. }
  25743. $message .= implode("\n ", $alternatives);
  25744. }
  25745. throw new CommandNotFoundException($message, $alternatives);
  25746. }
  25747. if (count($commands) > 1) {
  25748. $commandList = $this->commands;
  25749. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
  25750. $commandName = $commandList[$nameOrAlias]->getName();
  25751. return $commandName === $nameOrAlias || !in_array($commandName, $commands);
  25752. });
  25753. }
  25754. $exact = in_array($name, $commands, true);
  25755. if (count($commands) > 1 && !$exact) {
  25756. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  25757. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  25758. }
  25759. return $this->get($exact ? $name : reset($commands));
  25760. }
  25761. public function all($namespace = null)
  25762. {
  25763. if (null === $namespace) {
  25764. return $this->commands;
  25765. }
  25766. $commands = array();
  25767. foreach ($this->commands as $name => $command) {
  25768. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  25769. $commands[$name] = $command;
  25770. }
  25771. }
  25772. return $commands;
  25773. }
  25774. public static function getAbbreviations($names)
  25775. {
  25776. $abbrevs = array();
  25777. foreach ($names as $name) {
  25778. for ($len = strlen($name); $len > 0; --$len) {
  25779. $abbrev = substr($name, 0, $len);
  25780. $abbrevs[$abbrev][] = $name;
  25781. }
  25782. }
  25783. return $abbrevs;
  25784. }
  25785. public function asText($namespace = null, $raw = false)
  25786. {
  25787. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  25788. $descriptor = new TextDescriptor();
  25789. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  25790. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  25791. return $output->fetch();
  25792. }
  25793. public function asXml($namespace = null, $asDom = false)
  25794. {
  25795. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  25796. $descriptor = new XmlDescriptor();
  25797. if ($asDom) {
  25798. return $descriptor->getApplicationDocument($this, $namespace);
  25799. }
  25800. $output = new BufferedOutput();
  25801. $descriptor->describe($output, $this, array('namespace' => $namespace));
  25802. return $output->fetch();
  25803. }
  25804. public function renderException($e, $output)
  25805. {
  25806. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  25807. do {
  25808. $title = sprintf(' [%s] ', get_class($e));
  25809. $len = $this->stringWidth($title);
  25810. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  25811. if (defined('HHVM_VERSION') && $width > 1 << 31) {
  25812. $width = 1 << 31;
  25813. }
  25814. $formatter = $output->getFormatter();
  25815. $lines = array();
  25816. foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) {
  25817. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  25818. $lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $formatter->format($line))) + 4;
  25819. $lines[] = array($line, $lineLength);
  25820. $len = max($lineLength, $len);
  25821. }
  25822. }
  25823. $messages = array();
  25824. $messages[] = $emptyLine = $formatter->format(sprintf('<error>%s</error>', str_repeat(' ', $len)));
  25825. $messages[] = $formatter->format(sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - $this->stringWidth($title)))));
  25826. foreach ($lines as $line) {
  25827. $messages[] = $formatter->format(sprintf('<error> %s %s</error>', $line[0], str_repeat(' ', $len - $line[1])));
  25828. }
  25829. $messages[] = $emptyLine;
  25830. $messages[] = '';
  25831. $output->writeln($messages, OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_QUIET);
  25832. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  25833. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  25834. $trace = $e->getTrace();
  25835. array_unshift($trace, array(
  25836. 'function' => '',
  25837. 'file' => $e->getFile() !== null ? $e->getFile() : 'n/a',
  25838. 'line' => $e->getLine() !== null ? $e->getLine() : 'n/a',
  25839. 'args' => array(),
  25840. ));
  25841. for ($i = 0, $count = count($trace); $i < $count; ++$i) {
  25842. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  25843. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  25844. $function = $trace[$i]['function'];
  25845. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  25846. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  25847. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  25848. }
  25849. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  25850. }
  25851. } while ($e = $e->getPrevious());
  25852. if (null !== $this->runningCommand) {
  25853. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  25854. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  25855. }
  25856. }
  25857. protected function getTerminalWidth()
  25858. {
  25859. $dimensions = $this->getTerminalDimensions();
  25860. return $dimensions[0];
  25861. }
  25862. protected function getTerminalHeight()
  25863. {
  25864. $dimensions = $this->getTerminalDimensions();
  25865. return $dimensions[1];
  25866. }
  25867. public function getTerminalDimensions()
  25868. {
  25869. if ($this->terminalDimensions) {
  25870. return $this->terminalDimensions;
  25871. }
  25872. if ('\\' === DIRECTORY_SEPARATOR) {
  25873. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  25874. return array((int) $matches[1], (int) $matches[2]);
  25875. }
  25876. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  25877. return array((int) $matches[1], (int) $matches[2]);
  25878. }
  25879. }
  25880. if ($sttyString = $this->getSttyColumns()) {
  25881. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  25882. return array((int) $matches[2], (int) $matches[1]);
  25883. }
  25884. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  25885. return array((int) $matches[2], (int) $matches[1]);
  25886. }
  25887. }
  25888. return array(null, null);
  25889. }
  25890. public function setTerminalDimensions($width, $height)
  25891. {
  25892. $this->terminalDimensions = array($width, $height);
  25893. return $this;
  25894. }
  25895. protected function configureIO(InputInterface $input, OutputInterface $output)
  25896. {
  25897. if (true === $input->hasParameterOption(array('--ansi'))) {
  25898. $output->setDecorated(true);
  25899. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  25900. $output->setDecorated(false);
  25901. }
  25902. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  25903. $input->setInteractive(false);
  25904. } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  25905. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  25906. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  25907. $input->setInteractive(false);
  25908. }
  25909. }
  25910. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  25911. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  25912. } else {
  25913. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
  25914. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  25915. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
  25916. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  25917. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  25918. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  25919. }
  25920. }
  25921. }
  25922. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  25923. {
  25924. foreach ($command->getHelperSet() as $helper) {
  25925. if ($helper instanceof InputAwareInterface) {
  25926. $helper->setInput($input);
  25927. }
  25928. }
  25929. if (null === $this->dispatcher) {
  25930. return $command->run($input, $output);
  25931. }
  25932. try {
  25933. $command->mergeApplicationDefinition();
  25934. $input->bind($command->getDefinition());
  25935. } catch (ExceptionInterface $e) {
  25936. }
  25937. $event = new ConsoleCommandEvent($command, $input, $output);
  25938. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  25939. if ($event->commandShouldRun()) {
  25940. try {
  25941. $exitCode = $command->run($input, $output);
  25942. } catch (\Exception $e) {
  25943. $event = new ConsoleExceptionEvent($command, $input, $output, $e, $e->getCode());
  25944. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  25945. $e = $event->getException();
  25946. $event = new ConsoleTerminateEvent($command, $input, $output, $e->getCode());
  25947. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  25948. throw $e;
  25949. }
  25950. } else {
  25951. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  25952. }
  25953. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  25954. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  25955. return $event->getExitCode();
  25956. }
  25957. protected function getCommandName(InputInterface $input)
  25958. {
  25959. return $input->getFirstArgument();
  25960. }
  25961. protected function getDefaultInputDefinition()
  25962. {
  25963. return new InputDefinition(array(
  25964. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  25965. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  25966. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  25967. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  25968. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  25969. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  25970. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  25971. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  25972. ));
  25973. }
  25974. protected function getDefaultCommands()
  25975. {
  25976. return array(new HelpCommand(), new ListCommand());
  25977. }
  25978. protected function getDefaultHelperSet()
  25979. {
  25980. return new HelperSet(array(
  25981. new FormatterHelper(),
  25982. new DialogHelper(false),
  25983. new ProgressHelper(false),
  25984. new TableHelper(false),
  25985. new DebugFormatterHelper(),
  25986. new ProcessHelper(),
  25987. new QuestionHelper(),
  25988. ));
  25989. }
  25990. private function getSttyColumns()
  25991. {
  25992. if (!function_exists('proc_open')) {
  25993. return;
  25994. }
  25995. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  25996. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  25997. if (is_resource($process)) {
  25998. $info = stream_get_contents($pipes[1]);
  25999. fclose($pipes[1]);
  26000. fclose($pipes[2]);
  26001. proc_close($process);
  26002. return $info;
  26003. }
  26004. }
  26005. private function getConsoleMode()
  26006. {
  26007. if (!function_exists('proc_open')) {
  26008. return;
  26009. }
  26010. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  26011. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  26012. if (is_resource($process)) {
  26013. $info = stream_get_contents($pipes[1]);
  26014. fclose($pipes[1]);
  26015. fclose($pipes[2]);
  26016. proc_close($process);
  26017. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  26018. return $matches[2].'x'.$matches[1];
  26019. }
  26020. }
  26021. }
  26022. private function getAbbreviationSuggestions($abbrevs)
  26023. {
  26024. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
  26025. }
  26026. public function extractNamespace($name, $limit = null)
  26027. {
  26028. $parts = explode(':', $name);
  26029. array_pop($parts);
  26030. return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
  26031. }
  26032. private function findAlternatives($name, $collection)
  26033. {
  26034. $threshold = 1e3;
  26035. $alternatives = array();
  26036. $collectionParts = array();
  26037. foreach ($collection as $item) {
  26038. $collectionParts[$item] = explode(':', $item);
  26039. }
  26040. foreach (explode(':', $name) as $i => $subname) {
  26041. foreach ($collectionParts as $collectionName => $parts) {
  26042. $exists = isset($alternatives[$collectionName]);
  26043. if (!isset($parts[$i]) && $exists) {
  26044. $alternatives[$collectionName] += $threshold;
  26045. continue;
  26046. } elseif (!isset($parts[$i])) {
  26047. continue;
  26048. }
  26049. $lev = levenshtein($subname, $parts[$i]);
  26050. if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  26051. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  26052. } elseif ($exists) {
  26053. $alternatives[$collectionName] += $threshold;
  26054. }
  26055. }
  26056. }
  26057. foreach ($collection as $item) {
  26058. $lev = levenshtein($name, $item);
  26059. if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
  26060. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  26061. }
  26062. }
  26063. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  26064. asort($alternatives);
  26065. return array_keys($alternatives);
  26066. }
  26067. public function setDefaultCommand($commandName)
  26068. {
  26069. $this->defaultCommand = $commandName;
  26070. }
  26071. private function stringWidth($string)
  26072. {
  26073. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  26074. return strlen($string);
  26075. }
  26076. return mb_strwidth($string, $encoding);
  26077. }
  26078. private function splitStringByWidth($string, $width)
  26079. {
  26080. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  26081. return str_split($string, $width);
  26082. }
  26083. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  26084. $lines = array();
  26085. $line = '';
  26086. foreach (preg_split('//u', $utf8String) as $char) {
  26087. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  26088. $line .= $char;
  26089. continue;
  26090. }
  26091. $lines[] = str_pad($line, $width);
  26092. $line = $char;
  26093. }
  26094. if ('' !== $line) {
  26095. $lines[] = count($lines) ? str_pad($line, $width) : $line;
  26096. }
  26097. mb_convert_variables($encoding, 'utf8', $lines);
  26098. return $lines;
  26099. }
  26100. private function extractAllNamespaces($name)
  26101. {
  26102. $parts = explode(':', $name, -1);
  26103. $namespaces = array();
  26104. foreach ($parts as $part) {
  26105. if (count($namespaces)) {
  26106. $namespaces[] = end($namespaces).':'.$part;
  26107. } else {
  26108. $namespaces[] = $part;
  26109. }
  26110. }
  26111. return $namespaces;
  26112. }
  26113. }
  26114. <?php
  26115. namespace Symfony\Component\Console\Command;
  26116. use Symfony\Component\Console\Descriptor\TextDescriptor;
  26117. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  26118. use Symfony\Component\Console\Exception\ExceptionInterface;
  26119. use Symfony\Component\Console\Input\InputDefinition;
  26120. use Symfony\Component\Console\Input\InputOption;
  26121. use Symfony\Component\Console\Input\InputArgument;
  26122. use Symfony\Component\Console\Input\InputInterface;
  26123. use Symfony\Component\Console\Output\BufferedOutput;
  26124. use Symfony\Component\Console\Output\OutputInterface;
  26125. use Symfony\Component\Console\Application;
  26126. use Symfony\Component\Console\Helper\HelperSet;
  26127. use Symfony\Component\Console\Exception\InvalidArgumentException;
  26128. use Symfony\Component\Console\Exception\LogicException;
  26129. class Command
  26130. {
  26131. private $application;
  26132. private $name;
  26133. private $processTitle;
  26134. private $aliases = array();
  26135. private $definition;
  26136. private $help;
  26137. private $description;
  26138. private $ignoreValidationErrors = false;
  26139. private $applicationDefinitionMerged = false;
  26140. private $applicationDefinitionMergedWithArgs = false;
  26141. private $code;
  26142. private $synopsis = array();
  26143. private $usages = array();
  26144. private $helperSet;
  26145. public function __construct($name = null)
  26146. {
  26147. $this->definition = new InputDefinition();
  26148. if (null !== $name) {
  26149. $this->setName($name);
  26150. }
  26151. $this->configure();
  26152. if (!$this->name) {
  26153. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
  26154. }
  26155. }
  26156. public function ignoreValidationErrors()
  26157. {
  26158. $this->ignoreValidationErrors = true;
  26159. }
  26160. public function setApplication(Application $application = null)
  26161. {
  26162. $this->application = $application;
  26163. if ($application) {
  26164. $this->setHelperSet($application->getHelperSet());
  26165. } else {
  26166. $this->helperSet = null;
  26167. }
  26168. }
  26169. public function setHelperSet(HelperSet $helperSet)
  26170. {
  26171. $this->helperSet = $helperSet;
  26172. }
  26173. public function getHelperSet()
  26174. {
  26175. return $this->helperSet;
  26176. }
  26177. public function getApplication()
  26178. {
  26179. return $this->application;
  26180. }
  26181. public function isEnabled()
  26182. {
  26183. return true;
  26184. }
  26185. protected function configure()
  26186. {
  26187. }
  26188. protected function execute(InputInterface $input, OutputInterface $output)
  26189. {
  26190. throw new LogicException('You must override the execute() method in the concrete command class.');
  26191. }
  26192. protected function interact(InputInterface $input, OutputInterface $output)
  26193. {
  26194. }
  26195. protected function initialize(InputInterface $input, OutputInterface $output)
  26196. {
  26197. }
  26198. public function run(InputInterface $input, OutputInterface $output)
  26199. {
  26200. $this->getSynopsis(true);
  26201. $this->getSynopsis(false);
  26202. $this->mergeApplicationDefinition();
  26203. try {
  26204. $input->bind($this->definition);
  26205. } catch (ExceptionInterface $e) {
  26206. if (!$this->ignoreValidationErrors) {
  26207. throw $e;
  26208. }
  26209. }
  26210. $this->initialize($input, $output);
  26211. if (null !== $this->processTitle) {
  26212. if (function_exists('cli_set_process_title')) {
  26213. cli_set_process_title($this->processTitle);
  26214. } elseif (function_exists('setproctitle')) {
  26215. setproctitle($this->processTitle);
  26216. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  26217. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  26218. }
  26219. }
  26220. if ($input->isInteractive()) {
  26221. $this->interact($input, $output);
  26222. }
  26223. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  26224. $input->setArgument('command', $this->getName());
  26225. }
  26226. $input->validate();
  26227. if ($this->code) {
  26228. $statusCode = call_user_func($this->code, $input, $output);
  26229. } else {
  26230. $statusCode = $this->execute($input, $output);
  26231. }
  26232. return is_numeric($statusCode) ? (int) $statusCode : 0;
  26233. }
  26234. public function setCode($code)
  26235. {
  26236. if (!is_callable($code)) {
  26237. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  26238. }
  26239. if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  26240. $r = new \ReflectionFunction($code);
  26241. if (null === $r->getClosureThis()) {
  26242. $code = \Closure::bind($code, $this);
  26243. }
  26244. }
  26245. $this->code = $code;
  26246. return $this;
  26247. }
  26248. public function mergeApplicationDefinition($mergeArgs = true)
  26249. {
  26250. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  26251. return;
  26252. }
  26253. if ($mergeArgs) {
  26254. $currentArguments = $this->definition->getArguments();
  26255. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  26256. $this->definition->addArguments($currentArguments);
  26257. }
  26258. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  26259. $this->applicationDefinitionMerged = true;
  26260. if ($mergeArgs) {
  26261. $this->applicationDefinitionMergedWithArgs = true;
  26262. }
  26263. }
  26264. public function setDefinition($definition)
  26265. {
  26266. if ($definition instanceof InputDefinition) {
  26267. $this->definition = $definition;
  26268. } else {
  26269. $this->definition->setDefinition($definition);
  26270. }
  26271. $this->applicationDefinitionMerged = false;
  26272. return $this;
  26273. }
  26274. public function getDefinition()
  26275. {
  26276. return $this->definition;
  26277. }
  26278. public function getNativeDefinition()
  26279. {
  26280. return $this->getDefinition();
  26281. }
  26282. public function addArgument($name, $mode = null, $description = '', $default = null)
  26283. {
  26284. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  26285. return $this;
  26286. }
  26287. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  26288. {
  26289. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  26290. return $this;
  26291. }
  26292. public function setName($name)
  26293. {
  26294. $this->validateName($name);
  26295. $this->name = $name;
  26296. return $this;
  26297. }
  26298. public function setProcessTitle($title)
  26299. {
  26300. $this->processTitle = $title;
  26301. return $this;
  26302. }
  26303. public function getName()
  26304. {
  26305. return $this->name;
  26306. }
  26307. public function setDescription($description)
  26308. {
  26309. $this->description = $description;
  26310. return $this;
  26311. }
  26312. public function getDescription()
  26313. {
  26314. return $this->description;
  26315. }
  26316. public function setHelp($help)
  26317. {
  26318. $this->help = $help;
  26319. return $this;
  26320. }
  26321. public function getHelp()
  26322. {
  26323. return $this->help;
  26324. }
  26325. public function getProcessedHelp()
  26326. {
  26327. $name = $this->name;
  26328. $placeholders = array(
  26329. '%command.name%',
  26330. '%command.full_name%',
  26331. );
  26332. $replacements = array(
  26333. $name,
  26334. $_SERVER['PHP_SELF'].' '.$name,
  26335. );
  26336. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  26337. }
  26338. public function setAliases($aliases)
  26339. {
  26340. if (!is_array($aliases) && !$aliases instanceof \Traversable) {
  26341. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  26342. }
  26343. foreach ($aliases as $alias) {
  26344. $this->validateName($alias);
  26345. }
  26346. $this->aliases = $aliases;
  26347. return $this;
  26348. }
  26349. public function getAliases()
  26350. {
  26351. return $this->aliases;
  26352. }
  26353. public function getSynopsis($short = false)
  26354. {
  26355. $key = $short ? 'short' : 'long';
  26356. if (!isset($this->synopsis[$key])) {
  26357. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  26358. }
  26359. return $this->synopsis[$key];
  26360. }
  26361. public function addUsage($usage)
  26362. {
  26363. if (0 !== strpos($usage, $this->name)) {
  26364. $usage = sprintf('%s %s', $this->name, $usage);
  26365. }
  26366. $this->usages[] = $usage;
  26367. return $this;
  26368. }
  26369. public function getUsages()
  26370. {
  26371. return $this->usages;
  26372. }
  26373. public function getHelper($name)
  26374. {
  26375. return $this->helperSet->get($name);
  26376. }
  26377. public function asText()
  26378. {
  26379. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  26380. $descriptor = new TextDescriptor();
  26381. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  26382. $descriptor->describe($output, $this, array('raw_output' => true));
  26383. return $output->fetch();
  26384. }
  26385. public function asXml($asDom = false)
  26386. {
  26387. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  26388. $descriptor = new XmlDescriptor();
  26389. if ($asDom) {
  26390. return $descriptor->getCommandDocument($this);
  26391. }
  26392. $output = new BufferedOutput();
  26393. $descriptor->describe($output, $this);
  26394. return $output->fetch();
  26395. }
  26396. private function validateName($name)
  26397. {
  26398. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  26399. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  26400. }
  26401. }
  26402. }
  26403. <?php
  26404. namespace Symfony\Component\Console\Command;
  26405. use Symfony\Component\Console\Helper\DescriptorHelper;
  26406. use Symfony\Component\Console\Input\InputArgument;
  26407. use Symfony\Component\Console\Input\InputOption;
  26408. use Symfony\Component\Console\Input\InputInterface;
  26409. use Symfony\Component\Console\Output\OutputInterface;
  26410. class HelpCommand extends Command
  26411. {
  26412. private $command;
  26413. protected function configure()
  26414. {
  26415. $this->ignoreValidationErrors();
  26416. $this
  26417. ->setName('help')
  26418. ->setDefinition(array(
  26419. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  26420. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  26421. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  26422. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  26423. ))
  26424. ->setDescription('Displays help for a command')
  26425. ->setHelp(<<<'EOF'
  26426. The <info>%command.name%</info> command displays help for a given command:
  26427. <info>php %command.full_name% list</info>
  26428. You can also output the help in other formats by using the <comment>--format</comment> option:
  26429. <info>php %command.full_name% --format=xml list</info>
  26430. To display the list of available commands, please use the <info>list</info> command.
  26431. EOF
  26432. )
  26433. ;
  26434. }
  26435. public function setCommand(Command $command)
  26436. {
  26437. $this->command = $command;
  26438. }
  26439. protected function execute(InputInterface $input, OutputInterface $output)
  26440. {
  26441. if (null === $this->command) {
  26442. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  26443. }
  26444. if ($input->getOption('xml')) {
  26445. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  26446. $input->setOption('format', 'xml');
  26447. }
  26448. $helper = new DescriptorHelper();
  26449. $helper->describe($output, $this->command, array(
  26450. 'format' => $input->getOption('format'),
  26451. 'raw_text' => $input->getOption('raw'),
  26452. ));
  26453. $this->command = null;
  26454. }
  26455. }
  26456. <?php
  26457. namespace Symfony\Component\Console\Command;
  26458. use Symfony\Component\Console\Helper\DescriptorHelper;
  26459. use Symfony\Component\Console\Input\InputArgument;
  26460. use Symfony\Component\Console\Input\InputOption;
  26461. use Symfony\Component\Console\Input\InputInterface;
  26462. use Symfony\Component\Console\Output\OutputInterface;
  26463. use Symfony\Component\Console\Input\InputDefinition;
  26464. class ListCommand extends Command
  26465. {
  26466. protected function configure()
  26467. {
  26468. $this
  26469. ->setName('list')
  26470. ->setDefinition($this->createDefinition())
  26471. ->setDescription('Lists commands')
  26472. ->setHelp(<<<'EOF'
  26473. The <info>%command.name%</info> command lists all commands:
  26474. <info>php %command.full_name%</info>
  26475. You can also display the commands for a specific namespace:
  26476. <info>php %command.full_name% test</info>
  26477. You can also output the information in other formats by using the <comment>--format</comment> option:
  26478. <info>php %command.full_name% --format=xml</info>
  26479. It's also possible to get raw list of commands (useful for embedding command runner):
  26480. <info>php %command.full_name% --raw</info>
  26481. EOF
  26482. )
  26483. ;
  26484. }
  26485. public function getNativeDefinition()
  26486. {
  26487. return $this->createDefinition();
  26488. }
  26489. protected function execute(InputInterface $input, OutputInterface $output)
  26490. {
  26491. if ($input->getOption('xml')) {
  26492. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  26493. $input->setOption('format', 'xml');
  26494. }
  26495. $helper = new DescriptorHelper();
  26496. $helper->describe($output, $this->getApplication(), array(
  26497. 'format' => $input->getOption('format'),
  26498. 'raw_text' => $input->getOption('raw'),
  26499. 'namespace' => $input->getArgument('namespace'),
  26500. ));
  26501. }
  26502. private function createDefinition()
  26503. {
  26504. return new InputDefinition(array(
  26505. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  26506. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  26507. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  26508. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  26509. ));
  26510. }
  26511. }
  26512. <?php
  26513. namespace Symfony\Component\Console;
  26514. final class ConsoleEvents
  26515. {
  26516. const COMMAND = 'console.command';
  26517. const TERMINATE = 'console.terminate';
  26518. const EXCEPTION = 'console.exception';
  26519. }
  26520. <?php
  26521. namespace Symfony\Component\Console\Descriptor;
  26522. use Symfony\Component\Console\Application;
  26523. use Symfony\Component\Console\Command\Command;
  26524. use Symfony\Component\Console\Exception\CommandNotFoundException;
  26525. class ApplicationDescription
  26526. {
  26527. const GLOBAL_NAMESPACE = '_global';
  26528. private $application;
  26529. private $namespace;
  26530. private $namespaces;
  26531. private $commands;
  26532. private $aliases;
  26533. public function __construct(Application $application, $namespace = null)
  26534. {
  26535. $this->application = $application;
  26536. $this->namespace = $namespace;
  26537. }
  26538. public function getNamespaces()
  26539. {
  26540. if (null === $this->namespaces) {
  26541. $this->inspectApplication();
  26542. }
  26543. return $this->namespaces;
  26544. }
  26545. public function getCommands()
  26546. {
  26547. if (null === $this->commands) {
  26548. $this->inspectApplication();
  26549. }
  26550. return $this->commands;
  26551. }
  26552. public function getCommand($name)
  26553. {
  26554. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  26555. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  26556. }
  26557. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  26558. }
  26559. private function inspectApplication()
  26560. {
  26561. $this->commands = array();
  26562. $this->namespaces = array();
  26563. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  26564. foreach ($this->sortCommands($all) as $namespace => $commands) {
  26565. $names = array();
  26566. foreach ($commands as $name => $command) {
  26567. if (!$command->getName()) {
  26568. continue;
  26569. }
  26570. if ($command->getName() === $name) {
  26571. $this->commands[$name] = $command;
  26572. } else {
  26573. $this->aliases[$name] = $command;
  26574. }
  26575. $names[] = $name;
  26576. }
  26577. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  26578. }
  26579. }
  26580. private function sortCommands(array $commands)
  26581. {
  26582. $namespacedCommands = array();
  26583. $globalCommands = array();
  26584. foreach ($commands as $name => $command) {
  26585. $key = $this->application->extractNamespace($name, 1);
  26586. if (!$key) {
  26587. $globalCommands['_global'][$name] = $command;
  26588. } else {
  26589. $namespacedCommands[$key][$name] = $command;
  26590. }
  26591. }
  26592. ksort($namespacedCommands);
  26593. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  26594. foreach ($namespacedCommands as &$commandsSet) {
  26595. ksort($commandsSet);
  26596. }
  26597. unset($commandsSet);
  26598. return $namespacedCommands;
  26599. }
  26600. }
  26601. <?php
  26602. namespace Symfony\Component\Console\Descriptor;
  26603. use Symfony\Component\Console\Application;
  26604. use Symfony\Component\Console\Command\Command;
  26605. use Symfony\Component\Console\Input\InputArgument;
  26606. use Symfony\Component\Console\Input\InputDefinition;
  26607. use Symfony\Component\Console\Input\InputOption;
  26608. use Symfony\Component\Console\Output\OutputInterface;
  26609. use Symfony\Component\Console\Exception\InvalidArgumentException;
  26610. abstract class Descriptor implements DescriptorInterface
  26611. {
  26612. private $output;
  26613. public function describe(OutputInterface $output, $object, array $options = array())
  26614. {
  26615. $this->output = $output;
  26616. switch (true) {
  26617. case $object instanceof InputArgument:
  26618. $this->describeInputArgument($object, $options);
  26619. break;
  26620. case $object instanceof InputOption:
  26621. $this->describeInputOption($object, $options);
  26622. break;
  26623. case $object instanceof InputDefinition:
  26624. $this->describeInputDefinition($object, $options);
  26625. break;
  26626. case $object instanceof Command:
  26627. $this->describeCommand($object, $options);
  26628. break;
  26629. case $object instanceof Application:
  26630. $this->describeApplication($object, $options);
  26631. break;
  26632. default:
  26633. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
  26634. }
  26635. }
  26636. protected function write($content, $decorated = false)
  26637. {
  26638. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  26639. }
  26640. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  26641. abstract protected function describeInputOption(InputOption $option, array $options = array());
  26642. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  26643. abstract protected function describeCommand(Command $command, array $options = array());
  26644. abstract protected function describeApplication(Application $application, array $options = array());
  26645. }
  26646. <?php
  26647. namespace Symfony\Component\Console\Descriptor;
  26648. use Symfony\Component\Console\Output\OutputInterface;
  26649. interface DescriptorInterface
  26650. {
  26651. public function describe(OutputInterface $output, $object, array $options = array());
  26652. }
  26653. <?php
  26654. namespace Symfony\Component\Console\Descriptor;
  26655. use Symfony\Component\Console\Application;
  26656. use Symfony\Component\Console\Command\Command;
  26657. use Symfony\Component\Console\Input\InputArgument;
  26658. use Symfony\Component\Console\Input\InputDefinition;
  26659. use Symfony\Component\Console\Input\InputOption;
  26660. class JsonDescriptor extends Descriptor
  26661. {
  26662. protected function describeInputArgument(InputArgument $argument, array $options = array())
  26663. {
  26664. $this->writeData($this->getInputArgumentData($argument), $options);
  26665. }
  26666. protected function describeInputOption(InputOption $option, array $options = array())
  26667. {
  26668. $this->writeData($this->getInputOptionData($option), $options);
  26669. }
  26670. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  26671. {
  26672. $this->writeData($this->getInputDefinitionData($definition), $options);
  26673. }
  26674. protected function describeCommand(Command $command, array $options = array())
  26675. {
  26676. $this->writeData($this->getCommandData($command), $options);
  26677. }
  26678. protected function describeApplication(Application $application, array $options = array())
  26679. {
  26680. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  26681. $description = new ApplicationDescription($application, $describedNamespace);
  26682. $commands = array();
  26683. foreach ($description->getCommands() as $command) {
  26684. $commands[] = $this->getCommandData($command);
  26685. }
  26686. $data = $describedNamespace
  26687. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  26688. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  26689. $this->writeData($data, $options);
  26690. }
  26691. private function writeData(array $data, array $options)
  26692. {
  26693. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  26694. }
  26695. private function getInputArgumentData(InputArgument $argument)
  26696. {
  26697. return array(
  26698. 'name' => $argument->getName(),
  26699. 'is_required' => $argument->isRequired(),
  26700. 'is_array' => $argument->isArray(),
  26701. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  26702. 'default' => $argument->getDefault(),
  26703. );
  26704. }
  26705. private function getInputOptionData(InputOption $option)
  26706. {
  26707. return array(
  26708. 'name' => '--'.$option->getName(),
  26709. 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
  26710. 'accept_value' => $option->acceptValue(),
  26711. 'is_value_required' => $option->isValueRequired(),
  26712. 'is_multiple' => $option->isArray(),
  26713. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  26714. 'default' => $option->getDefault(),
  26715. );
  26716. }
  26717. private function getInputDefinitionData(InputDefinition $definition)
  26718. {
  26719. $inputArguments = array();
  26720. foreach ($definition->getArguments() as $name => $argument) {
  26721. $inputArguments[$name] = $this->getInputArgumentData($argument);
  26722. }
  26723. $inputOptions = array();
  26724. foreach ($definition->getOptions() as $name => $option) {
  26725. $inputOptions[$name] = $this->getInputOptionData($option);
  26726. }
  26727. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  26728. }
  26729. private function getCommandData(Command $command)
  26730. {
  26731. $command->getSynopsis();
  26732. $command->mergeApplicationDefinition(false);
  26733. return array(
  26734. 'name' => $command->getName(),
  26735. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  26736. 'description' => $command->getDescription(),
  26737. 'help' => $command->getProcessedHelp(),
  26738. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  26739. );
  26740. }
  26741. }
  26742. <?php
  26743. namespace Symfony\Component\Console\Descriptor;
  26744. use Symfony\Component\Console\Application;
  26745. use Symfony\Component\Console\Command\Command;
  26746. use Symfony\Component\Console\Input\InputArgument;
  26747. use Symfony\Component\Console\Input\InputDefinition;
  26748. use Symfony\Component\Console\Input\InputOption;
  26749. class MarkdownDescriptor extends Descriptor
  26750. {
  26751. protected function describeInputArgument(InputArgument $argument, array $options = array())
  26752. {
  26753. $this->write(
  26754. '**'.$argument->getName().':**'."\n\n"
  26755. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  26756. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  26757. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  26758. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  26759. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  26760. );
  26761. }
  26762. protected function describeInputOption(InputOption $option, array $options = array())
  26763. {
  26764. $this->write(
  26765. '**'.$option->getName().':**'."\n\n"
  26766. .'* Name: `--'.$option->getName().'`'."\n"
  26767. .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
  26768. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  26769. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  26770. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  26771. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  26772. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  26773. );
  26774. }
  26775. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  26776. {
  26777. if ($showArguments = count($definition->getArguments()) > 0) {
  26778. $this->write('### Arguments:');
  26779. foreach ($definition->getArguments() as $argument) {
  26780. $this->write("\n\n");
  26781. $this->write($this->describeInputArgument($argument));
  26782. }
  26783. }
  26784. if (count($definition->getOptions()) > 0) {
  26785. if ($showArguments) {
  26786. $this->write("\n\n");
  26787. }
  26788. $this->write('### Options:');
  26789. foreach ($definition->getOptions() as $option) {
  26790. $this->write("\n\n");
  26791. $this->write($this->describeInputOption($option));
  26792. }
  26793. }
  26794. }
  26795. protected function describeCommand(Command $command, array $options = array())
  26796. {
  26797. $command->getSynopsis();
  26798. $command->mergeApplicationDefinition(false);
  26799. $this->write(
  26800. $command->getName()."\n"
  26801. .str_repeat('-', strlen($command->getName()))."\n\n"
  26802. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  26803. .'* Usage:'."\n\n"
  26804. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  26805. return $carry .= ' * `'.$usage.'`'."\n";
  26806. })
  26807. );
  26808. if ($help = $command->getProcessedHelp()) {
  26809. $this->write("\n");
  26810. $this->write($help);
  26811. }
  26812. if ($command->getNativeDefinition()) {
  26813. $this->write("\n\n");
  26814. $this->describeInputDefinition($command->getNativeDefinition());
  26815. }
  26816. }
  26817. protected function describeApplication(Application $application, array $options = array())
  26818. {
  26819. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  26820. $description = new ApplicationDescription($application, $describedNamespace);
  26821. $this->write($application->getName()."\n".str_repeat('=', strlen($application->getName())));
  26822. foreach ($description->getNamespaces() as $namespace) {
  26823. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  26824. $this->write("\n\n");
  26825. $this->write('**'.$namespace['id'].':**');
  26826. }
  26827. $this->write("\n\n");
  26828. $this->write(implode("\n", array_map(function ($commandName) {
  26829. return '* '.$commandName;
  26830. }, $namespace['commands'])));
  26831. }
  26832. foreach ($description->getCommands() as $command) {
  26833. $this->write("\n\n");
  26834. $this->write($this->describeCommand($command));
  26835. }
  26836. }
  26837. }
  26838. <?php
  26839. namespace Symfony\Component\Console\Descriptor;
  26840. use Symfony\Component\Console\Application;
  26841. use Symfony\Component\Console\Command\Command;
  26842. use Symfony\Component\Console\Input\InputArgument;
  26843. use Symfony\Component\Console\Input\InputDefinition;
  26844. use Symfony\Component\Console\Input\InputOption;
  26845. class TextDescriptor extends Descriptor
  26846. {
  26847. protected function describeInputArgument(InputArgument $argument, array $options = array())
  26848. {
  26849. if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
  26850. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  26851. } else {
  26852. $default = '';
  26853. }
  26854. $totalWidth = isset($options['total_width']) ? $options['total_width'] : strlen($argument->getName());
  26855. $spacingWidth = $totalWidth - strlen($argument->getName()) + 2;
  26856. $this->writeText(sprintf(' <info>%s</info>%s%s%s',
  26857. $argument->getName(),
  26858. str_repeat(' ', $spacingWidth),
  26859. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 17), $argument->getDescription()),
  26860. $default
  26861. ), $options);
  26862. }
  26863. protected function describeInputOption(InputOption $option, array $options = array())
  26864. {
  26865. if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
  26866. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  26867. } else {
  26868. $default = '';
  26869. }
  26870. $value = '';
  26871. if ($option->acceptValue()) {
  26872. $value = '='.strtoupper($option->getName());
  26873. if ($option->isValueOptional()) {
  26874. $value = '['.$value.']';
  26875. }
  26876. }
  26877. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  26878. $synopsis = sprintf('%s%s',
  26879. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  26880. sprintf('--%s%s', $option->getName(), $value)
  26881. );
  26882. $spacingWidth = $totalWidth - strlen($synopsis) + 2;
  26883. $this->writeText(sprintf(' <info>%s</info>%s%s%s%s',
  26884. $synopsis,
  26885. str_repeat(' ', $spacingWidth),
  26886. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 17), $option->getDescription()),
  26887. $default,
  26888. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  26889. ), $options);
  26890. }
  26891. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  26892. {
  26893. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  26894. foreach ($definition->getArguments() as $argument) {
  26895. $totalWidth = max($totalWidth, strlen($argument->getName()));
  26896. }
  26897. if ($definition->getArguments()) {
  26898. $this->writeText('<comment>Arguments:</comment>', $options);
  26899. $this->writeText("\n");
  26900. foreach ($definition->getArguments() as $argument) {
  26901. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  26902. $this->writeText("\n");
  26903. }
  26904. }
  26905. if ($definition->getArguments() && $definition->getOptions()) {
  26906. $this->writeText("\n");
  26907. }
  26908. if ($definition->getOptions()) {
  26909. $laterOptions = array();
  26910. $this->writeText('<comment>Options:</comment>', $options);
  26911. foreach ($definition->getOptions() as $option) {
  26912. if (strlen($option->getShortcut()) > 1) {
  26913. $laterOptions[] = $option;
  26914. continue;
  26915. }
  26916. $this->writeText("\n");
  26917. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  26918. }
  26919. foreach ($laterOptions as $option) {
  26920. $this->writeText("\n");
  26921. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  26922. }
  26923. }
  26924. }
  26925. protected function describeCommand(Command $command, array $options = array())
  26926. {
  26927. $command->getSynopsis(true);
  26928. $command->getSynopsis(false);
  26929. $command->mergeApplicationDefinition(false);
  26930. $this->writeText('<comment>Usage:</comment>', $options);
  26931. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  26932. $this->writeText("\n");
  26933. $this->writeText(' '.$usage, $options);
  26934. }
  26935. $this->writeText("\n");
  26936. $definition = $command->getNativeDefinition();
  26937. if ($definition->getOptions() || $definition->getArguments()) {
  26938. $this->writeText("\n");
  26939. $this->describeInputDefinition($definition, $options);
  26940. $this->writeText("\n");
  26941. }
  26942. if ($help = $command->getProcessedHelp()) {
  26943. $this->writeText("\n");
  26944. $this->writeText('<comment>Help:</comment>', $options);
  26945. $this->writeText("\n");
  26946. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  26947. $this->writeText("\n");
  26948. }
  26949. }
  26950. protected function describeApplication(Application $application, array $options = array())
  26951. {
  26952. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  26953. $description = new ApplicationDescription($application, $describedNamespace);
  26954. if (isset($options['raw_text']) && $options['raw_text']) {
  26955. $width = $this->getColumnWidth($description->getCommands());
  26956. foreach ($description->getCommands() as $command) {
  26957. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  26958. $this->writeText("\n");
  26959. }
  26960. } else {
  26961. if ('' != $help = $application->getHelp()) {
  26962. $this->writeText("$help\n\n", $options);
  26963. }
  26964. $this->writeText("<comment>Usage:</comment>\n", $options);
  26965. $this->writeText(" command [options] [arguments]\n\n", $options);
  26966. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  26967. $this->writeText("\n");
  26968. $this->writeText("\n");
  26969. $width = $this->getColumnWidth($description->getCommands());
  26970. if ($describedNamespace) {
  26971. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  26972. } else {
  26973. $this->writeText('<comment>Available commands:</comment>', $options);
  26974. }
  26975. foreach ($description->getNamespaces() as $namespace) {
  26976. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  26977. $this->writeText("\n");
  26978. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  26979. }
  26980. foreach ($namespace['commands'] as $name) {
  26981. $this->writeText("\n");
  26982. $spacingWidth = $width - strlen($name);
  26983. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  26984. }
  26985. }
  26986. $this->writeText("\n");
  26987. }
  26988. }
  26989. private function writeText($content, array $options = array())
  26990. {
  26991. $this->write(
  26992. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  26993. isset($options['raw_output']) ? !$options['raw_output'] : true
  26994. );
  26995. }
  26996. private function formatDefaultValue($default)
  26997. {
  26998. if (PHP_VERSION_ID < 50400) {
  26999. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  27000. }
  27001. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  27002. }
  27003. private function getColumnWidth(array $commands)
  27004. {
  27005. $widths = array();
  27006. foreach ($commands as $command) {
  27007. $widths[] = strlen($command->getName());
  27008. foreach ($command->getAliases() as $alias) {
  27009. $widths[] = strlen($alias);
  27010. }
  27011. }
  27012. return max($widths) + 2;
  27013. }
  27014. private function calculateTotalWidthForOptions($options)
  27015. {
  27016. $totalWidth = 0;
  27017. foreach ($options as $option) {
  27018. $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + strlen($option->getName());
  27019. if ($option->acceptValue()) {
  27020. $valueLength = 1 + strlen($option->getName());
  27021. $valueLength += $option->isValueOptional() ? 2 : 0;
  27022. $nameLength += $valueLength;
  27023. }
  27024. $totalWidth = max($totalWidth, $nameLength);
  27025. }
  27026. return $totalWidth;
  27027. }
  27028. }
  27029. <?php
  27030. namespace Symfony\Component\Console\Descriptor;
  27031. use Symfony\Component\Console\Application;
  27032. use Symfony\Component\Console\Command\Command;
  27033. use Symfony\Component\Console\Input\InputArgument;
  27034. use Symfony\Component\Console\Input\InputDefinition;
  27035. use Symfony\Component\Console\Input\InputOption;
  27036. class XmlDescriptor extends Descriptor
  27037. {
  27038. public function getInputDefinitionDocument(InputDefinition $definition)
  27039. {
  27040. $dom = new \DOMDocument('1.0', 'UTF-8');
  27041. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  27042. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  27043. foreach ($definition->getArguments() as $argument) {
  27044. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  27045. }
  27046. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  27047. foreach ($definition->getOptions() as $option) {
  27048. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  27049. }
  27050. return $dom;
  27051. }
  27052. public function getCommandDocument(Command $command)
  27053. {
  27054. $dom = new \DOMDocument('1.0', 'UTF-8');
  27055. $dom->appendChild($commandXML = $dom->createElement('command'));
  27056. $command->getSynopsis();
  27057. $command->mergeApplicationDefinition(false);
  27058. $commandXML->setAttribute('id', $command->getName());
  27059. $commandXML->setAttribute('name', $command->getName());
  27060. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  27061. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  27062. $usagesXML->appendChild($dom->createElement('usage', $usage));
  27063. }
  27064. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  27065. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  27066. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  27067. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  27068. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  27069. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  27070. return $dom;
  27071. }
  27072. public function getApplicationDocument(Application $application, $namespace = null)
  27073. {
  27074. $dom = new \DOMDocument('1.0', 'UTF-8');
  27075. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  27076. if ($application->getName() !== 'UNKNOWN') {
  27077. $rootXml->setAttribute('name', $application->getName());
  27078. if ($application->getVersion() !== 'UNKNOWN') {
  27079. $rootXml->setAttribute('version', $application->getVersion());
  27080. }
  27081. }
  27082. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  27083. $description = new ApplicationDescription($application, $namespace);
  27084. if ($namespace) {
  27085. $commandsXML->setAttribute('namespace', $namespace);
  27086. }
  27087. foreach ($description->getCommands() as $command) {
  27088. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  27089. }
  27090. if (!$namespace) {
  27091. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  27092. foreach ($description->getNamespaces() as $namespaceDescription) {
  27093. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  27094. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  27095. foreach ($namespaceDescription['commands'] as $name) {
  27096. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  27097. $commandXML->appendChild($dom->createTextNode($name));
  27098. }
  27099. }
  27100. }
  27101. return $dom;
  27102. }
  27103. protected function describeInputArgument(InputArgument $argument, array $options = array())
  27104. {
  27105. $this->writeDocument($this->getInputArgumentDocument($argument));
  27106. }
  27107. protected function describeInputOption(InputOption $option, array $options = array())
  27108. {
  27109. $this->writeDocument($this->getInputOptionDocument($option));
  27110. }
  27111. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  27112. {
  27113. $this->writeDocument($this->getInputDefinitionDocument($definition));
  27114. }
  27115. protected function describeCommand(Command $command, array $options = array())
  27116. {
  27117. $this->writeDocument($this->getCommandDocument($command));
  27118. }
  27119. protected function describeApplication(Application $application, array $options = array())
  27120. {
  27121. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  27122. }
  27123. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  27124. {
  27125. foreach ($importedParent->childNodes as $childNode) {
  27126. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  27127. }
  27128. }
  27129. private function writeDocument(\DOMDocument $dom)
  27130. {
  27131. $dom->formatOutput = true;
  27132. $this->write($dom->saveXML());
  27133. }
  27134. private function getInputArgumentDocument(InputArgument $argument)
  27135. {
  27136. $dom = new \DOMDocument('1.0', 'UTF-8');
  27137. $dom->appendChild($objectXML = $dom->createElement('argument'));
  27138. $objectXML->setAttribute('name', $argument->getName());
  27139. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  27140. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  27141. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  27142. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  27143. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  27144. $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  27145. foreach ($defaults as $default) {
  27146. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  27147. $defaultXML->appendChild($dom->createTextNode($default));
  27148. }
  27149. return $dom;
  27150. }
  27151. private function getInputOptionDocument(InputOption $option)
  27152. {
  27153. $dom = new \DOMDocument('1.0', 'UTF-8');
  27154. $dom->appendChild($objectXML = $dom->createElement('option'));
  27155. $objectXML->setAttribute('name', '--'.$option->getName());
  27156. $pos = strpos($option->getShortcut(), '|');
  27157. if (false !== $pos) {
  27158. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  27159. $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
  27160. } else {
  27161. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  27162. }
  27163. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  27164. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  27165. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  27166. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  27167. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  27168. if ($option->acceptValue()) {
  27169. $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  27170. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  27171. if (!empty($defaults)) {
  27172. foreach ($defaults as $default) {
  27173. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  27174. $defaultXML->appendChild($dom->createTextNode($default));
  27175. }
  27176. }
  27177. }
  27178. return $dom;
  27179. }
  27180. }
  27181. <?php
  27182. namespace Symfony\Component\Console\Event;
  27183. class ConsoleCommandEvent extends ConsoleEvent
  27184. {
  27185. const RETURN_CODE_DISABLED = 113;
  27186. private $commandShouldRun = true;
  27187. public function disableCommand()
  27188. {
  27189. return $this->commandShouldRun = false;
  27190. }
  27191. public function enableCommand()
  27192. {
  27193. return $this->commandShouldRun = true;
  27194. }
  27195. public function commandShouldRun()
  27196. {
  27197. return $this->commandShouldRun;
  27198. }
  27199. }
  27200. <?php
  27201. namespace Symfony\Component\Console\Event;
  27202. use Symfony\Component\Console\Command\Command;
  27203. use Symfony\Component\Console\Input\InputInterface;
  27204. use Symfony\Component\Console\Output\OutputInterface;
  27205. use Symfony\Component\EventDispatcher\Event;
  27206. class ConsoleEvent extends Event
  27207. {
  27208. protected $command;
  27209. private $input;
  27210. private $output;
  27211. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  27212. {
  27213. $this->command = $command;
  27214. $this->input = $input;
  27215. $this->output = $output;
  27216. }
  27217. public function getCommand()
  27218. {
  27219. return $this->command;
  27220. }
  27221. public function getInput()
  27222. {
  27223. return $this->input;
  27224. }
  27225. public function getOutput()
  27226. {
  27227. return $this->output;
  27228. }
  27229. }
  27230. <?php
  27231. namespace Symfony\Component\Console\Event;
  27232. use Symfony\Component\Console\Command\Command;
  27233. use Symfony\Component\Console\Input\InputInterface;
  27234. use Symfony\Component\Console\Output\OutputInterface;
  27235. class ConsoleExceptionEvent extends ConsoleEvent
  27236. {
  27237. private $exception;
  27238. private $exitCode;
  27239. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  27240. {
  27241. parent::__construct($command, $input, $output);
  27242. $this->setException($exception);
  27243. $this->exitCode = (int) $exitCode;
  27244. }
  27245. public function getException()
  27246. {
  27247. return $this->exception;
  27248. }
  27249. public function setException(\Exception $exception)
  27250. {
  27251. $this->exception = $exception;
  27252. }
  27253. public function getExitCode()
  27254. {
  27255. return $this->exitCode;
  27256. }
  27257. }
  27258. <?php
  27259. namespace Symfony\Component\Console\Event;
  27260. use Symfony\Component\Console\Command\Command;
  27261. use Symfony\Component\Console\Input\InputInterface;
  27262. use Symfony\Component\Console\Output\OutputInterface;
  27263. class ConsoleTerminateEvent extends ConsoleEvent
  27264. {
  27265. private $exitCode;
  27266. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  27267. {
  27268. parent::__construct($command, $input, $output);
  27269. $this->setExitCode($exitCode);
  27270. }
  27271. public function setExitCode($exitCode)
  27272. {
  27273. $this->exitCode = (int) $exitCode;
  27274. }
  27275. public function getExitCode()
  27276. {
  27277. return $this->exitCode;
  27278. }
  27279. }
  27280. <?php
  27281. namespace Symfony\Component\Console\Exception;
  27282. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  27283. {
  27284. private $alternatives;
  27285. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  27286. {
  27287. parent::__construct($message, $code, $previous);
  27288. $this->alternatives = $alternatives;
  27289. }
  27290. public function getAlternatives()
  27291. {
  27292. return $this->alternatives;
  27293. }
  27294. }
  27295. <?php
  27296. namespace Symfony\Component\Console\Exception;
  27297. interface ExceptionInterface
  27298. {
  27299. }
  27300. <?php
  27301. namespace Symfony\Component\Console\Exception;
  27302. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  27303. {
  27304. }
  27305. <?php
  27306. namespace Symfony\Component\Console\Exception;
  27307. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  27308. {
  27309. }
  27310. <?php
  27311. namespace Symfony\Component\Console\Exception;
  27312. class LogicException extends \LogicException implements ExceptionInterface
  27313. {
  27314. }
  27315. <?php
  27316. namespace Symfony\Component\Console\Exception;
  27317. class RuntimeException extends \RuntimeException implements ExceptionInterface
  27318. {
  27319. }
  27320. <?php
  27321. namespace Symfony\Component\Console\Formatter;
  27322. use Symfony\Component\Console\Exception\InvalidArgumentException;
  27323. class OutputFormatter implements OutputFormatterInterface
  27324. {
  27325. private $decorated;
  27326. private $styles = array();
  27327. private $styleStack;
  27328. public static function escape($text)
  27329. {
  27330. return preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  27331. }
  27332. public function __construct($decorated = false, array $styles = array())
  27333. {
  27334. $this->decorated = (bool) $decorated;
  27335. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  27336. $this->setStyle('info', new OutputFormatterStyle('green'));
  27337. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  27338. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  27339. foreach ($styles as $name => $style) {
  27340. $this->setStyle($name, $style);
  27341. }
  27342. $this->styleStack = new OutputFormatterStyleStack();
  27343. }
  27344. public function setDecorated($decorated)
  27345. {
  27346. $this->decorated = (bool) $decorated;
  27347. }
  27348. public function isDecorated()
  27349. {
  27350. return $this->decorated;
  27351. }
  27352. public function setStyle($name, OutputFormatterStyleInterface $style)
  27353. {
  27354. $this->styles[strtolower($name)] = $style;
  27355. }
  27356. public function hasStyle($name)
  27357. {
  27358. return isset($this->styles[strtolower($name)]);
  27359. }
  27360. public function getStyle($name)
  27361. {
  27362. if (!$this->hasStyle($name)) {
  27363. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  27364. }
  27365. return $this->styles[strtolower($name)];
  27366. }
  27367. public function format($message)
  27368. {
  27369. $message = (string) $message;
  27370. $offset = 0;
  27371. $output = '';
  27372. $tagRegex = '[a-z][a-z0-9_=;-]*';
  27373. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  27374. foreach ($matches[0] as $i => $match) {
  27375. $pos = $match[1];
  27376. $text = $match[0];
  27377. if (0 != $pos && '\\' == $message[$pos - 1]) {
  27378. continue;
  27379. }
  27380. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  27381. $offset = $pos + strlen($text);
  27382. if ($open = '/' != $text[1]) {
  27383. $tag = $matches[1][$i][0];
  27384. } else {
  27385. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  27386. }
  27387. if (!$open && !$tag) {
  27388. $this->styleStack->pop();
  27389. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  27390. $output .= $this->applyCurrentStyle($text);
  27391. } elseif ($open) {
  27392. $this->styleStack->push($style);
  27393. } else {
  27394. $this->styleStack->pop($style);
  27395. }
  27396. }
  27397. $output .= $this->applyCurrentStyle(substr($message, $offset));
  27398. return str_replace('\\<', '<', $output);
  27399. }
  27400. public function getStyleStack()
  27401. {
  27402. return $this->styleStack;
  27403. }
  27404. private function createStyleFromString($string)
  27405. {
  27406. if (isset($this->styles[$string])) {
  27407. return $this->styles[$string];
  27408. }
  27409. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  27410. return false;
  27411. }
  27412. $style = new OutputFormatterStyle();
  27413. foreach ($matches as $match) {
  27414. array_shift($match);
  27415. if ('fg' == $match[0]) {
  27416. $style->setForeground($match[1]);
  27417. } elseif ('bg' == $match[0]) {
  27418. $style->setBackground($match[1]);
  27419. } else {
  27420. try {
  27421. $style->setOption($match[1]);
  27422. } catch (\InvalidArgumentException $e) {
  27423. return false;
  27424. }
  27425. }
  27426. }
  27427. return $style;
  27428. }
  27429. private function applyCurrentStyle($text)
  27430. {
  27431. return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  27432. }
  27433. }
  27434. <?php
  27435. namespace Symfony\Component\Console\Formatter;
  27436. interface OutputFormatterInterface
  27437. {
  27438. public function setDecorated($decorated);
  27439. public function isDecorated();
  27440. public function setStyle($name, OutputFormatterStyleInterface $style);
  27441. public function hasStyle($name);
  27442. public function getStyle($name);
  27443. public function format($message);
  27444. }
  27445. <?php
  27446. namespace Symfony\Component\Console\Formatter;
  27447. use Symfony\Component\Console\Exception\InvalidArgumentException;
  27448. class OutputFormatterStyle implements OutputFormatterStyleInterface
  27449. {
  27450. private static $availableForegroundColors = array(
  27451. 'black' => array('set' => 30, 'unset' => 39),
  27452. 'red' => array('set' => 31, 'unset' => 39),
  27453. 'green' => array('set' => 32, 'unset' => 39),
  27454. 'yellow' => array('set' => 33, 'unset' => 39),
  27455. 'blue' => array('set' => 34, 'unset' => 39),
  27456. 'magenta' => array('set' => 35, 'unset' => 39),
  27457. 'cyan' => array('set' => 36, 'unset' => 39),
  27458. 'white' => array('set' => 37, 'unset' => 39),
  27459. 'default' => array('set' => 39, 'unset' => 39),
  27460. );
  27461. private static $availableBackgroundColors = array(
  27462. 'black' => array('set' => 40, 'unset' => 49),
  27463. 'red' => array('set' => 41, 'unset' => 49),
  27464. 'green' => array('set' => 42, 'unset' => 49),
  27465. 'yellow' => array('set' => 43, 'unset' => 49),
  27466. 'blue' => array('set' => 44, 'unset' => 49),
  27467. 'magenta' => array('set' => 45, 'unset' => 49),
  27468. 'cyan' => array('set' => 46, 'unset' => 49),
  27469. 'white' => array('set' => 47, 'unset' => 49),
  27470. 'default' => array('set' => 49, 'unset' => 49),
  27471. );
  27472. private static $availableOptions = array(
  27473. 'bold' => array('set' => 1, 'unset' => 22),
  27474. 'underscore' => array('set' => 4, 'unset' => 24),
  27475. 'blink' => array('set' => 5, 'unset' => 25),
  27476. 'reverse' => array('set' => 7, 'unset' => 27),
  27477. 'conceal' => array('set' => 8, 'unset' => 28),
  27478. );
  27479. private $foreground;
  27480. private $background;
  27481. private $options = array();
  27482. public function __construct($foreground = null, $background = null, array $options = array())
  27483. {
  27484. if (null !== $foreground) {
  27485. $this->setForeground($foreground);
  27486. }
  27487. if (null !== $background) {
  27488. $this->setBackground($background);
  27489. }
  27490. if (count($options)) {
  27491. $this->setOptions($options);
  27492. }
  27493. }
  27494. public function setForeground($color = null)
  27495. {
  27496. if (null === $color) {
  27497. $this->foreground = null;
  27498. return;
  27499. }
  27500. if (!isset(static::$availableForegroundColors[$color])) {
  27501. throw new InvalidArgumentException(sprintf(
  27502. 'Invalid foreground color specified: "%s". Expected one of (%s)',
  27503. $color,
  27504. implode(', ', array_keys(static::$availableForegroundColors))
  27505. ));
  27506. }
  27507. $this->foreground = static::$availableForegroundColors[$color];
  27508. }
  27509. public function setBackground($color = null)
  27510. {
  27511. if (null === $color) {
  27512. $this->background = null;
  27513. return;
  27514. }
  27515. if (!isset(static::$availableBackgroundColors[$color])) {
  27516. throw new InvalidArgumentException(sprintf(
  27517. 'Invalid background color specified: "%s". Expected one of (%s)',
  27518. $color,
  27519. implode(', ', array_keys(static::$availableBackgroundColors))
  27520. ));
  27521. }
  27522. $this->background = static::$availableBackgroundColors[$color];
  27523. }
  27524. public function setOption($option)
  27525. {
  27526. if (!isset(static::$availableOptions[$option])) {
  27527. throw new InvalidArgumentException(sprintf(
  27528. 'Invalid option specified: "%s". Expected one of (%s)',
  27529. $option,
  27530. implode(', ', array_keys(static::$availableOptions))
  27531. ));
  27532. }
  27533. if (!in_array(static::$availableOptions[$option], $this->options)) {
  27534. $this->options[] = static::$availableOptions[$option];
  27535. }
  27536. }
  27537. public function unsetOption($option)
  27538. {
  27539. if (!isset(static::$availableOptions[$option])) {
  27540. throw new InvalidArgumentException(sprintf(
  27541. 'Invalid option specified: "%s". Expected one of (%s)',
  27542. $option,
  27543. implode(', ', array_keys(static::$availableOptions))
  27544. ));
  27545. }
  27546. $pos = array_search(static::$availableOptions[$option], $this->options);
  27547. if (false !== $pos) {
  27548. unset($this->options[$pos]);
  27549. }
  27550. }
  27551. public function setOptions(array $options)
  27552. {
  27553. $this->options = array();
  27554. foreach ($options as $option) {
  27555. $this->setOption($option);
  27556. }
  27557. }
  27558. public function apply($text)
  27559. {
  27560. $setCodes = array();
  27561. $unsetCodes = array();
  27562. if (null !== $this->foreground) {
  27563. $setCodes[] = $this->foreground['set'];
  27564. $unsetCodes[] = $this->foreground['unset'];
  27565. }
  27566. if (null !== $this->background) {
  27567. $setCodes[] = $this->background['set'];
  27568. $unsetCodes[] = $this->background['unset'];
  27569. }
  27570. if (count($this->options)) {
  27571. foreach ($this->options as $option) {
  27572. $setCodes[] = $option['set'];
  27573. $unsetCodes[] = $option['unset'];
  27574. }
  27575. }
  27576. if (0 === count($setCodes)) {
  27577. return $text;
  27578. }
  27579. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  27580. }
  27581. }
  27582. <?php
  27583. namespace Symfony\Component\Console\Formatter;
  27584. interface OutputFormatterStyleInterface
  27585. {
  27586. public function setForeground($color = null);
  27587. public function setBackground($color = null);
  27588. public function setOption($option);
  27589. public function unsetOption($option);
  27590. public function setOptions(array $options);
  27591. public function apply($text);
  27592. }
  27593. <?php
  27594. namespace Symfony\Component\Console\Formatter;
  27595. use Symfony\Component\Console\Exception\InvalidArgumentException;
  27596. class OutputFormatterStyleStack
  27597. {
  27598. private $styles;
  27599. private $emptyStyle;
  27600. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  27601. {
  27602. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  27603. $this->reset();
  27604. }
  27605. public function reset()
  27606. {
  27607. $this->styles = array();
  27608. }
  27609. public function push(OutputFormatterStyleInterface $style)
  27610. {
  27611. $this->styles[] = $style;
  27612. }
  27613. public function pop(OutputFormatterStyleInterface $style = null)
  27614. {
  27615. if (empty($this->styles)) {
  27616. return $this->emptyStyle;
  27617. }
  27618. if (null === $style) {
  27619. return array_pop($this->styles);
  27620. }
  27621. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  27622. if ($style->apply('') === $stackedStyle->apply('')) {
  27623. $this->styles = array_slice($this->styles, 0, $index);
  27624. return $stackedStyle;
  27625. }
  27626. }
  27627. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  27628. }
  27629. public function getCurrent()
  27630. {
  27631. if (empty($this->styles)) {
  27632. return $this->emptyStyle;
  27633. }
  27634. return $this->styles[count($this->styles) - 1];
  27635. }
  27636. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  27637. {
  27638. $this->emptyStyle = $emptyStyle;
  27639. return $this;
  27640. }
  27641. public function getEmptyStyle()
  27642. {
  27643. return $this->emptyStyle;
  27644. }
  27645. }
  27646. <?php
  27647. namespace Symfony\Component\Console\Helper;
  27648. class DebugFormatterHelper extends Helper
  27649. {
  27650. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  27651. private $started = array();
  27652. private $count = -1;
  27653. public function start($id, $message, $prefix = 'RUN')
  27654. {
  27655. $this->started[$id] = array('border' => ++$this->count % count($this->colors));
  27656. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  27657. }
  27658. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  27659. {
  27660. $message = '';
  27661. if ($error) {
  27662. if (isset($this->started[$id]['out'])) {
  27663. $message .= "\n";
  27664. unset($this->started[$id]['out']);
  27665. }
  27666. if (!isset($this->started[$id]['err'])) {
  27667. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  27668. $this->started[$id]['err'] = true;
  27669. }
  27670. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  27671. } else {
  27672. if (isset($this->started[$id]['err'])) {
  27673. $message .= "\n";
  27674. unset($this->started[$id]['err']);
  27675. }
  27676. if (!isset($this->started[$id]['out'])) {
  27677. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  27678. $this->started[$id]['out'] = true;
  27679. }
  27680. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  27681. }
  27682. return $message;
  27683. }
  27684. public function stop($id, $message, $successful, $prefix = 'RES')
  27685. {
  27686. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  27687. if ($successful) {
  27688. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  27689. }
  27690. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  27691. unset($this->started[$id]['out'], $this->started[$id]['err']);
  27692. return $message;
  27693. }
  27694. private function getBorder($id)
  27695. {
  27696. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  27697. }
  27698. public function getName()
  27699. {
  27700. return 'debug_formatter';
  27701. }
  27702. }
  27703. <?php
  27704. namespace Symfony\Component\Console\Helper;
  27705. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  27706. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  27707. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  27708. use Symfony\Component\Console\Descriptor\TextDescriptor;
  27709. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  27710. use Symfony\Component\Console\Output\OutputInterface;
  27711. use Symfony\Component\Console\Exception\InvalidArgumentException;
  27712. class DescriptorHelper extends Helper
  27713. {
  27714. private $descriptors = array();
  27715. public function __construct()
  27716. {
  27717. $this
  27718. ->register('txt', new TextDescriptor())
  27719. ->register('xml', new XmlDescriptor())
  27720. ->register('json', new JsonDescriptor())
  27721. ->register('md', new MarkdownDescriptor())
  27722. ;
  27723. }
  27724. public function describe(OutputInterface $output, $object, array $options = array())
  27725. {
  27726. $options = array_merge(array(
  27727. 'raw_text' => false,
  27728. 'format' => 'txt',
  27729. ), $options);
  27730. if (!isset($this->descriptors[$options['format']])) {
  27731. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  27732. }
  27733. $descriptor = $this->descriptors[$options['format']];
  27734. $descriptor->describe($output, $object, $options);
  27735. }
  27736. public function register($format, DescriptorInterface $descriptor)
  27737. {
  27738. $this->descriptors[$format] = $descriptor;
  27739. return $this;
  27740. }
  27741. public function getName()
  27742. {
  27743. return 'descriptor';
  27744. }
  27745. }
  27746. <?php
  27747. namespace Symfony\Component\Console\Helper;
  27748. use Symfony\Component\Console\Exception\InvalidArgumentException;
  27749. use Symfony\Component\Console\Exception\RuntimeException;
  27750. use Symfony\Component\Console\Output\OutputInterface;
  27751. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  27752. class DialogHelper extends InputAwareHelper
  27753. {
  27754. private $inputStream;
  27755. private static $shell;
  27756. private static $stty;
  27757. public function __construct($triggerDeprecationError = true)
  27758. {
  27759. if ($triggerDeprecationError) {
  27760. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  27761. }
  27762. }
  27763. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  27764. {
  27765. $width = max(array_map('strlen', array_keys($choices)));
  27766. $messages = (array) $question;
  27767. foreach ($choices as $key => $value) {
  27768. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  27769. }
  27770. $output->writeln($messages);
  27771. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  27772. $selectedChoices = str_replace(' ', '', $picked);
  27773. if ($multiselect) {
  27774. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  27775. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  27776. }
  27777. $selectedChoices = explode(',', $selectedChoices);
  27778. } else {
  27779. $selectedChoices = array($picked);
  27780. }
  27781. $multiselectChoices = array();
  27782. foreach ($selectedChoices as $value) {
  27783. if (empty($choices[$value])) {
  27784. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  27785. }
  27786. $multiselectChoices[] = $value;
  27787. }
  27788. if ($multiselect) {
  27789. return $multiselectChoices;
  27790. }
  27791. return $picked;
  27792. }, $attempts, $default);
  27793. return $result;
  27794. }
  27795. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  27796. {
  27797. if ($this->input && !$this->input->isInteractive()) {
  27798. return $default;
  27799. }
  27800. $output->write($question);
  27801. $inputStream = $this->inputStream ?: STDIN;
  27802. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  27803. $ret = fgets($inputStream, 4096);
  27804. if (false === $ret) {
  27805. throw new RuntimeException('Aborted');
  27806. }
  27807. $ret = trim($ret);
  27808. } else {
  27809. $ret = '';
  27810. $i = 0;
  27811. $ofs = -1;
  27812. $matches = $autocomplete;
  27813. $numMatches = count($matches);
  27814. $sttyMode = shell_exec('stty -g');
  27815. shell_exec('stty -icanon -echo');
  27816. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  27817. while (!feof($inputStream)) {
  27818. $c = fread($inputStream, 1);
  27819. if ("\177" === $c) {
  27820. if (0 === $numMatches && 0 !== $i) {
  27821. --$i;
  27822. $output->write("\033[1D");
  27823. }
  27824. if ($i === 0) {
  27825. $ofs = -1;
  27826. $matches = $autocomplete;
  27827. $numMatches = count($matches);
  27828. } else {
  27829. $numMatches = 0;
  27830. }
  27831. $ret = substr($ret, 0, $i);
  27832. } elseif ("\033" === $c) {
  27833. $c .= fread($inputStream, 2);
  27834. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  27835. if ('A' === $c[2] && -1 === $ofs) {
  27836. $ofs = 0;
  27837. }
  27838. if (0 === $numMatches) {
  27839. continue;
  27840. }
  27841. $ofs += ('A' === $c[2]) ? -1 : 1;
  27842. $ofs = ($numMatches + $ofs) % $numMatches;
  27843. }
  27844. } elseif (ord($c) < 32) {
  27845. if ("\t" === $c || "\n" === $c) {
  27846. if ($numMatches > 0 && -1 !== $ofs) {
  27847. $ret = $matches[$ofs];
  27848. $output->write(substr($ret, $i));
  27849. $i = strlen($ret);
  27850. }
  27851. if ("\n" === $c) {
  27852. $output->write($c);
  27853. break;
  27854. }
  27855. $numMatches = 0;
  27856. }
  27857. continue;
  27858. } else {
  27859. $output->write($c);
  27860. $ret .= $c;
  27861. ++$i;
  27862. $numMatches = 0;
  27863. $ofs = 0;
  27864. foreach ($autocomplete as $value) {
  27865. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  27866. $matches[$numMatches++] = $value;
  27867. }
  27868. }
  27869. }
  27870. $output->write("\033[K");
  27871. if ($numMatches > 0 && -1 !== $ofs) {
  27872. $output->write("\0337");
  27873. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  27874. $output->write("\0338");
  27875. }
  27876. }
  27877. shell_exec(sprintf('stty %s', $sttyMode));
  27878. }
  27879. return strlen($ret) > 0 ? $ret : $default;
  27880. }
  27881. public function askConfirmation(OutputInterface $output, $question, $default = true)
  27882. {
  27883. $answer = 'z';
  27884. while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
  27885. $answer = $this->ask($output, $question);
  27886. }
  27887. if (false === $default) {
  27888. return $answer && 'y' == strtolower($answer[0]);
  27889. }
  27890. return !$answer || 'y' == strtolower($answer[0]);
  27891. }
  27892. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  27893. {
  27894. if ('\\' === DIRECTORY_SEPARATOR) {
  27895. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  27896. if ('phar:' === substr(__FILE__, 0, 5)) {
  27897. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  27898. copy($exe, $tmpExe);
  27899. $exe = $tmpExe;
  27900. }
  27901. $output->write($question);
  27902. $value = rtrim(shell_exec($exe));
  27903. $output->writeln('');
  27904. if (isset($tmpExe)) {
  27905. unlink($tmpExe);
  27906. }
  27907. return $value;
  27908. }
  27909. if ($this->hasSttyAvailable()) {
  27910. $output->write($question);
  27911. $sttyMode = shell_exec('stty -g');
  27912. shell_exec('stty -echo');
  27913. $value = fgets($this->inputStream ?: STDIN, 4096);
  27914. shell_exec(sprintf('stty %s', $sttyMode));
  27915. if (false === $value) {
  27916. throw new RuntimeException('Aborted');
  27917. }
  27918. $value = trim($value);
  27919. $output->writeln('');
  27920. return $value;
  27921. }
  27922. if (false !== $shell = $this->getShell()) {
  27923. $output->write($question);
  27924. $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword';
  27925. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  27926. $value = rtrim(shell_exec($command));
  27927. $output->writeln('');
  27928. return $value;
  27929. }
  27930. if ($fallback) {
  27931. return $this->ask($output, $question);
  27932. }
  27933. throw new RuntimeException('Unable to hide the response');
  27934. }
  27935. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  27936. {
  27937. $that = $this;
  27938. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  27939. return $that->ask($output, $question, $default, $autocomplete);
  27940. };
  27941. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  27942. }
  27943. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  27944. {
  27945. $that = $this;
  27946. $interviewer = function () use ($output, $question, $fallback, $that) {
  27947. return $that->askHiddenResponse($output, $question, $fallback);
  27948. };
  27949. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  27950. }
  27951. public function setInputStream($stream)
  27952. {
  27953. $this->inputStream = $stream;
  27954. }
  27955. public function getInputStream()
  27956. {
  27957. return $this->inputStream;
  27958. }
  27959. public function getName()
  27960. {
  27961. return 'dialog';
  27962. }
  27963. private function getShell()
  27964. {
  27965. if (null !== self::$shell) {
  27966. return self::$shell;
  27967. }
  27968. self::$shell = false;
  27969. if (file_exists('/usr/bin/env')) {
  27970. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  27971. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  27972. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  27973. self::$shell = $sh;
  27974. break;
  27975. }
  27976. }
  27977. }
  27978. return self::$shell;
  27979. }
  27980. private function hasSttyAvailable()
  27981. {
  27982. if (null !== self::$stty) {
  27983. return self::$stty;
  27984. }
  27985. exec('stty 2>&1', $output, $exitcode);
  27986. return self::$stty = $exitcode === 0;
  27987. }
  27988. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  27989. {
  27990. $e = null;
  27991. while (false === $attempts || $attempts--) {
  27992. if (null !== $e) {
  27993. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  27994. }
  27995. try {
  27996. return call_user_func($validator, $interviewer());
  27997. } catch (\Exception $e) {
  27998. }
  27999. }
  28000. throw $e;
  28001. }
  28002. }
  28003. <?php
  28004. namespace Symfony\Component\Console\Helper;
  28005. use Symfony\Component\Console\Formatter\OutputFormatter;
  28006. class FormatterHelper extends Helper
  28007. {
  28008. public function formatSection($section, $message, $style = 'info')
  28009. {
  28010. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  28011. }
  28012. public function formatBlock($messages, $style, $large = false)
  28013. {
  28014. if (!is_array($messages)) {
  28015. $messages = array($messages);
  28016. }
  28017. $len = 0;
  28018. $lines = array();
  28019. foreach ($messages as $message) {
  28020. $message = OutputFormatter::escape($message);
  28021. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  28022. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  28023. }
  28024. $messages = $large ? array(str_repeat(' ', $len)) : array();
  28025. for ($i = 0; isset($lines[$i]); ++$i) {
  28026. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  28027. }
  28028. if ($large) {
  28029. $messages[] = str_repeat(' ', $len);
  28030. }
  28031. for ($i = 0; isset($messages[$i]); ++$i) {
  28032. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  28033. }
  28034. return implode("\n", $messages);
  28035. }
  28036. public function getName()
  28037. {
  28038. return 'formatter';
  28039. }
  28040. }
  28041. <?php
  28042. namespace Symfony\Component\Console\Helper;
  28043. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  28044. abstract class Helper implements HelperInterface
  28045. {
  28046. protected $helperSet = null;
  28047. public function setHelperSet(HelperSet $helperSet = null)
  28048. {
  28049. $this->helperSet = $helperSet;
  28050. }
  28051. public function getHelperSet()
  28052. {
  28053. return $this->helperSet;
  28054. }
  28055. public static function strlen($string)
  28056. {
  28057. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  28058. return strlen($string);
  28059. }
  28060. return mb_strwidth($string, $encoding);
  28061. }
  28062. public static function formatTime($secs)
  28063. {
  28064. static $timeFormats = array(
  28065. array(0, '< 1 sec'),
  28066. array(2, '1 sec'),
  28067. array(59, 'secs', 1),
  28068. array(60, '1 min'),
  28069. array(3600, 'mins', 60),
  28070. array(5400, '1 hr'),
  28071. array(86400, 'hrs', 3600),
  28072. array(129600, '1 day'),
  28073. array(604800, 'days', 86400),
  28074. );
  28075. foreach ($timeFormats as $format) {
  28076. if ($secs >= $format[0]) {
  28077. continue;
  28078. }
  28079. if (2 == count($format)) {
  28080. return $format[1];
  28081. }
  28082. return ceil($secs / $format[2]).' '.$format[1];
  28083. }
  28084. }
  28085. public static function formatMemory($memory)
  28086. {
  28087. if ($memory >= 1024 * 1024 * 1024) {
  28088. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  28089. }
  28090. if ($memory >= 1024 * 1024) {
  28091. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  28092. }
  28093. if ($memory >= 1024) {
  28094. return sprintf('%d KiB', $memory / 1024);
  28095. }
  28096. return sprintf('%d B', $memory);
  28097. }
  28098. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  28099. {
  28100. $isDecorated = $formatter->isDecorated();
  28101. $formatter->setDecorated(false);
  28102. $string = $formatter->format($string);
  28103. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  28104. $formatter->setDecorated($isDecorated);
  28105. return self::strlen($string);
  28106. }
  28107. }
  28108. <?php
  28109. namespace Symfony\Component\Console\Helper;
  28110. interface HelperInterface
  28111. {
  28112. public function setHelperSet(HelperSet $helperSet = null);
  28113. public function getHelperSet();
  28114. public function getName();
  28115. }
  28116. <?php
  28117. namespace Symfony\Component\Console\Helper;
  28118. use Symfony\Component\Console\Command\Command;
  28119. use Symfony\Component\Console\Exception\InvalidArgumentException;
  28120. class HelperSet implements \IteratorAggregate
  28121. {
  28122. private $helpers = array();
  28123. private $command;
  28124. public function __construct(array $helpers = array())
  28125. {
  28126. foreach ($helpers as $alias => $helper) {
  28127. $this->set($helper, is_int($alias) ? null : $alias);
  28128. }
  28129. }
  28130. public function set(HelperInterface $helper, $alias = null)
  28131. {
  28132. $this->helpers[$helper->getName()] = $helper;
  28133. if (null !== $alias) {
  28134. $this->helpers[$alias] = $helper;
  28135. }
  28136. $helper->setHelperSet($this);
  28137. }
  28138. public function has($name)
  28139. {
  28140. return isset($this->helpers[$name]);
  28141. }
  28142. public function get($name)
  28143. {
  28144. if (!$this->has($name)) {
  28145. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  28146. }
  28147. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  28148. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  28149. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  28150. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  28151. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  28152. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  28153. }
  28154. return $this->helpers[$name];
  28155. }
  28156. public function setCommand(Command $command = null)
  28157. {
  28158. $this->command = $command;
  28159. }
  28160. public function getCommand()
  28161. {
  28162. return $this->command;
  28163. }
  28164. public function getIterator()
  28165. {
  28166. return new \ArrayIterator($this->helpers);
  28167. }
  28168. }
  28169. <?php
  28170. namespace Symfony\Component\Console\Helper;
  28171. use Symfony\Component\Console\Input\InputInterface;
  28172. use Symfony\Component\Console\Input\InputAwareInterface;
  28173. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  28174. {
  28175. protected $input;
  28176. public function setInput(InputInterface $input)
  28177. {
  28178. $this->input = $input;
  28179. }
  28180. }
  28181. <?php
  28182. namespace Symfony\Component\Console\Helper;
  28183. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  28184. use Symfony\Component\Console\Output\OutputInterface;
  28185. use Symfony\Component\Process\Exception\ProcessFailedException;
  28186. use Symfony\Component\Process\Process;
  28187. use Symfony\Component\Process\ProcessBuilder;
  28188. class ProcessHelper extends Helper
  28189. {
  28190. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  28191. {
  28192. if ($output instanceof ConsoleOutputInterface) {
  28193. $output = $output->getErrorOutput();
  28194. }
  28195. $formatter = $this->getHelperSet()->get('debug_formatter');
  28196. if (is_array($cmd)) {
  28197. $process = ProcessBuilder::create($cmd)->getProcess();
  28198. } elseif ($cmd instanceof Process) {
  28199. $process = $cmd;
  28200. } else {
  28201. $process = new Process($cmd);
  28202. }
  28203. if ($verbosity <= $output->getVerbosity()) {
  28204. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  28205. }
  28206. if ($output->isDebug()) {
  28207. $callback = $this->wrapCallback($output, $process, $callback);
  28208. }
  28209. $process->run($callback);
  28210. if ($verbosity <= $output->getVerbosity()) {
  28211. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  28212. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  28213. }
  28214. if (!$process->isSuccessful() && null !== $error) {
  28215. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  28216. }
  28217. return $process;
  28218. }
  28219. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  28220. {
  28221. $process = $this->run($output, $cmd, $error, $callback);
  28222. if (!$process->isSuccessful()) {
  28223. throw new ProcessFailedException($process);
  28224. }
  28225. return $process;
  28226. }
  28227. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  28228. {
  28229. if ($output instanceof ConsoleOutputInterface) {
  28230. $output = $output->getErrorOutput();
  28231. }
  28232. $formatter = $this->getHelperSet()->get('debug_formatter');
  28233. $that = $this;
  28234. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  28235. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  28236. if (null !== $callback) {
  28237. call_user_func($callback, $type, $buffer);
  28238. }
  28239. };
  28240. }
  28241. public function escapeString($str)
  28242. {
  28243. return str_replace('<', '\\<', $str);
  28244. }
  28245. public function getName()
  28246. {
  28247. return 'process';
  28248. }
  28249. }
  28250. <?php
  28251. namespace Symfony\Component\Console\Helper;
  28252. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  28253. use Symfony\Component\Console\Output\OutputInterface;
  28254. use Symfony\Component\Console\Exception\LogicException;
  28255. class ProgressBar
  28256. {
  28257. private $barWidth = 28;
  28258. private $barChar;
  28259. private $emptyBarChar = '-';
  28260. private $progressChar = '>';
  28261. private $format;
  28262. private $internalFormat;
  28263. private $redrawFreq = 1;
  28264. private $output;
  28265. private $step = 0;
  28266. private $max;
  28267. private $startTime;
  28268. private $stepWidth;
  28269. private $percent = 0.0;
  28270. private $lastMessagesLength = 0;
  28271. private $formatLineCount;
  28272. private $messages;
  28273. private $overwrite = true;
  28274. private static $formatters;
  28275. private static $formats;
  28276. public function __construct(OutputInterface $output, $max = 0)
  28277. {
  28278. if ($output instanceof ConsoleOutputInterface) {
  28279. $output = $output->getErrorOutput();
  28280. }
  28281. $this->output = $output;
  28282. $this->setMaxSteps($max);
  28283. if (!$this->output->isDecorated()) {
  28284. $this->overwrite = false;
  28285. $this->setRedrawFrequency($max / 10);
  28286. }
  28287. $this->startTime = time();
  28288. }
  28289. public static function setPlaceholderFormatterDefinition($name, $callable)
  28290. {
  28291. if (!self::$formatters) {
  28292. self::$formatters = self::initPlaceholderFormatters();
  28293. }
  28294. self::$formatters[$name] = $callable;
  28295. }
  28296. public static function getPlaceholderFormatterDefinition($name)
  28297. {
  28298. if (!self::$formatters) {
  28299. self::$formatters = self::initPlaceholderFormatters();
  28300. }
  28301. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  28302. }
  28303. public static function setFormatDefinition($name, $format)
  28304. {
  28305. if (!self::$formats) {
  28306. self::$formats = self::initFormats();
  28307. }
  28308. self::$formats[$name] = $format;
  28309. }
  28310. public static function getFormatDefinition($name)
  28311. {
  28312. if (!self::$formats) {
  28313. self::$formats = self::initFormats();
  28314. }
  28315. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  28316. }
  28317. public function setMessage($message, $name = 'message')
  28318. {
  28319. $this->messages[$name] = $message;
  28320. }
  28321. public function getMessage($name = 'message')
  28322. {
  28323. return $this->messages[$name];
  28324. }
  28325. public function getStartTime()
  28326. {
  28327. return $this->startTime;
  28328. }
  28329. public function getMaxSteps()
  28330. {
  28331. return $this->max;
  28332. }
  28333. public function getStep()
  28334. {
  28335. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  28336. return $this->getProgress();
  28337. }
  28338. public function getProgress()
  28339. {
  28340. return $this->step;
  28341. }
  28342. public function getStepWidth()
  28343. {
  28344. return $this->stepWidth;
  28345. }
  28346. public function getProgressPercent()
  28347. {
  28348. return $this->percent;
  28349. }
  28350. public function setBarWidth($size)
  28351. {
  28352. $this->barWidth = (int) $size;
  28353. }
  28354. public function getBarWidth()
  28355. {
  28356. return $this->barWidth;
  28357. }
  28358. public function setBarCharacter($char)
  28359. {
  28360. $this->barChar = $char;
  28361. }
  28362. public function getBarCharacter()
  28363. {
  28364. if (null === $this->barChar) {
  28365. return $this->max ? '=' : $this->emptyBarChar;
  28366. }
  28367. return $this->barChar;
  28368. }
  28369. public function setEmptyBarCharacter($char)
  28370. {
  28371. $this->emptyBarChar = $char;
  28372. }
  28373. public function getEmptyBarCharacter()
  28374. {
  28375. return $this->emptyBarChar;
  28376. }
  28377. public function setProgressCharacter($char)
  28378. {
  28379. $this->progressChar = $char;
  28380. }
  28381. public function getProgressCharacter()
  28382. {
  28383. return $this->progressChar;
  28384. }
  28385. public function setFormat($format)
  28386. {
  28387. $this->format = null;
  28388. $this->internalFormat = $format;
  28389. }
  28390. public function setRedrawFrequency($freq)
  28391. {
  28392. $this->redrawFreq = max((int) $freq, 1);
  28393. }
  28394. public function start($max = null)
  28395. {
  28396. $this->startTime = time();
  28397. $this->step = 0;
  28398. $this->percent = 0.0;
  28399. if (null !== $max) {
  28400. $this->setMaxSteps($max);
  28401. }
  28402. $this->display();
  28403. }
  28404. public function advance($step = 1)
  28405. {
  28406. $this->setProgress($this->step + $step);
  28407. }
  28408. public function setCurrent($step)
  28409. {
  28410. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  28411. $this->setProgress($step);
  28412. }
  28413. public function setOverwrite($overwrite)
  28414. {
  28415. $this->overwrite = (bool) $overwrite;
  28416. }
  28417. public function setProgress($step)
  28418. {
  28419. $step = (int) $step;
  28420. if ($step < $this->step) {
  28421. throw new LogicException('You can\'t regress the progress bar.');
  28422. }
  28423. if ($this->max && $step > $this->max) {
  28424. $this->max = $step;
  28425. }
  28426. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  28427. $currPeriod = (int) ($step / $this->redrawFreq);
  28428. $this->step = $step;
  28429. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  28430. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  28431. $this->display();
  28432. }
  28433. }
  28434. public function finish()
  28435. {
  28436. if (!$this->max) {
  28437. $this->max = $this->step;
  28438. }
  28439. if ($this->step === $this->max && !$this->overwrite) {
  28440. return;
  28441. }
  28442. $this->setProgress($this->max);
  28443. }
  28444. public function display()
  28445. {
  28446. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  28447. return;
  28448. }
  28449. if (null === $this->format) {
  28450. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  28451. }
  28452. $self = $this;
  28453. $output = $this->output;
  28454. $messages = $this->messages;
  28455. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  28456. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  28457. $text = call_user_func($formatter, $self, $output);
  28458. } elseif (isset($messages[$matches[1]])) {
  28459. $text = $messages[$matches[1]];
  28460. } else {
  28461. return $matches[0];
  28462. }
  28463. if (isset($matches[2])) {
  28464. $text = sprintf('%'.$matches[2], $text);
  28465. }
  28466. return $text;
  28467. }, $this->format));
  28468. }
  28469. public function clear()
  28470. {
  28471. if (!$this->overwrite) {
  28472. return;
  28473. }
  28474. if (null === $this->format) {
  28475. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  28476. }
  28477. $this->overwrite(str_repeat("\n", $this->formatLineCount));
  28478. }
  28479. private function setRealFormat($format)
  28480. {
  28481. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  28482. $this->format = self::getFormatDefinition($format.'_nomax');
  28483. } elseif (null !== self::getFormatDefinition($format)) {
  28484. $this->format = self::getFormatDefinition($format);
  28485. } else {
  28486. $this->format = $format;
  28487. }
  28488. $this->formatLineCount = substr_count($this->format, "\n");
  28489. }
  28490. private function setMaxSteps($max)
  28491. {
  28492. $this->max = max(0, (int) $max);
  28493. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  28494. }
  28495. private function overwrite($message)
  28496. {
  28497. $lines = explode("\n", $message);
  28498. if (null !== $this->lastMessagesLength) {
  28499. foreach ($lines as $i => $line) {
  28500. if ($this->lastMessagesLength > Helper::strlenWithoutDecoration($this->output->getFormatter(), $line)) {
  28501. $lines[$i] = str_pad($line, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  28502. }
  28503. }
  28504. }
  28505. if ($this->overwrite) {
  28506. $this->output->write("\x0D");
  28507. } elseif ($this->step > 0) {
  28508. $this->output->writeln('');
  28509. }
  28510. if ($this->formatLineCount) {
  28511. $this->output->write(sprintf("\033[%dA", $this->formatLineCount));
  28512. }
  28513. $this->output->write(implode("\n", $lines));
  28514. $this->lastMessagesLength = 0;
  28515. foreach ($lines as $line) {
  28516. $len = Helper::strlenWithoutDecoration($this->output->getFormatter(), $line);
  28517. if ($len > $this->lastMessagesLength) {
  28518. $this->lastMessagesLength = $len;
  28519. }
  28520. }
  28521. }
  28522. private function determineBestFormat()
  28523. {
  28524. switch ($this->output->getVerbosity()) {
  28525. case OutputInterface::VERBOSITY_VERBOSE:
  28526. return $this->max ? 'verbose' : 'verbose_nomax';
  28527. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  28528. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  28529. case OutputInterface::VERBOSITY_DEBUG:
  28530. return $this->max ? 'debug' : 'debug_nomax';
  28531. default:
  28532. return $this->max ? 'normal' : 'normal_nomax';
  28533. }
  28534. }
  28535. private static function initPlaceholderFormatters()
  28536. {
  28537. return array(
  28538. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  28539. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  28540. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  28541. if ($completeBars < $bar->getBarWidth()) {
  28542. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  28543. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  28544. }
  28545. return $display;
  28546. },
  28547. 'elapsed' => function (ProgressBar $bar) {
  28548. return Helper::formatTime(time() - $bar->getStartTime());
  28549. },
  28550. 'remaining' => function (ProgressBar $bar) {
  28551. if (!$bar->getMaxSteps()) {
  28552. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  28553. }
  28554. if (!$bar->getProgress()) {
  28555. $remaining = 0;
  28556. } else {
  28557. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  28558. }
  28559. return Helper::formatTime($remaining);
  28560. },
  28561. 'estimated' => function (ProgressBar $bar) {
  28562. if (!$bar->getMaxSteps()) {
  28563. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  28564. }
  28565. if (!$bar->getProgress()) {
  28566. $estimated = 0;
  28567. } else {
  28568. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  28569. }
  28570. return Helper::formatTime($estimated);
  28571. },
  28572. 'memory' => function (ProgressBar $bar) {
  28573. return Helper::formatMemory(memory_get_usage(true));
  28574. },
  28575. 'current' => function (ProgressBar $bar) {
  28576. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  28577. },
  28578. 'max' => function (ProgressBar $bar) {
  28579. return $bar->getMaxSteps();
  28580. },
  28581. 'percent' => function (ProgressBar $bar) {
  28582. return floor($bar->getProgressPercent() * 100);
  28583. },
  28584. );
  28585. }
  28586. private static function initFormats()
  28587. {
  28588. return array(
  28589. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  28590. 'normal_nomax' => ' %current% [%bar%]',
  28591. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  28592. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  28593. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  28594. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  28595. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  28596. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  28597. );
  28598. }
  28599. }
  28600. <?php
  28601. namespace Symfony\Component\Console\Helper;
  28602. use Symfony\Component\Console\Output\NullOutput;
  28603. use Symfony\Component\Console\Output\OutputInterface;
  28604. use Symfony\Component\Console\Exception\LogicException;
  28605. class ProgressHelper extends Helper
  28606. {
  28607. const FORMAT_QUIET = ' %percent%%';
  28608. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  28609. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  28610. const FORMAT_QUIET_NOMAX = ' %current%';
  28611. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  28612. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  28613. private $barWidth = 28;
  28614. private $barChar = '=';
  28615. private $emptyBarChar = '-';
  28616. private $progressChar = '>';
  28617. private $format = null;
  28618. private $redrawFreq = 1;
  28619. private $lastMessagesLength;
  28620. private $barCharOriginal;
  28621. private $output;
  28622. private $current;
  28623. private $max;
  28624. private $startTime;
  28625. private $defaultFormatVars = array(
  28626. 'current',
  28627. 'max',
  28628. 'bar',
  28629. 'percent',
  28630. 'elapsed',
  28631. );
  28632. private $formatVars;
  28633. private $widths = array(
  28634. 'current' => 4,
  28635. 'max' => 4,
  28636. 'percent' => 3,
  28637. 'elapsed' => 6,
  28638. );
  28639. private $timeFormats = array(
  28640. array(0, '???'),
  28641. array(2, '1 sec'),
  28642. array(59, 'secs', 1),
  28643. array(60, '1 min'),
  28644. array(3600, 'mins', 60),
  28645. array(5400, '1 hr'),
  28646. array(86400, 'hrs', 3600),
  28647. array(129600, '1 day'),
  28648. array(604800, 'days', 86400),
  28649. );
  28650. public function __construct($triggerDeprecationError = true)
  28651. {
  28652. if ($triggerDeprecationError) {
  28653. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  28654. }
  28655. }
  28656. public function setBarWidth($size)
  28657. {
  28658. $this->barWidth = (int) $size;
  28659. }
  28660. public function setBarCharacter($char)
  28661. {
  28662. $this->barChar = $char;
  28663. }
  28664. public function setEmptyBarCharacter($char)
  28665. {
  28666. $this->emptyBarChar = $char;
  28667. }
  28668. public function setProgressCharacter($char)
  28669. {
  28670. $this->progressChar = $char;
  28671. }
  28672. public function setFormat($format)
  28673. {
  28674. $this->format = $format;
  28675. }
  28676. public function setRedrawFrequency($freq)
  28677. {
  28678. $this->redrawFreq = (int) $freq;
  28679. }
  28680. public function start(OutputInterface $output, $max = null)
  28681. {
  28682. $this->startTime = time();
  28683. $this->current = 0;
  28684. $this->max = (int) $max;
  28685. $this->output = $output->isDecorated() ? $output : new NullOutput();
  28686. $this->lastMessagesLength = 0;
  28687. $this->barCharOriginal = '';
  28688. if (null === $this->format) {
  28689. switch ($output->getVerbosity()) {
  28690. case OutputInterface::VERBOSITY_QUIET:
  28691. $this->format = self::FORMAT_QUIET_NOMAX;
  28692. if ($this->max > 0) {
  28693. $this->format = self::FORMAT_QUIET;
  28694. }
  28695. break;
  28696. case OutputInterface::VERBOSITY_VERBOSE:
  28697. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  28698. case OutputInterface::VERBOSITY_DEBUG:
  28699. $this->format = self::FORMAT_VERBOSE_NOMAX;
  28700. if ($this->max > 0) {
  28701. $this->format = self::FORMAT_VERBOSE;
  28702. }
  28703. break;
  28704. default:
  28705. $this->format = self::FORMAT_NORMAL_NOMAX;
  28706. if ($this->max > 0) {
  28707. $this->format = self::FORMAT_NORMAL;
  28708. }
  28709. break;
  28710. }
  28711. }
  28712. $this->initialize();
  28713. }
  28714. public function advance($step = 1, $redraw = false)
  28715. {
  28716. $this->setCurrent($this->current + $step, $redraw);
  28717. }
  28718. public function setCurrent($current, $redraw = false)
  28719. {
  28720. if (null === $this->startTime) {
  28721. throw new LogicException('You must start the progress bar before calling setCurrent().');
  28722. }
  28723. $current = (int) $current;
  28724. if ($current < $this->current) {
  28725. throw new LogicException('You can\'t regress the progress bar');
  28726. }
  28727. if (0 === $this->current) {
  28728. $redraw = true;
  28729. }
  28730. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  28731. $this->current = $current;
  28732. $currPeriod = (int) ($this->current / $this->redrawFreq);
  28733. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  28734. $this->display();
  28735. }
  28736. }
  28737. public function display($finish = false)
  28738. {
  28739. if (null === $this->startTime) {
  28740. throw new LogicException('You must start the progress bar before calling display().');
  28741. }
  28742. $message = $this->format;
  28743. foreach ($this->generate($finish) as $name => $value) {
  28744. $message = str_replace("%{$name}%", $value, $message);
  28745. }
  28746. $this->overwrite($this->output, $message);
  28747. }
  28748. public function clear()
  28749. {
  28750. $this->overwrite($this->output, '');
  28751. }
  28752. public function finish()
  28753. {
  28754. if (null === $this->startTime) {
  28755. throw new LogicException('You must start the progress bar before calling finish().');
  28756. }
  28757. if (null !== $this->startTime) {
  28758. if (!$this->max) {
  28759. $this->barChar = $this->barCharOriginal;
  28760. $this->display(true);
  28761. }
  28762. $this->startTime = null;
  28763. $this->output->writeln('');
  28764. $this->output = null;
  28765. }
  28766. }
  28767. private function initialize()
  28768. {
  28769. $this->formatVars = array();
  28770. foreach ($this->defaultFormatVars as $var) {
  28771. if (false !== strpos($this->format, "%{$var}%")) {
  28772. $this->formatVars[$var] = true;
  28773. }
  28774. }
  28775. if ($this->max > 0) {
  28776. $this->widths['max'] = $this->strlen($this->max);
  28777. $this->widths['current'] = $this->widths['max'];
  28778. } else {
  28779. $this->barCharOriginal = $this->barChar;
  28780. $this->barChar = $this->emptyBarChar;
  28781. }
  28782. }
  28783. private function generate($finish = false)
  28784. {
  28785. $vars = array();
  28786. $percent = 0;
  28787. if ($this->max > 0) {
  28788. $percent = (float) $this->current / $this->max;
  28789. }
  28790. if (isset($this->formatVars['bar'])) {
  28791. $completeBars = 0;
  28792. if ($this->max > 0) {
  28793. $completeBars = floor($percent * $this->barWidth);
  28794. } else {
  28795. if (!$finish) {
  28796. $completeBars = floor($this->current % $this->barWidth);
  28797. } else {
  28798. $completeBars = $this->barWidth;
  28799. }
  28800. }
  28801. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  28802. $bar = str_repeat($this->barChar, $completeBars);
  28803. if ($completeBars < $this->barWidth) {
  28804. $bar .= $this->progressChar;
  28805. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  28806. }
  28807. $vars['bar'] = $bar;
  28808. }
  28809. if (isset($this->formatVars['elapsed'])) {
  28810. $elapsed = time() - $this->startTime;
  28811. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  28812. }
  28813. if (isset($this->formatVars['current'])) {
  28814. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  28815. }
  28816. if (isset($this->formatVars['max'])) {
  28817. $vars['max'] = $this->max;
  28818. }
  28819. if (isset($this->formatVars['percent'])) {
  28820. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  28821. }
  28822. return $vars;
  28823. }
  28824. private function humaneTime($secs)
  28825. {
  28826. $text = '';
  28827. foreach ($this->timeFormats as $format) {
  28828. if ($secs < $format[0]) {
  28829. if (count($format) == 2) {
  28830. $text = $format[1];
  28831. break;
  28832. } else {
  28833. $text = ceil($secs / $format[2]).' '.$format[1];
  28834. break;
  28835. }
  28836. }
  28837. }
  28838. return $text;
  28839. }
  28840. private function overwrite(OutputInterface $output, $message)
  28841. {
  28842. $length = $this->strlen($message);
  28843. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  28844. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  28845. }
  28846. $output->write("\x0D");
  28847. $output->write($message);
  28848. $this->lastMessagesLength = $this->strlen($message);
  28849. }
  28850. public function getName()
  28851. {
  28852. return 'progress';
  28853. }
  28854. }
  28855. <?php
  28856. namespace Symfony\Component\Console\Helper;
  28857. use Symfony\Component\Console\Output\OutputInterface;
  28858. class ProgressIndicator
  28859. {
  28860. private $output;
  28861. private $startTime;
  28862. private $format;
  28863. private $message;
  28864. private $indicatorValues;
  28865. private $indicatorCurrent;
  28866. private $indicatorChangeInterval;
  28867. private $indicatorUpdateTime;
  28868. private $lastMessagesLength;
  28869. private $started = false;
  28870. private static $formatters;
  28871. private static $formats;
  28872. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  28873. {
  28874. $this->output = $output;
  28875. if (null === $format) {
  28876. $format = $this->determineBestFormat();
  28877. }
  28878. if (null === $indicatorValues) {
  28879. $indicatorValues = array('-', '\\', '|', '/');
  28880. }
  28881. $indicatorValues = array_values($indicatorValues);
  28882. if (2 > count($indicatorValues)) {
  28883. throw new \InvalidArgumentException('Must have at least 2 indicator value characters.');
  28884. }
  28885. $this->format = self::getFormatDefinition($format);
  28886. $this->indicatorChangeInterval = $indicatorChangeInterval;
  28887. $this->indicatorValues = $indicatorValues;
  28888. $this->startTime = time();
  28889. }
  28890. public function setMessage($message)
  28891. {
  28892. $this->message = $message;
  28893. $this->display();
  28894. }
  28895. public function getMessage()
  28896. {
  28897. return $this->message;
  28898. }
  28899. public function getStartTime()
  28900. {
  28901. return $this->startTime;
  28902. }
  28903. public function getCurrentValue()
  28904. {
  28905. return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)];
  28906. }
  28907. public function start($message)
  28908. {
  28909. if ($this->started) {
  28910. throw new \LogicException('Progress indicator already started.');
  28911. }
  28912. $this->message = $message;
  28913. $this->started = true;
  28914. $this->lastMessagesLength = 0;
  28915. $this->startTime = time();
  28916. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  28917. $this->indicatorCurrent = 0;
  28918. $this->display();
  28919. }
  28920. public function advance()
  28921. {
  28922. if (!$this->started) {
  28923. throw new \LogicException('Progress indicator has not yet been started.');
  28924. }
  28925. if (!$this->output->isDecorated()) {
  28926. return;
  28927. }
  28928. $currentTime = $this->getCurrentTimeInMilliseconds();
  28929. if ($currentTime < $this->indicatorUpdateTime) {
  28930. return;
  28931. }
  28932. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  28933. ++$this->indicatorCurrent;
  28934. $this->display();
  28935. }
  28936. public function finish($message)
  28937. {
  28938. if (!$this->started) {
  28939. throw new \LogicException('Progress indicator has not yet been started.');
  28940. }
  28941. $this->message = $message;
  28942. $this->display();
  28943. $this->output->writeln('');
  28944. $this->started = false;
  28945. }
  28946. public static function getFormatDefinition($name)
  28947. {
  28948. if (!self::$formats) {
  28949. self::$formats = self::initFormats();
  28950. }
  28951. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  28952. }
  28953. public static function setPlaceholderFormatterDefinition($name, $callable)
  28954. {
  28955. if (!self::$formatters) {
  28956. self::$formatters = self::initPlaceholderFormatters();
  28957. }
  28958. self::$formatters[$name] = $callable;
  28959. }
  28960. public static function getPlaceholderFormatterDefinition($name)
  28961. {
  28962. if (!self::$formatters) {
  28963. self::$formatters = self::initPlaceholderFormatters();
  28964. }
  28965. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  28966. }
  28967. private function display()
  28968. {
  28969. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  28970. return;
  28971. }
  28972. $self = $this;
  28973. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  28974. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  28975. return call_user_func($formatter, $self);
  28976. }
  28977. return $matches[0];
  28978. }, $this->format));
  28979. }
  28980. private function determineBestFormat()
  28981. {
  28982. switch ($this->output->getVerbosity()) {
  28983. case OutputInterface::VERBOSITY_VERBOSE:
  28984. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  28985. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  28986. case OutputInterface::VERBOSITY_DEBUG:
  28987. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  28988. default:
  28989. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  28990. }
  28991. }
  28992. private function overwrite($message)
  28993. {
  28994. if (null !== $this->lastMessagesLength) {
  28995. if ($this->lastMessagesLength > Helper::strlenWithoutDecoration($this->output->getFormatter(), $message)) {
  28996. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  28997. }
  28998. }
  28999. if ($this->output->isDecorated()) {
  29000. $this->output->write("\x0D");
  29001. $this->output->write($message);
  29002. } else {
  29003. $this->output->writeln($message);
  29004. }
  29005. $this->lastMessagesLength = 0;
  29006. $len = Helper::strlenWithoutDecoration($this->output->getFormatter(), $message);
  29007. if ($len > $this->lastMessagesLength) {
  29008. $this->lastMessagesLength = $len;
  29009. }
  29010. }
  29011. private function getCurrentTimeInMilliseconds()
  29012. {
  29013. return round(microtime(true) * 1000);
  29014. }
  29015. private static function initPlaceholderFormatters()
  29016. {
  29017. return array(
  29018. 'indicator' => function (ProgressIndicator $indicator) {
  29019. return $indicator->getCurrentValue();
  29020. },
  29021. 'message' => function (ProgressIndicator $indicator) {
  29022. return $indicator->getMessage();
  29023. },
  29024. 'elapsed' => function (ProgressIndicator $indicator) {
  29025. return Helper::formatTime(time() - $indicator->getStartTime());
  29026. },
  29027. 'memory' => function () {
  29028. return Helper::formatMemory(memory_get_usage(true));
  29029. },
  29030. );
  29031. }
  29032. private static function initFormats()
  29033. {
  29034. return array(
  29035. 'normal' => ' %indicator% %message%',
  29036. 'normal_no_ansi' => ' %message%',
  29037. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  29038. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  29039. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  29040. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  29041. );
  29042. }
  29043. }
  29044. <?php
  29045. namespace Symfony\Component\Console\Helper;
  29046. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29047. use Symfony\Component\Console\Exception\RuntimeException;
  29048. use Symfony\Component\Console\Input\InputInterface;
  29049. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  29050. use Symfony\Component\Console\Output\OutputInterface;
  29051. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  29052. use Symfony\Component\Console\Question\Question;
  29053. use Symfony\Component\Console\Question\ChoiceQuestion;
  29054. class QuestionHelper extends Helper
  29055. {
  29056. private $inputStream;
  29057. private static $shell;
  29058. private static $stty;
  29059. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  29060. {
  29061. if ($output instanceof ConsoleOutputInterface) {
  29062. $output = $output->getErrorOutput();
  29063. }
  29064. if (!$input->isInteractive()) {
  29065. return $question->getDefault();
  29066. }
  29067. if (!$question->getValidator()) {
  29068. return $this->doAsk($output, $question);
  29069. }
  29070. $that = $this;
  29071. $interviewer = function () use ($output, $question, $that) {
  29072. return $that->doAsk($output, $question);
  29073. };
  29074. return $this->validateAttempts($interviewer, $output, $question);
  29075. }
  29076. public function setInputStream($stream)
  29077. {
  29078. if (!is_resource($stream)) {
  29079. throw new InvalidArgumentException('Input stream must be a valid resource.');
  29080. }
  29081. $this->inputStream = $stream;
  29082. }
  29083. public function getInputStream()
  29084. {
  29085. return $this->inputStream;
  29086. }
  29087. public function getName()
  29088. {
  29089. return 'question';
  29090. }
  29091. public function doAsk(OutputInterface $output, Question $question)
  29092. {
  29093. $this->writePrompt($output, $question);
  29094. $inputStream = $this->inputStream ?: STDIN;
  29095. $autocomplete = $question->getAutocompleterValues();
  29096. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  29097. $ret = false;
  29098. if ($question->isHidden()) {
  29099. try {
  29100. $ret = trim($this->getHiddenResponse($output, $inputStream));
  29101. } catch (\RuntimeException $e) {
  29102. if (!$question->isHiddenFallback()) {
  29103. throw $e;
  29104. }
  29105. }
  29106. }
  29107. if (false === $ret) {
  29108. $ret = $this->readFromInput($inputStream);
  29109. }
  29110. } else {
  29111. $ret = trim($this->autocomplete($output, $question, $inputStream));
  29112. }
  29113. $ret = strlen($ret) > 0 ? $ret : $question->getDefault();
  29114. if ($normalizer = $question->getNormalizer()) {
  29115. return $normalizer($ret);
  29116. }
  29117. return $ret;
  29118. }
  29119. protected function writePrompt(OutputInterface $output, Question $question)
  29120. {
  29121. $message = $question->getQuestion();
  29122. if ($question instanceof ChoiceQuestion) {
  29123. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  29124. $messages = (array) $question->getQuestion();
  29125. foreach ($question->getChoices() as $key => $value) {
  29126. $width = $maxWidth - $this->strlen($key);
  29127. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  29128. }
  29129. $output->writeln($messages);
  29130. $message = $question->getPrompt();
  29131. }
  29132. $output->write($message);
  29133. }
  29134. protected function writeError(OutputInterface $output, \Exception $error)
  29135. {
  29136. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  29137. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  29138. } else {
  29139. $message = '<error>'.$error->getMessage().'</error>';
  29140. }
  29141. $output->writeln($message);
  29142. }
  29143. private function autocomplete(OutputInterface $output, Question $question, $inputStream)
  29144. {
  29145. $autocomplete = $question->getAutocompleterValues();
  29146. $ret = '';
  29147. $i = 0;
  29148. $ofs = -1;
  29149. $matches = $autocomplete;
  29150. $numMatches = count($matches);
  29151. $sttyMode = shell_exec('stty -g');
  29152. shell_exec('stty -icanon -echo');
  29153. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  29154. while (!feof($inputStream)) {
  29155. $c = fread($inputStream, 1);
  29156. if ("\177" === $c) {
  29157. if (0 === $numMatches && 0 !== $i) {
  29158. --$i;
  29159. $output->write("\033[1D");
  29160. }
  29161. if ($i === 0) {
  29162. $ofs = -1;
  29163. $matches = $autocomplete;
  29164. $numMatches = count($matches);
  29165. } else {
  29166. $numMatches = 0;
  29167. }
  29168. $ret = substr($ret, 0, $i);
  29169. } elseif ("\033" === $c) {
  29170. $c .= fread($inputStream, 2);
  29171. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  29172. if ('A' === $c[2] && -1 === $ofs) {
  29173. $ofs = 0;
  29174. }
  29175. if (0 === $numMatches) {
  29176. continue;
  29177. }
  29178. $ofs += ('A' === $c[2]) ? -1 : 1;
  29179. $ofs = ($numMatches + $ofs) % $numMatches;
  29180. }
  29181. } elseif (ord($c) < 32) {
  29182. if ("\t" === $c || "\n" === $c) {
  29183. if ($numMatches > 0 && -1 !== $ofs) {
  29184. $ret = $matches[$ofs];
  29185. $output->write(substr($ret, $i));
  29186. $i = strlen($ret);
  29187. }
  29188. if ("\n" === $c) {
  29189. $output->write($c);
  29190. break;
  29191. }
  29192. $numMatches = 0;
  29193. }
  29194. continue;
  29195. } else {
  29196. $output->write($c);
  29197. $ret .= $c;
  29198. ++$i;
  29199. $numMatches = 0;
  29200. $ofs = 0;
  29201. foreach ($autocomplete as $value) {
  29202. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  29203. $matches[$numMatches++] = $value;
  29204. }
  29205. }
  29206. }
  29207. $output->write("\033[K");
  29208. if ($numMatches > 0 && -1 !== $ofs) {
  29209. $output->write("\0337");
  29210. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  29211. $output->write("\0338");
  29212. }
  29213. }
  29214. shell_exec(sprintf('stty %s', $sttyMode));
  29215. return $ret;
  29216. }
  29217. private function getHiddenResponse(OutputInterface $output, $inputStream)
  29218. {
  29219. if ('\\' === DIRECTORY_SEPARATOR) {
  29220. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  29221. if ('phar:' === substr(__FILE__, 0, 5)) {
  29222. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  29223. copy($exe, $tmpExe);
  29224. $exe = $tmpExe;
  29225. }
  29226. $value = rtrim(shell_exec($exe));
  29227. $output->writeln('');
  29228. if (isset($tmpExe)) {
  29229. unlink($tmpExe);
  29230. }
  29231. return $value;
  29232. }
  29233. if ($this->hasSttyAvailable()) {
  29234. $sttyMode = shell_exec('stty -g');
  29235. shell_exec('stty -echo');
  29236. $value = fgets($inputStream, 4096);
  29237. shell_exec(sprintf('stty %s', $sttyMode));
  29238. if (false === $value) {
  29239. throw new RuntimeException('Aborted');
  29240. }
  29241. $value = trim($value);
  29242. $output->writeln('');
  29243. return $value;
  29244. }
  29245. if (false !== $shell = $this->getShell()) {
  29246. $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword';
  29247. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  29248. $value = rtrim(shell_exec($command));
  29249. $output->writeln('');
  29250. return $value;
  29251. }
  29252. throw new RuntimeException('Unable to hide the response.');
  29253. }
  29254. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  29255. {
  29256. $error = null;
  29257. $attempts = $question->getMaxAttempts();
  29258. while (null === $attempts || $attempts--) {
  29259. if (null !== $error) {
  29260. $this->writeError($output, $error);
  29261. }
  29262. try {
  29263. return call_user_func($question->getValidator(), $interviewer());
  29264. } catch (\Exception $error) {
  29265. }
  29266. }
  29267. throw $error;
  29268. }
  29269. private function getShell()
  29270. {
  29271. if (null !== self::$shell) {
  29272. return self::$shell;
  29273. }
  29274. self::$shell = false;
  29275. if (file_exists('/usr/bin/env')) {
  29276. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  29277. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  29278. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  29279. self::$shell = $sh;
  29280. break;
  29281. }
  29282. }
  29283. }
  29284. return self::$shell;
  29285. }
  29286. private function readFromInput($stream)
  29287. {
  29288. if (STDIN === $stream && function_exists('readline')) {
  29289. $ret = readline('');
  29290. } else {
  29291. $ret = fgets($stream, 4096);
  29292. }
  29293. if (false === $ret) {
  29294. throw new RuntimeException('Aborted');
  29295. }
  29296. return trim($ret);
  29297. }
  29298. private function hasSttyAvailable()
  29299. {
  29300. if (null !== self::$stty) {
  29301. return self::$stty;
  29302. }
  29303. exec('stty 2>&1', $output, $exitcode);
  29304. return self::$stty = $exitcode === 0;
  29305. }
  29306. }
  29307. <?php
  29308. namespace Symfony\Component\Console\Helper;
  29309. use Symfony\Component\Console\Exception\LogicException;
  29310. use Symfony\Component\Console\Input\InputInterface;
  29311. use Symfony\Component\Console\Output\OutputInterface;
  29312. use Symfony\Component\Console\Question\ChoiceQuestion;
  29313. use Symfony\Component\Console\Question\ConfirmationQuestion;
  29314. use Symfony\Component\Console\Question\Question;
  29315. use Symfony\Component\Console\Style\SymfonyStyle;
  29316. class SymfonyQuestionHelper extends QuestionHelper
  29317. {
  29318. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  29319. {
  29320. $validator = $question->getValidator();
  29321. $question->setValidator(function ($value) use ($validator) {
  29322. if (null !== $validator) {
  29323. $value = $validator($value);
  29324. }
  29325. if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
  29326. throw new LogicException('A value is required.');
  29327. }
  29328. return $value;
  29329. });
  29330. return parent::ask($input, $output, $question);
  29331. }
  29332. protected function writePrompt(OutputInterface $output, Question $question)
  29333. {
  29334. $text = $question->getQuestion();
  29335. $default = $question->getDefault();
  29336. switch (true) {
  29337. case null === $default:
  29338. $text = sprintf(' <info>%s</info>:', $text);
  29339. break;
  29340. case $question instanceof ConfirmationQuestion:
  29341. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  29342. break;
  29343. case $question instanceof ChoiceQuestion:
  29344. $choices = $question->getChoices();
  29345. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, $choices[$default]);
  29346. break;
  29347. default:
  29348. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, $default);
  29349. }
  29350. $output->writeln($text);
  29351. if ($question instanceof ChoiceQuestion) {
  29352. $width = max(array_map('strlen', array_keys($question->getChoices())));
  29353. foreach ($question->getChoices() as $key => $value) {
  29354. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  29355. }
  29356. }
  29357. $output->write(' > ');
  29358. }
  29359. protected function writeError(OutputInterface $output, \Exception $error)
  29360. {
  29361. if ($output instanceof SymfonyStyle) {
  29362. $output->newLine();
  29363. $output->error($error->getMessage());
  29364. return;
  29365. }
  29366. parent::writeError($output, $error);
  29367. }
  29368. }
  29369. <?php
  29370. namespace Symfony\Component\Console\Helper;
  29371. use Symfony\Component\Console\Output\OutputInterface;
  29372. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29373. class Table
  29374. {
  29375. private $headers = array();
  29376. private $rows = array();
  29377. private $columnWidths = array();
  29378. private $numberOfColumns;
  29379. private $output;
  29380. private $style;
  29381. private $columnStyles = array();
  29382. private static $styles;
  29383. public function __construct(OutputInterface $output)
  29384. {
  29385. $this->output = $output;
  29386. if (!self::$styles) {
  29387. self::$styles = self::initStyles();
  29388. }
  29389. $this->setStyle('default');
  29390. }
  29391. public static function setStyleDefinition($name, TableStyle $style)
  29392. {
  29393. if (!self::$styles) {
  29394. self::$styles = self::initStyles();
  29395. }
  29396. self::$styles[$name] = $style;
  29397. }
  29398. public static function getStyleDefinition($name)
  29399. {
  29400. if (!self::$styles) {
  29401. self::$styles = self::initStyles();
  29402. }
  29403. if (!self::$styles[$name]) {
  29404. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  29405. }
  29406. return self::$styles[$name];
  29407. }
  29408. public function setStyle($name)
  29409. {
  29410. if ($name instanceof TableStyle) {
  29411. $this->style = $name;
  29412. } elseif (isset(self::$styles[$name])) {
  29413. $this->style = self::$styles[$name];
  29414. } else {
  29415. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  29416. }
  29417. return $this;
  29418. }
  29419. public function getStyle()
  29420. {
  29421. return $this->style;
  29422. }
  29423. public function setColumnStyle($columnIndex, $name)
  29424. {
  29425. $columnIndex = intval($columnIndex);
  29426. if ($name instanceof TableStyle) {
  29427. $this->columnStyles[$columnIndex] = $name;
  29428. } elseif (isset(self::$styles[$name])) {
  29429. $this->columnStyles[$columnIndex] = self::$styles[$name];
  29430. } else {
  29431. throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  29432. }
  29433. return $this;
  29434. }
  29435. public function getColumnStyle($columnIndex)
  29436. {
  29437. if (isset($this->columnStyles[$columnIndex])) {
  29438. return $this->columnStyles[$columnIndex];
  29439. }
  29440. return $this->getStyle();
  29441. }
  29442. public function setHeaders(array $headers)
  29443. {
  29444. $headers = array_values($headers);
  29445. if (!empty($headers) && !is_array($headers[0])) {
  29446. $headers = array($headers);
  29447. }
  29448. $this->headers = $headers;
  29449. return $this;
  29450. }
  29451. public function setRows(array $rows)
  29452. {
  29453. $this->rows = array();
  29454. return $this->addRows($rows);
  29455. }
  29456. public function addRows(array $rows)
  29457. {
  29458. foreach ($rows as $row) {
  29459. $this->addRow($row);
  29460. }
  29461. return $this;
  29462. }
  29463. public function addRow($row)
  29464. {
  29465. if ($row instanceof TableSeparator) {
  29466. $this->rows[] = $row;
  29467. return $this;
  29468. }
  29469. if (!is_array($row)) {
  29470. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  29471. }
  29472. $this->rows[] = array_values($row);
  29473. return $this;
  29474. }
  29475. public function setRow($column, array $row)
  29476. {
  29477. $this->rows[$column] = $row;
  29478. return $this;
  29479. }
  29480. public function render()
  29481. {
  29482. $this->calculateNumberOfColumns();
  29483. $rows = $this->buildTableRows($this->rows);
  29484. $headers = $this->buildTableRows($this->headers);
  29485. $this->calculateColumnsWidth(array_merge($headers, $rows));
  29486. $this->renderRowSeparator();
  29487. if (!empty($headers)) {
  29488. foreach ($headers as $header) {
  29489. $this->renderRow($header, $this->style->getCellHeaderFormat());
  29490. $this->renderRowSeparator();
  29491. }
  29492. }
  29493. foreach ($rows as $row) {
  29494. if ($row instanceof TableSeparator) {
  29495. $this->renderRowSeparator();
  29496. } else {
  29497. $this->renderRow($row, $this->style->getCellRowFormat());
  29498. }
  29499. }
  29500. if (!empty($rows)) {
  29501. $this->renderRowSeparator();
  29502. }
  29503. $this->cleanup();
  29504. }
  29505. private function renderRowSeparator()
  29506. {
  29507. if (0 === $count = $this->numberOfColumns) {
  29508. return;
  29509. }
  29510. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  29511. return;
  29512. }
  29513. $markup = $this->style->getCrossingChar();
  29514. for ($column = 0; $column < $count; ++$column) {
  29515. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  29516. }
  29517. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  29518. }
  29519. private function renderColumnSeparator()
  29520. {
  29521. $this->output->write(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  29522. }
  29523. private function renderRow(array $row, $cellFormat)
  29524. {
  29525. if (empty($row)) {
  29526. return;
  29527. }
  29528. $this->renderColumnSeparator();
  29529. foreach ($this->getRowColumns($row) as $column) {
  29530. $this->renderCell($row, $column, $cellFormat);
  29531. $this->renderColumnSeparator();
  29532. }
  29533. $this->output->writeln('');
  29534. }
  29535. private function renderCell(array $row, $column, $cellFormat)
  29536. {
  29537. $cell = isset($row[$column]) ? $row[$column] : '';
  29538. $width = $this->columnWidths[$column];
  29539. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  29540. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  29541. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  29542. }
  29543. }
  29544. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  29545. $width += strlen($cell) - mb_strwidth($cell, $encoding);
  29546. }
  29547. $style = $this->getColumnStyle($column);
  29548. if ($cell instanceof TableSeparator) {
  29549. $this->output->write(sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width)));
  29550. } else {
  29551. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  29552. $content = sprintf($style->getCellRowContentFormat(), $cell);
  29553. $this->output->write(sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType())));
  29554. }
  29555. }
  29556. private function calculateNumberOfColumns()
  29557. {
  29558. if (null !== $this->numberOfColumns) {
  29559. return;
  29560. }
  29561. $columns = array(0);
  29562. foreach (array_merge($this->headers, $this->rows) as $row) {
  29563. if ($row instanceof TableSeparator) {
  29564. continue;
  29565. }
  29566. $columns[] = $this->getNumberOfColumns($row);
  29567. }
  29568. $this->numberOfColumns = max($columns);
  29569. }
  29570. private function buildTableRows($rows)
  29571. {
  29572. $unmergedRows = array();
  29573. for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) {
  29574. $rows = $this->fillNextRows($rows, $rowKey);
  29575. foreach ($rows[$rowKey] as $column => $cell) {
  29576. if (!strstr($cell, "\n")) {
  29577. continue;
  29578. }
  29579. $lines = explode("\n", $cell);
  29580. foreach ($lines as $lineKey => $line) {
  29581. if ($cell instanceof TableCell) {
  29582. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  29583. }
  29584. if (0 === $lineKey) {
  29585. $rows[$rowKey][$column] = $line;
  29586. } else {
  29587. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  29588. }
  29589. }
  29590. }
  29591. }
  29592. $tableRows = array();
  29593. foreach ($rows as $rowKey => $row) {
  29594. $tableRows[] = $this->fillCells($row);
  29595. if (isset($unmergedRows[$rowKey])) {
  29596. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  29597. }
  29598. }
  29599. return $tableRows;
  29600. }
  29601. private function fillNextRows($rows, $line)
  29602. {
  29603. $unmergedRows = array();
  29604. foreach ($rows[$line] as $column => $cell) {
  29605. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  29606. $nbLines = $cell->getRowspan() - 1;
  29607. $lines = array($cell);
  29608. if (strstr($cell, "\n")) {
  29609. $lines = explode("\n", $cell);
  29610. $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  29611. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  29612. unset($lines[0]);
  29613. }
  29614. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, ''), $unmergedRows);
  29615. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  29616. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  29617. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  29618. }
  29619. }
  29620. }
  29621. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  29622. if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  29623. foreach ($unmergedRow as $cellKey => $cell) {
  29624. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  29625. }
  29626. } else {
  29627. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  29628. foreach ($unmergedRow as $column => $cell) {
  29629. if (!empty($cell)) {
  29630. $row[$column] = $unmergedRow[$column];
  29631. }
  29632. }
  29633. array_splice($rows, $unmergedRowKey, 0, array($row));
  29634. }
  29635. }
  29636. return $rows;
  29637. }
  29638. private function fillCells($row)
  29639. {
  29640. $newRow = array();
  29641. foreach ($row as $column => $cell) {
  29642. $newRow[] = $cell;
  29643. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  29644. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  29645. $newRow[] = '';
  29646. }
  29647. }
  29648. }
  29649. return $newRow ?: $row;
  29650. }
  29651. private function copyRow($rows, $line)
  29652. {
  29653. $row = $rows[$line];
  29654. foreach ($row as $cellKey => $cellValue) {
  29655. $row[$cellKey] = '';
  29656. if ($cellValue instanceof TableCell) {
  29657. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  29658. }
  29659. }
  29660. return $row;
  29661. }
  29662. private function getNumberOfColumns(array $row)
  29663. {
  29664. $columns = count($row);
  29665. foreach ($row as $column) {
  29666. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  29667. }
  29668. return $columns;
  29669. }
  29670. private function getRowColumns($row)
  29671. {
  29672. $columns = range(0, $this->numberOfColumns - 1);
  29673. foreach ($row as $cellKey => $cell) {
  29674. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  29675. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  29676. }
  29677. }
  29678. return $columns;
  29679. }
  29680. private function calculateColumnsWidth($rows)
  29681. {
  29682. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  29683. $lengths = array();
  29684. foreach ($rows as $row) {
  29685. if ($row instanceof TableSeparator) {
  29686. continue;
  29687. }
  29688. $lengths[] = $this->getCellWidth($row, $column);
  29689. }
  29690. $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2;
  29691. }
  29692. }
  29693. private function getColumnSeparatorWidth()
  29694. {
  29695. return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  29696. }
  29697. private function getCellWidth(array $row, $column)
  29698. {
  29699. if (isset($row[$column])) {
  29700. $cell = $row[$column];
  29701. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  29702. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  29703. $cellWidth = $cellWidth / $cell->getColspan();
  29704. }
  29705. return $cellWidth;
  29706. }
  29707. return 0;
  29708. }
  29709. private function cleanup()
  29710. {
  29711. $this->columnWidths = array();
  29712. $this->numberOfColumns = null;
  29713. }
  29714. private static function initStyles()
  29715. {
  29716. $borderless = new TableStyle();
  29717. $borderless
  29718. ->setHorizontalBorderChar('=')
  29719. ->setVerticalBorderChar(' ')
  29720. ->setCrossingChar(' ')
  29721. ;
  29722. $compact = new TableStyle();
  29723. $compact
  29724. ->setHorizontalBorderChar('')
  29725. ->setVerticalBorderChar(' ')
  29726. ->setCrossingChar('')
  29727. ->setCellRowContentFormat('%s')
  29728. ;
  29729. $styleGuide = new TableStyle();
  29730. $styleGuide
  29731. ->setHorizontalBorderChar('-')
  29732. ->setVerticalBorderChar(' ')
  29733. ->setCrossingChar(' ')
  29734. ->setCellHeaderFormat('%s')
  29735. ;
  29736. return array(
  29737. 'default' => new TableStyle(),
  29738. 'borderless' => $borderless,
  29739. 'compact' => $compact,
  29740. 'symfony-style-guide' => $styleGuide,
  29741. );
  29742. }
  29743. }
  29744. <?php
  29745. namespace Symfony\Component\Console\Helper;
  29746. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29747. class TableCell
  29748. {
  29749. private $value;
  29750. private $options = array(
  29751. 'rowspan' => 1,
  29752. 'colspan' => 1,
  29753. );
  29754. public function __construct($value = '', array $options = array())
  29755. {
  29756. $this->value = $value;
  29757. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  29758. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  29759. }
  29760. $this->options = array_merge($this->options, $options);
  29761. }
  29762. public function __toString()
  29763. {
  29764. return $this->value;
  29765. }
  29766. public function getColspan()
  29767. {
  29768. return (int) $this->options['colspan'];
  29769. }
  29770. public function getRowspan()
  29771. {
  29772. return (int) $this->options['rowspan'];
  29773. }
  29774. }
  29775. <?php
  29776. namespace Symfony\Component\Console\Helper;
  29777. use Symfony\Component\Console\Output\OutputInterface;
  29778. use Symfony\Component\Console\Output\NullOutput;
  29779. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29780. class TableHelper extends Helper
  29781. {
  29782. const LAYOUT_DEFAULT = 0;
  29783. const LAYOUT_BORDERLESS = 1;
  29784. const LAYOUT_COMPACT = 2;
  29785. private $table;
  29786. public function __construct($triggerDeprecationError = true)
  29787. {
  29788. if ($triggerDeprecationError) {
  29789. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  29790. }
  29791. $this->table = new Table(new NullOutput());
  29792. }
  29793. public function setLayout($layout)
  29794. {
  29795. switch ($layout) {
  29796. case self::LAYOUT_BORDERLESS:
  29797. $this->table->setStyle('borderless');
  29798. break;
  29799. case self::LAYOUT_COMPACT:
  29800. $this->table->setStyle('compact');
  29801. break;
  29802. case self::LAYOUT_DEFAULT:
  29803. $this->table->setStyle('default');
  29804. break;
  29805. default:
  29806. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  29807. }
  29808. return $this;
  29809. }
  29810. public function setHeaders(array $headers)
  29811. {
  29812. $this->table->setHeaders($headers);
  29813. return $this;
  29814. }
  29815. public function setRows(array $rows)
  29816. {
  29817. $this->table->setRows($rows);
  29818. return $this;
  29819. }
  29820. public function addRows(array $rows)
  29821. {
  29822. $this->table->addRows($rows);
  29823. return $this;
  29824. }
  29825. public function addRow(array $row)
  29826. {
  29827. $this->table->addRow($row);
  29828. return $this;
  29829. }
  29830. public function setRow($column, array $row)
  29831. {
  29832. $this->table->setRow($column, $row);
  29833. return $this;
  29834. }
  29835. public function setPaddingChar($paddingChar)
  29836. {
  29837. $this->table->getStyle()->setPaddingChar($paddingChar);
  29838. return $this;
  29839. }
  29840. public function setHorizontalBorderChar($horizontalBorderChar)
  29841. {
  29842. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  29843. return $this;
  29844. }
  29845. public function setVerticalBorderChar($verticalBorderChar)
  29846. {
  29847. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  29848. return $this;
  29849. }
  29850. public function setCrossingChar($crossingChar)
  29851. {
  29852. $this->table->getStyle()->setCrossingChar($crossingChar);
  29853. return $this;
  29854. }
  29855. public function setCellHeaderFormat($cellHeaderFormat)
  29856. {
  29857. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  29858. return $this;
  29859. }
  29860. public function setCellRowFormat($cellRowFormat)
  29861. {
  29862. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  29863. return $this;
  29864. }
  29865. public function setCellRowContentFormat($cellRowContentFormat)
  29866. {
  29867. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  29868. return $this;
  29869. }
  29870. public function setBorderFormat($borderFormat)
  29871. {
  29872. $this->table->getStyle()->setBorderFormat($borderFormat);
  29873. return $this;
  29874. }
  29875. public function setPadType($padType)
  29876. {
  29877. $this->table->getStyle()->setPadType($padType);
  29878. return $this;
  29879. }
  29880. public function render(OutputInterface $output)
  29881. {
  29882. $p = new \ReflectionProperty($this->table, 'output');
  29883. $p->setAccessible(true);
  29884. $p->setValue($this->table, $output);
  29885. $this->table->render();
  29886. }
  29887. public function getName()
  29888. {
  29889. return 'table';
  29890. }
  29891. }
  29892. <?php
  29893. namespace Symfony\Component\Console\Helper;
  29894. class TableSeparator extends TableCell
  29895. {
  29896. public function __construct(array $options = array())
  29897. {
  29898. parent::__construct('', $options);
  29899. }
  29900. }
  29901. <?php
  29902. namespace Symfony\Component\Console\Helper;
  29903. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29904. use Symfony\Component\Console\Exception\LogicException;
  29905. class TableStyle
  29906. {
  29907. private $paddingChar = ' ';
  29908. private $horizontalBorderChar = '-';
  29909. private $verticalBorderChar = '|';
  29910. private $crossingChar = '+';
  29911. private $cellHeaderFormat = '<info>%s</info>';
  29912. private $cellRowFormat = '%s';
  29913. private $cellRowContentFormat = ' %s ';
  29914. private $borderFormat = '%s';
  29915. private $padType = STR_PAD_RIGHT;
  29916. public function setPaddingChar($paddingChar)
  29917. {
  29918. if (!$paddingChar) {
  29919. throw new LogicException('The padding char must not be empty');
  29920. }
  29921. $this->paddingChar = $paddingChar;
  29922. return $this;
  29923. }
  29924. public function getPaddingChar()
  29925. {
  29926. return $this->paddingChar;
  29927. }
  29928. public function setHorizontalBorderChar($horizontalBorderChar)
  29929. {
  29930. $this->horizontalBorderChar = $horizontalBorderChar;
  29931. return $this;
  29932. }
  29933. public function getHorizontalBorderChar()
  29934. {
  29935. return $this->horizontalBorderChar;
  29936. }
  29937. public function setVerticalBorderChar($verticalBorderChar)
  29938. {
  29939. $this->verticalBorderChar = $verticalBorderChar;
  29940. return $this;
  29941. }
  29942. public function getVerticalBorderChar()
  29943. {
  29944. return $this->verticalBorderChar;
  29945. }
  29946. public function setCrossingChar($crossingChar)
  29947. {
  29948. $this->crossingChar = $crossingChar;
  29949. return $this;
  29950. }
  29951. public function getCrossingChar()
  29952. {
  29953. return $this->crossingChar;
  29954. }
  29955. public function setCellHeaderFormat($cellHeaderFormat)
  29956. {
  29957. $this->cellHeaderFormat = $cellHeaderFormat;
  29958. return $this;
  29959. }
  29960. public function getCellHeaderFormat()
  29961. {
  29962. return $this->cellHeaderFormat;
  29963. }
  29964. public function setCellRowFormat($cellRowFormat)
  29965. {
  29966. $this->cellRowFormat = $cellRowFormat;
  29967. return $this;
  29968. }
  29969. public function getCellRowFormat()
  29970. {
  29971. return $this->cellRowFormat;
  29972. }
  29973. public function setCellRowContentFormat($cellRowContentFormat)
  29974. {
  29975. $this->cellRowContentFormat = $cellRowContentFormat;
  29976. return $this;
  29977. }
  29978. public function getCellRowContentFormat()
  29979. {
  29980. return $this->cellRowContentFormat;
  29981. }
  29982. public function setBorderFormat($borderFormat)
  29983. {
  29984. $this->borderFormat = $borderFormat;
  29985. return $this;
  29986. }
  29987. public function getBorderFormat()
  29988. {
  29989. return $this->borderFormat;
  29990. }
  29991. public function setPadType($padType)
  29992. {
  29993. if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  29994. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  29995. }
  29996. $this->padType = $padType;
  29997. return $this;
  29998. }
  29999. public function getPadType()
  30000. {
  30001. return $this->padType;
  30002. }
  30003. }
  30004. <?php
  30005. namespace Symfony\Component\Console\Input;
  30006. use Symfony\Component\Console\Exception\RuntimeException;
  30007. class ArgvInput extends Input
  30008. {
  30009. private $tokens;
  30010. private $parsed;
  30011. public function __construct(array $argv = null, InputDefinition $definition = null)
  30012. {
  30013. if (null === $argv) {
  30014. $argv = $_SERVER['argv'];
  30015. }
  30016. array_shift($argv);
  30017. $this->tokens = $argv;
  30018. parent::__construct($definition);
  30019. }
  30020. protected function setTokens(array $tokens)
  30021. {
  30022. $this->tokens = $tokens;
  30023. }
  30024. protected function parse()
  30025. {
  30026. $parseOptions = true;
  30027. $this->parsed = $this->tokens;
  30028. while (null !== $token = array_shift($this->parsed)) {
  30029. if ($parseOptions && '' == $token) {
  30030. $this->parseArgument($token);
  30031. } elseif ($parseOptions && '--' == $token) {
  30032. $parseOptions = false;
  30033. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  30034. $this->parseLongOption($token);
  30035. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  30036. $this->parseShortOption($token);
  30037. } else {
  30038. $this->parseArgument($token);
  30039. }
  30040. }
  30041. }
  30042. private function parseShortOption($token)
  30043. {
  30044. $name = substr($token, 1);
  30045. if (strlen($name) > 1) {
  30046. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  30047. $this->addShortOption($name[0], substr($name, 1));
  30048. } else {
  30049. $this->parseShortOptionSet($name);
  30050. }
  30051. } else {
  30052. $this->addShortOption($name, null);
  30053. }
  30054. }
  30055. private function parseShortOptionSet($name)
  30056. {
  30057. $len = strlen($name);
  30058. for ($i = 0; $i < $len; ++$i) {
  30059. if (!$this->definition->hasShortcut($name[$i])) {
  30060. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
  30061. }
  30062. $option = $this->definition->getOptionForShortcut($name[$i]);
  30063. if ($option->acceptValue()) {
  30064. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  30065. break;
  30066. } else {
  30067. $this->addLongOption($option->getName(), null);
  30068. }
  30069. }
  30070. }
  30071. private function parseLongOption($token)
  30072. {
  30073. $name = substr($token, 2);
  30074. if (false !== $pos = strpos($name, '=')) {
  30075. $this->addLongOption(substr($name, 0, $pos), substr($name, $pos + 1));
  30076. } else {
  30077. $this->addLongOption($name, null);
  30078. }
  30079. }
  30080. private function parseArgument($token)
  30081. {
  30082. $c = count($this->arguments);
  30083. if ($this->definition->hasArgument($c)) {
  30084. $arg = $this->definition->getArgument($c);
  30085. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  30086. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  30087. $arg = $this->definition->getArgument($c - 1);
  30088. $this->arguments[$arg->getName()][] = $token;
  30089. } else {
  30090. throw new RuntimeException('Too many arguments.');
  30091. }
  30092. }
  30093. private function addShortOption($shortcut, $value)
  30094. {
  30095. if (!$this->definition->hasShortcut($shortcut)) {
  30096. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  30097. }
  30098. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  30099. }
  30100. private function addLongOption($name, $value)
  30101. {
  30102. if (!$this->definition->hasOption($name)) {
  30103. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  30104. }
  30105. $option = $this->definition->getOption($name);
  30106. if (!isset($value[0])) {
  30107. $value = null;
  30108. }
  30109. if (null !== $value && !$option->acceptValue()) {
  30110. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  30111. }
  30112. if (null === $value && $option->acceptValue() && count($this->parsed)) {
  30113. $next = array_shift($this->parsed);
  30114. if (isset($next[0]) && '-' !== $next[0]) {
  30115. $value = $next;
  30116. } elseif (empty($next)) {
  30117. $value = '';
  30118. } else {
  30119. array_unshift($this->parsed, $next);
  30120. }
  30121. }
  30122. if (null === $value) {
  30123. if ($option->isValueRequired()) {
  30124. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  30125. }
  30126. if (!$option->isArray()) {
  30127. $value = $option->isValueOptional() ? $option->getDefault() : true;
  30128. }
  30129. }
  30130. if ($option->isArray()) {
  30131. $this->options[$name][] = $value;
  30132. } else {
  30133. $this->options[$name] = $value;
  30134. }
  30135. }
  30136. public function getFirstArgument()
  30137. {
  30138. foreach ($this->tokens as $token) {
  30139. if ($token && '-' === $token[0]) {
  30140. continue;
  30141. }
  30142. return $token;
  30143. }
  30144. }
  30145. public function hasParameterOption($values)
  30146. {
  30147. $values = (array) $values;
  30148. foreach ($this->tokens as $token) {
  30149. foreach ($values as $value) {
  30150. if ($token === $value || 0 === strpos($token, $value.'=')) {
  30151. return true;
  30152. }
  30153. }
  30154. }
  30155. return false;
  30156. }
  30157. public function getParameterOption($values, $default = false)
  30158. {
  30159. $values = (array) $values;
  30160. $tokens = $this->tokens;
  30161. while (0 < count($tokens)) {
  30162. $token = array_shift($tokens);
  30163. foreach ($values as $value) {
  30164. if ($token === $value || 0 === strpos($token, $value.'=')) {
  30165. if (false !== $pos = strpos($token, '=')) {
  30166. return substr($token, $pos + 1);
  30167. }
  30168. return array_shift($tokens);
  30169. }
  30170. }
  30171. }
  30172. return $default;
  30173. }
  30174. public function __toString()
  30175. {
  30176. $self = $this;
  30177. $tokens = array_map(function ($token) use ($self) {
  30178. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  30179. return $match[1].$self->escapeToken($match[2]);
  30180. }
  30181. if ($token && $token[0] !== '-') {
  30182. return $self->escapeToken($token);
  30183. }
  30184. return $token;
  30185. }, $this->tokens);
  30186. return implode(' ', $tokens);
  30187. }
  30188. }
  30189. <?php
  30190. namespace Symfony\Component\Console\Input;
  30191. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30192. use Symfony\Component\Console\Exception\InvalidOptionException;
  30193. class ArrayInput extends Input
  30194. {
  30195. private $parameters;
  30196. public function __construct(array $parameters, InputDefinition $definition = null)
  30197. {
  30198. $this->parameters = $parameters;
  30199. parent::__construct($definition);
  30200. }
  30201. public function getFirstArgument()
  30202. {
  30203. foreach ($this->parameters as $key => $value) {
  30204. if ($key && '-' === $key[0]) {
  30205. continue;
  30206. }
  30207. return $value;
  30208. }
  30209. }
  30210. public function hasParameterOption($values)
  30211. {
  30212. $values = (array) $values;
  30213. foreach ($this->parameters as $k => $v) {
  30214. if (!is_int($k)) {
  30215. $v = $k;
  30216. }
  30217. if (in_array($v, $values)) {
  30218. return true;
  30219. }
  30220. }
  30221. return false;
  30222. }
  30223. public function getParameterOption($values, $default = false)
  30224. {
  30225. $values = (array) $values;
  30226. foreach ($this->parameters as $k => $v) {
  30227. if (is_int($k)) {
  30228. if (in_array($v, $values)) {
  30229. return true;
  30230. }
  30231. } elseif (in_array($k, $values)) {
  30232. return $v;
  30233. }
  30234. }
  30235. return $default;
  30236. }
  30237. public function __toString()
  30238. {
  30239. $params = array();
  30240. foreach ($this->parameters as $param => $val) {
  30241. if ($param && '-' === $param[0]) {
  30242. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  30243. } else {
  30244. $params[] = $this->escapeToken($val);
  30245. }
  30246. }
  30247. return implode(' ', $params);
  30248. }
  30249. protected function parse()
  30250. {
  30251. foreach ($this->parameters as $key => $value) {
  30252. if (0 === strpos($key, '--')) {
  30253. $this->addLongOption(substr($key, 2), $value);
  30254. } elseif ('-' === $key[0]) {
  30255. $this->addShortOption(substr($key, 1), $value);
  30256. } else {
  30257. $this->addArgument($key, $value);
  30258. }
  30259. }
  30260. }
  30261. private function addShortOption($shortcut, $value)
  30262. {
  30263. if (!$this->definition->hasShortcut($shortcut)) {
  30264. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  30265. }
  30266. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  30267. }
  30268. private function addLongOption($name, $value)
  30269. {
  30270. if (!$this->definition->hasOption($name)) {
  30271. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  30272. }
  30273. $option = $this->definition->getOption($name);
  30274. if (null === $value) {
  30275. if ($option->isValueRequired()) {
  30276. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  30277. }
  30278. $value = $option->isValueOptional() ? $option->getDefault() : true;
  30279. }
  30280. $this->options[$name] = $value;
  30281. }
  30282. private function addArgument($name, $value)
  30283. {
  30284. if (!$this->definition->hasArgument($name)) {
  30285. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  30286. }
  30287. $this->arguments[$name] = $value;
  30288. }
  30289. }
  30290. <?php
  30291. namespace Symfony\Component\Console\Input;
  30292. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30293. use Symfony\Component\Console\Exception\RuntimeException;
  30294. abstract class Input implements InputInterface
  30295. {
  30296. protected $definition;
  30297. protected $options = array();
  30298. protected $arguments = array();
  30299. protected $interactive = true;
  30300. public function __construct(InputDefinition $definition = null)
  30301. {
  30302. if (null === $definition) {
  30303. $this->definition = new InputDefinition();
  30304. } else {
  30305. $this->bind($definition);
  30306. $this->validate();
  30307. }
  30308. }
  30309. public function bind(InputDefinition $definition)
  30310. {
  30311. $this->arguments = array();
  30312. $this->options = array();
  30313. $this->definition = $definition;
  30314. $this->parse();
  30315. }
  30316. abstract protected function parse();
  30317. public function validate()
  30318. {
  30319. $definition = $this->definition;
  30320. $givenArguments = $this->arguments;
  30321. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  30322. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  30323. });
  30324. if (count($missingArguments) > 0) {
  30325. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  30326. }
  30327. }
  30328. public function isInteractive()
  30329. {
  30330. return $this->interactive;
  30331. }
  30332. public function setInteractive($interactive)
  30333. {
  30334. $this->interactive = (bool) $interactive;
  30335. }
  30336. public function getArguments()
  30337. {
  30338. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  30339. }
  30340. public function getArgument($name)
  30341. {
  30342. if (!$this->definition->hasArgument($name)) {
  30343. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  30344. }
  30345. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  30346. }
  30347. public function setArgument($name, $value)
  30348. {
  30349. if (!$this->definition->hasArgument($name)) {
  30350. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  30351. }
  30352. $this->arguments[$name] = $value;
  30353. }
  30354. public function hasArgument($name)
  30355. {
  30356. return $this->definition->hasArgument($name);
  30357. }
  30358. public function getOptions()
  30359. {
  30360. return array_merge($this->definition->getOptionDefaults(), $this->options);
  30361. }
  30362. public function getOption($name)
  30363. {
  30364. if (!$this->definition->hasOption($name)) {
  30365. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  30366. }
  30367. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  30368. }
  30369. public function setOption($name, $value)
  30370. {
  30371. if (!$this->definition->hasOption($name)) {
  30372. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  30373. }
  30374. $this->options[$name] = $value;
  30375. }
  30376. public function hasOption($name)
  30377. {
  30378. return $this->definition->hasOption($name);
  30379. }
  30380. public function escapeToken($token)
  30381. {
  30382. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  30383. }
  30384. }
  30385. <?php
  30386. namespace Symfony\Component\Console\Input;
  30387. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30388. use Symfony\Component\Console\Exception\LogicException;
  30389. class InputArgument
  30390. {
  30391. const REQUIRED = 1;
  30392. const OPTIONAL = 2;
  30393. const IS_ARRAY = 4;
  30394. private $name;
  30395. private $mode;
  30396. private $default;
  30397. private $description;
  30398. public function __construct($name, $mode = null, $description = '', $default = null)
  30399. {
  30400. if (null === $mode) {
  30401. $mode = self::OPTIONAL;
  30402. } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
  30403. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  30404. }
  30405. $this->name = $name;
  30406. $this->mode = $mode;
  30407. $this->description = $description;
  30408. $this->setDefault($default);
  30409. }
  30410. public function getName()
  30411. {
  30412. return $this->name;
  30413. }
  30414. public function isRequired()
  30415. {
  30416. return self::REQUIRED === (self::REQUIRED & $this->mode);
  30417. }
  30418. public function isArray()
  30419. {
  30420. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  30421. }
  30422. public function setDefault($default = null)
  30423. {
  30424. if (self::REQUIRED === $this->mode && null !== $default) {
  30425. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  30426. }
  30427. if ($this->isArray()) {
  30428. if (null === $default) {
  30429. $default = array();
  30430. } elseif (!is_array($default)) {
  30431. throw new LogicException('A default value for an array argument must be an array.');
  30432. }
  30433. }
  30434. $this->default = $default;
  30435. }
  30436. public function getDefault()
  30437. {
  30438. return $this->default;
  30439. }
  30440. public function getDescription()
  30441. {
  30442. return $this->description;
  30443. }
  30444. }
  30445. <?php
  30446. namespace Symfony\Component\Console\Input;
  30447. interface InputAwareInterface
  30448. {
  30449. public function setInput(InputInterface $input);
  30450. }
  30451. <?php
  30452. namespace Symfony\Component\Console\Input;
  30453. use Symfony\Component\Console\Descriptor\TextDescriptor;
  30454. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  30455. use Symfony\Component\Console\Output\BufferedOutput;
  30456. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30457. use Symfony\Component\Console\Exception\LogicException;
  30458. class InputDefinition
  30459. {
  30460. private $arguments;
  30461. private $requiredCount;
  30462. private $hasAnArrayArgument = false;
  30463. private $hasOptional;
  30464. private $options;
  30465. private $shortcuts;
  30466. public function __construct(array $definition = array())
  30467. {
  30468. $this->setDefinition($definition);
  30469. }
  30470. public function setDefinition(array $definition)
  30471. {
  30472. $arguments = array();
  30473. $options = array();
  30474. foreach ($definition as $item) {
  30475. if ($item instanceof InputOption) {
  30476. $options[] = $item;
  30477. } else {
  30478. $arguments[] = $item;
  30479. }
  30480. }
  30481. $this->setArguments($arguments);
  30482. $this->setOptions($options);
  30483. }
  30484. public function setArguments($arguments = array())
  30485. {
  30486. $this->arguments = array();
  30487. $this->requiredCount = 0;
  30488. $this->hasOptional = false;
  30489. $this->hasAnArrayArgument = false;
  30490. $this->addArguments($arguments);
  30491. }
  30492. public function addArguments($arguments = array())
  30493. {
  30494. if (null !== $arguments) {
  30495. foreach ($arguments as $argument) {
  30496. $this->addArgument($argument);
  30497. }
  30498. }
  30499. }
  30500. public function addArgument(InputArgument $argument)
  30501. {
  30502. if (isset($this->arguments[$argument->getName()])) {
  30503. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  30504. }
  30505. if ($this->hasAnArrayArgument) {
  30506. throw new LogicException('Cannot add an argument after an array argument.');
  30507. }
  30508. if ($argument->isRequired() && $this->hasOptional) {
  30509. throw new LogicException('Cannot add a required argument after an optional one.');
  30510. }
  30511. if ($argument->isArray()) {
  30512. $this->hasAnArrayArgument = true;
  30513. }
  30514. if ($argument->isRequired()) {
  30515. ++$this->requiredCount;
  30516. } else {
  30517. $this->hasOptional = true;
  30518. }
  30519. $this->arguments[$argument->getName()] = $argument;
  30520. }
  30521. public function getArgument($name)
  30522. {
  30523. if (!$this->hasArgument($name)) {
  30524. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  30525. }
  30526. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  30527. return $arguments[$name];
  30528. }
  30529. public function hasArgument($name)
  30530. {
  30531. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  30532. return isset($arguments[$name]);
  30533. }
  30534. public function getArguments()
  30535. {
  30536. return $this->arguments;
  30537. }
  30538. public function getArgumentCount()
  30539. {
  30540. return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
  30541. }
  30542. public function getArgumentRequiredCount()
  30543. {
  30544. return $this->requiredCount;
  30545. }
  30546. public function getArgumentDefaults()
  30547. {
  30548. $values = array();
  30549. foreach ($this->arguments as $argument) {
  30550. $values[$argument->getName()] = $argument->getDefault();
  30551. }
  30552. return $values;
  30553. }
  30554. public function setOptions($options = array())
  30555. {
  30556. $this->options = array();
  30557. $this->shortcuts = array();
  30558. $this->addOptions($options);
  30559. }
  30560. public function addOptions($options = array())
  30561. {
  30562. foreach ($options as $option) {
  30563. $this->addOption($option);
  30564. }
  30565. }
  30566. public function addOption(InputOption $option)
  30567. {
  30568. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  30569. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  30570. }
  30571. if ($option->getShortcut()) {
  30572. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  30573. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  30574. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  30575. }
  30576. }
  30577. }
  30578. $this->options[$option->getName()] = $option;
  30579. if ($option->getShortcut()) {
  30580. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  30581. $this->shortcuts[$shortcut] = $option->getName();
  30582. }
  30583. }
  30584. }
  30585. public function getOption($name)
  30586. {
  30587. if (!$this->hasOption($name)) {
  30588. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  30589. }
  30590. return $this->options[$name];
  30591. }
  30592. public function hasOption($name)
  30593. {
  30594. return isset($this->options[$name]);
  30595. }
  30596. public function getOptions()
  30597. {
  30598. return $this->options;
  30599. }
  30600. public function hasShortcut($name)
  30601. {
  30602. return isset($this->shortcuts[$name]);
  30603. }
  30604. public function getOptionForShortcut($shortcut)
  30605. {
  30606. return $this->getOption($this->shortcutToName($shortcut));
  30607. }
  30608. public function getOptionDefaults()
  30609. {
  30610. $values = array();
  30611. foreach ($this->options as $option) {
  30612. $values[$option->getName()] = $option->getDefault();
  30613. }
  30614. return $values;
  30615. }
  30616. private function shortcutToName($shortcut)
  30617. {
  30618. if (!isset($this->shortcuts[$shortcut])) {
  30619. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  30620. }
  30621. return $this->shortcuts[$shortcut];
  30622. }
  30623. public function getSynopsis($short = false)
  30624. {
  30625. $elements = array();
  30626. if ($short && $this->getOptions()) {
  30627. $elements[] = '[options]';
  30628. } elseif (!$short) {
  30629. foreach ($this->getOptions() as $option) {
  30630. $value = '';
  30631. if ($option->acceptValue()) {
  30632. $value = sprintf(
  30633. ' %s%s%s',
  30634. $option->isValueOptional() ? '[' : '',
  30635. strtoupper($option->getName()),
  30636. $option->isValueOptional() ? ']' : ''
  30637. );
  30638. }
  30639. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  30640. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  30641. }
  30642. }
  30643. if (count($elements) && $this->getArguments()) {
  30644. $elements[] = '[--]';
  30645. }
  30646. foreach ($this->getArguments() as $argument) {
  30647. $element = '<'.$argument->getName().'>';
  30648. if (!$argument->isRequired()) {
  30649. $element = '['.$element.']';
  30650. } elseif ($argument->isArray()) {
  30651. $element = $element.' ('.$element.')';
  30652. }
  30653. if ($argument->isArray()) {
  30654. $element .= '...';
  30655. }
  30656. $elements[] = $element;
  30657. }
  30658. return implode(' ', $elements);
  30659. }
  30660. public function asText()
  30661. {
  30662. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30663. $descriptor = new TextDescriptor();
  30664. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  30665. $descriptor->describe($output, $this, array('raw_output' => true));
  30666. return $output->fetch();
  30667. }
  30668. public function asXml($asDom = false)
  30669. {
  30670. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30671. $descriptor = new XmlDescriptor();
  30672. if ($asDom) {
  30673. return $descriptor->getInputDefinitionDocument($this);
  30674. }
  30675. $output = new BufferedOutput();
  30676. $descriptor->describe($output, $this);
  30677. return $output->fetch();
  30678. }
  30679. }
  30680. <?php
  30681. namespace Symfony\Component\Console\Input;
  30682. interface InputInterface
  30683. {
  30684. public function getFirstArgument();
  30685. public function hasParameterOption($values);
  30686. public function getParameterOption($values, $default = false);
  30687. public function bind(InputDefinition $definition);
  30688. public function validate();
  30689. public function getArguments();
  30690. public function getArgument($name);
  30691. public function setArgument($name, $value);
  30692. public function hasArgument($name);
  30693. public function getOptions();
  30694. public function getOption($name);
  30695. public function setOption($name, $value);
  30696. public function hasOption($name);
  30697. public function isInteractive();
  30698. public function setInteractive($interactive);
  30699. }
  30700. <?php
  30701. namespace Symfony\Component\Console\Input;
  30702. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30703. use Symfony\Component\Console\Exception\LogicException;
  30704. class InputOption
  30705. {
  30706. const VALUE_NONE = 1;
  30707. const VALUE_REQUIRED = 2;
  30708. const VALUE_OPTIONAL = 4;
  30709. const VALUE_IS_ARRAY = 8;
  30710. private $name;
  30711. private $shortcut;
  30712. private $mode;
  30713. private $default;
  30714. private $description;
  30715. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  30716. {
  30717. if (0 === strpos($name, '--')) {
  30718. $name = substr($name, 2);
  30719. }
  30720. if (empty($name)) {
  30721. throw new InvalidArgumentException('An option name cannot be empty.');
  30722. }
  30723. if (empty($shortcut)) {
  30724. $shortcut = null;
  30725. }
  30726. if (null !== $shortcut) {
  30727. if (is_array($shortcut)) {
  30728. $shortcut = implode('|', $shortcut);
  30729. }
  30730. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  30731. $shortcuts = array_filter($shortcuts);
  30732. $shortcut = implode('|', $shortcuts);
  30733. if (empty($shortcut)) {
  30734. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  30735. }
  30736. }
  30737. if (null === $mode) {
  30738. $mode = self::VALUE_NONE;
  30739. } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
  30740. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  30741. }
  30742. $this->name = $name;
  30743. $this->shortcut = $shortcut;
  30744. $this->mode = $mode;
  30745. $this->description = $description;
  30746. if ($this->isArray() && !$this->acceptValue()) {
  30747. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  30748. }
  30749. $this->setDefault($default);
  30750. }
  30751. public function getShortcut()
  30752. {
  30753. return $this->shortcut;
  30754. }
  30755. public function getName()
  30756. {
  30757. return $this->name;
  30758. }
  30759. public function acceptValue()
  30760. {
  30761. return $this->isValueRequired() || $this->isValueOptional();
  30762. }
  30763. public function isValueRequired()
  30764. {
  30765. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  30766. }
  30767. public function isValueOptional()
  30768. {
  30769. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  30770. }
  30771. public function isArray()
  30772. {
  30773. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  30774. }
  30775. public function setDefault($default = null)
  30776. {
  30777. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  30778. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  30779. }
  30780. if ($this->isArray()) {
  30781. if (null === $default) {
  30782. $default = array();
  30783. } elseif (!is_array($default)) {
  30784. throw new LogicException('A default value for an array option must be an array.');
  30785. }
  30786. }
  30787. $this->default = $this->acceptValue() ? $default : false;
  30788. }
  30789. public function getDefault()
  30790. {
  30791. return $this->default;
  30792. }
  30793. public function getDescription()
  30794. {
  30795. return $this->description;
  30796. }
  30797. public function equals(InputOption $option)
  30798. {
  30799. return $option->getName() === $this->getName()
  30800. && $option->getShortcut() === $this->getShortcut()
  30801. && $option->getDefault() === $this->getDefault()
  30802. && $option->isArray() === $this->isArray()
  30803. && $option->isValueRequired() === $this->isValueRequired()
  30804. && $option->isValueOptional() === $this->isValueOptional()
  30805. ;
  30806. }
  30807. }
  30808. <?php
  30809. namespace Symfony\Component\Console\Input;
  30810. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30811. class StringInput extends ArgvInput
  30812. {
  30813. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  30814. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  30815. public function __construct($input, InputDefinition $definition = null)
  30816. {
  30817. if ($definition) {
  30818. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  30819. }
  30820. parent::__construct(array(), null);
  30821. $this->setTokens($this->tokenize($input));
  30822. if (null !== $definition) {
  30823. $this->bind($definition);
  30824. }
  30825. }
  30826. private function tokenize($input)
  30827. {
  30828. $tokens = array();
  30829. $length = strlen($input);
  30830. $cursor = 0;
  30831. while ($cursor < $length) {
  30832. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  30833. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  30834. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
  30835. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  30836. $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
  30837. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  30838. $tokens[] = stripcslashes($match[1]);
  30839. } else {
  30840. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  30841. }
  30842. $cursor += strlen($match[0]);
  30843. }
  30844. return $tokens;
  30845. }
  30846. }
  30847. Copyright (c) 2004-2016 Fabien Potencier
  30848. Permission is hereby granted, free of charge, to any person obtaining a copy
  30849. of this software and associated documentation files (the "Software"), to deal
  30850. in the Software without restriction, including without limitation the rights
  30851. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  30852. copies of the Software, and to permit persons to whom the Software is furnished
  30853. to do so, subject to the following conditions:
  30854. The above copyright notice and this permission notice shall be included in all
  30855. copies or substantial portions of the Software.
  30856. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  30857. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  30858. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  30859. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  30860. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  30861. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  30862. THE SOFTWARE.
  30863. <?php
  30864. namespace Symfony\Component\Console\Logger;
  30865. use Psr\Log\AbstractLogger;
  30866. use Psr\Log\InvalidArgumentException;
  30867. use Psr\Log\LogLevel;
  30868. use Symfony\Component\Console\Output\OutputInterface;
  30869. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30870. class ConsoleLogger extends AbstractLogger
  30871. {
  30872. const INFO = 'info';
  30873. const ERROR = 'error';
  30874. private $output;
  30875. private $verbosityLevelMap = array(
  30876. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  30877. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  30878. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  30879. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  30880. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  30881. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  30882. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  30883. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  30884. );
  30885. private $formatLevelMap = array(
  30886. LogLevel::EMERGENCY => self::ERROR,
  30887. LogLevel::ALERT => self::ERROR,
  30888. LogLevel::CRITICAL => self::ERROR,
  30889. LogLevel::ERROR => self::ERROR,
  30890. LogLevel::WARNING => self::INFO,
  30891. LogLevel::NOTICE => self::INFO,
  30892. LogLevel::INFO => self::INFO,
  30893. LogLevel::DEBUG => self::INFO,
  30894. );
  30895. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  30896. {
  30897. $this->output = $output;
  30898. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  30899. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  30900. }
  30901. public function log($level, $message, array $context = array())
  30902. {
  30903. if (!isset($this->verbosityLevelMap[$level])) {
  30904. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  30905. }
  30906. if ($this->formatLevelMap[$level] === self::ERROR && $this->output instanceof ConsoleOutputInterface) {
  30907. $output = $this->output->getErrorOutput();
  30908. } else {
  30909. $output = $this->output;
  30910. }
  30911. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  30912. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  30913. }
  30914. }
  30915. private function interpolate($message, array $context)
  30916. {
  30917. $replace = array();
  30918. foreach ($context as $key => $val) {
  30919. if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
  30920. $replace[sprintf('{%s}', $key)] = $val;
  30921. }
  30922. }
  30923. return strtr($message, $replace);
  30924. }
  30925. }
  30926. <?php
  30927. namespace Symfony\Component\Console\Output;
  30928. class BufferedOutput extends Output
  30929. {
  30930. private $buffer = '';
  30931. public function fetch()
  30932. {
  30933. $content = $this->buffer;
  30934. $this->buffer = '';
  30935. return $content;
  30936. }
  30937. protected function doWrite($message, $newline)
  30938. {
  30939. $this->buffer .= $message;
  30940. if ($newline) {
  30941. $this->buffer .= "\n";
  30942. }
  30943. }
  30944. }
  30945. <?php
  30946. namespace Symfony\Component\Console\Output;
  30947. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  30948. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  30949. {
  30950. private $stderr;
  30951. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  30952. {
  30953. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  30954. $actualDecorated = $this->isDecorated();
  30955. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  30956. if (null === $decorated) {
  30957. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  30958. }
  30959. }
  30960. public function setDecorated($decorated)
  30961. {
  30962. parent::setDecorated($decorated);
  30963. $this->stderr->setDecorated($decorated);
  30964. }
  30965. public function setFormatter(OutputFormatterInterface $formatter)
  30966. {
  30967. parent::setFormatter($formatter);
  30968. $this->stderr->setFormatter($formatter);
  30969. }
  30970. public function setVerbosity($level)
  30971. {
  30972. parent::setVerbosity($level);
  30973. $this->stderr->setVerbosity($level);
  30974. }
  30975. public function getErrorOutput()
  30976. {
  30977. return $this->stderr;
  30978. }
  30979. public function setErrorOutput(OutputInterface $error)
  30980. {
  30981. $this->stderr = $error;
  30982. }
  30983. protected function hasStdoutSupport()
  30984. {
  30985. return false === $this->isRunningOS400();
  30986. }
  30987. protected function hasStderrSupport()
  30988. {
  30989. return false === $this->isRunningOS400();
  30990. }
  30991. private function isRunningOS400()
  30992. {
  30993. $checks = array(
  30994. function_exists('php_uname') ? php_uname('s') : '',
  30995. getenv('OSTYPE'),
  30996. PHP_OS,
  30997. );
  30998. return false !== stripos(implode(';', $checks), 'OS400');
  30999. }
  31000. private function openOutputStream()
  31001. {
  31002. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  31003. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  31004. }
  31005. private function openErrorStream()
  31006. {
  31007. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  31008. return fopen($errorStream, 'w');
  31009. }
  31010. }
  31011. <?php
  31012. namespace Symfony\Component\Console\Output;
  31013. interface ConsoleOutputInterface extends OutputInterface
  31014. {
  31015. public function getErrorOutput();
  31016. public function setErrorOutput(OutputInterface $error);
  31017. }
  31018. <?php
  31019. namespace Symfony\Component\Console\Output;
  31020. use Symfony\Component\Console\Formatter\OutputFormatter;
  31021. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  31022. class NullOutput implements OutputInterface
  31023. {
  31024. public function setFormatter(OutputFormatterInterface $formatter)
  31025. {
  31026. }
  31027. public function getFormatter()
  31028. {
  31029. return new OutputFormatter();
  31030. }
  31031. public function setDecorated($decorated)
  31032. {
  31033. }
  31034. public function isDecorated()
  31035. {
  31036. return false;
  31037. }
  31038. public function setVerbosity($level)
  31039. {
  31040. }
  31041. public function getVerbosity()
  31042. {
  31043. return self::VERBOSITY_QUIET;
  31044. }
  31045. public function isQuiet()
  31046. {
  31047. return true;
  31048. }
  31049. public function isVerbose()
  31050. {
  31051. return false;
  31052. }
  31053. public function isVeryVerbose()
  31054. {
  31055. return false;
  31056. }
  31057. public function isDebug()
  31058. {
  31059. return false;
  31060. }
  31061. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  31062. {
  31063. }
  31064. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  31065. {
  31066. }
  31067. }
  31068. <?php
  31069. namespace Symfony\Component\Console\Output;
  31070. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  31071. use Symfony\Component\Console\Formatter\OutputFormatter;
  31072. abstract class Output implements OutputInterface
  31073. {
  31074. private $verbosity;
  31075. private $formatter;
  31076. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  31077. {
  31078. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  31079. $this->formatter = $formatter ?: new OutputFormatter();
  31080. $this->formatter->setDecorated($decorated);
  31081. }
  31082. public function setFormatter(OutputFormatterInterface $formatter)
  31083. {
  31084. $this->formatter = $formatter;
  31085. }
  31086. public function getFormatter()
  31087. {
  31088. return $this->formatter;
  31089. }
  31090. public function setDecorated($decorated)
  31091. {
  31092. $this->formatter->setDecorated($decorated);
  31093. }
  31094. public function isDecorated()
  31095. {
  31096. return $this->formatter->isDecorated();
  31097. }
  31098. public function setVerbosity($level)
  31099. {
  31100. $this->verbosity = (int) $level;
  31101. }
  31102. public function getVerbosity()
  31103. {
  31104. return $this->verbosity;
  31105. }
  31106. public function isQuiet()
  31107. {
  31108. return self::VERBOSITY_QUIET === $this->verbosity;
  31109. }
  31110. public function isVerbose()
  31111. {
  31112. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  31113. }
  31114. public function isVeryVerbose()
  31115. {
  31116. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  31117. }
  31118. public function isDebug()
  31119. {
  31120. return self::VERBOSITY_DEBUG <= $this->verbosity;
  31121. }
  31122. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  31123. {
  31124. $this->write($messages, true, $options);
  31125. }
  31126. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  31127. {
  31128. $messages = (array) $messages;
  31129. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  31130. $type = $types & $options ?: self::OUTPUT_NORMAL;
  31131. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  31132. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  31133. if ($verbosity > $this->getVerbosity()) {
  31134. return;
  31135. }
  31136. foreach ($messages as $message) {
  31137. switch ($type) {
  31138. case OutputInterface::OUTPUT_NORMAL:
  31139. $message = $this->formatter->format($message);
  31140. break;
  31141. case OutputInterface::OUTPUT_RAW:
  31142. break;
  31143. case OutputInterface::OUTPUT_PLAIN:
  31144. $message = strip_tags($this->formatter->format($message));
  31145. break;
  31146. }
  31147. $this->doWrite($message, $newline);
  31148. }
  31149. }
  31150. abstract protected function doWrite($message, $newline);
  31151. }
  31152. <?php
  31153. namespace Symfony\Component\Console\Output;
  31154. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  31155. interface OutputInterface
  31156. {
  31157. const VERBOSITY_QUIET = 16;
  31158. const VERBOSITY_NORMAL = 32;
  31159. const VERBOSITY_VERBOSE = 64;
  31160. const VERBOSITY_VERY_VERBOSE = 128;
  31161. const VERBOSITY_DEBUG = 256;
  31162. const OUTPUT_NORMAL = 1;
  31163. const OUTPUT_RAW = 2;
  31164. const OUTPUT_PLAIN = 4;
  31165. public function write($messages, $newline = false, $options = 0);
  31166. public function writeln($messages, $options = 0);
  31167. public function setVerbosity($level);
  31168. public function getVerbosity();
  31169. public function setDecorated($decorated);
  31170. public function isDecorated();
  31171. public function setFormatter(OutputFormatterInterface $formatter);
  31172. public function getFormatter();
  31173. }
  31174. <?php
  31175. namespace Symfony\Component\Console\Output;
  31176. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31177. use Symfony\Component\Console\Exception\RuntimeException;
  31178. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  31179. class StreamOutput extends Output
  31180. {
  31181. private $stream;
  31182. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  31183. {
  31184. if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  31185. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  31186. }
  31187. $this->stream = $stream;
  31188. if (null === $decorated) {
  31189. $decorated = $this->hasColorSupport();
  31190. }
  31191. parent::__construct($verbosity, $decorated, $formatter);
  31192. }
  31193. public function getStream()
  31194. {
  31195. return $this->stream;
  31196. }
  31197. protected function doWrite($message, $newline)
  31198. {
  31199. if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) {
  31200. throw new RuntimeException('Unable to write output.');
  31201. }
  31202. fflush($this->stream);
  31203. }
  31204. protected function hasColorSupport()
  31205. {
  31206. if (DIRECTORY_SEPARATOR === '\\') {
  31207. return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
  31208. }
  31209. return function_exists('posix_isatty') && @posix_isatty($this->stream);
  31210. }
  31211. }
  31212. <?php
  31213. namespace Symfony\Component\Console\Question;
  31214. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31215. class ChoiceQuestion extends Question
  31216. {
  31217. private $choices;
  31218. private $multiselect = false;
  31219. private $prompt = ' > ';
  31220. private $errorMessage = 'Value "%s" is invalid';
  31221. public function __construct($question, array $choices, $default = null)
  31222. {
  31223. parent::__construct($question, $default);
  31224. $this->choices = $choices;
  31225. $this->setValidator($this->getDefaultValidator());
  31226. $this->setAutocompleterValues($choices);
  31227. }
  31228. public function getChoices()
  31229. {
  31230. return $this->choices;
  31231. }
  31232. public function setMultiselect($multiselect)
  31233. {
  31234. $this->multiselect = $multiselect;
  31235. $this->setValidator($this->getDefaultValidator());
  31236. return $this;
  31237. }
  31238. public function getPrompt()
  31239. {
  31240. return $this->prompt;
  31241. }
  31242. public function setPrompt($prompt)
  31243. {
  31244. $this->prompt = $prompt;
  31245. return $this;
  31246. }
  31247. public function setErrorMessage($errorMessage)
  31248. {
  31249. $this->errorMessage = $errorMessage;
  31250. $this->setValidator($this->getDefaultValidator());
  31251. return $this;
  31252. }
  31253. private function getDefaultValidator()
  31254. {
  31255. $choices = $this->choices;
  31256. $errorMessage = $this->errorMessage;
  31257. $multiselect = $this->multiselect;
  31258. $isAssoc = $this->isAssoc($choices);
  31259. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  31260. $selectedChoices = str_replace(' ', '', $selected);
  31261. if ($multiselect) {
  31262. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  31263. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  31264. }
  31265. $selectedChoices = explode(',', $selectedChoices);
  31266. } else {
  31267. $selectedChoices = array($selected);
  31268. }
  31269. $multiselectChoices = array();
  31270. foreach ($selectedChoices as $value) {
  31271. $results = array();
  31272. foreach ($choices as $key => $choice) {
  31273. if ($choice === $value) {
  31274. $results[] = $key;
  31275. }
  31276. }
  31277. if (count($results) > 1) {
  31278. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  31279. }
  31280. $result = array_search($value, $choices);
  31281. if (!$isAssoc) {
  31282. if (false !== $result) {
  31283. $result = $choices[$result];
  31284. } elseif (isset($choices[$value])) {
  31285. $result = $choices[$value];
  31286. }
  31287. } elseif (false === $result && isset($choices[$value])) {
  31288. $result = $value;
  31289. }
  31290. if (false === $result) {
  31291. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  31292. }
  31293. $multiselectChoices[] = (string) $result;
  31294. }
  31295. if ($multiselect) {
  31296. return $multiselectChoices;
  31297. }
  31298. return current($multiselectChoices);
  31299. };
  31300. }
  31301. }
  31302. <?php
  31303. namespace Symfony\Component\Console\Question;
  31304. class ConfirmationQuestion extends Question
  31305. {
  31306. private $trueAnswerRegex;
  31307. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  31308. {
  31309. parent::__construct($question, (bool) $default);
  31310. $this->trueAnswerRegex = $trueAnswerRegex;
  31311. $this->setNormalizer($this->getDefaultNormalizer());
  31312. }
  31313. private function getDefaultNormalizer()
  31314. {
  31315. $default = $this->getDefault();
  31316. $regex = $this->trueAnswerRegex;
  31317. return function ($answer) use ($default, $regex) {
  31318. if (is_bool($answer)) {
  31319. return $answer;
  31320. }
  31321. $answerIsTrue = (bool) preg_match($regex, $answer);
  31322. if (false === $default) {
  31323. return $answer && $answerIsTrue;
  31324. }
  31325. return !$answer || $answerIsTrue;
  31326. };
  31327. }
  31328. }
  31329. <?php
  31330. namespace Symfony\Component\Console\Question;
  31331. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31332. use Symfony\Component\Console\Exception\LogicException;
  31333. class Question
  31334. {
  31335. private $question;
  31336. private $attempts;
  31337. private $hidden = false;
  31338. private $hiddenFallback = true;
  31339. private $autocompleterValues;
  31340. private $validator;
  31341. private $default;
  31342. private $normalizer;
  31343. public function __construct($question, $default = null)
  31344. {
  31345. $this->question = $question;
  31346. $this->default = $default;
  31347. }
  31348. public function getQuestion()
  31349. {
  31350. return $this->question;
  31351. }
  31352. public function getDefault()
  31353. {
  31354. return $this->default;
  31355. }
  31356. public function isHidden()
  31357. {
  31358. return $this->hidden;
  31359. }
  31360. public function setHidden($hidden)
  31361. {
  31362. if ($this->autocompleterValues) {
  31363. throw new LogicException('A hidden question cannot use the autocompleter.');
  31364. }
  31365. $this->hidden = (bool) $hidden;
  31366. return $this;
  31367. }
  31368. public function isHiddenFallback()
  31369. {
  31370. return $this->hiddenFallback;
  31371. }
  31372. public function setHiddenFallback($fallback)
  31373. {
  31374. $this->hiddenFallback = (bool) $fallback;
  31375. return $this;
  31376. }
  31377. public function getAutocompleterValues()
  31378. {
  31379. return $this->autocompleterValues;
  31380. }
  31381. public function setAutocompleterValues($values)
  31382. {
  31383. if (is_array($values) && $this->isAssoc($values)) {
  31384. $values = array_merge(array_keys($values), array_values($values));
  31385. }
  31386. if (null !== $values && !is_array($values)) {
  31387. if (!$values instanceof \Traversable || $values instanceof \Countable) {
  31388. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.');
  31389. }
  31390. }
  31391. if ($this->hidden) {
  31392. throw new LogicException('A hidden question cannot use the autocompleter.');
  31393. }
  31394. $this->autocompleterValues = $values;
  31395. return $this;
  31396. }
  31397. public function setValidator($validator)
  31398. {
  31399. $this->validator = $validator;
  31400. return $this;
  31401. }
  31402. public function getValidator()
  31403. {
  31404. return $this->validator;
  31405. }
  31406. public function setMaxAttempts($attempts)
  31407. {
  31408. if (null !== $attempts && $attempts < 1) {
  31409. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  31410. }
  31411. $this->attempts = $attempts;
  31412. return $this;
  31413. }
  31414. public function getMaxAttempts()
  31415. {
  31416. return $this->attempts;
  31417. }
  31418. public function setNormalizer($normalizer)
  31419. {
  31420. $this->normalizer = $normalizer;
  31421. return $this;
  31422. }
  31423. public function getNormalizer()
  31424. {
  31425. return $this->normalizer;
  31426. }
  31427. protected function isAssoc($array)
  31428. {
  31429. return (bool) count(array_filter(array_keys($array), 'is_string'));
  31430. }
  31431. }
  31432. <?php
  31433. namespace Symfony\Component\Console;
  31434. use Symfony\Component\Console\Exception\RuntimeException;
  31435. use Symfony\Component\Console\Input\StringInput;
  31436. use Symfony\Component\Console\Output\ConsoleOutput;
  31437. use Symfony\Component\Process\ProcessBuilder;
  31438. use Symfony\Component\Process\PhpExecutableFinder;
  31439. class Shell
  31440. {
  31441. private $application;
  31442. private $history;
  31443. private $output;
  31444. private $hasReadline;
  31445. private $processIsolation = false;
  31446. public function __construct(Application $application)
  31447. {
  31448. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  31449. $this->hasReadline = function_exists('readline');
  31450. $this->application = $application;
  31451. $this->history = getenv('HOME').'/.history_'.$application->getName();
  31452. $this->output = new ConsoleOutput();
  31453. }
  31454. public function run()
  31455. {
  31456. $this->application->setAutoExit(false);
  31457. $this->application->setCatchExceptions(true);
  31458. if ($this->hasReadline) {
  31459. readline_read_history($this->history);
  31460. readline_completion_function(array($this, 'autocompleter'));
  31461. }
  31462. $this->output->writeln($this->getHeader());
  31463. $php = null;
  31464. if ($this->processIsolation) {
  31465. $finder = new PhpExecutableFinder();
  31466. $php = $finder->find();
  31467. $this->output->writeln(<<<'EOF'
  31468. <info>Running with process isolation, you should consider this:</info>
  31469. * each command is executed as separate process,
  31470. * commands don't support interactivity, all params must be passed explicitly,
  31471. * commands output is not colorized.
  31472. EOF
  31473. );
  31474. }
  31475. while (true) {
  31476. $command = $this->readline();
  31477. if (false === $command) {
  31478. $this->output->writeln("\n");
  31479. break;
  31480. }
  31481. if ($this->hasReadline) {
  31482. readline_add_history($command);
  31483. readline_write_history($this->history);
  31484. }
  31485. if ($this->processIsolation) {
  31486. $pb = new ProcessBuilder();
  31487. $process = $pb
  31488. ->add($php)
  31489. ->add($_SERVER['argv'][0])
  31490. ->add($command)
  31491. ->inheritEnvironmentVariables(true)
  31492. ->getProcess()
  31493. ;
  31494. $output = $this->output;
  31495. $process->run(function ($type, $data) use ($output) {
  31496. $output->writeln($data);
  31497. });
  31498. $ret = $process->getExitCode();
  31499. } else {
  31500. $ret = $this->application->run(new StringInput($command), $this->output);
  31501. }
  31502. if (0 !== $ret) {
  31503. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  31504. }
  31505. }
  31506. }
  31507. protected function getHeader()
  31508. {
  31509. return <<<EOF
  31510. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  31511. At the prompt, type <comment>help</comment> for some help,
  31512. or <comment>list</comment> to get a list of available commands.
  31513. To exit the shell, type <comment>^D</comment>.
  31514. EOF;
  31515. }
  31516. protected function getPrompt()
  31517. {
  31518. return $this->output->getFormatter()->format($this->application->getName().' > ');
  31519. }
  31520. protected function getOutput()
  31521. {
  31522. return $this->output;
  31523. }
  31524. protected function getApplication()
  31525. {
  31526. return $this->application;
  31527. }
  31528. private function autocompleter($text)
  31529. {
  31530. $info = readline_info();
  31531. $text = substr($info['line_buffer'], 0, $info['end']);
  31532. if ($info['point'] !== $info['end']) {
  31533. return true;
  31534. }
  31535. if (false === strpos($text, ' ') || !$text) {
  31536. return array_keys($this->application->all());
  31537. }
  31538. try {
  31539. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  31540. } catch (\Exception $e) {
  31541. return true;
  31542. }
  31543. $list = array('--help');
  31544. foreach ($command->getDefinition()->getOptions() as $option) {
  31545. $list[] = '--'.$option->getName();
  31546. }
  31547. return $list;
  31548. }
  31549. private function readline()
  31550. {
  31551. if ($this->hasReadline) {
  31552. $line = readline($this->getPrompt());
  31553. } else {
  31554. $this->output->write($this->getPrompt());
  31555. $line = fgets(STDIN, 1024);
  31556. $line = (false === $line || '' === $line) ? false : rtrim($line);
  31557. }
  31558. return $line;
  31559. }
  31560. public function getProcessIsolation()
  31561. {
  31562. return $this->processIsolation;
  31563. }
  31564. public function setProcessIsolation($processIsolation)
  31565. {
  31566. $this->processIsolation = (bool) $processIsolation;
  31567. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  31568. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  31569. }
  31570. }
  31571. }
  31572. <?php
  31573. namespace Symfony\Component\Console\Style;
  31574. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  31575. use Symfony\Component\Console\Helper\ProgressBar;
  31576. use Symfony\Component\Console\Output\OutputInterface;
  31577. abstract class OutputStyle implements OutputInterface, StyleInterface
  31578. {
  31579. private $output;
  31580. public function __construct(OutputInterface $output)
  31581. {
  31582. $this->output = $output;
  31583. }
  31584. public function newLine($count = 1)
  31585. {
  31586. $this->output->write(str_repeat(PHP_EOL, $count));
  31587. }
  31588. public function createProgressBar($max = 0)
  31589. {
  31590. return new ProgressBar($this->output, $max);
  31591. }
  31592. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  31593. {
  31594. $this->output->write($messages, $newline, $type);
  31595. }
  31596. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  31597. {
  31598. $this->output->writeln($messages, $type);
  31599. }
  31600. public function setVerbosity($level)
  31601. {
  31602. $this->output->setVerbosity($level);
  31603. }
  31604. public function getVerbosity()
  31605. {
  31606. return $this->output->getVerbosity();
  31607. }
  31608. public function setDecorated($decorated)
  31609. {
  31610. $this->output->setDecorated($decorated);
  31611. }
  31612. public function isDecorated()
  31613. {
  31614. return $this->output->isDecorated();
  31615. }
  31616. public function setFormatter(OutputFormatterInterface $formatter)
  31617. {
  31618. $this->output->setFormatter($formatter);
  31619. }
  31620. public function getFormatter()
  31621. {
  31622. return $this->output->getFormatter();
  31623. }
  31624. }
  31625. <?php
  31626. namespace Symfony\Component\Console\Style;
  31627. interface StyleInterface
  31628. {
  31629. public function title($message);
  31630. public function section($message);
  31631. public function listing(array $elements);
  31632. public function text($message);
  31633. public function success($message);
  31634. public function error($message);
  31635. public function warning($message);
  31636. public function note($message);
  31637. public function caution($message);
  31638. public function table(array $headers, array $rows);
  31639. public function ask($question, $default = null, $validator = null);
  31640. public function askHidden($question, $validator = null);
  31641. public function confirm($question, $default = true);
  31642. public function choice($question, array $choices, $default = null);
  31643. public function newLine($count = 1);
  31644. public function progressStart($max = 0);
  31645. public function progressAdvance($step = 1);
  31646. public function progressFinish();
  31647. }
  31648. <?php
  31649. namespace Symfony\Component\Console\Style;
  31650. use Symfony\Component\Console\Application;
  31651. use Symfony\Component\Console\Exception\RuntimeException;
  31652. use Symfony\Component\Console\Formatter\OutputFormatter;
  31653. use Symfony\Component\Console\Helper\Helper;
  31654. use Symfony\Component\Console\Helper\ProgressBar;
  31655. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  31656. use Symfony\Component\Console\Helper\Table;
  31657. use Symfony\Component\Console\Input\InputInterface;
  31658. use Symfony\Component\Console\Output\BufferedOutput;
  31659. use Symfony\Component\Console\Output\OutputInterface;
  31660. use Symfony\Component\Console\Question\ChoiceQuestion;
  31661. use Symfony\Component\Console\Question\ConfirmationQuestion;
  31662. use Symfony\Component\Console\Question\Question;
  31663. class SymfonyStyle extends OutputStyle
  31664. {
  31665. const MAX_LINE_LENGTH = 120;
  31666. private $input;
  31667. private $questionHelper;
  31668. private $progressBar;
  31669. private $lineLength;
  31670. private $bufferedOutput;
  31671. public function __construct(InputInterface $input, OutputInterface $output)
  31672. {
  31673. $this->input = $input;
  31674. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  31675. $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  31676. parent::__construct($output);
  31677. }
  31678. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  31679. {
  31680. $this->autoPrependBlock();
  31681. $messages = is_array($messages) ? array_values($messages) : array($messages);
  31682. $lines = array();
  31683. if (null !== $type) {
  31684. $messages[0] = sprintf('[%s] %s', $type, $messages[0]);
  31685. }
  31686. foreach ($messages as $key => $message) {
  31687. $message = OutputFormatter::escape($message);
  31688. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix), PHP_EOL, true)));
  31689. if (count($messages) > 1 && $key < count($messages) - 1) {
  31690. $lines[] = '';
  31691. }
  31692. }
  31693. if ($padding && $this->isDecorated()) {
  31694. array_unshift($lines, '');
  31695. $lines[] = '';
  31696. }
  31697. foreach ($lines as &$line) {
  31698. $line = sprintf('%s%s', $prefix, $line);
  31699. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  31700. if ($style) {
  31701. $line = sprintf('<%s>%s</>', $style, $line);
  31702. }
  31703. }
  31704. $this->writeln($lines);
  31705. $this->newLine();
  31706. }
  31707. public function title($message)
  31708. {
  31709. $this->autoPrependBlock();
  31710. $this->writeln(array(
  31711. sprintf('<comment>%s</>', $message),
  31712. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  31713. ));
  31714. $this->newLine();
  31715. }
  31716. public function section($message)
  31717. {
  31718. $this->autoPrependBlock();
  31719. $this->writeln(array(
  31720. sprintf('<comment>%s</>', $message),
  31721. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  31722. ));
  31723. $this->newLine();
  31724. }
  31725. public function listing(array $elements)
  31726. {
  31727. $this->autoPrependText();
  31728. $elements = array_map(function ($element) {
  31729. return sprintf(' * %s', $element);
  31730. }, $elements);
  31731. $this->writeln($elements);
  31732. $this->newLine();
  31733. }
  31734. public function text($message)
  31735. {
  31736. $this->autoPrependText();
  31737. $messages = is_array($message) ? array_values($message) : array($message);
  31738. foreach ($messages as $message) {
  31739. $this->writeln(sprintf(' %s', $message));
  31740. }
  31741. }
  31742. public function comment($message)
  31743. {
  31744. $this->autoPrependText();
  31745. $messages = is_array($message) ? array_values($message) : array($message);
  31746. foreach ($messages as $message) {
  31747. $this->writeln(sprintf(' // %s', $message));
  31748. }
  31749. }
  31750. public function success($message)
  31751. {
  31752. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  31753. }
  31754. public function error($message)
  31755. {
  31756. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  31757. }
  31758. public function warning($message)
  31759. {
  31760. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  31761. }
  31762. public function note($message)
  31763. {
  31764. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  31765. }
  31766. public function caution($message)
  31767. {
  31768. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  31769. }
  31770. public function table(array $headers, array $rows)
  31771. {
  31772. $headers = array_map(function ($value) { return sprintf('<info>%s</>', $value); }, $headers);
  31773. $table = new Table($this);
  31774. $table->setHeaders($headers);
  31775. $table->setRows($rows);
  31776. $table->setStyle('symfony-style-guide');
  31777. $table->render();
  31778. $this->newLine();
  31779. }
  31780. public function ask($question, $default = null, $validator = null)
  31781. {
  31782. $question = new Question($question, $default);
  31783. $question->setValidator($validator);
  31784. return $this->askQuestion($question);
  31785. }
  31786. public function askHidden($question, $validator = null)
  31787. {
  31788. $question = new Question($question);
  31789. $question->setHidden(true);
  31790. $question->setValidator($validator);
  31791. return $this->askQuestion($question);
  31792. }
  31793. public function confirm($question, $default = true)
  31794. {
  31795. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  31796. }
  31797. public function choice($question, array $choices, $default = null)
  31798. {
  31799. if (null !== $default) {
  31800. $values = array_flip($choices);
  31801. $default = $values[$default];
  31802. }
  31803. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  31804. }
  31805. public function progressStart($max = 0)
  31806. {
  31807. $this->progressBar = $this->createProgressBar($max);
  31808. $this->progressBar->start();
  31809. }
  31810. public function progressAdvance($step = 1)
  31811. {
  31812. $this->getProgressBar()->advance($step);
  31813. }
  31814. public function progressFinish()
  31815. {
  31816. $this->getProgressBar()->finish();
  31817. $this->newLine(2);
  31818. $this->progressBar = null;
  31819. }
  31820. public function createProgressBar($max = 0)
  31821. {
  31822. $progressBar = parent::createProgressBar($max);
  31823. if ('\\' !== DIRECTORY_SEPARATOR) {
  31824. $progressBar->setEmptyBarCharacter('â–‘');
  31825. $progressBar->setProgressCharacter('');
  31826. $progressBar->setBarCharacter('â–“');
  31827. }
  31828. return $progressBar;
  31829. }
  31830. public function askQuestion(Question $question)
  31831. {
  31832. if ($this->input->isInteractive()) {
  31833. $this->autoPrependBlock();
  31834. }
  31835. if (!$this->questionHelper) {
  31836. $this->questionHelper = new SymfonyQuestionHelper();
  31837. }
  31838. $answer = $this->questionHelper->ask($this->input, $this, $question);
  31839. if ($this->input->isInteractive()) {
  31840. $this->newLine();
  31841. $this->bufferedOutput->write("\n");
  31842. }
  31843. return $answer;
  31844. }
  31845. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  31846. {
  31847. parent::writeln($messages, $type);
  31848. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  31849. }
  31850. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  31851. {
  31852. parent::write($messages, $newline, $type);
  31853. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  31854. }
  31855. public function newLine($count = 1)
  31856. {
  31857. parent::newLine($count);
  31858. $this->bufferedOutput->write(str_repeat("\n", $count));
  31859. }
  31860. private function getProgressBar()
  31861. {
  31862. if (!$this->progressBar) {
  31863. throw new RuntimeException('The ProgressBar is not started.');
  31864. }
  31865. return $this->progressBar;
  31866. }
  31867. private function getTerminalWidth()
  31868. {
  31869. $application = new Application();
  31870. $dimensions = $application->getTerminalDimensions();
  31871. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  31872. }
  31873. private function autoPrependBlock()
  31874. {
  31875. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  31876. if (!isset($chars[0])) {
  31877. return $this->newLine();
  31878. }
  31879. $this->newLine(2 - substr_count($chars, "\n"));
  31880. }
  31881. private function autoPrependText()
  31882. {
  31883. $fetched = $this->bufferedOutput->fetch();
  31884. if ("\n" !== substr($fetched, -1)) {
  31885. $this->newLine();
  31886. }
  31887. }
  31888. private function reduceBuffer($messages)
  31889. {
  31890. return array_map(function ($value) {
  31891. return substr($value, -4);
  31892. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  31893. }
  31894. }
  31895. <?php
  31896. namespace Symfony\Component\Console\Tester;
  31897. use Symfony\Component\Console\Application;
  31898. use Symfony\Component\Console\Input\ArrayInput;
  31899. use Symfony\Component\Console\Input\InputInterface;
  31900. use Symfony\Component\Console\Output\OutputInterface;
  31901. use Symfony\Component\Console\Output\StreamOutput;
  31902. class ApplicationTester
  31903. {
  31904. private $application;
  31905. private $input;
  31906. private $output;
  31907. private $statusCode;
  31908. public function __construct(Application $application)
  31909. {
  31910. $this->application = $application;
  31911. }
  31912. public function run(array $input, $options = array())
  31913. {
  31914. $this->input = new ArrayInput($input);
  31915. if (isset($options['interactive'])) {
  31916. $this->input->setInteractive($options['interactive']);
  31917. }
  31918. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  31919. if (isset($options['decorated'])) {
  31920. $this->output->setDecorated($options['decorated']);
  31921. }
  31922. if (isset($options['verbosity'])) {
  31923. $this->output->setVerbosity($options['verbosity']);
  31924. }
  31925. return $this->statusCode = $this->application->run($this->input, $this->output);
  31926. }
  31927. public function getDisplay($normalize = false)
  31928. {
  31929. rewind($this->output->getStream());
  31930. $display = stream_get_contents($this->output->getStream());
  31931. if ($normalize) {
  31932. $display = str_replace(PHP_EOL, "\n", $display);
  31933. }
  31934. return $display;
  31935. }
  31936. public function getInput()
  31937. {
  31938. return $this->input;
  31939. }
  31940. public function getOutput()
  31941. {
  31942. return $this->output;
  31943. }
  31944. public function getStatusCode()
  31945. {
  31946. return $this->statusCode;
  31947. }
  31948. }
  31949. <?php
  31950. namespace Symfony\Component\Console\Tester;
  31951. use Symfony\Component\Console\Command\Command;
  31952. use Symfony\Component\Console\Input\ArrayInput;
  31953. use Symfony\Component\Console\Output\StreamOutput;
  31954. use Symfony\Component\Console\Input\InputInterface;
  31955. use Symfony\Component\Console\Output\OutputInterface;
  31956. class CommandTester
  31957. {
  31958. private $command;
  31959. private $input;
  31960. private $output;
  31961. private $statusCode;
  31962. public function __construct(Command $command)
  31963. {
  31964. $this->command = $command;
  31965. }
  31966. public function execute(array $input, array $options = array())
  31967. {
  31968. if (!isset($input['command'])
  31969. && (null !== $application = $this->command->getApplication())
  31970. && $application->getDefinition()->hasArgument('command')
  31971. ) {
  31972. $input = array_merge(array('command' => $this->command->getName()), $input);
  31973. }
  31974. $this->input = new ArrayInput($input);
  31975. if (isset($options['interactive'])) {
  31976. $this->input->setInteractive($options['interactive']);
  31977. }
  31978. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  31979. if (isset($options['decorated'])) {
  31980. $this->output->setDecorated($options['decorated']);
  31981. }
  31982. if (isset($options['verbosity'])) {
  31983. $this->output->setVerbosity($options['verbosity']);
  31984. }
  31985. return $this->statusCode = $this->command->run($this->input, $this->output);
  31986. }
  31987. public function getDisplay($normalize = false)
  31988. {
  31989. rewind($this->output->getStream());
  31990. $display = stream_get_contents($this->output->getStream());
  31991. if ($normalize) {
  31992. $display = str_replace(PHP_EOL, "\n", $display);
  31993. }
  31994. return $display;
  31995. }
  31996. public function getInput()
  31997. {
  31998. return $this->input;
  31999. }
  32000. public function getOutput()
  32001. {
  32002. return $this->output;
  32003. }
  32004. public function getStatusCode()
  32005. {
  32006. return $this->statusCode;
  32007. }
  32008. }
  32009. <?php
  32010. namespace Symfony\Component\Filesystem\Exception;
  32011. interface ExceptionInterface
  32012. {
  32013. }
  32014. <?php
  32015. namespace Symfony\Component\Filesystem\Exception;
  32016. class FileNotFoundException extends IOException
  32017. {
  32018. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  32019. {
  32020. if (null === $message) {
  32021. if (null === $path) {
  32022. $message = 'File could not be found.';
  32023. } else {
  32024. $message = sprintf('File "%s" could not be found.', $path);
  32025. }
  32026. }
  32027. parent::__construct($message, $code, $previous, $path);
  32028. }
  32029. }
  32030. <?php
  32031. namespace Symfony\Component\Filesystem\Exception;
  32032. class IOException extends \RuntimeException implements IOExceptionInterface
  32033. {
  32034. private $path;
  32035. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  32036. {
  32037. $this->path = $path;
  32038. parent::__construct($message, $code, $previous);
  32039. }
  32040. public function getPath()
  32041. {
  32042. return $this->path;
  32043. }
  32044. }
  32045. <?php
  32046. namespace Symfony\Component\Filesystem\Exception;
  32047. interface IOExceptionInterface extends ExceptionInterface
  32048. {
  32049. public function getPath();
  32050. }
  32051. <?php
  32052. namespace Symfony\Component\Filesystem;
  32053. use Symfony\Component\Filesystem\Exception\IOException;
  32054. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  32055. class Filesystem
  32056. {
  32057. public function copy($originFile, $targetFile, $override = false)
  32058. {
  32059. if (stream_is_local($originFile) && !is_file($originFile)) {
  32060. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  32061. }
  32062. $this->mkdir(dirname($targetFile));
  32063. $doCopy = true;
  32064. if (!$override && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  32065. $doCopy = filemtime($originFile) > filemtime($targetFile);
  32066. }
  32067. if ($doCopy) {
  32068. if (false === $source = @fopen($originFile, 'r')) {
  32069. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  32070. }
  32071. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  32072. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  32073. }
  32074. $bytesCopied = stream_copy_to_stream($source, $target);
  32075. fclose($source);
  32076. fclose($target);
  32077. unset($source, $target);
  32078. if (!is_file($targetFile)) {
  32079. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  32080. }
  32081. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  32082. if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) {
  32083. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  32084. }
  32085. }
  32086. }
  32087. public function mkdir($dirs, $mode = 0777)
  32088. {
  32089. foreach ($this->toIterator($dirs) as $dir) {
  32090. if (is_dir($dir)) {
  32091. continue;
  32092. }
  32093. if (true !== @mkdir($dir, $mode, true)) {
  32094. $error = error_get_last();
  32095. if (!is_dir($dir)) {
  32096. if ($error) {
  32097. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir);
  32098. }
  32099. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  32100. }
  32101. }
  32102. }
  32103. }
  32104. public function exists($files)
  32105. {
  32106. foreach ($this->toIterator($files) as $file) {
  32107. if (!file_exists($file)) {
  32108. return false;
  32109. }
  32110. }
  32111. return true;
  32112. }
  32113. public function touch($files, $time = null, $atime = null)
  32114. {
  32115. foreach ($this->toIterator($files) as $file) {
  32116. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  32117. if (true !== $touch) {
  32118. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  32119. }
  32120. }
  32121. }
  32122. public function remove($files)
  32123. {
  32124. $files = iterator_to_array($this->toIterator($files));
  32125. $files = array_reverse($files);
  32126. foreach ($files as $file) {
  32127. if (!file_exists($file) && !is_link($file)) {
  32128. continue;
  32129. }
  32130. if (is_dir($file) && !is_link($file)) {
  32131. $this->remove(new \FilesystemIterator($file));
  32132. if (true !== @rmdir($file)) {
  32133. throw new IOException(sprintf('Failed to remove directory "%s".', $file), 0, null, $file);
  32134. }
  32135. } else {
  32136. if ('\\' === DIRECTORY_SEPARATOR && is_dir($file)) {
  32137. if (true !== @rmdir($file)) {
  32138. throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file);
  32139. }
  32140. } else {
  32141. if (true !== @unlink($file)) {
  32142. throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file);
  32143. }
  32144. }
  32145. }
  32146. }
  32147. }
  32148. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  32149. {
  32150. foreach ($this->toIterator($files) as $file) {
  32151. if (true !== @chmod($file, $mode & ~$umask)) {
  32152. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  32153. }
  32154. if ($recursive && is_dir($file) && !is_link($file)) {
  32155. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  32156. }
  32157. }
  32158. }
  32159. public function chown($files, $user, $recursive = false)
  32160. {
  32161. foreach ($this->toIterator($files) as $file) {
  32162. if ($recursive && is_dir($file) && !is_link($file)) {
  32163. $this->chown(new \FilesystemIterator($file), $user, true);
  32164. }
  32165. if (is_link($file) && function_exists('lchown')) {
  32166. if (true !== @lchown($file, $user)) {
  32167. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  32168. }
  32169. } else {
  32170. if (true !== @chown($file, $user)) {
  32171. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  32172. }
  32173. }
  32174. }
  32175. }
  32176. public function chgrp($files, $group, $recursive = false)
  32177. {
  32178. foreach ($this->toIterator($files) as $file) {
  32179. if ($recursive && is_dir($file) && !is_link($file)) {
  32180. $this->chgrp(new \FilesystemIterator($file), $group, true);
  32181. }
  32182. if (is_link($file) && function_exists('lchgrp')) {
  32183. if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  32184. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  32185. }
  32186. } else {
  32187. if (true !== @chgrp($file, $group)) {
  32188. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  32189. }
  32190. }
  32191. }
  32192. }
  32193. public function rename($origin, $target, $overwrite = false)
  32194. {
  32195. if (!$overwrite && is_readable($target)) {
  32196. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  32197. }
  32198. if (true !== @rename($origin, $target)) {
  32199. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  32200. }
  32201. }
  32202. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  32203. {
  32204. if ('\\' === DIRECTORY_SEPARATOR && $copyOnWindows) {
  32205. $this->mirror($originDir, $targetDir);
  32206. return;
  32207. }
  32208. $this->mkdir(dirname($targetDir));
  32209. $ok = false;
  32210. if (is_link($targetDir)) {
  32211. if (readlink($targetDir) != $originDir) {
  32212. $this->remove($targetDir);
  32213. } else {
  32214. $ok = true;
  32215. }
  32216. }
  32217. if (!$ok && true !== @symlink($originDir, $targetDir)) {
  32218. $report = error_get_last();
  32219. if (is_array($report)) {
  32220. if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) {
  32221. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  32222. }
  32223. }
  32224. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  32225. }
  32226. }
  32227. public function makePathRelative($endPath, $startPath)
  32228. {
  32229. if ('\\' === DIRECTORY_SEPARATOR) {
  32230. $endPath = str_replace('\\', '/', $endPath);
  32231. $startPath = str_replace('\\', '/', $startPath);
  32232. }
  32233. $startPathArr = explode('/', trim($startPath, '/'));
  32234. $endPathArr = explode('/', trim($endPath, '/'));
  32235. $index = 0;
  32236. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  32237. ++$index;
  32238. }
  32239. $depth = count($startPathArr) - $index;
  32240. if ('/' === $startPath[0] && 0 === $index && 1 === $depth) {
  32241. $traverser = '';
  32242. } else {
  32243. $traverser = str_repeat('../', $depth);
  32244. }
  32245. $endPathRemainder = implode('/', array_slice($endPathArr, $index));
  32246. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  32247. return '' === $relativePath ? './' : $relativePath;
  32248. }
  32249. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  32250. {
  32251. $targetDir = rtrim($targetDir, '/\\');
  32252. $originDir = rtrim($originDir, '/\\');
  32253. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  32254. $deleteIterator = $iterator;
  32255. if (null === $deleteIterator) {
  32256. $flags = \FilesystemIterator::SKIP_DOTS;
  32257. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  32258. }
  32259. foreach ($deleteIterator as $file) {
  32260. $origin = str_replace($targetDir, $originDir, $file->getPathname());
  32261. if (!$this->exists($origin)) {
  32262. $this->remove($file);
  32263. }
  32264. }
  32265. }
  32266. $copyOnWindows = false;
  32267. if (isset($options['copy_on_windows'])) {
  32268. $copyOnWindows = $options['copy_on_windows'];
  32269. }
  32270. if (null === $iterator) {
  32271. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  32272. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  32273. }
  32274. if ($this->exists($originDir)) {
  32275. $this->mkdir($targetDir);
  32276. }
  32277. foreach ($iterator as $file) {
  32278. $target = str_replace($originDir, $targetDir, $file->getPathname());
  32279. if ($copyOnWindows) {
  32280. if (is_link($file) || is_file($file)) {
  32281. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  32282. } elseif (is_dir($file)) {
  32283. $this->mkdir($target);
  32284. } else {
  32285. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  32286. }
  32287. } else {
  32288. if (is_link($file)) {
  32289. $this->symlink($file->getLinkTarget(), $target);
  32290. } elseif (is_dir($file)) {
  32291. $this->mkdir($target);
  32292. } elseif (is_file($file)) {
  32293. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  32294. } else {
  32295. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  32296. }
  32297. }
  32298. }
  32299. }
  32300. public function isAbsolutePath($file)
  32301. {
  32302. return strspn($file, '/\\', 0, 1)
  32303. || (strlen($file) > 3 && ctype_alpha($file[0])
  32304. && substr($file, 1, 1) === ':'
  32305. && strspn($file, '/\\', 2, 1)
  32306. )
  32307. || null !== parse_url($file, PHP_URL_SCHEME)
  32308. ;
  32309. }
  32310. public function tempnam($dir, $prefix)
  32311. {
  32312. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  32313. if (null === $scheme || 'file' === $scheme) {
  32314. $tmpFile = tempnam($hierarchy, $prefix);
  32315. if (false !== $tmpFile) {
  32316. if (null !== $scheme) {
  32317. return $scheme.'://'.$tmpFile;
  32318. }
  32319. return $tmpFile;
  32320. }
  32321. throw new IOException('A temporary file could not be created.');
  32322. }
  32323. for ($i = 0; $i < 10; ++$i) {
  32324. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  32325. $handle = @fopen($tmpFile, 'x+');
  32326. if (false === $handle) {
  32327. continue;
  32328. }
  32329. @fclose($handle);
  32330. return $tmpFile;
  32331. }
  32332. throw new IOException('A temporary file could not be created.');
  32333. }
  32334. public function dumpFile($filename, $content, $mode = 0666)
  32335. {
  32336. $dir = dirname($filename);
  32337. if (!is_dir($dir)) {
  32338. $this->mkdir($dir);
  32339. } elseif (!is_writable($dir)) {
  32340. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  32341. }
  32342. $tmpFile = $this->tempnam($dir, basename($filename));
  32343. if (false === @file_put_contents($tmpFile, $content)) {
  32344. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  32345. }
  32346. if (null !== $mode) {
  32347. if (func_num_args() > 2) {
  32348. @trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  32349. }
  32350. $this->chmod($tmpFile, $mode);
  32351. }
  32352. $this->rename($tmpFile, $filename, true);
  32353. }
  32354. private function toIterator($files)
  32355. {
  32356. if (!$files instanceof \Traversable) {
  32357. $files = new \ArrayObject(is_array($files) ? $files : array($files));
  32358. }
  32359. return $files;
  32360. }
  32361. private function getSchemeAndHierarchy($filename)
  32362. {
  32363. $components = explode('://', $filename, 2);
  32364. return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  32365. }
  32366. }
  32367. Copyright (c) 2004-2016 Fabien Potencier
  32368. Permission is hereby granted, free of charge, to any person obtaining a copy
  32369. of this software and associated documentation files (the "Software"), to deal
  32370. in the Software without restriction, including without limitation the rights
  32371. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  32372. copies of the Software, and to permit persons to whom the Software is furnished
  32373. to do so, subject to the following conditions:
  32374. The above copyright notice and this permission notice shall be included in all
  32375. copies or substantial portions of the Software.
  32376. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  32377. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  32378. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  32379. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  32380. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  32381. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  32382. THE SOFTWARE.
  32383. <?php
  32384. namespace Symfony\Component\Filesystem;
  32385. use Symfony\Component\Filesystem\Exception\IOException;
  32386. class LockHandler
  32387. {
  32388. private $file;
  32389. private $handle;
  32390. public function __construct($name, $lockPath = null)
  32391. {
  32392. $lockPath = $lockPath ?: sys_get_temp_dir();
  32393. if (!is_dir($lockPath)) {
  32394. $fs = new Filesystem();
  32395. $fs->mkdir($lockPath);
  32396. }
  32397. if (!is_writable($lockPath)) {
  32398. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  32399. }
  32400. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  32401. }
  32402. public function lock($blocking = false)
  32403. {
  32404. if ($this->handle) {
  32405. return true;
  32406. }
  32407. set_error_handler(function() {});
  32408. if (!$this->handle = fopen($this->file, 'r')) {
  32409. if ($this->handle = fopen($this->file, 'x')) {
  32410. chmod($this->file, 0444);
  32411. } elseif (!$this->handle = fopen($this->file, 'r')) {
  32412. usleep(100);
  32413. $this->handle = fopen($this->file, 'r');
  32414. }
  32415. }
  32416. restore_error_handler();
  32417. if (!$this->handle) {
  32418. $error = error_get_last();
  32419. throw new IOException($error['message'], 0, null, $this->file);
  32420. }
  32421. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  32422. fclose($this->handle);
  32423. $this->handle = null;
  32424. return false;
  32425. }
  32426. return true;
  32427. }
  32428. public function release()
  32429. {
  32430. if ($this->handle) {
  32431. flock($this->handle, LOCK_UN | LOCK_NB);
  32432. fclose($this->handle);
  32433. $this->handle = null;
  32434. }
  32435. }
  32436. }
  32437. <?php
  32438. namespace Symfony\Component\Finder\Adapter;
  32439. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  32440. abstract class AbstractAdapter implements AdapterInterface
  32441. {
  32442. protected $followLinks = false;
  32443. protected $mode = 0;
  32444. protected $minDepth = 0;
  32445. protected $maxDepth = PHP_INT_MAX;
  32446. protected $exclude = array();
  32447. protected $names = array();
  32448. protected $notNames = array();
  32449. protected $contains = array();
  32450. protected $notContains = array();
  32451. protected $sizes = array();
  32452. protected $dates = array();
  32453. protected $filters = array();
  32454. protected $sort = false;
  32455. protected $paths = array();
  32456. protected $notPaths = array();
  32457. protected $ignoreUnreadableDirs = false;
  32458. private static $areSupported = array();
  32459. public function isSupported()
  32460. {
  32461. $name = $this->getName();
  32462. if (!array_key_exists($name, self::$areSupported)) {
  32463. self::$areSupported[$name] = $this->canBeUsed();
  32464. }
  32465. return self::$areSupported[$name];
  32466. }
  32467. public function setFollowLinks($followLinks)
  32468. {
  32469. $this->followLinks = $followLinks;
  32470. return $this;
  32471. }
  32472. public function setMode($mode)
  32473. {
  32474. $this->mode = $mode;
  32475. return $this;
  32476. }
  32477. public function setDepths(array $depths)
  32478. {
  32479. $this->minDepth = 0;
  32480. $this->maxDepth = PHP_INT_MAX;
  32481. foreach ($depths as $comparator) {
  32482. switch ($comparator->getOperator()) {
  32483. case '>':
  32484. $this->minDepth = $comparator->getTarget() + 1;
  32485. break;
  32486. case '>=':
  32487. $this->minDepth = $comparator->getTarget();
  32488. break;
  32489. case '<':
  32490. $this->maxDepth = $comparator->getTarget() - 1;
  32491. break;
  32492. case '<=':
  32493. $this->maxDepth = $comparator->getTarget();
  32494. break;
  32495. default:
  32496. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  32497. }
  32498. }
  32499. return $this;
  32500. }
  32501. public function setExclude(array $exclude)
  32502. {
  32503. $this->exclude = $exclude;
  32504. return $this;
  32505. }
  32506. public function setNames(array $names)
  32507. {
  32508. $this->names = $names;
  32509. return $this;
  32510. }
  32511. public function setNotNames(array $notNames)
  32512. {
  32513. $this->notNames = $notNames;
  32514. return $this;
  32515. }
  32516. public function setContains(array $contains)
  32517. {
  32518. $this->contains = $contains;
  32519. return $this;
  32520. }
  32521. public function setNotContains(array $notContains)
  32522. {
  32523. $this->notContains = $notContains;
  32524. return $this;
  32525. }
  32526. public function setSizes(array $sizes)
  32527. {
  32528. $this->sizes = $sizes;
  32529. return $this;
  32530. }
  32531. public function setDates(array $dates)
  32532. {
  32533. $this->dates = $dates;
  32534. return $this;
  32535. }
  32536. public function setFilters(array $filters)
  32537. {
  32538. $this->filters = $filters;
  32539. return $this;
  32540. }
  32541. public function setSort($sort)
  32542. {
  32543. $this->sort = $sort;
  32544. return $this;
  32545. }
  32546. public function setPath(array $paths)
  32547. {
  32548. $this->paths = $paths;
  32549. return $this;
  32550. }
  32551. public function setNotPath(array $notPaths)
  32552. {
  32553. $this->notPaths = $notPaths;
  32554. return $this;
  32555. }
  32556. public function ignoreUnreadableDirs($ignore = true)
  32557. {
  32558. $this->ignoreUnreadableDirs = (bool) $ignore;
  32559. return $this;
  32560. }
  32561. abstract protected function canBeUsed();
  32562. }
  32563. <?php
  32564. namespace Symfony\Component\Finder\Adapter;
  32565. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  32566. use Symfony\Component\Finder\Exception\AccessDeniedException;
  32567. use Symfony\Component\Finder\Iterator;
  32568. use Symfony\Component\Finder\Shell\Shell;
  32569. use Symfony\Component\Finder\Expression\Expression;
  32570. use Symfony\Component\Finder\Shell\Command;
  32571. use Symfony\Component\Finder\Comparator\NumberComparator;
  32572. use Symfony\Component\Finder\Comparator\DateComparator;
  32573. abstract class AbstractFindAdapter extends AbstractAdapter
  32574. {
  32575. protected $shell;
  32576. public function __construct()
  32577. {
  32578. $this->shell = new Shell();
  32579. }
  32580. public function searchInDirectory($dir)
  32581. {
  32582. $dir = realpath($dir);
  32583. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  32584. return new Iterator\FilePathsIterator(array(), $dir);
  32585. }
  32586. $command = Command::create();
  32587. $find = $this->buildFindCommand($command, $dir);
  32588. if ($this->followLinks) {
  32589. $find->add('-follow');
  32590. }
  32591. $find->add('-mindepth')->add($this->minDepth + 1);
  32592. if (PHP_INT_MAX !== $this->maxDepth) {
  32593. $find->add('-maxdepth')->add($this->maxDepth + 1);
  32594. }
  32595. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  32596. $find->add('-type d');
  32597. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  32598. $find->add('-type f');
  32599. }
  32600. $this->buildNamesFiltering($find, $this->names);
  32601. $this->buildNamesFiltering($find, $this->notNames, true);
  32602. $this->buildPathsFiltering($find, $dir, $this->paths);
  32603. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  32604. $this->buildSizesFiltering($find, $this->sizes);
  32605. $this->buildDatesFiltering($find, $this->dates);
  32606. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  32607. $useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  32608. if ($useGrep && ($this->contains || $this->notContains)) {
  32609. $grep = $command->ins('grep');
  32610. $this->buildContentFiltering($grep, $this->contains);
  32611. $this->buildContentFiltering($grep, $this->notContains, true);
  32612. }
  32613. if ($useSort) {
  32614. $this->buildSorting($command, $this->sort);
  32615. }
  32616. $command->setErrorHandler(
  32617. $this->ignoreUnreadableDirs
  32618. ? function ($stderr) { return; }
  32619. : function ($stderr) { throw new AccessDeniedException($stderr); }
  32620. );
  32621. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  32622. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  32623. if ($this->exclude) {
  32624. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  32625. }
  32626. if (!$useGrep && ($this->contains || $this->notContains)) {
  32627. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  32628. }
  32629. if ($this->filters) {
  32630. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  32631. }
  32632. if (!$useSort && $this->sort) {
  32633. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  32634. $iterator = $iteratorAggregate->getIterator();
  32635. }
  32636. return $iterator;
  32637. }
  32638. protected function canBeUsed()
  32639. {
  32640. return $this->shell->testCommand('find');
  32641. }
  32642. protected function buildFindCommand(Command $command, $dir)
  32643. {
  32644. return $command
  32645. ->ins('find')
  32646. ->add('find ')
  32647. ->arg($dir)
  32648. ->add('-noleaf');
  32649. }
  32650. private function buildNamesFiltering(Command $command, array $names, $not = false)
  32651. {
  32652. if (0 === count($names)) {
  32653. return;
  32654. }
  32655. $command->add($not ? '-not' : null)->cmd('(');
  32656. foreach ($names as $i => $name) {
  32657. $expr = Expression::create($name);
  32658. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  32659. $expr = Expression::create($expr->getGlob()->toRegex(false));
  32660. }
  32661. if ($expr->isRegex()) {
  32662. $regex = $expr->getRegex();
  32663. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  32664. ->setStartFlag(false)
  32665. ->setStartJoker(true)
  32666. ->replaceJokers('[^/]');
  32667. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  32668. $regex->setEndJoker(false)->append('[^/]*');
  32669. }
  32670. }
  32671. $command
  32672. ->add($i > 0 ? '-or' : null)
  32673. ->add($expr->isRegex()
  32674. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  32675. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  32676. )
  32677. ->arg($expr->renderPattern());
  32678. }
  32679. $command->cmd(')');
  32680. }
  32681. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  32682. {
  32683. if (0 === count($paths)) {
  32684. return;
  32685. }
  32686. $command->add($not ? '-not' : null)->cmd('(');
  32687. foreach ($paths as $i => $path) {
  32688. $expr = Expression::create($path);
  32689. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  32690. $expr = Expression::create($expr->getGlob()->toRegex(false));
  32691. }
  32692. if ($expr->isRegex()) {
  32693. $regex = $expr->getRegex();
  32694. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  32695. } else {
  32696. $expr->prepend('*')->append('*');
  32697. }
  32698. $command
  32699. ->add($i > 0 ? '-or' : null)
  32700. ->add($expr->isRegex()
  32701. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  32702. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  32703. )
  32704. ->arg($expr->renderPattern());
  32705. }
  32706. $command->cmd(')');
  32707. }
  32708. private function buildSizesFiltering(Command $command, array $sizes)
  32709. {
  32710. foreach ($sizes as $i => $size) {
  32711. $command->add($i > 0 ? '-and' : null);
  32712. switch ($size->getOperator()) {
  32713. case '<=':
  32714. $command->add('-size -'.($size->getTarget() + 1).'c');
  32715. break;
  32716. case '>=':
  32717. $command->add('-size +'.($size->getTarget() - 1).'c');
  32718. break;
  32719. case '>':
  32720. $command->add('-size +'.$size->getTarget().'c');
  32721. break;
  32722. case '!=':
  32723. $command->add('-size -'.$size->getTarget().'c');
  32724. $command->add('-size +'.$size->getTarget().'c');
  32725. break;
  32726. case '<':
  32727. default:
  32728. $command->add('-size -'.$size->getTarget().'c');
  32729. }
  32730. }
  32731. }
  32732. private function buildDatesFiltering(Command $command, array $dates)
  32733. {
  32734. foreach ($dates as $i => $date) {
  32735. $command->add($i > 0 ? '-and' : null);
  32736. $mins = (int) round((time() - $date->getTarget()) / 60);
  32737. if (0 > $mins) {
  32738. $command->add(' -mmin -0');
  32739. return;
  32740. }
  32741. switch ($date->getOperator()) {
  32742. case '<=':
  32743. $command->add('-mmin +'.($mins - 1));
  32744. break;
  32745. case '>=':
  32746. $command->add('-mmin -'.($mins + 1));
  32747. break;
  32748. case '>':
  32749. $command->add('-mmin -'.$mins);
  32750. break;
  32751. case '!=':
  32752. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  32753. break;
  32754. case '<':
  32755. default:
  32756. $command->add('-mmin +'.$mins);
  32757. }
  32758. }
  32759. }
  32760. private function buildSorting(Command $command, $sort)
  32761. {
  32762. $this->buildFormatSorting($command, $sort);
  32763. }
  32764. abstract protected function buildFormatSorting(Command $command, $sort);
  32765. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  32766. }
  32767. <?php
  32768. namespace Symfony\Component\Finder\Adapter;
  32769. interface AdapterInterface
  32770. {
  32771. public function setFollowLinks($followLinks);
  32772. public function setMode($mode);
  32773. public function setExclude(array $exclude);
  32774. public function setDepths(array $depths);
  32775. public function setNames(array $names);
  32776. public function setNotNames(array $notNames);
  32777. public function setContains(array $contains);
  32778. public function setNotContains(array $notContains);
  32779. public function setSizes(array $sizes);
  32780. public function setDates(array $dates);
  32781. public function setFilters(array $filters);
  32782. public function setSort($sort);
  32783. public function setPath(array $paths);
  32784. public function setNotPath(array $notPaths);
  32785. public function ignoreUnreadableDirs($ignore = true);
  32786. public function searchInDirectory($dir);
  32787. public function isSupported();
  32788. public function getName();
  32789. }
  32790. <?php
  32791. namespace Symfony\Component\Finder\Adapter;
  32792. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  32793. use Symfony\Component\Finder\Shell\Shell;
  32794. use Symfony\Component\Finder\Shell\Command;
  32795. use Symfony\Component\Finder\Iterator\SortableIterator;
  32796. use Symfony\Component\Finder\Expression\Expression;
  32797. class BsdFindAdapter extends AbstractFindAdapter
  32798. {
  32799. public function getName()
  32800. {
  32801. return 'bsd_find';
  32802. }
  32803. protected function canBeUsed()
  32804. {
  32805. return in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  32806. }
  32807. protected function buildFormatSorting(Command $command, $sort)
  32808. {
  32809. switch ($sort) {
  32810. case SortableIterator::SORT_BY_NAME:
  32811. $command->ins('sort')->add('| sort');
  32812. return;
  32813. case SortableIterator::SORT_BY_TYPE:
  32814. $format = '%HT';
  32815. break;
  32816. case SortableIterator::SORT_BY_ACCESSED_TIME:
  32817. $format = '%a';
  32818. break;
  32819. case SortableIterator::SORT_BY_CHANGED_TIME:
  32820. $format = '%c';
  32821. break;
  32822. case SortableIterator::SORT_BY_MODIFIED_TIME:
  32823. $format = '%m';
  32824. break;
  32825. default:
  32826. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  32827. }
  32828. $command
  32829. ->add('-print0 | xargs -0 stat -f')
  32830. ->arg($format.'%t%N')
  32831. ->add('| sort | cut -f 2');
  32832. }
  32833. protected function buildFindCommand(Command $command, $dir)
  32834. {
  32835. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  32836. return $command;
  32837. }
  32838. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  32839. {
  32840. foreach ($contains as $contain) {
  32841. $expr = Expression::create($contain);
  32842. $command
  32843. ->add('| grep -v \'^$\'')
  32844. ->add('| xargs -I{} grep -I')
  32845. ->add($expr->isCaseSensitive() ? null : '-i')
  32846. ->add($not ? '-L' : '-l')
  32847. ->add('-Ee')->arg($expr->renderPattern())
  32848. ->add('{}')
  32849. ;
  32850. }
  32851. }
  32852. }
  32853. <?php
  32854. namespace Symfony\Component\Finder\Adapter;
  32855. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  32856. use Symfony\Component\Finder\Shell\Shell;
  32857. use Symfony\Component\Finder\Shell\Command;
  32858. use Symfony\Component\Finder\Iterator\SortableIterator;
  32859. use Symfony\Component\Finder\Expression\Expression;
  32860. class GnuFindAdapter extends AbstractFindAdapter
  32861. {
  32862. public function getName()
  32863. {
  32864. return 'gnu_find';
  32865. }
  32866. protected function buildFormatSorting(Command $command, $sort)
  32867. {
  32868. switch ($sort) {
  32869. case SortableIterator::SORT_BY_NAME:
  32870. $command->ins('sort')->add('| sort');
  32871. return;
  32872. case SortableIterator::SORT_BY_TYPE:
  32873. $format = '%y';
  32874. break;
  32875. case SortableIterator::SORT_BY_ACCESSED_TIME:
  32876. $format = '%A@';
  32877. break;
  32878. case SortableIterator::SORT_BY_CHANGED_TIME:
  32879. $format = '%C@';
  32880. break;
  32881. case SortableIterator::SORT_BY_MODIFIED_TIME:
  32882. $format = '%T@';
  32883. break;
  32884. default:
  32885. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  32886. }
  32887. $command
  32888. ->get('find')
  32889. ->add('-printf')
  32890. ->arg($format.' %h/%f\\n')
  32891. ->add('| sort | cut')
  32892. ->arg('-d ')
  32893. ->arg('-f2-')
  32894. ;
  32895. }
  32896. protected function canBeUsed()
  32897. {
  32898. return $this->shell->getType() === Shell::TYPE_UNIX && parent::canBeUsed();
  32899. }
  32900. protected function buildFindCommand(Command $command, $dir)
  32901. {
  32902. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  32903. }
  32904. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  32905. {
  32906. foreach ($contains as $contain) {
  32907. $expr = Expression::create($contain);
  32908. $command
  32909. ->add('| xargs -I{} -r grep -I')
  32910. ->add($expr->isCaseSensitive() ? null : '-i')
  32911. ->add($not ? '-L' : '-l')
  32912. ->add('-Ee')->arg($expr->renderPattern())
  32913. ->add('{}')
  32914. ;
  32915. }
  32916. }
  32917. }
  32918. <?php
  32919. namespace Symfony\Component\Finder\Adapter;
  32920. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  32921. use Symfony\Component\Finder\Iterator;
  32922. class PhpAdapter extends AbstractAdapter
  32923. {
  32924. public function searchInDirectory($dir)
  32925. {
  32926. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  32927. if ($this->followLinks) {
  32928. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  32929. }
  32930. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  32931. if ($this->exclude) {
  32932. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  32933. }
  32934. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  32935. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  32936. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  32937. }
  32938. if ($this->mode) {
  32939. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  32940. }
  32941. if ($this->names || $this->notNames) {
  32942. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  32943. }
  32944. if ($this->contains || $this->notContains) {
  32945. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  32946. }
  32947. if ($this->sizes) {
  32948. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  32949. }
  32950. if ($this->dates) {
  32951. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  32952. }
  32953. if ($this->filters) {
  32954. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  32955. }
  32956. if ($this->paths || $this->notPaths) {
  32957. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  32958. }
  32959. if ($this->sort) {
  32960. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  32961. $iterator = $iteratorAggregate->getIterator();
  32962. }
  32963. return $iterator;
  32964. }
  32965. public function getName()
  32966. {
  32967. return 'php';
  32968. }
  32969. protected function canBeUsed()
  32970. {
  32971. return true;
  32972. }
  32973. }
  32974. <?php
  32975. namespace Symfony\Component\Finder\Comparator;
  32976. class Comparator
  32977. {
  32978. private $target;
  32979. private $operator = '==';
  32980. public function getTarget()
  32981. {
  32982. return $this->target;
  32983. }
  32984. public function setTarget($target)
  32985. {
  32986. $this->target = $target;
  32987. }
  32988. public function getOperator()
  32989. {
  32990. return $this->operator;
  32991. }
  32992. public function setOperator($operator)
  32993. {
  32994. if (!$operator) {
  32995. $operator = '==';
  32996. }
  32997. if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  32998. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  32999. }
  33000. $this->operator = $operator;
  33001. }
  33002. public function test($test)
  33003. {
  33004. switch ($this->operator) {
  33005. case '>':
  33006. return $test > $this->target;
  33007. case '>=':
  33008. return $test >= $this->target;
  33009. case '<':
  33010. return $test < $this->target;
  33011. case '<=':
  33012. return $test <= $this->target;
  33013. case '!=':
  33014. return $test != $this->target;
  33015. }
  33016. return $test == $this->target;
  33017. }
  33018. }
  33019. <?php
  33020. namespace Symfony\Component\Finder\Comparator;
  33021. class DateComparator extends Comparator
  33022. {
  33023. public function __construct($test)
  33024. {
  33025. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  33026. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  33027. }
  33028. try {
  33029. $date = new \DateTime($matches[2]);
  33030. $target = $date->format('U');
  33031. } catch (\Exception $e) {
  33032. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  33033. }
  33034. $operator = isset($matches[1]) ? $matches[1] : '==';
  33035. if ('since' === $operator || 'after' === $operator) {
  33036. $operator = '>';
  33037. }
  33038. if ('until' === $operator || 'before' === $operator) {
  33039. $operator = '<';
  33040. }
  33041. $this->setOperator($operator);
  33042. $this->setTarget($target);
  33043. }
  33044. }
  33045. <?php
  33046. namespace Symfony\Component\Finder\Comparator;
  33047. class NumberComparator extends Comparator
  33048. {
  33049. public function __construct($test)
  33050. {
  33051. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  33052. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  33053. }
  33054. $target = $matches[2];
  33055. if (!is_numeric($target)) {
  33056. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  33057. }
  33058. if (isset($matches[3])) {
  33059. switch (strtolower($matches[3])) {
  33060. case 'k':
  33061. $target *= 1000;
  33062. break;
  33063. case 'ki':
  33064. $target *= 1024;
  33065. break;
  33066. case 'm':
  33067. $target *= 1000000;
  33068. break;
  33069. case 'mi':
  33070. $target *= 1024 * 1024;
  33071. break;
  33072. case 'g':
  33073. $target *= 1000000000;
  33074. break;
  33075. case 'gi':
  33076. $target *= 1024 * 1024 * 1024;
  33077. break;
  33078. }
  33079. }
  33080. $this->setTarget($target);
  33081. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  33082. }
  33083. }
  33084. <?php
  33085. namespace Symfony\Component\Finder\Exception;
  33086. class AccessDeniedException extends \UnexpectedValueException
  33087. {
  33088. }
  33089. <?php
  33090. namespace Symfony\Component\Finder\Exception;
  33091. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33092. use Symfony\Component\Finder\Adapter\AdapterInterface;
  33093. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  33094. {
  33095. private $adapter;
  33096. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  33097. {
  33098. $this->adapter = $adapter;
  33099. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  33100. }
  33101. public function getAdapter()
  33102. {
  33103. return $this->adapter;
  33104. }
  33105. }
  33106. <?php
  33107. namespace Symfony\Component\Finder\Exception;
  33108. interface ExceptionInterface
  33109. {
  33110. public function getAdapter();
  33111. }
  33112. <?php
  33113. namespace Symfony\Component\Finder\Exception;
  33114. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33115. class OperationNotPermitedException extends AdapterFailureException
  33116. {
  33117. }
  33118. <?php
  33119. namespace Symfony\Component\Finder\Exception;
  33120. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33121. use Symfony\Component\Finder\Adapter\AdapterInterface;
  33122. use Symfony\Component\Finder\Shell\Command;
  33123. class ShellCommandFailureException extends AdapterFailureException
  33124. {
  33125. private $command;
  33126. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  33127. {
  33128. $this->command = $command;
  33129. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  33130. }
  33131. public function getCommand()
  33132. {
  33133. return $this->command;
  33134. }
  33135. }
  33136. <?php
  33137. namespace Symfony\Component\Finder\Expression;
  33138. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33139. class Expression implements ValueInterface
  33140. {
  33141. const TYPE_REGEX = 1;
  33142. const TYPE_GLOB = 2;
  33143. private $value;
  33144. public static function create($expr)
  33145. {
  33146. return new self($expr);
  33147. }
  33148. public function __construct($expr)
  33149. {
  33150. try {
  33151. $this->value = Regex::create($expr);
  33152. } catch (\InvalidArgumentException $e) {
  33153. $this->value = new Glob($expr);
  33154. }
  33155. }
  33156. public function __toString()
  33157. {
  33158. return $this->render();
  33159. }
  33160. public function render()
  33161. {
  33162. return $this->value->render();
  33163. }
  33164. public function renderPattern()
  33165. {
  33166. return $this->value->renderPattern();
  33167. }
  33168. public function isCaseSensitive()
  33169. {
  33170. return $this->value->isCaseSensitive();
  33171. }
  33172. public function getType()
  33173. {
  33174. return $this->value->getType();
  33175. }
  33176. public function prepend($expr)
  33177. {
  33178. $this->value->prepend($expr);
  33179. return $this;
  33180. }
  33181. public function append($expr)
  33182. {
  33183. $this->value->append($expr);
  33184. return $this;
  33185. }
  33186. public function isRegex()
  33187. {
  33188. return self::TYPE_REGEX === $this->value->getType();
  33189. }
  33190. public function isGlob()
  33191. {
  33192. return self::TYPE_GLOB === $this->value->getType();
  33193. }
  33194. public function getGlob()
  33195. {
  33196. if (self::TYPE_GLOB !== $this->value->getType()) {
  33197. throw new \LogicException('Regex can\'t be transformed to glob.');
  33198. }
  33199. return $this->value;
  33200. }
  33201. public function getRegex()
  33202. {
  33203. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  33204. }
  33205. }
  33206. <?php
  33207. namespace Symfony\Component\Finder\Expression;
  33208. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33209. use Symfony\Component\Finder\Glob as FinderGlob;
  33210. class Glob implements ValueInterface
  33211. {
  33212. private $pattern;
  33213. public function __construct($pattern)
  33214. {
  33215. $this->pattern = $pattern;
  33216. }
  33217. public function render()
  33218. {
  33219. return $this->pattern;
  33220. }
  33221. public function renderPattern()
  33222. {
  33223. return $this->pattern;
  33224. }
  33225. public function getType()
  33226. {
  33227. return Expression::TYPE_GLOB;
  33228. }
  33229. public function isCaseSensitive()
  33230. {
  33231. return true;
  33232. }
  33233. public function prepend($expr)
  33234. {
  33235. $this->pattern = $expr.$this->pattern;
  33236. return $this;
  33237. }
  33238. public function append($expr)
  33239. {
  33240. $this->pattern .= $expr;
  33241. return $this;
  33242. }
  33243. public function isExpandable()
  33244. {
  33245. return false !== strpos($this->pattern, '{')
  33246. && false !== strpos($this->pattern, '}');
  33247. }
  33248. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  33249. {
  33250. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  33251. return new Regex($regex);
  33252. }
  33253. }
  33254. <?php
  33255. namespace Symfony\Component\Finder\Expression;
  33256. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33257. class Regex implements ValueInterface
  33258. {
  33259. const START_FLAG = '^';
  33260. const END_FLAG = '$';
  33261. const BOUNDARY = '~';
  33262. const JOKER = '.*';
  33263. const ESCAPING = '\\';
  33264. private $pattern;
  33265. private $options;
  33266. private $startFlag;
  33267. private $endFlag;
  33268. private $startJoker;
  33269. private $endJoker;
  33270. public static function create($expr)
  33271. {
  33272. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  33273. $start = substr($m[1], 0, 1);
  33274. $end = substr($m[1], -1);
  33275. if (
  33276. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  33277. || ($start === '{' && $end === '}')
  33278. || ($start === '(' && $end === ')')
  33279. ) {
  33280. return new self(substr($m[1], 1, -1), $m[2], $end);
  33281. }
  33282. }
  33283. throw new \InvalidArgumentException('Given expression is not a regex.');
  33284. }
  33285. public function __construct($pattern, $options = '', $delimiter = null)
  33286. {
  33287. if (null !== $delimiter) {
  33288. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  33289. }
  33290. $this->parsePattern($pattern);
  33291. $this->options = $options;
  33292. }
  33293. public function __toString()
  33294. {
  33295. return $this->render();
  33296. }
  33297. public function render()
  33298. {
  33299. return self::BOUNDARY
  33300. .$this->renderPattern()
  33301. .self::BOUNDARY
  33302. .$this->options;
  33303. }
  33304. public function renderPattern()
  33305. {
  33306. return ($this->startFlag ? self::START_FLAG : '')
  33307. .($this->startJoker ? self::JOKER : '')
  33308. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  33309. .($this->endJoker ? self::JOKER : '')
  33310. .($this->endFlag ? self::END_FLAG : '');
  33311. }
  33312. public function isCaseSensitive()
  33313. {
  33314. return !$this->hasOption('i');
  33315. }
  33316. public function getType()
  33317. {
  33318. return Expression::TYPE_REGEX;
  33319. }
  33320. public function prepend($expr)
  33321. {
  33322. $this->pattern = $expr.$this->pattern;
  33323. return $this;
  33324. }
  33325. public function append($expr)
  33326. {
  33327. $this->pattern .= $expr;
  33328. return $this;
  33329. }
  33330. public function hasOption($option)
  33331. {
  33332. return false !== strpos($this->options, $option);
  33333. }
  33334. public function addOption($option)
  33335. {
  33336. if (!$this->hasOption($option)) {
  33337. $this->options .= $option;
  33338. }
  33339. return $this;
  33340. }
  33341. public function removeOption($option)
  33342. {
  33343. $this->options = str_replace($option, '', $this->options);
  33344. return $this;
  33345. }
  33346. public function setStartFlag($startFlag)
  33347. {
  33348. $this->startFlag = $startFlag;
  33349. return $this;
  33350. }
  33351. public function hasStartFlag()
  33352. {
  33353. return $this->startFlag;
  33354. }
  33355. public function setEndFlag($endFlag)
  33356. {
  33357. $this->endFlag = (bool) $endFlag;
  33358. return $this;
  33359. }
  33360. public function hasEndFlag()
  33361. {
  33362. return $this->endFlag;
  33363. }
  33364. public function setStartJoker($startJoker)
  33365. {
  33366. $this->startJoker = $startJoker;
  33367. return $this;
  33368. }
  33369. public function hasStartJoker()
  33370. {
  33371. return $this->startJoker;
  33372. }
  33373. public function setEndJoker($endJoker)
  33374. {
  33375. $this->endJoker = (bool) $endJoker;
  33376. return $this;
  33377. }
  33378. public function hasEndJoker()
  33379. {
  33380. return $this->endJoker;
  33381. }
  33382. public function replaceJokers($replacement)
  33383. {
  33384. $replace = function ($subject) use ($replacement) {
  33385. $subject = $subject[0];
  33386. $replace = 0 === substr_count($subject, '\\') % 2;
  33387. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  33388. };
  33389. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  33390. return $this;
  33391. }
  33392. private function parsePattern($pattern)
  33393. {
  33394. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  33395. $pattern = substr($pattern, 1);
  33396. }
  33397. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  33398. $pattern = substr($pattern, 2);
  33399. }
  33400. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  33401. $pattern = substr($pattern, 0, -1);
  33402. }
  33403. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  33404. $pattern = substr($pattern, 0, -2);
  33405. }
  33406. $this->pattern = $pattern;
  33407. }
  33408. }
  33409. <?php
  33410. namespace Symfony\Component\Finder\Expression;
  33411. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33412. interface ValueInterface
  33413. {
  33414. public function render();
  33415. public function renderPattern();
  33416. public function isCaseSensitive();
  33417. public function getType();
  33418. public function prepend($expr);
  33419. public function append($expr);
  33420. }
  33421. <?php
  33422. namespace Symfony\Component\Finder;
  33423. use Symfony\Component\Finder\Adapter\AdapterInterface;
  33424. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  33425. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  33426. use Symfony\Component\Finder\Adapter\PhpAdapter;
  33427. use Symfony\Component\Finder\Comparator\DateComparator;
  33428. use Symfony\Component\Finder\Comparator\NumberComparator;
  33429. use Symfony\Component\Finder\Exception\ExceptionInterface;
  33430. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  33431. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  33432. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  33433. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  33434. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  33435. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  33436. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  33437. use Symfony\Component\Finder\Iterator\SortableIterator;
  33438. class Finder implements \IteratorAggregate, \Countable
  33439. {
  33440. const IGNORE_VCS_FILES = 1;
  33441. const IGNORE_DOT_FILES = 2;
  33442. private $mode = 0;
  33443. private $names = array();
  33444. private $notNames = array();
  33445. private $exclude = array();
  33446. private $filters = array();
  33447. private $depths = array();
  33448. private $sizes = array();
  33449. private $followLinks = false;
  33450. private $sort = false;
  33451. private $ignore = 0;
  33452. private $dirs = array();
  33453. private $dates = array();
  33454. private $iterators = array();
  33455. private $contains = array();
  33456. private $notContains = array();
  33457. private $adapters = null;
  33458. private $paths = array();
  33459. private $notPaths = array();
  33460. private $ignoreUnreadableDirs = false;
  33461. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  33462. public function __construct()
  33463. {
  33464. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  33465. }
  33466. public static function create()
  33467. {
  33468. return new static();
  33469. }
  33470. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  33471. {
  33472. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33473. $this->initDefaultAdapters();
  33474. $this->adapters[$adapter->getName()] = array(
  33475. 'adapter' => $adapter,
  33476. 'priority' => $priority,
  33477. 'selected' => false,
  33478. );
  33479. return $this->sortAdapters();
  33480. }
  33481. public function useBestAdapter()
  33482. {
  33483. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33484. $this->initDefaultAdapters();
  33485. $this->resetAdapterSelection();
  33486. return $this->sortAdapters();
  33487. }
  33488. public function setAdapter($name)
  33489. {
  33490. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33491. $this->initDefaultAdapters();
  33492. if (!isset($this->adapters[$name])) {
  33493. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  33494. }
  33495. $this->resetAdapterSelection();
  33496. $this->adapters[$name]['selected'] = true;
  33497. return $this->sortAdapters();
  33498. }
  33499. public function removeAdapters()
  33500. {
  33501. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33502. $this->adapters = array();
  33503. return $this;
  33504. }
  33505. public function getAdapters()
  33506. {
  33507. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  33508. $this->initDefaultAdapters();
  33509. return array_values(array_map(function (array $adapter) {
  33510. return $adapter['adapter'];
  33511. }, $this->adapters));
  33512. }
  33513. public function directories()
  33514. {
  33515. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  33516. return $this;
  33517. }
  33518. public function files()
  33519. {
  33520. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  33521. return $this;
  33522. }
  33523. public function depth($level)
  33524. {
  33525. $this->depths[] = new Comparator\NumberComparator($level);
  33526. return $this;
  33527. }
  33528. public function date($date)
  33529. {
  33530. $this->dates[] = new Comparator\DateComparator($date);
  33531. return $this;
  33532. }
  33533. public function name($pattern)
  33534. {
  33535. $this->names[] = $pattern;
  33536. return $this;
  33537. }
  33538. public function notName($pattern)
  33539. {
  33540. $this->notNames[] = $pattern;
  33541. return $this;
  33542. }
  33543. public function contains($pattern)
  33544. {
  33545. $this->contains[] = $pattern;
  33546. return $this;
  33547. }
  33548. public function notContains($pattern)
  33549. {
  33550. $this->notContains[] = $pattern;
  33551. return $this;
  33552. }
  33553. public function path($pattern)
  33554. {
  33555. $this->paths[] = $pattern;
  33556. return $this;
  33557. }
  33558. public function notPath($pattern)
  33559. {
  33560. $this->notPaths[] = $pattern;
  33561. return $this;
  33562. }
  33563. public function size($size)
  33564. {
  33565. $this->sizes[] = new Comparator\NumberComparator($size);
  33566. return $this;
  33567. }
  33568. public function exclude($dirs)
  33569. {
  33570. $this->exclude = array_merge($this->exclude, (array) $dirs);
  33571. return $this;
  33572. }
  33573. public function ignoreDotFiles($ignoreDotFiles)
  33574. {
  33575. if ($ignoreDotFiles) {
  33576. $this->ignore |= static::IGNORE_DOT_FILES;
  33577. } else {
  33578. $this->ignore &= ~static::IGNORE_DOT_FILES;
  33579. }
  33580. return $this;
  33581. }
  33582. public function ignoreVCS($ignoreVCS)
  33583. {
  33584. if ($ignoreVCS) {
  33585. $this->ignore |= static::IGNORE_VCS_FILES;
  33586. } else {
  33587. $this->ignore &= ~static::IGNORE_VCS_FILES;
  33588. }
  33589. return $this;
  33590. }
  33591. public static function addVCSPattern($pattern)
  33592. {
  33593. foreach ((array) $pattern as $p) {
  33594. self::$vcsPatterns[] = $p;
  33595. }
  33596. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  33597. }
  33598. public function sort(\Closure $closure)
  33599. {
  33600. $this->sort = $closure;
  33601. return $this;
  33602. }
  33603. public function sortByName()
  33604. {
  33605. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  33606. return $this;
  33607. }
  33608. public function sortByType()
  33609. {
  33610. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  33611. return $this;
  33612. }
  33613. public function sortByAccessedTime()
  33614. {
  33615. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  33616. return $this;
  33617. }
  33618. public function sortByChangedTime()
  33619. {
  33620. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  33621. return $this;
  33622. }
  33623. public function sortByModifiedTime()
  33624. {
  33625. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  33626. return $this;
  33627. }
  33628. public function filter(\Closure $closure)
  33629. {
  33630. $this->filters[] = $closure;
  33631. return $this;
  33632. }
  33633. public function followLinks()
  33634. {
  33635. $this->followLinks = true;
  33636. return $this;
  33637. }
  33638. public function ignoreUnreadableDirs($ignore = true)
  33639. {
  33640. $this->ignoreUnreadableDirs = (bool) $ignore;
  33641. return $this;
  33642. }
  33643. public function in($dirs)
  33644. {
  33645. $resolvedDirs = array();
  33646. foreach ((array) $dirs as $dir) {
  33647. if (is_dir($dir)) {
  33648. $resolvedDirs[] = $dir;
  33649. } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  33650. $resolvedDirs = array_merge($resolvedDirs, $glob);
  33651. } else {
  33652. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  33653. }
  33654. }
  33655. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  33656. return $this;
  33657. }
  33658. public function getIterator()
  33659. {
  33660. if (0 === count($this->dirs) && 0 === count($this->iterators)) {
  33661. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  33662. }
  33663. if (1 === count($this->dirs) && 0 === count($this->iterators)) {
  33664. return $this->searchInDirectory($this->dirs[0]);
  33665. }
  33666. $iterator = new \AppendIterator();
  33667. foreach ($this->dirs as $dir) {
  33668. $iterator->append($this->searchInDirectory($dir));
  33669. }
  33670. foreach ($this->iterators as $it) {
  33671. $iterator->append($it);
  33672. }
  33673. return $iterator;
  33674. }
  33675. public function append($iterator)
  33676. {
  33677. if ($iterator instanceof \IteratorAggregate) {
  33678. $this->iterators[] = $iterator->getIterator();
  33679. } elseif ($iterator instanceof \Iterator) {
  33680. $this->iterators[] = $iterator;
  33681. } elseif ($iterator instanceof \Traversable || is_array($iterator)) {
  33682. $it = new \ArrayIterator();
  33683. foreach ($iterator as $file) {
  33684. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  33685. }
  33686. $this->iterators[] = $it;
  33687. } else {
  33688. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  33689. }
  33690. return $this;
  33691. }
  33692. public function count()
  33693. {
  33694. return iterator_count($this->getIterator());
  33695. }
  33696. private function sortAdapters()
  33697. {
  33698. uasort($this->adapters, function (array $a, array $b) {
  33699. if ($a['selected'] || $b['selected']) {
  33700. return $a['selected'] ? -1 : 1;
  33701. }
  33702. return $a['priority'] > $b['priority'] ? -1 : 1;
  33703. });
  33704. return $this;
  33705. }
  33706. private function searchInDirectory($dir)
  33707. {
  33708. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  33709. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  33710. }
  33711. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  33712. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  33713. }
  33714. if ($this->adapters) {
  33715. foreach ($this->adapters as $adapter) {
  33716. if ($adapter['adapter']->isSupported()) {
  33717. try {
  33718. return $this
  33719. ->buildAdapter($adapter['adapter'])
  33720. ->searchInDirectory($dir);
  33721. } catch (ExceptionInterface $e) {
  33722. }
  33723. }
  33724. }
  33725. }
  33726. $minDepth = 0;
  33727. $maxDepth = PHP_INT_MAX;
  33728. foreach ($this->depths as $comparator) {
  33729. switch ($comparator->getOperator()) {
  33730. case '>':
  33731. $minDepth = $comparator->getTarget() + 1;
  33732. break;
  33733. case '>=':
  33734. $minDepth = $comparator->getTarget();
  33735. break;
  33736. case '<':
  33737. $maxDepth = $comparator->getTarget() - 1;
  33738. break;
  33739. case '<=':
  33740. $maxDepth = $comparator->getTarget();
  33741. break;
  33742. default:
  33743. $minDepth = $maxDepth = $comparator->getTarget();
  33744. }
  33745. }
  33746. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  33747. if ($this->followLinks) {
  33748. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  33749. }
  33750. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  33751. if ($this->exclude) {
  33752. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  33753. }
  33754. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  33755. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  33756. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  33757. }
  33758. if ($this->mode) {
  33759. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  33760. }
  33761. if ($this->names || $this->notNames) {
  33762. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  33763. }
  33764. if ($this->contains || $this->notContains) {
  33765. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  33766. }
  33767. if ($this->sizes) {
  33768. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  33769. }
  33770. if ($this->dates) {
  33771. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  33772. }
  33773. if ($this->filters) {
  33774. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  33775. }
  33776. if ($this->paths || $this->notPaths) {
  33777. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  33778. }
  33779. if ($this->sort) {
  33780. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  33781. $iterator = $iteratorAggregate->getIterator();
  33782. }
  33783. return $iterator;
  33784. }
  33785. private function buildAdapter(AdapterInterface $adapter)
  33786. {
  33787. return $adapter
  33788. ->setFollowLinks($this->followLinks)
  33789. ->setDepths($this->depths)
  33790. ->setMode($this->mode)
  33791. ->setExclude($this->exclude)
  33792. ->setNames($this->names)
  33793. ->setNotNames($this->notNames)
  33794. ->setContains($this->contains)
  33795. ->setNotContains($this->notContains)
  33796. ->setSizes($this->sizes)
  33797. ->setDates($this->dates)
  33798. ->setFilters($this->filters)
  33799. ->setSort($this->sort)
  33800. ->setPath($this->paths)
  33801. ->setNotPath($this->notPaths)
  33802. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  33803. }
  33804. private function resetAdapterSelection()
  33805. {
  33806. $this->adapters = array_map(function (array $properties) {
  33807. $properties['selected'] = false;
  33808. return $properties;
  33809. }, $this->adapters);
  33810. }
  33811. private function initDefaultAdapters()
  33812. {
  33813. if (null === $this->adapters) {
  33814. $this->adapters = array();
  33815. $this
  33816. ->addAdapter(new GnuFindAdapter())
  33817. ->addAdapter(new BsdFindAdapter())
  33818. ->addAdapter(new PhpAdapter(), -50)
  33819. ->setAdapter('php')
  33820. ;
  33821. }
  33822. }
  33823. }
  33824. <?php
  33825. namespace Symfony\Component\Finder;
  33826. class Glob
  33827. {
  33828. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  33829. {
  33830. $firstByte = true;
  33831. $escaping = false;
  33832. $inCurlies = 0;
  33833. $regex = '';
  33834. $sizeGlob = strlen($glob);
  33835. for ($i = 0; $i < $sizeGlob; ++$i) {
  33836. $car = $glob[$i];
  33837. if ($firstByte) {
  33838. if ($strictLeadingDot && '.' !== $car) {
  33839. $regex .= '(?=[^\.])';
  33840. }
  33841. $firstByte = false;
  33842. }
  33843. if ('/' === $car) {
  33844. $firstByte = true;
  33845. }
  33846. if ('.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  33847. $regex .= "\\$car";
  33848. } elseif ('*' === $car) {
  33849. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  33850. } elseif ('?' === $car) {
  33851. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  33852. } elseif ('{' === $car) {
  33853. $regex .= $escaping ? '\\{' : '(';
  33854. if (!$escaping) {
  33855. ++$inCurlies;
  33856. }
  33857. } elseif ('}' === $car && $inCurlies) {
  33858. $regex .= $escaping ? '}' : ')';
  33859. if (!$escaping) {
  33860. --$inCurlies;
  33861. }
  33862. } elseif (',' === $car && $inCurlies) {
  33863. $regex .= $escaping ? ',' : '|';
  33864. } elseif ('\\' === $car) {
  33865. if ($escaping) {
  33866. $regex .= '\\\\';
  33867. $escaping = false;
  33868. } else {
  33869. $escaping = true;
  33870. }
  33871. continue;
  33872. } else {
  33873. $regex .= $car;
  33874. }
  33875. $escaping = false;
  33876. }
  33877. return $delimiter.'^'.$regex.'$'.$delimiter;
  33878. }
  33879. }
  33880. <?php
  33881. namespace Symfony\Component\Finder\Iterator;
  33882. class CustomFilterIterator extends FilterIterator
  33883. {
  33884. private $filters = array();
  33885. public function __construct(\Iterator $iterator, array $filters)
  33886. {
  33887. foreach ($filters as $filter) {
  33888. if (!is_callable($filter)) {
  33889. throw new \InvalidArgumentException('Invalid PHP callback.');
  33890. }
  33891. }
  33892. $this->filters = $filters;
  33893. parent::__construct($iterator);
  33894. }
  33895. public function accept()
  33896. {
  33897. $fileinfo = $this->current();
  33898. foreach ($this->filters as $filter) {
  33899. if (false === call_user_func($filter, $fileinfo)) {
  33900. return false;
  33901. }
  33902. }
  33903. return true;
  33904. }
  33905. }
  33906. <?php
  33907. namespace Symfony\Component\Finder\Iterator;
  33908. use Symfony\Component\Finder\Comparator\DateComparator;
  33909. class DateRangeFilterIterator extends FilterIterator
  33910. {
  33911. private $comparators = array();
  33912. public function __construct(\Iterator $iterator, array $comparators)
  33913. {
  33914. $this->comparators = $comparators;
  33915. parent::__construct($iterator);
  33916. }
  33917. public function accept()
  33918. {
  33919. $fileinfo = $this->current();
  33920. if (!file_exists($fileinfo->getRealPath())) {
  33921. return false;
  33922. }
  33923. $filedate = $fileinfo->getMTime();
  33924. foreach ($this->comparators as $compare) {
  33925. if (!$compare->test($filedate)) {
  33926. return false;
  33927. }
  33928. }
  33929. return true;
  33930. }
  33931. }
  33932. <?php
  33933. namespace Symfony\Component\Finder\Iterator;
  33934. class DepthRangeFilterIterator extends FilterIterator
  33935. {
  33936. private $minDepth = 0;
  33937. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  33938. {
  33939. $this->minDepth = $minDepth;
  33940. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  33941. parent::__construct($iterator);
  33942. }
  33943. public function accept()
  33944. {
  33945. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  33946. }
  33947. }
  33948. <?php
  33949. namespace Symfony\Component\Finder\Iterator;
  33950. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  33951. {
  33952. private $iterator;
  33953. private $isRecursive;
  33954. private $excludedDirs = array();
  33955. private $excludedPattern;
  33956. public function __construct(\Iterator $iterator, array $directories)
  33957. {
  33958. $this->iterator = $iterator;
  33959. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  33960. $patterns = array();
  33961. foreach ($directories as $directory) {
  33962. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  33963. $patterns[] = preg_quote($directory, '#');
  33964. } else {
  33965. $this->excludedDirs[$directory] = true;
  33966. }
  33967. }
  33968. if ($patterns) {
  33969. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  33970. }
  33971. parent::__construct($iterator);
  33972. }
  33973. public function accept()
  33974. {
  33975. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  33976. return false;
  33977. }
  33978. if ($this->excludedPattern) {
  33979. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  33980. $path = str_replace('\\', '/', $path);
  33981. return !preg_match($this->excludedPattern, $path);
  33982. }
  33983. return true;
  33984. }
  33985. public function hasChildren()
  33986. {
  33987. return $this->isRecursive && $this->iterator->hasChildren();
  33988. }
  33989. public function getChildren()
  33990. {
  33991. $children = new self($this->iterator->getChildren(), array());
  33992. $children->excludedDirs = $this->excludedDirs;
  33993. $children->excludedPattern = $this->excludedPattern;
  33994. return $children;
  33995. }
  33996. }
  33997. <?php
  33998. namespace Symfony\Component\Finder\Iterator;
  33999. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  34000. use Symfony\Component\Finder\SplFileInfo;
  34001. class FilePathsIterator extends \ArrayIterator
  34002. {
  34003. private $baseDir;
  34004. private $baseDirLength;
  34005. private $subPath;
  34006. private $subPathname;
  34007. private $current;
  34008. public function __construct(array $paths, $baseDir)
  34009. {
  34010. $this->baseDir = $baseDir;
  34011. $this->baseDirLength = strlen($baseDir);
  34012. parent::__construct($paths);
  34013. }
  34014. public function __call($name, array $arguments)
  34015. {
  34016. return call_user_func_array(array($this->current(), $name), $arguments);
  34017. }
  34018. public function current()
  34019. {
  34020. return $this->current;
  34021. }
  34022. public function key()
  34023. {
  34024. return $this->current->getPathname();
  34025. }
  34026. public function next()
  34027. {
  34028. parent::next();
  34029. $this->buildProperties();
  34030. }
  34031. public function rewind()
  34032. {
  34033. parent::rewind();
  34034. $this->buildProperties();
  34035. }
  34036. public function getSubPath()
  34037. {
  34038. return $this->subPath;
  34039. }
  34040. public function getSubPathname()
  34041. {
  34042. return $this->subPathname;
  34043. }
  34044. private function buildProperties()
  34045. {
  34046. $absolutePath = parent::current();
  34047. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  34048. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  34049. $dir = dirname($this->subPathname);
  34050. $this->subPath = '.' === $dir ? '' : $dir;
  34051. } else {
  34052. $this->subPath = $this->subPathname = '';
  34053. }
  34054. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  34055. }
  34056. }
  34057. <?php
  34058. namespace Symfony\Component\Finder\Iterator;
  34059. class FileTypeFilterIterator extends FilterIterator
  34060. {
  34061. const ONLY_FILES = 1;
  34062. const ONLY_DIRECTORIES = 2;
  34063. private $mode;
  34064. public function __construct(\Iterator $iterator, $mode)
  34065. {
  34066. $this->mode = $mode;
  34067. parent::__construct($iterator);
  34068. }
  34069. public function accept()
  34070. {
  34071. $fileinfo = $this->current();
  34072. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  34073. return false;
  34074. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  34075. return false;
  34076. }
  34077. return true;
  34078. }
  34079. }
  34080. <?php
  34081. namespace Symfony\Component\Finder\Iterator;
  34082. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  34083. {
  34084. public function accept()
  34085. {
  34086. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  34087. return true;
  34088. }
  34089. $fileinfo = $this->current();
  34090. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  34091. return false;
  34092. }
  34093. $content = $fileinfo->getContents();
  34094. if (!$content) {
  34095. return false;
  34096. }
  34097. return $this->isAccepted($content);
  34098. }
  34099. protected function toRegex($str)
  34100. {
  34101. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  34102. }
  34103. }
  34104. <?php
  34105. namespace Symfony\Component\Finder\Iterator;
  34106. use Symfony\Component\Finder\Glob;
  34107. class FilenameFilterIterator extends MultiplePcreFilterIterator
  34108. {
  34109. public function accept()
  34110. {
  34111. return $this->isAccepted($this->current()->getFilename());
  34112. }
  34113. protected function toRegex($str)
  34114. {
  34115. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  34116. }
  34117. }
  34118. <?php
  34119. namespace Symfony\Component\Finder\Iterator;
  34120. abstract class FilterIterator extends \FilterIterator
  34121. {
  34122. public function rewind()
  34123. {
  34124. $iterator = $this;
  34125. while ($iterator instanceof \OuterIterator) {
  34126. $innerIterator = $iterator->getInnerIterator();
  34127. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  34128. if ($innerIterator->isRewindable()) {
  34129. $innerIterator->next();
  34130. $innerIterator->rewind();
  34131. }
  34132. } elseif ($iterator->getInnerIterator() instanceof \FilesystemIterator) {
  34133. $iterator->getInnerIterator()->next();
  34134. $iterator->getInnerIterator()->rewind();
  34135. }
  34136. $iterator = $iterator->getInnerIterator();
  34137. }
  34138. parent::rewind();
  34139. }
  34140. }
  34141. <?php
  34142. namespace Symfony\Component\Finder\Iterator;
  34143. abstract class MultiplePcreFilterIterator extends FilterIterator
  34144. {
  34145. protected $matchRegexps = array();
  34146. protected $noMatchRegexps = array();
  34147. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  34148. {
  34149. foreach ($matchPatterns as $pattern) {
  34150. $this->matchRegexps[] = $this->toRegex($pattern);
  34151. }
  34152. foreach ($noMatchPatterns as $pattern) {
  34153. $this->noMatchRegexps[] = $this->toRegex($pattern);
  34154. }
  34155. parent::__construct($iterator);
  34156. }
  34157. protected function isAccepted($string)
  34158. {
  34159. foreach ($this->noMatchRegexps as $regex) {
  34160. if (preg_match($regex, $string)) {
  34161. return false;
  34162. }
  34163. }
  34164. if ($this->matchRegexps) {
  34165. foreach ($this->matchRegexps as $regex) {
  34166. if (preg_match($regex, $string)) {
  34167. return true;
  34168. }
  34169. }
  34170. return false;
  34171. }
  34172. return true;
  34173. }
  34174. protected function isRegex($str)
  34175. {
  34176. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  34177. $start = substr($m[1], 0, 1);
  34178. $end = substr($m[1], -1);
  34179. if ($start === $end) {
  34180. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  34181. }
  34182. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  34183. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  34184. return true;
  34185. }
  34186. }
  34187. }
  34188. return false;
  34189. }
  34190. abstract protected function toRegex($str);
  34191. }
  34192. <?php
  34193. namespace Symfony\Component\Finder\Iterator;
  34194. class PathFilterIterator extends MultiplePcreFilterIterator
  34195. {
  34196. public function accept()
  34197. {
  34198. $filename = $this->current()->getRelativePathname();
  34199. if ('\\' === DIRECTORY_SEPARATOR) {
  34200. $filename = str_replace('\\', '/', $filename);
  34201. }
  34202. return $this->isAccepted($filename);
  34203. }
  34204. protected function toRegex($str)
  34205. {
  34206. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  34207. }
  34208. }
  34209. <?php
  34210. namespace Symfony\Component\Finder\Iterator;
  34211. use Symfony\Component\Finder\Exception\AccessDeniedException;
  34212. use Symfony\Component\Finder\SplFileInfo;
  34213. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  34214. {
  34215. private $ignoreUnreadableDirs;
  34216. private $rewindable;
  34217. private $rootPath;
  34218. private $subPath;
  34219. private $directorySeparator = '/';
  34220. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  34221. {
  34222. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  34223. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  34224. }
  34225. parent::__construct($path, $flags);
  34226. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  34227. $this->rootPath = (string) $path;
  34228. if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  34229. $this->directorySeparator = DIRECTORY_SEPARATOR;
  34230. }
  34231. }
  34232. public function current()
  34233. {
  34234. if (null === $subPathname = $this->subPath) {
  34235. $subPathname = $this->subPath = (string) $this->getSubPath();
  34236. }
  34237. if ('' !== $subPathname) {
  34238. $subPathname .= $this->directorySeparator;
  34239. }
  34240. $subPathname .= $this->getFilename();
  34241. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  34242. }
  34243. public function getChildren()
  34244. {
  34245. try {
  34246. $children = parent::getChildren();
  34247. if ($children instanceof self) {
  34248. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  34249. $children->rewindable = &$this->rewindable;
  34250. $children->rootPath = $this->rootPath;
  34251. }
  34252. return $children;
  34253. } catch (\UnexpectedValueException $e) {
  34254. if ($this->ignoreUnreadableDirs) {
  34255. return new \RecursiveArrayIterator(array());
  34256. } else {
  34257. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  34258. }
  34259. }
  34260. }
  34261. public function rewind()
  34262. {
  34263. if (false === $this->isRewindable()) {
  34264. return;
  34265. }
  34266. parent::next();
  34267. parent::rewind();
  34268. }
  34269. public function isRewindable()
  34270. {
  34271. if (null !== $this->rewindable) {
  34272. return $this->rewindable;
  34273. }
  34274. if (false !== $stream = @opendir($this->getPath())) {
  34275. $infos = stream_get_meta_data($stream);
  34276. closedir($stream);
  34277. if ($infos['seekable']) {
  34278. return $this->rewindable = true;
  34279. }
  34280. }
  34281. return $this->rewindable = false;
  34282. }
  34283. }
  34284. <?php
  34285. namespace Symfony\Component\Finder\Iterator;
  34286. use Symfony\Component\Finder\Comparator\NumberComparator;
  34287. class SizeRangeFilterIterator extends FilterIterator
  34288. {
  34289. private $comparators = array();
  34290. public function __construct(\Iterator $iterator, array $comparators)
  34291. {
  34292. $this->comparators = $comparators;
  34293. parent::__construct($iterator);
  34294. }
  34295. public function accept()
  34296. {
  34297. $fileinfo = $this->current();
  34298. if (!$fileinfo->isFile()) {
  34299. return true;
  34300. }
  34301. $filesize = $fileinfo->getSize();
  34302. foreach ($this->comparators as $compare) {
  34303. if (!$compare->test($filesize)) {
  34304. return false;
  34305. }
  34306. }
  34307. return true;
  34308. }
  34309. }
  34310. <?php
  34311. namespace Symfony\Component\Finder\Iterator;
  34312. class SortableIterator implements \IteratorAggregate
  34313. {
  34314. const SORT_BY_NAME = 1;
  34315. const SORT_BY_TYPE = 2;
  34316. const SORT_BY_ACCESSED_TIME = 3;
  34317. const SORT_BY_CHANGED_TIME = 4;
  34318. const SORT_BY_MODIFIED_TIME = 5;
  34319. private $iterator;
  34320. private $sort;
  34321. public function __construct(\Traversable $iterator, $sort)
  34322. {
  34323. $this->iterator = $iterator;
  34324. if (self::SORT_BY_NAME === $sort) {
  34325. $this->sort = function ($a, $b) {
  34326. return strcmp($a->getRealpath(), $b->getRealpath());
  34327. };
  34328. } elseif (self::SORT_BY_TYPE === $sort) {
  34329. $this->sort = function ($a, $b) {
  34330. if ($a->isDir() && $b->isFile()) {
  34331. return -1;
  34332. } elseif ($a->isFile() && $b->isDir()) {
  34333. return 1;
  34334. }
  34335. return strcmp($a->getRealpath(), $b->getRealpath());
  34336. };
  34337. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  34338. $this->sort = function ($a, $b) {
  34339. return $a->getATime() - $b->getATime();
  34340. };
  34341. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  34342. $this->sort = function ($a, $b) {
  34343. return $a->getCTime() - $b->getCTime();
  34344. };
  34345. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  34346. $this->sort = function ($a, $b) {
  34347. return $a->getMTime() - $b->getMTime();
  34348. };
  34349. } elseif (is_callable($sort)) {
  34350. $this->sort = $sort;
  34351. } else {
  34352. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  34353. }
  34354. }
  34355. public function getIterator()
  34356. {
  34357. $array = iterator_to_array($this->iterator, true);
  34358. uasort($array, $this->sort);
  34359. return new \ArrayIterator($array);
  34360. }
  34361. }
  34362. Copyright (c) 2004-2016 Fabien Potencier
  34363. Permission is hereby granted, free of charge, to any person obtaining a copy
  34364. of this software and associated documentation files (the "Software"), to deal
  34365. in the Software without restriction, including without limitation the rights
  34366. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34367. copies of the Software, and to permit persons to whom the Software is furnished
  34368. to do so, subject to the following conditions:
  34369. The above copyright notice and this permission notice shall be included in all
  34370. copies or substantial portions of the Software.
  34371. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34372. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34373. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34374. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34375. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34376. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  34377. THE SOFTWARE.
  34378. <?php
  34379. namespace Symfony\Component\Finder\Shell;
  34380. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  34381. class Command
  34382. {
  34383. private $parent;
  34384. private $bits = array();
  34385. private $labels = array();
  34386. private $errorHandler;
  34387. public function __construct(Command $parent = null)
  34388. {
  34389. $this->parent = $parent;
  34390. }
  34391. public function __toString()
  34392. {
  34393. return $this->join();
  34394. }
  34395. public static function create(Command $parent = null)
  34396. {
  34397. return new self($parent);
  34398. }
  34399. public static function escape($input)
  34400. {
  34401. return escapeshellcmd($input);
  34402. }
  34403. public static function quote($input)
  34404. {
  34405. return escapeshellarg($input);
  34406. }
  34407. public function add($bit)
  34408. {
  34409. $this->bits[] = $bit;
  34410. return $this;
  34411. }
  34412. public function top($bit)
  34413. {
  34414. array_unshift($this->bits, $bit);
  34415. foreach ($this->labels as $label => $index) {
  34416. $this->labels[$label] += 1;
  34417. }
  34418. return $this;
  34419. }
  34420. public function arg($arg)
  34421. {
  34422. $this->bits[] = self::quote($arg);
  34423. return $this;
  34424. }
  34425. public function cmd($esc)
  34426. {
  34427. $this->bits[] = self::escape($esc);
  34428. return $this;
  34429. }
  34430. public function ins($label)
  34431. {
  34432. if (isset($this->labels[$label])) {
  34433. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  34434. }
  34435. $this->bits[] = self::create($this);
  34436. $this->labels[$label] = count($this->bits) - 1;
  34437. return $this->bits[$this->labels[$label]];
  34438. }
  34439. public function get($label)
  34440. {
  34441. if (!isset($this->labels[$label])) {
  34442. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  34443. }
  34444. return $this->bits[$this->labels[$label]];
  34445. }
  34446. public function end()
  34447. {
  34448. if (null === $this->parent) {
  34449. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  34450. }
  34451. return $this->parent;
  34452. }
  34453. public function length()
  34454. {
  34455. return count($this->bits);
  34456. }
  34457. public function setErrorHandler(\Closure $errorHandler)
  34458. {
  34459. $this->errorHandler = $errorHandler;
  34460. return $this;
  34461. }
  34462. public function getErrorHandler()
  34463. {
  34464. return $this->errorHandler;
  34465. }
  34466. public function execute()
  34467. {
  34468. if (null === $errorHandler = $this->errorHandler) {
  34469. exec($this->join(), $output);
  34470. } else {
  34471. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  34472. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  34473. if ($error = stream_get_contents($pipes[2])) {
  34474. $errorHandler($error);
  34475. }
  34476. proc_close($process);
  34477. }
  34478. return $output ?: array();
  34479. }
  34480. public function join()
  34481. {
  34482. return implode(' ', array_filter(
  34483. array_map(function ($bit) {
  34484. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  34485. }, $this->bits),
  34486. function ($bit) { return null !== $bit; }
  34487. ));
  34488. }
  34489. public function addAtIndex($bit, $index)
  34490. {
  34491. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  34492. return $this;
  34493. }
  34494. }
  34495. <?php
  34496. namespace Symfony\Component\Finder\Shell;
  34497. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  34498. class Shell
  34499. {
  34500. const TYPE_UNIX = 1;
  34501. const TYPE_DARWIN = 2;
  34502. const TYPE_CYGWIN = 3;
  34503. const TYPE_WINDOWS = 4;
  34504. const TYPE_BSD = 5;
  34505. private $type;
  34506. public function getType()
  34507. {
  34508. if (null === $this->type) {
  34509. $this->type = $this->guessType();
  34510. }
  34511. return $this->type;
  34512. }
  34513. public function testCommand($command)
  34514. {
  34515. if (!function_exists('exec')) {
  34516. return false;
  34517. }
  34518. $testCommand = 'which ';
  34519. if (self::TYPE_WINDOWS === $this->type) {
  34520. $testCommand = 'where ';
  34521. }
  34522. $command = escapeshellcmd($command);
  34523. exec($testCommand.$command, $output, $code);
  34524. return 0 === $code && count($output) > 0;
  34525. }
  34526. private function guessType()
  34527. {
  34528. $os = strtolower(PHP_OS);
  34529. if (false !== strpos($os, 'cygwin')) {
  34530. return self::TYPE_CYGWIN;
  34531. }
  34532. if (false !== strpos($os, 'darwin')) {
  34533. return self::TYPE_DARWIN;
  34534. }
  34535. if (false !== strpos($os, 'bsd')) {
  34536. return self::TYPE_BSD;
  34537. }
  34538. if (0 === strpos($os, 'win')) {
  34539. return self::TYPE_WINDOWS;
  34540. }
  34541. return self::TYPE_UNIX;
  34542. }
  34543. }
  34544. <?php
  34545. namespace Symfony\Component\Finder;
  34546. class SplFileInfo extends \SplFileInfo
  34547. {
  34548. private $relativePath;
  34549. private $relativePathname;
  34550. public function __construct($file, $relativePath, $relativePathname)
  34551. {
  34552. parent::__construct($file);
  34553. $this->relativePath = $relativePath;
  34554. $this->relativePathname = $relativePathname;
  34555. }
  34556. public function getRelativePath()
  34557. {
  34558. return $this->relativePath;
  34559. }
  34560. public function getRelativePathname()
  34561. {
  34562. return $this->relativePathname;
  34563. }
  34564. public function getContents()
  34565. {
  34566. $level = error_reporting(0);
  34567. $content = file_get_contents($this->getPathname());
  34568. error_reporting($level);
  34569. if (false === $content) {
  34570. $error = error_get_last();
  34571. throw new \RuntimeException($error['message']);
  34572. }
  34573. return $content;
  34574. }
  34575. }
  34576. Copyright (c) 2014-2016 Fabien Potencier
  34577. Permission is hereby granted, free of charge, to any person obtaining a copy
  34578. of this software and associated documentation files (the "Software"), to deal
  34579. in the Software without restriction, including without limitation the rights
  34580. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34581. copies of the Software, and to permit persons to whom the Software is furnished
  34582. to do so, subject to the following conditions:
  34583. The above copyright notice and this permission notice shall be included in all
  34584. copies or substantial portions of the Software.
  34585. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34586. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34587. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34588. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34589. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34590. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  34591. THE SOFTWARE.
  34592. <?php
  34593. namespace Symfony\Polyfill\Mbstring;
  34594. final class Mbstring
  34595. {
  34596. const MB_CASE_FOLD = PHP_INT_MAX;
  34597. private static $encodingList = array('ASCII', 'UTF-8');
  34598. private static $language = 'neutral';
  34599. private static $internalEncoding = 'UTF-8';
  34600. private static $caseFold = array(
  34601. array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
  34602. array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1",'ι'),
  34603. );
  34604. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  34605. {
  34606. if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  34607. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  34608. } else {
  34609. $fromEncoding = self::getEncoding($fromEncoding);
  34610. }
  34611. $toEncoding = self::getEncoding($toEncoding);
  34612. if ('BASE64' === $fromEncoding) {
  34613. $s = base64_decode($s);
  34614. $fromEncoding = $toEncoding;
  34615. }
  34616. if ('BASE64' === $toEncoding) {
  34617. return base64_encode($s);
  34618. }
  34619. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  34620. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  34621. $fromEncoding = 'Windows-1252';
  34622. }
  34623. if ('UTF-8' !== $fromEncoding) {
  34624. $s = iconv($fromEncoding, 'UTF-8', $s);
  34625. }
  34626. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  34627. }
  34628. if ('HTML-ENTITIES' === $fromEncoding) {
  34629. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  34630. $fromEncoding = 'UTF-8';
  34631. }
  34632. return iconv($fromEncoding, $toEncoding, $s);
  34633. }
  34634. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  34635. {
  34636. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  34637. $ok = true;
  34638. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  34639. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  34640. $ok = false;
  34641. }
  34642. });
  34643. return $ok ? $fromEncoding : false;
  34644. }
  34645. public static function mb_decode_mimeheader($s)
  34646. {
  34647. return iconv_mime_decode($s, 2, self::$internalEncoding);
  34648. }
  34649. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  34650. {
  34651. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  34652. }
  34653. public static function mb_convert_case($s, $mode, $encoding = null)
  34654. {
  34655. if ('' === $s .= '') {
  34656. return '';
  34657. }
  34658. $encoding = self::getEncoding($encoding);
  34659. if ('UTF-8' === $encoding) {
  34660. $encoding = null;
  34661. } else {
  34662. $s = iconv($encoding, 'UTF-8', $s);
  34663. }
  34664. if (MB_CASE_TITLE == $mode) {
  34665. $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
  34666. $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
  34667. } else {
  34668. if (MB_CASE_UPPER == $mode) {
  34669. static $upper = null;
  34670. if (null === $upper) {
  34671. $upper = self::getData('upperCase');
  34672. }
  34673. $map = $upper;
  34674. } else {
  34675. if (self::MB_CASE_FOLD === $mode) {
  34676. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  34677. }
  34678. static $lower = null;
  34679. if (null === $lower) {
  34680. $lower = self::getData('lowerCase');
  34681. }
  34682. $map = $lower;
  34683. }
  34684. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  34685. $i = 0;
  34686. $len = strlen($s);
  34687. while ($i < $len) {
  34688. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  34689. $uchr = substr($s, $i, $ulen);
  34690. $i += $ulen;
  34691. if (isset($map[$uchr])) {
  34692. $uchr = $map[$uchr];
  34693. $nlen = strlen($uchr);
  34694. if ($nlen == $ulen) {
  34695. $nlen = $i;
  34696. do {
  34697. $s[--$nlen] = $uchr[--$ulen];
  34698. } while ($ulen);
  34699. } else {
  34700. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  34701. $len += $nlen - $ulen;
  34702. $i += $nlen - $ulen;
  34703. }
  34704. }
  34705. }
  34706. }
  34707. if (null === $encoding) {
  34708. return $s;
  34709. }
  34710. return iconv('UTF-8', $encoding, $s);
  34711. }
  34712. public static function mb_internal_encoding($encoding = null)
  34713. {
  34714. if (null === $encoding) {
  34715. return self::$internalEncoding;
  34716. }
  34717. $encoding = self::getEncoding($encoding);
  34718. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  34719. self::$internalEncoding = $encoding;
  34720. return true;
  34721. }
  34722. return false;
  34723. }
  34724. public static function mb_language($lang = null)
  34725. {
  34726. if (null === $lang) {
  34727. return self::$language;
  34728. }
  34729. switch ($lang = strtolower($lang)) {
  34730. case 'uni':
  34731. case 'neutral':
  34732. self::$language = $lang;
  34733. return true;
  34734. }
  34735. return false;
  34736. }
  34737. public static function mb_list_encodings()
  34738. {
  34739. return array('UTF-8');
  34740. }
  34741. public static function mb_encoding_aliases($encoding)
  34742. {
  34743. switch (strtoupper($encoding)) {
  34744. case 'UTF8':
  34745. case 'UTF-8':
  34746. return array('utf8');
  34747. }
  34748. return false;
  34749. }
  34750. public static function mb_check_encoding($var = null, $encoding = null)
  34751. {
  34752. if (null === $encoding) {
  34753. if (null === $var) {
  34754. return false;
  34755. }
  34756. $encoding = self::$internalEncoding;
  34757. }
  34758. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  34759. }
  34760. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  34761. {
  34762. if (null === $encodingList) {
  34763. $encodingList = self::$encodingList;
  34764. } else {
  34765. if (!is_array($encodingList)) {
  34766. $encodingList = array_map('trim', explode(',', $encodingList));
  34767. }
  34768. $encodingList = array_map('strtoupper', $encodingList);
  34769. }
  34770. foreach ($encodingList as $enc) {
  34771. switch ($enc) {
  34772. case 'ASCII':
  34773. if (!preg_match('/[\x80-\xFF]/', $str)) {
  34774. return $enc;
  34775. }
  34776. break;
  34777. case 'UTF8':
  34778. case 'UTF-8':
  34779. if (preg_match('//u', $str)) {
  34780. return 'UTF-8';
  34781. }
  34782. break;
  34783. default:
  34784. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  34785. return $enc;
  34786. }
  34787. }
  34788. }
  34789. return false;
  34790. }
  34791. public static function mb_detect_order($encodingList = null)
  34792. {
  34793. if (null === $encodingList) {
  34794. return self::$encodingList;
  34795. }
  34796. if (!is_array($encodingList)) {
  34797. $encodingList = array_map('trim', explode(',', $encodingList));
  34798. }
  34799. $encodingList = array_map('strtoupper', $encodingList);
  34800. foreach ($encodingList as $enc) {
  34801. switch ($enc) {
  34802. default:
  34803. if (strncmp($enc, 'ISO-8859-', 9)) {
  34804. return false;
  34805. }
  34806. case 'ASCII':
  34807. case 'UTF8':
  34808. case 'UTF-8':
  34809. }
  34810. }
  34811. self::$encodingList = $encodingList;
  34812. return true;
  34813. }
  34814. public static function mb_strlen($s, $encoding = null)
  34815. {
  34816. $encoding = self::getEncoding($encoding);
  34817. return iconv_strlen($s, $encoding);
  34818. }
  34819. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  34820. {
  34821. $encoding = self::getEncoding($encoding);
  34822. if ('' === $needle .= '') {
  34823. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  34824. return false;
  34825. }
  34826. return iconv_strpos($haystack, $needle, $offset, $encoding);
  34827. }
  34828. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  34829. {
  34830. $encoding = self::getEncoding($encoding);
  34831. if ($offset != (int) $offset) {
  34832. $offset = 0;
  34833. } elseif ($offset = (int) $offset) {
  34834. if ($offset < 0) {
  34835. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  34836. $offset = 0;
  34837. } else {
  34838. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  34839. }
  34840. }
  34841. $pos = iconv_strrpos($haystack, $needle, $encoding);
  34842. return false !== $pos ? $offset + $pos : false;
  34843. }
  34844. public static function mb_strtolower($s, $encoding = null)
  34845. {
  34846. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  34847. }
  34848. public static function mb_strtoupper($s, $encoding = null)
  34849. {
  34850. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  34851. }
  34852. public static function mb_substitute_character($c = null)
  34853. {
  34854. if (0 === strcasecmp($c, 'none')) {
  34855. return true;
  34856. }
  34857. return null !== $c ? false : 'none';
  34858. }
  34859. public static function mb_substr($s, $start, $length = null, $encoding = null)
  34860. {
  34861. $encoding = self::getEncoding($encoding);
  34862. if ($start < 0) {
  34863. $start = iconv_strlen($s, $encoding) + $start;
  34864. if ($start < 0) {
  34865. $start = 0;
  34866. }
  34867. }
  34868. if (null === $length) {
  34869. $length = 2147483647;
  34870. } elseif ($length < 0) {
  34871. $length = iconv_strlen($s, $encoding) + $length - $start;
  34872. if ($length < 0) {
  34873. return '';
  34874. }
  34875. }
  34876. return iconv_substr($s, $start, $length, $encoding).'';
  34877. }
  34878. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  34879. {
  34880. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  34881. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  34882. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  34883. }
  34884. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  34885. {
  34886. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  34887. return self::getSubpart($pos, $part, $haystack, $encoding);
  34888. }
  34889. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  34890. {
  34891. $encoding = self::getEncoding($encoding);
  34892. $needle = self::mb_substr($needle, 0, 1, $encoding);
  34893. $pos = iconv_strrpos($haystack, $needle, $encoding);
  34894. return self::getSubpart($pos, $part, $haystack, $encoding);
  34895. }
  34896. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  34897. {
  34898. $needle = self::mb_substr($needle, 0, 1, $encoding);
  34899. $pos = self::mb_strripos($haystack, $needle, $encoding);
  34900. return self::getSubpart($pos, $part, $haystack, $encoding);
  34901. }
  34902. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  34903. {
  34904. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  34905. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  34906. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  34907. }
  34908. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  34909. {
  34910. $pos = strpos($haystack, $needle);
  34911. if (false === $pos) {
  34912. return false;
  34913. }
  34914. if ($part) {
  34915. return substr($haystack, 0, $pos);
  34916. }
  34917. return substr($haystack, $pos);
  34918. }
  34919. public static function mb_get_info($type = 'all')
  34920. {
  34921. $info = array(
  34922. 'internal_encoding' => self::$internalEncoding,
  34923. 'http_output' => 'pass',
  34924. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  34925. 'func_overload' => 0,
  34926. 'func_overload_list' => 'no overload',
  34927. 'mail_charset' => 'UTF-8',
  34928. 'mail_header_encoding' => 'BASE64',
  34929. 'mail_body_encoding' => 'BASE64',
  34930. 'illegal_chars' => 0,
  34931. 'encoding_translation' => 'Off',
  34932. 'language' => self::$language,
  34933. 'detect_order' => self::$encodingList,
  34934. 'substitute_character' => 'none',
  34935. 'strict_detection' => 'Off',
  34936. );
  34937. if ('all' === $type) {
  34938. return $info;
  34939. }
  34940. if (isset($info[$type])) {
  34941. return $info[$type];
  34942. }
  34943. return false;
  34944. }
  34945. public static function mb_http_input($type = '')
  34946. {
  34947. return false;
  34948. }
  34949. public static function mb_http_output($encoding = null)
  34950. {
  34951. return null !== $encoding ? 'pass' === $encoding : 'pass';
  34952. }
  34953. public static function mb_strwidth($s, $encoding = null)
  34954. {
  34955. $encoding = self::getEncoding($encoding);
  34956. if ('UTF-8' !== $encoding) {
  34957. $s = iconv($encoding, 'UTF-8', $s);
  34958. }
  34959. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  34960. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  34961. }
  34962. public static function mb_substr_count($haystack, $needle, $encoding = null)
  34963. {
  34964. return substr_count($haystack, $needle);
  34965. }
  34966. public static function mb_output_handler($contents, $status)
  34967. {
  34968. return $contents;
  34969. }
  34970. private static function getSubpart($pos, $part, $haystack, $encoding)
  34971. {
  34972. if (false === $pos) {
  34973. return false;
  34974. }
  34975. if ($part) {
  34976. return self::mb_substr($haystack, 0, $pos, $encoding);
  34977. }
  34978. return self::mb_substr($haystack, $pos, null, $encoding);
  34979. }
  34980. private static function html_encoding_callback($m)
  34981. {
  34982. $i = 1;
  34983. $entities = '';
  34984. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  34985. while (isset($m[$i])) {
  34986. if (0x80 > $m[$i]) {
  34987. $entities .= chr($m[$i++]);
  34988. continue;
  34989. }
  34990. if (0xF0 <= $m[$i]) {
  34991. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  34992. } elseif (0xE0 <= $m[$i]) {
  34993. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  34994. } else {
  34995. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  34996. }
  34997. $entities .= '&#'.$c.';';
  34998. }
  34999. return $entities;
  35000. }
  35001. private static function title_case_lower($s)
  35002. {
  35003. return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
  35004. }
  35005. private static function title_case_upper($s)
  35006. {
  35007. return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
  35008. }
  35009. private static function getData($file)
  35010. {
  35011. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.ser')) {
  35012. return unserialize(file_get_contents($file));
  35013. }
  35014. return false;
  35015. }
  35016. private static function getEncoding($encoding)
  35017. {
  35018. if (null === $encoding) {
  35019. return self::$internalEncoding;
  35020. }
  35021. $encoding = strtoupper($encoding);
  35022. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  35023. return 'CP850';
  35024. }
  35025. if ('UTF8' === $encoding) {
  35026. return 'UTF-8';
  35027. }
  35028. return $encoding;
  35029. }
  35030. }
  35031. <?php
  35032. use Symfony\Polyfill\Mbstring as p;
  35033. if (!function_exists('mb_strlen')) {
  35034. define('MB_CASE_UPPER', 0);
  35035. define('MB_CASE_LOWER', 1);
  35036. define('MB_CASE_TITLE', 2);
  35037. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  35038. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  35039. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  35040. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  35041. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  35042. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  35043. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  35044. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  35045. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  35046. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  35047. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  35048. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  35049. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  35050. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  35051. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  35052. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  35053. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  35054. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  35055. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  35056. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  35057. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  35058. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  35059. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  35060. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  35061. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  35062. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  35063. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  35064. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  35065. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  35066. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  35067. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  35068. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $v0, $a, $b, $c, $d, $e, $f); }
  35069. }
  35070. <?php
  35071. namespace Symfony\Component\Process\Exception;
  35072. interface ExceptionInterface
  35073. {
  35074. }
  35075. <?php
  35076. namespace Symfony\Component\Process\Exception;
  35077. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  35078. {
  35079. }
  35080. <?php
  35081. namespace Symfony\Component\Process\Exception;
  35082. class LogicException extends \LogicException implements ExceptionInterface
  35083. {
  35084. }
  35085. <?php
  35086. namespace Symfony\Component\Process\Exception;
  35087. use Symfony\Component\Process\Process;
  35088. class ProcessFailedException extends RuntimeException
  35089. {
  35090. private $process;
  35091. public function __construct(Process $process)
  35092. {
  35093. if ($process->isSuccessful()) {
  35094. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  35095. }
  35096. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  35097. $process->getCommandLine(),
  35098. $process->getExitCode(),
  35099. $process->getExitCodeText(),
  35100. $process->getWorkingDirectory()
  35101. );
  35102. if (!$process->isOutputDisabled()) {
  35103. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  35104. $process->getOutput(),
  35105. $process->getErrorOutput()
  35106. );
  35107. }
  35108. parent::__construct($error);
  35109. $this->process = $process;
  35110. }
  35111. public function getProcess()
  35112. {
  35113. return $this->process;
  35114. }
  35115. }
  35116. <?php
  35117. namespace Symfony\Component\Process\Exception;
  35118. use Symfony\Component\Process\Process;
  35119. class ProcessTimedOutException extends RuntimeException
  35120. {
  35121. const TYPE_GENERAL = 1;
  35122. const TYPE_IDLE = 2;
  35123. private $process;
  35124. private $timeoutType;
  35125. public function __construct(Process $process, $timeoutType)
  35126. {
  35127. $this->process = $process;
  35128. $this->timeoutType = $timeoutType;
  35129. parent::__construct(sprintf(
  35130. 'The process "%s" exceeded the timeout of %s seconds.',
  35131. $process->getCommandLine(),
  35132. $this->getExceededTimeout()
  35133. ));
  35134. }
  35135. public function getProcess()
  35136. {
  35137. return $this->process;
  35138. }
  35139. public function isGeneralTimeout()
  35140. {
  35141. return $this->timeoutType === self::TYPE_GENERAL;
  35142. }
  35143. public function isIdleTimeout()
  35144. {
  35145. return $this->timeoutType === self::TYPE_IDLE;
  35146. }
  35147. public function getExceededTimeout()
  35148. {
  35149. switch ($this->timeoutType) {
  35150. case self::TYPE_GENERAL:
  35151. return $this->process->getTimeout();
  35152. case self::TYPE_IDLE:
  35153. return $this->process->getIdleTimeout();
  35154. default:
  35155. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  35156. }
  35157. }
  35158. }
  35159. <?php
  35160. namespace Symfony\Component\Process\Exception;
  35161. class RuntimeException extends \RuntimeException implements ExceptionInterface
  35162. {
  35163. }
  35164. <?php
  35165. namespace Symfony\Component\Process;
  35166. class ExecutableFinder
  35167. {
  35168. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  35169. public function setSuffixes(array $suffixes)
  35170. {
  35171. $this->suffixes = $suffixes;
  35172. }
  35173. public function addSuffix($suffix)
  35174. {
  35175. $this->suffixes[] = $suffix;
  35176. }
  35177. public function find($name, $default = null, array $extraDirs = array())
  35178. {
  35179. if (ini_get('open_basedir')) {
  35180. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  35181. $dirs = array();
  35182. foreach ($searchPath as $path) {
  35183. if (@is_dir($path)) {
  35184. $dirs[] = $path;
  35185. } else {
  35186. if (basename($path) == $name && is_executable($path)) {
  35187. return $path;
  35188. }
  35189. }
  35190. }
  35191. } else {
  35192. $dirs = array_merge(
  35193. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  35194. $extraDirs
  35195. );
  35196. }
  35197. $suffixes = array('');
  35198. if ('\\' === DIRECTORY_SEPARATOR) {
  35199. $pathExt = getenv('PATHEXT');
  35200. $suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes;
  35201. }
  35202. foreach ($suffixes as $suffix) {
  35203. foreach ($dirs as $dir) {
  35204. if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
  35205. return $file;
  35206. }
  35207. }
  35208. }
  35209. return $default;
  35210. }
  35211. }
  35212. Copyright (c) 2004-2016 Fabien Potencier
  35213. Permission is hereby granted, free of charge, to any person obtaining a copy
  35214. of this software and associated documentation files (the "Software"), to deal
  35215. in the Software without restriction, including without limitation the rights
  35216. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35217. copies of the Software, and to permit persons to whom the Software is furnished
  35218. to do so, subject to the following conditions:
  35219. The above copyright notice and this permission notice shall be included in all
  35220. copies or substantial portions of the Software.
  35221. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35222. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35223. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35224. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35225. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35226. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  35227. THE SOFTWARE.
  35228. <?php
  35229. namespace Symfony\Component\Process;
  35230. class PhpExecutableFinder
  35231. {
  35232. private $executableFinder;
  35233. public function __construct()
  35234. {
  35235. $this->executableFinder = new ExecutableFinder();
  35236. }
  35237. public function find($includeArgs = true)
  35238. {
  35239. $args = $this->findArguments();
  35240. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  35241. if (defined('HHVM_VERSION')) {
  35242. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  35243. }
  35244. if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
  35245. return PHP_BINARY.$args;
  35246. }
  35247. if ($php = getenv('PHP_PATH')) {
  35248. if (!is_executable($php)) {
  35249. return false;
  35250. }
  35251. return $php;
  35252. }
  35253. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  35254. if (is_executable($php)) {
  35255. return $php;
  35256. }
  35257. }
  35258. $dirs = array(PHP_BINDIR);
  35259. if ('\\' === DIRECTORY_SEPARATOR) {
  35260. $dirs[] = 'C:\xampp\php\\';
  35261. }
  35262. return $this->executableFinder->find('php', false, $dirs);
  35263. }
  35264. public function findArguments()
  35265. {
  35266. $arguments = array();
  35267. if (defined('HHVM_VERSION')) {
  35268. $arguments[] = '--php';
  35269. } elseif ('phpdbg' === PHP_SAPI) {
  35270. $arguments[] = '-qrr';
  35271. }
  35272. return $arguments;
  35273. }
  35274. }
  35275. <?php
  35276. namespace Symfony\Component\Process;
  35277. use Symfony\Component\Process\Exception\RuntimeException;
  35278. class PhpProcess extends Process
  35279. {
  35280. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  35281. {
  35282. $executableFinder = new PhpExecutableFinder();
  35283. if (false === $php = $executableFinder->find()) {
  35284. $php = null;
  35285. }
  35286. if ('phpdbg' === PHP_SAPI) {
  35287. $file = tempnam(sys_get_temp_dir(), 'dbg');
  35288. file_put_contents($file, $script);
  35289. register_shutdown_function('unlink', $file);
  35290. $php .= ' '.ProcessUtils::escapeArgument($file);
  35291. $script = null;
  35292. }
  35293. if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
  35294. $php = 'exec '.$php;
  35295. }
  35296. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  35297. }
  35298. public function setPhpBinary($php)
  35299. {
  35300. $this->setCommandLine($php);
  35301. }
  35302. public function start($callback = null)
  35303. {
  35304. if (null === $this->getCommandLine()) {
  35305. throw new RuntimeException('Unable to find the PHP executable.');
  35306. }
  35307. parent::start($callback);
  35308. }
  35309. }
  35310. <?php
  35311. namespace Symfony\Component\Process\Pipes;
  35312. abstract class AbstractPipes implements PipesInterface
  35313. {
  35314. public $pipes = array();
  35315. protected $inputBuffer = '';
  35316. protected $input;
  35317. private $blocked = true;
  35318. public function close()
  35319. {
  35320. foreach ($this->pipes as $pipe) {
  35321. fclose($pipe);
  35322. }
  35323. $this->pipes = array();
  35324. }
  35325. protected function hasSystemCallBeenInterrupted()
  35326. {
  35327. $lastError = error_get_last();
  35328. return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
  35329. }
  35330. protected function unblock()
  35331. {
  35332. if (!$this->blocked) {
  35333. return;
  35334. }
  35335. foreach ($this->pipes as $pipe) {
  35336. stream_set_blocking($pipe, 0);
  35337. }
  35338. if (null !== $this->input) {
  35339. stream_set_blocking($this->input, 0);
  35340. }
  35341. $this->blocked = false;
  35342. }
  35343. }
  35344. <?php
  35345. namespace Symfony\Component\Process\Pipes;
  35346. interface PipesInterface
  35347. {
  35348. const CHUNK_SIZE = 16384;
  35349. public function getDescriptors();
  35350. public function getFiles();
  35351. public function readAndWrite($blocking, $close = false);
  35352. public function areOpen();
  35353. public function close();
  35354. }
  35355. <?php
  35356. namespace Symfony\Component\Process\Pipes;
  35357. use Symfony\Component\Process\Process;
  35358. class UnixPipes extends AbstractPipes
  35359. {
  35360. private $ttyMode;
  35361. private $ptyMode;
  35362. private $disableOutput;
  35363. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  35364. {
  35365. $this->ttyMode = (bool) $ttyMode;
  35366. $this->ptyMode = (bool) $ptyMode;
  35367. $this->disableOutput = (bool) $disableOutput;
  35368. if (is_resource($input)) {
  35369. $this->input = $input;
  35370. } else {
  35371. $this->inputBuffer = (string) $input;
  35372. }
  35373. }
  35374. public function __destruct()
  35375. {
  35376. $this->close();
  35377. }
  35378. public function getDescriptors()
  35379. {
  35380. if ($this->disableOutput) {
  35381. $nullstream = fopen('/dev/null', 'c');
  35382. return array(
  35383. array('pipe', 'r'),
  35384. $nullstream,
  35385. $nullstream,
  35386. );
  35387. }
  35388. if ($this->ttyMode) {
  35389. return array(
  35390. array('file', '/dev/tty', 'r'),
  35391. array('file', '/dev/tty', 'w'),
  35392. array('file', '/dev/tty', 'w'),
  35393. );
  35394. }
  35395. if ($this->ptyMode && Process::isPtySupported()) {
  35396. return array(
  35397. array('pty'),
  35398. array('pty'),
  35399. array('pty'),
  35400. );
  35401. }
  35402. return array(
  35403. array('pipe', 'r'),
  35404. array('pipe', 'w'),
  35405. array('pipe', 'w'),
  35406. );
  35407. }
  35408. public function getFiles()
  35409. {
  35410. return array();
  35411. }
  35412. public function readAndWrite($blocking, $close = false)
  35413. {
  35414. if (1 === count($this->pipes) && array(0) === array_keys($this->pipes)) {
  35415. fclose($this->pipes[0]);
  35416. unset($this->pipes[0]);
  35417. }
  35418. if (empty($this->pipes)) {
  35419. return array();
  35420. }
  35421. $this->unblock();
  35422. $read = array();
  35423. if (null !== $this->input) {
  35424. $r = array_merge($this->pipes, array('input' => $this->input));
  35425. } else {
  35426. $r = $this->pipes;
  35427. }
  35428. unset($r[0]);
  35429. $w = isset($this->pipes[0]) ? array($this->pipes[0]) : null;
  35430. $e = null;
  35431. if (false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  35432. if (!$this->hasSystemCallBeenInterrupted()) {
  35433. $this->pipes = array();
  35434. }
  35435. return $read;
  35436. }
  35437. if (0 === $n) {
  35438. return $read;
  35439. }
  35440. foreach ($r as $pipe) {
  35441. $type = (false !== $found = array_search($pipe, $this->pipes)) ? $found : 'input';
  35442. $data = '';
  35443. while ('' !== $dataread = (string) fread($pipe, self::CHUNK_SIZE)) {
  35444. $data .= $dataread;
  35445. }
  35446. if ('' !== $data) {
  35447. if ($type === 'input') {
  35448. $this->inputBuffer .= $data;
  35449. } else {
  35450. $read[$type] = $data;
  35451. }
  35452. }
  35453. if (false === $data || (true === $close && feof($pipe) && '' === $data)) {
  35454. if ($type === 'input') {
  35455. $this->input = null;
  35456. } else {
  35457. fclose($this->pipes[$type]);
  35458. unset($this->pipes[$type]);
  35459. }
  35460. }
  35461. }
  35462. if (null !== $w && 0 < count($w)) {
  35463. while (strlen($this->inputBuffer)) {
  35464. $written = fwrite($w[0], $this->inputBuffer, 2 << 18);
  35465. if ($written > 0) {
  35466. $this->inputBuffer = (string) substr($this->inputBuffer, $written);
  35467. } else {
  35468. break;
  35469. }
  35470. }
  35471. }
  35472. if ('' === $this->inputBuffer && null === $this->input && isset($this->pipes[0])) {
  35473. fclose($this->pipes[0]);
  35474. unset($this->pipes[0]);
  35475. }
  35476. return $read;
  35477. }
  35478. public function areOpen()
  35479. {
  35480. return (bool) $this->pipes;
  35481. }
  35482. public static function create(Process $process, $input)
  35483. {
  35484. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  35485. }
  35486. }
  35487. <?php
  35488. namespace Symfony\Component\Process\Pipes;
  35489. use Symfony\Component\Process\Process;
  35490. use Symfony\Component\Process\Exception\RuntimeException;
  35491. class WindowsPipes extends AbstractPipes
  35492. {
  35493. private $files = array();
  35494. private $fileHandles = array();
  35495. private $readBytes = array(
  35496. Process::STDOUT => 0,
  35497. Process::STDERR => 0,
  35498. );
  35499. private $disableOutput;
  35500. public function __construct($disableOutput, $input)
  35501. {
  35502. $this->disableOutput = (bool) $disableOutput;
  35503. if (!$this->disableOutput) {
  35504. $this->files = array(
  35505. Process::STDOUT => tempnam(sys_get_temp_dir(), 'out_sf_proc'),
  35506. Process::STDERR => tempnam(sys_get_temp_dir(), 'err_sf_proc'),
  35507. );
  35508. foreach ($this->files as $offset => $file) {
  35509. if (false === $file || false === $this->fileHandles[$offset] = fopen($file, 'rb')) {
  35510. throw new RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable');
  35511. }
  35512. }
  35513. }
  35514. if (is_resource($input)) {
  35515. $this->input = $input;
  35516. } else {
  35517. $this->inputBuffer = $input;
  35518. }
  35519. }
  35520. public function __destruct()
  35521. {
  35522. $this->close();
  35523. $this->removeFiles();
  35524. }
  35525. public function getDescriptors()
  35526. {
  35527. if ($this->disableOutput) {
  35528. $nullstream = fopen('NUL', 'c');
  35529. return array(
  35530. array('pipe', 'r'),
  35531. $nullstream,
  35532. $nullstream,
  35533. );
  35534. }
  35535. return array(
  35536. array('pipe', 'r'),
  35537. array('file', 'NUL', 'w'),
  35538. array('file', 'NUL', 'w'),
  35539. );
  35540. }
  35541. public function getFiles()
  35542. {
  35543. return $this->files;
  35544. }
  35545. public function readAndWrite($blocking, $close = false)
  35546. {
  35547. $this->write($blocking, $close);
  35548. $read = array();
  35549. $fh = $this->fileHandles;
  35550. foreach ($fh as $type => $fileHandle) {
  35551. if (0 !== fseek($fileHandle, $this->readBytes[$type])) {
  35552. continue;
  35553. }
  35554. $data = '';
  35555. $dataread = null;
  35556. while (!feof($fileHandle)) {
  35557. if (false !== $dataread = fread($fileHandle, self::CHUNK_SIZE)) {
  35558. $data .= $dataread;
  35559. }
  35560. }
  35561. if (0 < $length = strlen($data)) {
  35562. $this->readBytes[$type] += $length;
  35563. $read[$type] = $data;
  35564. }
  35565. if (false === $dataread || (true === $close && feof($fileHandle) && '' === $data)) {
  35566. fclose($this->fileHandles[$type]);
  35567. unset($this->fileHandles[$type]);
  35568. }
  35569. }
  35570. return $read;
  35571. }
  35572. public function areOpen()
  35573. {
  35574. return (bool) $this->pipes && (bool) $this->fileHandles;
  35575. }
  35576. public function close()
  35577. {
  35578. parent::close();
  35579. foreach ($this->fileHandles as $handle) {
  35580. fclose($handle);
  35581. }
  35582. $this->fileHandles = array();
  35583. }
  35584. public static function create(Process $process, $input)
  35585. {
  35586. return new static($process->isOutputDisabled(), $input);
  35587. }
  35588. private function removeFiles()
  35589. {
  35590. foreach ($this->files as $filename) {
  35591. if (file_exists($filename)) {
  35592. @unlink($filename);
  35593. }
  35594. }
  35595. $this->files = array();
  35596. }
  35597. private function write($blocking, $close)
  35598. {
  35599. if (empty($this->pipes)) {
  35600. return;
  35601. }
  35602. $this->unblock();
  35603. $r = null !== $this->input ? array('input' => $this->input) : null;
  35604. $w = isset($this->pipes[0]) ? array($this->pipes[0]) : null;
  35605. $e = null;
  35606. if (false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  35607. if (!$this->hasSystemCallBeenInterrupted()) {
  35608. $this->pipes = array();
  35609. }
  35610. return;
  35611. }
  35612. if (0 === $n) {
  35613. return;
  35614. }
  35615. if (null !== $w && 0 < count($r)) {
  35616. $data = '';
  35617. while ($dataread = fread($r['input'], self::CHUNK_SIZE)) {
  35618. $data .= $dataread;
  35619. }
  35620. $this->inputBuffer .= $data;
  35621. if (false === $data || (true === $close && feof($r['input']) && '' === $data)) {
  35622. $this->input = null;
  35623. }
  35624. }
  35625. if (null !== $w && 0 < count($w)) {
  35626. while (strlen($this->inputBuffer)) {
  35627. $written = fwrite($w[0], $this->inputBuffer, 2 << 18);
  35628. if ($written > 0) {
  35629. $this->inputBuffer = (string) substr($this->inputBuffer, $written);
  35630. } else {
  35631. break;
  35632. }
  35633. }
  35634. }
  35635. if ('' === $this->inputBuffer && null === $this->input && isset($this->pipes[0])) {
  35636. fclose($this->pipes[0]);
  35637. unset($this->pipes[0]);
  35638. }
  35639. }
  35640. }
  35641. <?php
  35642. namespace Symfony\Component\Process;
  35643. use Symfony\Component\Process\Exception\InvalidArgumentException;
  35644. use Symfony\Component\Process\Exception\LogicException;
  35645. use Symfony\Component\Process\Exception\ProcessFailedException;
  35646. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  35647. use Symfony\Component\Process\Exception\RuntimeException;
  35648. use Symfony\Component\Process\Pipes\PipesInterface;
  35649. use Symfony\Component\Process\Pipes\UnixPipes;
  35650. use Symfony\Component\Process\Pipes\WindowsPipes;
  35651. class Process
  35652. {
  35653. const ERR = 'err';
  35654. const OUT = 'out';
  35655. const STATUS_READY = 'ready';
  35656. const STATUS_STARTED = 'started';
  35657. const STATUS_TERMINATED = 'terminated';
  35658. const STDIN = 0;
  35659. const STDOUT = 1;
  35660. const STDERR = 2;
  35661. const TIMEOUT_PRECISION = 0.2;
  35662. private $callback;
  35663. private $commandline;
  35664. private $cwd;
  35665. private $env;
  35666. private $input;
  35667. private $starttime;
  35668. private $lastOutputTime;
  35669. private $timeout;
  35670. private $idleTimeout;
  35671. private $options;
  35672. private $exitcode;
  35673. private $fallbackStatus = array();
  35674. private $processInformation;
  35675. private $outputDisabled = false;
  35676. private $stdout;
  35677. private $stderr;
  35678. private $enhanceWindowsCompatibility = true;
  35679. private $enhanceSigchildCompatibility;
  35680. private $process;
  35681. private $status = self::STATUS_READY;
  35682. private $incrementalOutputOffset = 0;
  35683. private $incrementalErrorOutputOffset = 0;
  35684. private $tty;
  35685. private $pty;
  35686. private $useFileHandles = false;
  35687. private $processPipes;
  35688. private $latestSignal;
  35689. private static $sigchild;
  35690. public static $exitCodes = array(
  35691. 0 => 'OK',
  35692. 1 => 'General error',
  35693. 2 => 'Misuse of shell builtins',
  35694. 126 => 'Invoked command cannot execute',
  35695. 127 => 'Command not found',
  35696. 128 => 'Invalid exit argument',
  35697. 129 => 'Hangup',
  35698. 130 => 'Interrupt',
  35699. 131 => 'Quit and dump core',
  35700. 132 => 'Illegal instruction',
  35701. 133 => 'Trace/breakpoint trap',
  35702. 134 => 'Process aborted',
  35703. 135 => 'Bus error: "access to undefined portion of memory object"',
  35704. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  35705. 137 => 'Kill (terminate immediately)',
  35706. 138 => 'User-defined 1',
  35707. 139 => 'Segmentation violation',
  35708. 140 => 'User-defined 2',
  35709. 141 => 'Write to pipe with no one reading',
  35710. 142 => 'Signal raised by alarm',
  35711. 143 => 'Termination (request to terminate)',
  35712. 145 => 'Child process terminated, stopped (or continued*)',
  35713. 146 => 'Continue if stopped',
  35714. 147 => 'Stop executing temporarily',
  35715. 148 => 'Terminal stop signal',
  35716. 149 => 'Background process attempting to read from tty ("in")',
  35717. 150 => 'Background process attempting to write to tty ("out")',
  35718. 151 => 'Urgent data available on socket',
  35719. 152 => 'CPU time limit exceeded',
  35720. 153 => 'File size limit exceeded',
  35721. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  35722. 155 => 'Profiling timer expired',
  35723. 157 => 'Pollable event',
  35724. 159 => 'Bad syscall',
  35725. );
  35726. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  35727. {
  35728. if (!function_exists('proc_open')) {
  35729. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  35730. }
  35731. $this->commandline = $commandline;
  35732. $this->cwd = $cwd;
  35733. if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
  35734. $this->cwd = getcwd();
  35735. }
  35736. if (null !== $env) {
  35737. $this->setEnv($env);
  35738. }
  35739. $this->input = $input;
  35740. $this->setTimeout($timeout);
  35741. $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  35742. $this->pty = false;
  35743. $this->enhanceWindowsCompatibility = true;
  35744. $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  35745. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  35746. }
  35747. public function __destruct()
  35748. {
  35749. $this->stop(0);
  35750. }
  35751. public function __clone()
  35752. {
  35753. $this->resetProcessData();
  35754. }
  35755. public function run($callback = null)
  35756. {
  35757. $this->start($callback);
  35758. return $this->wait();
  35759. }
  35760. public function mustRun($callback = null)
  35761. {
  35762. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  35763. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  35764. }
  35765. if (0 !== $this->run($callback)) {
  35766. throw new ProcessFailedException($this);
  35767. }
  35768. return $this;
  35769. }
  35770. public function start($callback = null)
  35771. {
  35772. if ($this->isRunning()) {
  35773. throw new RuntimeException('Process is already running');
  35774. }
  35775. if ($this->outputDisabled && null !== $callback) {
  35776. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  35777. }
  35778. $this->resetProcessData();
  35779. $this->starttime = $this->lastOutputTime = microtime(true);
  35780. $this->callback = $this->buildCallback($callback);
  35781. $descriptors = $this->getDescriptors();
  35782. $commandline = $this->commandline;
  35783. if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  35784. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  35785. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  35786. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  35787. }
  35788. $commandline .= '"';
  35789. if (!isset($this->options['bypass_shell'])) {
  35790. $this->options['bypass_shell'] = true;
  35791. }
  35792. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  35793. $descriptors[3] = array('pipe', 'w');
  35794. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  35795. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  35796. $ptsWorkaround = fopen(__FILE__, 'r');
  35797. }
  35798. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  35799. if (!is_resource($this->process)) {
  35800. throw new RuntimeException('Unable to launch a new process.');
  35801. }
  35802. $this->status = self::STATUS_STARTED;
  35803. if (isset($descriptors[3])) {
  35804. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  35805. }
  35806. if ($this->tty) {
  35807. return;
  35808. }
  35809. $this->updateStatus(false);
  35810. $this->checkTimeout();
  35811. }
  35812. public function restart($callback = null)
  35813. {
  35814. if ($this->isRunning()) {
  35815. throw new RuntimeException('Process is already running');
  35816. }
  35817. $process = clone $this;
  35818. $process->start($callback);
  35819. return $process;
  35820. }
  35821. public function wait($callback = null)
  35822. {
  35823. $this->requireProcessIsStarted(__FUNCTION__);
  35824. $this->updateStatus(false);
  35825. if (null !== $callback) {
  35826. $this->callback = $this->buildCallback($callback);
  35827. }
  35828. do {
  35829. $this->checkTimeout();
  35830. $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  35831. $close = '\\' !== DIRECTORY_SEPARATOR || !$running;
  35832. $this->readPipes(true, $close);
  35833. } while ($running);
  35834. while ($this->isRunning()) {
  35835. usleep(1000);
  35836. }
  35837. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  35838. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  35839. }
  35840. return $this->exitcode;
  35841. }
  35842. public function getPid()
  35843. {
  35844. return $this->isRunning() ? $this->processInformation['pid'] : null;
  35845. }
  35846. public function signal($signal)
  35847. {
  35848. $this->doSignal($signal, true);
  35849. return $this;
  35850. }
  35851. public function disableOutput()
  35852. {
  35853. if ($this->isRunning()) {
  35854. throw new RuntimeException('Disabling output while the process is running is not possible.');
  35855. }
  35856. if (null !== $this->idleTimeout) {
  35857. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  35858. }
  35859. $this->outputDisabled = true;
  35860. return $this;
  35861. }
  35862. public function enableOutput()
  35863. {
  35864. if ($this->isRunning()) {
  35865. throw new RuntimeException('Enabling output while the process is running is not possible.');
  35866. }
  35867. $this->outputDisabled = false;
  35868. return $this;
  35869. }
  35870. public function isOutputDisabled()
  35871. {
  35872. return $this->outputDisabled;
  35873. }
  35874. public function getOutput()
  35875. {
  35876. if ($this->outputDisabled) {
  35877. throw new LogicException('Output has been disabled.');
  35878. }
  35879. $this->requireProcessIsStarted(__FUNCTION__);
  35880. $this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
  35881. return $this->stdout;
  35882. }
  35883. public function getIncrementalOutput()
  35884. {
  35885. $this->requireProcessIsStarted(__FUNCTION__);
  35886. $data = $this->getOutput();
  35887. $latest = substr($data, $this->incrementalOutputOffset);
  35888. if (false === $latest) {
  35889. return '';
  35890. }
  35891. $this->incrementalOutputOffset = strlen($data);
  35892. return $latest;
  35893. }
  35894. public function clearOutput()
  35895. {
  35896. $this->stdout = '';
  35897. $this->incrementalOutputOffset = 0;
  35898. return $this;
  35899. }
  35900. public function getErrorOutput()
  35901. {
  35902. if ($this->outputDisabled) {
  35903. throw new LogicException('Output has been disabled.');
  35904. }
  35905. $this->requireProcessIsStarted(__FUNCTION__);
  35906. $this->readPipes(false, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
  35907. return $this->stderr;
  35908. }
  35909. public function getIncrementalErrorOutput()
  35910. {
  35911. $this->requireProcessIsStarted(__FUNCTION__);
  35912. $data = $this->getErrorOutput();
  35913. $latest = substr($data, $this->incrementalErrorOutputOffset);
  35914. if (false === $latest) {
  35915. return '';
  35916. }
  35917. $this->incrementalErrorOutputOffset = strlen($data);
  35918. return $latest;
  35919. }
  35920. public function clearErrorOutput()
  35921. {
  35922. $this->stderr = '';
  35923. $this->incrementalErrorOutputOffset = 0;
  35924. return $this;
  35925. }
  35926. public function getExitCode()
  35927. {
  35928. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  35929. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  35930. }
  35931. $this->updateStatus(false);
  35932. return $this->exitcode;
  35933. }
  35934. public function getExitCodeText()
  35935. {
  35936. if (null === $exitcode = $this->getExitCode()) {
  35937. return;
  35938. }
  35939. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  35940. }
  35941. public function isSuccessful()
  35942. {
  35943. return 0 === $this->getExitCode();
  35944. }
  35945. public function hasBeenSignaled()
  35946. {
  35947. $this->requireProcessIsTerminated(__FUNCTION__);
  35948. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  35949. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  35950. }
  35951. return $this->processInformation['signaled'];
  35952. }
  35953. public function getTermSignal()
  35954. {
  35955. $this->requireProcessIsTerminated(__FUNCTION__);
  35956. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  35957. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  35958. }
  35959. return $this->processInformation['termsig'];
  35960. }
  35961. public function hasBeenStopped()
  35962. {
  35963. $this->requireProcessIsTerminated(__FUNCTION__);
  35964. return $this->processInformation['stopped'];
  35965. }
  35966. public function getStopSignal()
  35967. {
  35968. $this->requireProcessIsTerminated(__FUNCTION__);
  35969. return $this->processInformation['stopsig'];
  35970. }
  35971. public function isRunning()
  35972. {
  35973. if (self::STATUS_STARTED !== $this->status) {
  35974. return false;
  35975. }
  35976. $this->updateStatus(false);
  35977. return $this->processInformation['running'];
  35978. }
  35979. public function isStarted()
  35980. {
  35981. return $this->status != self::STATUS_READY;
  35982. }
  35983. public function isTerminated()
  35984. {
  35985. $this->updateStatus(false);
  35986. return $this->status == self::STATUS_TERMINATED;
  35987. }
  35988. public function getStatus()
  35989. {
  35990. $this->updateStatus(false);
  35991. return $this->status;
  35992. }
  35993. public function stop($timeout = 10, $signal = null)
  35994. {
  35995. $timeoutMicro = microtime(true) + $timeout;
  35996. if ($this->isRunning()) {
  35997. $this->doSignal(15, false);
  35998. do {
  35999. usleep(1000);
  36000. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  36001. if ($this->isRunning()) {
  36002. $this->doSignal($signal ?: 9, false);
  36003. }
  36004. }
  36005. if ($this->isRunning()) {
  36006. if (isset($this->fallbackStatus['pid'])) {
  36007. unset($this->fallbackStatus['pid']);
  36008. return $this->stop(0, $signal);
  36009. }
  36010. $this->close();
  36011. }
  36012. return $this->exitcode;
  36013. }
  36014. public function addOutput($line)
  36015. {
  36016. $this->lastOutputTime = microtime(true);
  36017. $this->stdout .= $line;
  36018. }
  36019. public function addErrorOutput($line)
  36020. {
  36021. $this->lastOutputTime = microtime(true);
  36022. $this->stderr .= $line;
  36023. }
  36024. public function getCommandLine()
  36025. {
  36026. return $this->commandline;
  36027. }
  36028. public function setCommandLine($commandline)
  36029. {
  36030. $this->commandline = $commandline;
  36031. return $this;
  36032. }
  36033. public function getTimeout()
  36034. {
  36035. return $this->timeout;
  36036. }
  36037. public function getIdleTimeout()
  36038. {
  36039. return $this->idleTimeout;
  36040. }
  36041. public function setTimeout($timeout)
  36042. {
  36043. $this->timeout = $this->validateTimeout($timeout);
  36044. return $this;
  36045. }
  36046. public function setIdleTimeout($timeout)
  36047. {
  36048. if (null !== $timeout && $this->outputDisabled) {
  36049. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  36050. }
  36051. $this->idleTimeout = $this->validateTimeout($timeout);
  36052. return $this;
  36053. }
  36054. public function setTty($tty)
  36055. {
  36056. if ('\\' === DIRECTORY_SEPARATOR && $tty) {
  36057. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  36058. }
  36059. if ($tty && (!file_exists('/dev/tty') || !is_readable('/dev/tty'))) {
  36060. throw new RuntimeException('TTY mode requires /dev/tty to be readable.');
  36061. }
  36062. $this->tty = (bool) $tty;
  36063. return $this;
  36064. }
  36065. public function isTty()
  36066. {
  36067. return $this->tty;
  36068. }
  36069. public function setPty($bool)
  36070. {
  36071. $this->pty = (bool) $bool;
  36072. return $this;
  36073. }
  36074. public function isPty()
  36075. {
  36076. return $this->pty;
  36077. }
  36078. public function getWorkingDirectory()
  36079. {
  36080. if (null === $this->cwd) {
  36081. return getcwd() ?: null;
  36082. }
  36083. return $this->cwd;
  36084. }
  36085. public function setWorkingDirectory($cwd)
  36086. {
  36087. $this->cwd = $cwd;
  36088. return $this;
  36089. }
  36090. public function getEnv()
  36091. {
  36092. return $this->env;
  36093. }
  36094. public function setEnv(array $env)
  36095. {
  36096. $env = array_filter($env, function ($value) {
  36097. return !is_array($value);
  36098. });
  36099. $this->env = array();
  36100. foreach ($env as $key => $value) {
  36101. $this->env[$key] = (string) $value;
  36102. }
  36103. return $this;
  36104. }
  36105. public function getStdin()
  36106. {
  36107. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  36108. return $this->getInput();
  36109. }
  36110. public function getInput()
  36111. {
  36112. return $this->input;
  36113. }
  36114. public function setStdin($stdin)
  36115. {
  36116. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  36117. return $this->setInput($stdin);
  36118. }
  36119. public function setInput($input)
  36120. {
  36121. if ($this->isRunning()) {
  36122. throw new LogicException('Input can not be set while the process is running.');
  36123. }
  36124. $this->input = ProcessUtils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input);
  36125. return $this;
  36126. }
  36127. public function getOptions()
  36128. {
  36129. return $this->options;
  36130. }
  36131. public function setOptions(array $options)
  36132. {
  36133. $this->options = $options;
  36134. return $this;
  36135. }
  36136. public function getEnhanceWindowsCompatibility()
  36137. {
  36138. return $this->enhanceWindowsCompatibility;
  36139. }
  36140. public function setEnhanceWindowsCompatibility($enhance)
  36141. {
  36142. $this->enhanceWindowsCompatibility = (bool) $enhance;
  36143. return $this;
  36144. }
  36145. public function getEnhanceSigchildCompatibility()
  36146. {
  36147. return $this->enhanceSigchildCompatibility;
  36148. }
  36149. public function setEnhanceSigchildCompatibility($enhance)
  36150. {
  36151. $this->enhanceSigchildCompatibility = (bool) $enhance;
  36152. return $this;
  36153. }
  36154. public function checkTimeout()
  36155. {
  36156. if ($this->status !== self::STATUS_STARTED) {
  36157. return;
  36158. }
  36159. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  36160. $this->stop(0);
  36161. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  36162. }
  36163. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  36164. $this->stop(0);
  36165. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  36166. }
  36167. }
  36168. public static function isPtySupported()
  36169. {
  36170. static $result;
  36171. if (null !== $result) {
  36172. return $result;
  36173. }
  36174. if ('\\' === DIRECTORY_SEPARATOR) {
  36175. return $result = false;
  36176. }
  36177. return $result = (bool) @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
  36178. }
  36179. private function getDescriptors()
  36180. {
  36181. if ('\\' === DIRECTORY_SEPARATOR) {
  36182. $this->processPipes = WindowsPipes::create($this, $this->input);
  36183. } else {
  36184. $this->processPipes = UnixPipes::create($this, $this->input);
  36185. }
  36186. return $this->processPipes->getDescriptors($this->outputDisabled);
  36187. }
  36188. protected function buildCallback($callback)
  36189. {
  36190. $that = $this;
  36191. $out = self::OUT;
  36192. $callback = function ($type, $data) use ($that, $callback, $out) {
  36193. if ($out == $type) {
  36194. $that->addOutput($data);
  36195. } else {
  36196. $that->addErrorOutput($data);
  36197. }
  36198. if (null !== $callback) {
  36199. call_user_func($callback, $type, $data);
  36200. }
  36201. };
  36202. return $callback;
  36203. }
  36204. protected function updateStatus($blocking)
  36205. {
  36206. if (self::STATUS_STARTED !== $this->status) {
  36207. return;
  36208. }
  36209. $this->processInformation = proc_get_status($this->process);
  36210. $this->readPipes($blocking, '\\' === DIRECTORY_SEPARATOR ? !$this->processInformation['running'] : true);
  36211. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  36212. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  36213. }
  36214. if (!$this->processInformation['running']) {
  36215. $this->close();
  36216. }
  36217. }
  36218. protected function isSigchildEnabled()
  36219. {
  36220. if (null !== self::$sigchild) {
  36221. return self::$sigchild;
  36222. }
  36223. if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
  36224. return self::$sigchild = false;
  36225. }
  36226. ob_start();
  36227. phpinfo(INFO_GENERAL);
  36228. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  36229. }
  36230. private function validateTimeout($timeout)
  36231. {
  36232. $timeout = (float) $timeout;
  36233. if (0.0 === $timeout) {
  36234. $timeout = null;
  36235. } elseif ($timeout < 0) {
  36236. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  36237. }
  36238. return $timeout;
  36239. }
  36240. private function readPipes($blocking, $close)
  36241. {
  36242. $result = $this->processPipes->readAndWrite($blocking, $close);
  36243. $callback = $this->callback;
  36244. foreach ($result as $type => $data) {
  36245. if (3 !== $type) {
  36246. $callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
  36247. } elseif (!isset($this->fallbackStatus['signaled'])) {
  36248. $this->fallbackStatus['exitcode'] = (int) $data;
  36249. }
  36250. }
  36251. }
  36252. private function close()
  36253. {
  36254. $this->processPipes->close();
  36255. if (is_resource($this->process)) {
  36256. proc_close($this->process);
  36257. }
  36258. $this->exitcode = $this->processInformation['exitcode'];
  36259. $this->status = self::STATUS_TERMINATED;
  36260. if (-1 === $this->exitcode) {
  36261. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  36262. $this->exitcode = 128 + $this->processInformation['termsig'];
  36263. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  36264. $this->processInformation['signaled'] = true;
  36265. $this->processInformation['termsig'] = -1;
  36266. }
  36267. }
  36268. $this->callback = null;
  36269. return $this->exitcode;
  36270. }
  36271. private function resetProcessData()
  36272. {
  36273. $this->starttime = null;
  36274. $this->callback = null;
  36275. $this->exitcode = null;
  36276. $this->fallbackStatus = array();
  36277. $this->processInformation = null;
  36278. $this->stdout = null;
  36279. $this->stderr = null;
  36280. $this->process = null;
  36281. $this->latestSignal = null;
  36282. $this->status = self::STATUS_READY;
  36283. $this->incrementalOutputOffset = 0;
  36284. $this->incrementalErrorOutputOffset = 0;
  36285. }
  36286. private function doSignal($signal, $throwException)
  36287. {
  36288. if (null === $pid = $this->getPid()) {
  36289. if ($throwException) {
  36290. throw new LogicException('Can not send signal on a non running process.');
  36291. }
  36292. return false;
  36293. }
  36294. if ('\\' === DIRECTORY_SEPARATOR) {
  36295. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  36296. if ($exitCode && $this->isRunning()) {
  36297. if ($throwException) {
  36298. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  36299. }
  36300. return false;
  36301. }
  36302. } else {
  36303. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  36304. $ok = @proc_terminate($this->process, $signal);
  36305. } elseif (function_exists('posix_kill')) {
  36306. $ok = @posix_kill($pid, $signal);
  36307. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  36308. $ok = false === fgets($pipes[2]);
  36309. }
  36310. if (!$ok) {
  36311. if ($throwException) {
  36312. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  36313. }
  36314. return false;
  36315. }
  36316. }
  36317. $this->latestSignal = (int) $signal;
  36318. $this->fallbackStatus['signaled'] = true;
  36319. $this->fallbackStatus['exitcode'] = -1;
  36320. $this->fallbackStatus['termsig'] = $this->latestSignal;
  36321. return true;
  36322. }
  36323. private function requireProcessIsStarted($functionName)
  36324. {
  36325. if (!$this->isStarted()) {
  36326. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  36327. }
  36328. }
  36329. private function requireProcessIsTerminated($functionName)
  36330. {
  36331. if (!$this->isTerminated()) {
  36332. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  36333. }
  36334. }
  36335. }
  36336. <?php
  36337. namespace Symfony\Component\Process;
  36338. use Symfony\Component\Process\Exception\InvalidArgumentException;
  36339. use Symfony\Component\Process\Exception\LogicException;
  36340. class ProcessBuilder
  36341. {
  36342. private $arguments;
  36343. private $cwd;
  36344. private $env = array();
  36345. private $input;
  36346. private $timeout = 60;
  36347. private $options = array();
  36348. private $inheritEnv = true;
  36349. private $prefix = array();
  36350. private $outputDisabled = false;
  36351. public function __construct(array $arguments = array())
  36352. {
  36353. $this->arguments = $arguments;
  36354. }
  36355. public static function create(array $arguments = array())
  36356. {
  36357. return new static($arguments);
  36358. }
  36359. public function add($argument)
  36360. {
  36361. $this->arguments[] = $argument;
  36362. return $this;
  36363. }
  36364. public function setPrefix($prefix)
  36365. {
  36366. $this->prefix = is_array($prefix) ? $prefix : array($prefix);
  36367. return $this;
  36368. }
  36369. public function setArguments(array $arguments)
  36370. {
  36371. $this->arguments = $arguments;
  36372. return $this;
  36373. }
  36374. public function setWorkingDirectory($cwd)
  36375. {
  36376. $this->cwd = $cwd;
  36377. return $this;
  36378. }
  36379. public function inheritEnvironmentVariables($inheritEnv = true)
  36380. {
  36381. $this->inheritEnv = $inheritEnv;
  36382. return $this;
  36383. }
  36384. public function setEnv($name, $value)
  36385. {
  36386. $this->env[$name] = $value;
  36387. return $this;
  36388. }
  36389. public function addEnvironmentVariables(array $variables)
  36390. {
  36391. $this->env = array_replace($this->env, $variables);
  36392. return $this;
  36393. }
  36394. public function setInput($input)
  36395. {
  36396. $this->input = ProcessUtils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input);
  36397. return $this;
  36398. }
  36399. public function setTimeout($timeout)
  36400. {
  36401. if (null === $timeout) {
  36402. $this->timeout = null;
  36403. return $this;
  36404. }
  36405. $timeout = (float) $timeout;
  36406. if ($timeout < 0) {
  36407. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  36408. }
  36409. $this->timeout = $timeout;
  36410. return $this;
  36411. }
  36412. public function setOption($name, $value)
  36413. {
  36414. $this->options[$name] = $value;
  36415. return $this;
  36416. }
  36417. public function disableOutput()
  36418. {
  36419. $this->outputDisabled = true;
  36420. return $this;
  36421. }
  36422. public function enableOutput()
  36423. {
  36424. $this->outputDisabled = false;
  36425. return $this;
  36426. }
  36427. public function getProcess()
  36428. {
  36429. if (0 === count($this->prefix) && 0 === count($this->arguments)) {
  36430. throw new LogicException('You must add() command arguments before calling getProcess().');
  36431. }
  36432. $options = $this->options;
  36433. $arguments = array_merge($this->prefix, $this->arguments);
  36434. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  36435. if ($this->inheritEnv) {
  36436. $env = array_replace($_ENV, $_SERVER, $this->env);
  36437. } else {
  36438. $env = $this->env;
  36439. }
  36440. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  36441. if ($this->outputDisabled) {
  36442. $process->disableOutput();
  36443. }
  36444. return $process;
  36445. }
  36446. }
  36447. <?php
  36448. namespace Symfony\Component\Process;
  36449. use Symfony\Component\Process\Exception\InvalidArgumentException;
  36450. class ProcessUtils
  36451. {
  36452. private function __construct()
  36453. {
  36454. }
  36455. public static function escapeArgument($argument)
  36456. {
  36457. if ('\\' === DIRECTORY_SEPARATOR) {
  36458. if ('' === $argument) {
  36459. return escapeshellarg($argument);
  36460. }
  36461. $escapedArgument = '';
  36462. $quote = false;
  36463. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  36464. if ('"' === $part) {
  36465. $escapedArgument .= '\\"';
  36466. } elseif (self::isSurroundedBy($part, '%')) {
  36467. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  36468. } else {
  36469. if ('\\' === substr($part, -1)) {
  36470. $part .= '\\';
  36471. }
  36472. $quote = true;
  36473. $escapedArgument .= $part;
  36474. }
  36475. }
  36476. if ($quote) {
  36477. $escapedArgument = '"'.$escapedArgument.'"';
  36478. }
  36479. return $escapedArgument;
  36480. }
  36481. return escapeshellarg($argument);
  36482. }
  36483. public static function validateInput($caller, $input)
  36484. {
  36485. if (null !== $input) {
  36486. if (is_resource($input)) {
  36487. return $input;
  36488. }
  36489. if (is_scalar($input)) {
  36490. return (string) $input;
  36491. }
  36492. if (is_object($input) && method_exists($input, '__toString')) {
  36493. @trigger_error('Passing an object as an input is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  36494. return (string) $input;
  36495. }
  36496. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  36497. }
  36498. return $input;
  36499. }
  36500. private static function isSurroundedBy($arg, $char)
  36501. {
  36502. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  36503. }
  36504. }
  36505. Copyright (c) 2011 Jordi Boggiano
  36506. Permission is hereby granted, free of charge, to any person obtaining a copy
  36507. of this software and associated documentation files (the "Software"), to deal
  36508. in the Software without restriction, including without limitation the rights
  36509. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  36510. copies of the Software, and to permit persons to whom the Software is furnished
  36511. to do so, subject to the following conditions:
  36512. The above copyright notice and this permission notice shall be included in all
  36513. copies or substantial portions of the Software.
  36514. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  36515. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36516. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  36517. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  36518. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  36519. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  36520. THE SOFTWARE.
  36521. <?php
  36522. namespace Seld\JsonLint;
  36523. class DuplicateKeyException extends ParsingException
  36524. {
  36525. public function __construct($message, $key, array $details = array())
  36526. {
  36527. $details['key'] = $key;
  36528. parent::__construct($message, $details);
  36529. }
  36530. public function getKey()
  36531. {
  36532. return $this->details['key'];
  36533. }
  36534. }
  36535. <?php
  36536. namespace Seld\JsonLint;
  36537. use stdClass;
  36538. class JsonParser
  36539. {
  36540. const DETECT_KEY_CONFLICTS = 1;
  36541. const ALLOW_DUPLICATE_KEYS = 2;
  36542. const PARSE_TO_ASSOC = 4;
  36543. private $lexer;
  36544. private $flags;
  36545. private $stack;
  36546. private $vstack;
  36547. private $lstack;
  36548. private $symbols = array(
  36549. 'error' => 2,
  36550. 'JSONString' => 3,
  36551. 'STRING' => 4,
  36552. 'JSONNumber' => 5,
  36553. 'NUMBER' => 6,
  36554. 'JSONNullLiteral' => 7,
  36555. 'NULL' => 8,
  36556. 'JSONBooleanLiteral' => 9,
  36557. 'TRUE' => 10,
  36558. 'FALSE' => 11,
  36559. 'JSONText' => 12,
  36560. 'JSONValue' => 13,
  36561. 'EOF' => 14,
  36562. 'JSONObject' => 15,
  36563. 'JSONArray' => 16,
  36564. '{' => 17,
  36565. '}' => 18,
  36566. 'JSONMemberList' => 19,
  36567. 'JSONMember' => 20,
  36568. ':' => 21,
  36569. ',' => 22,
  36570. '[' => 23,
  36571. ']' => 24,
  36572. 'JSONElementList' => 25,
  36573. '$accept' => 0,
  36574. '$end' => 1,
  36575. );
  36576. private $terminals_ = array(
  36577. 2 => "error",
  36578. 4 => "STRING",
  36579. 6 => "NUMBER",
  36580. 8 => "NULL",
  36581. 10 => "TRUE",
  36582. 11 => "FALSE",
  36583. 14 => "EOF",
  36584. 17 => "{",
  36585. 18 => "}",
  36586. 21 => ":",
  36587. 22 => ",",
  36588. 23 => "[",
  36589. 24 => "]",
  36590. );
  36591. private $productions_ = array(
  36592. 0,
  36593. array(3, 1),
  36594. array(5, 1),
  36595. array(7, 1),
  36596. array(9, 1),
  36597. array(9, 1),
  36598. array(12, 2),
  36599. array(13, 1),
  36600. array(13, 1),
  36601. array(13, 1),
  36602. array(13, 1),
  36603. array(13, 1),
  36604. array(13, 1),
  36605. array(15, 2),
  36606. array(15, 3),
  36607. array(20, 3),
  36608. array(19, 1),
  36609. array(19, 3),
  36610. array(16, 2),
  36611. array(16, 3),
  36612. array(25, 1),
  36613. array(25, 3)
  36614. );
  36615. private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  36616. );
  36617. private $defaultActions = array(
  36618. 16 => array(2, 6)
  36619. );
  36620. public function lint($input)
  36621. {
  36622. try {
  36623. $this->parse($input);
  36624. } catch (ParsingException $e) {
  36625. return $e;
  36626. }
  36627. }
  36628. public function parse($input, $flags = 0)
  36629. {
  36630. $this->failOnBOM($input);
  36631. $this->flags = $flags;
  36632. $this->stack = array(0);
  36633. $this->vstack = array(null);
  36634. $this->lstack = array();
  36635. $yytext = '';
  36636. $yylineno = 0;
  36637. $yyleng = 0;
  36638. $recovering = 0;
  36639. $TERROR = 2;
  36640. $EOF = 1;
  36641. $this->lexer = new Lexer();
  36642. $this->lexer->setInput($input);
  36643. $yyloc = $this->lexer->yylloc;
  36644. $this->lstack[] = $yyloc;
  36645. $symbol = null;
  36646. $preErrorSymbol = null;
  36647. $state = null;
  36648. $action = null;
  36649. $a = null;
  36650. $r = null;
  36651. $yyval = new stdClass;
  36652. $p = null;
  36653. $len = null;
  36654. $newState = null;
  36655. $expected = null;
  36656. $errStr = null;
  36657. while (true) {
  36658. $state = $this->stack[count($this->stack)-1];
  36659. if (isset($this->defaultActions[$state])) {
  36660. $action = $this->defaultActions[$state];
  36661. } else {
  36662. if ($symbol == null) {
  36663. $symbol = $this->lex();
  36664. }
  36665. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  36666. }
  36667. if (!$action || !$action[0]) {
  36668. if (!$recovering) {
  36669. $expected = array();
  36670. foreach ($this->table[$state] as $p => $ignore) {
  36671. if (isset($this->terminals_[$p]) && $p > 2) {
  36672. $expected[] = "'" . $this->terminals_[$p] . "'";
  36673. }
  36674. }
  36675. $message = null;
  36676. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  36677. $message = "Invalid string";
  36678. if ("'" === substr($this->lexer->match, 0, 1)) {
  36679. $message .= ", it appears you used single quotes instead of double quotes";
  36680. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  36681. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  36682. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  36683. $message .= ", it appears you forgot to terminated the string, or attempted to write a multiline string which is invalid";
  36684. }
  36685. }
  36686. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  36687. $errStr .= $this->lexer->showPosition() . "\n";
  36688. if ($message) {
  36689. $errStr .= $message;
  36690. } else {
  36691. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  36692. $errStr .= implode(', ', $expected);
  36693. }
  36694. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  36695. $errStr .= " - It appears you have an extra trailing comma";
  36696. }
  36697. $this->parseError($errStr, array(
  36698. 'text' => $this->lexer->match,
  36699. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  36700. 'line' => $this->lexer->yylineno,
  36701. 'loc' => $yyloc,
  36702. 'expected' => $expected,
  36703. ));
  36704. }
  36705. if ($recovering == 3) {
  36706. if ($symbol == $EOF) {
  36707. throw new ParsingException($errStr ?: 'Parsing halted.');
  36708. }
  36709. $yyleng = $this->lexer->yyleng;
  36710. $yytext = $this->lexer->yytext;
  36711. $yylineno = $this->lexer->yylineno;
  36712. $yyloc = $this->lexer->yylloc;
  36713. $symbol = $this->lex();
  36714. }
  36715. while (true) {
  36716. if (array_key_exists($TERROR, $this->table[$state])) {
  36717. break;
  36718. }
  36719. if ($state == 0) {
  36720. throw new ParsingException($errStr ?: 'Parsing halted.');
  36721. }
  36722. $this->popStack(1);
  36723. $state = $this->stack[count($this->stack)-1];
  36724. }
  36725. $preErrorSymbol = $symbol;
  36726. $symbol = $TERROR;
  36727. $state = $this->stack[count($this->stack)-1];
  36728. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  36729. $recovering = 3;
  36730. }
  36731. if (is_array($action[0]) && count($action) > 1) {
  36732. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  36733. }
  36734. switch ($action[0]) {
  36735. case 1:
  36736. $this->stack[] = $symbol;
  36737. $this->vstack[] = $this->lexer->yytext;
  36738. $this->lstack[] = $this->lexer->yylloc;
  36739. $this->stack[] = $action[1];
  36740. $symbol = null;
  36741. if (!$preErrorSymbol) {
  36742. $yyleng = $this->lexer->yyleng;
  36743. $yytext = $this->lexer->yytext;
  36744. $yylineno = $this->lexer->yylineno;
  36745. $yyloc = $this->lexer->yylloc;
  36746. if ($recovering > 0) {
  36747. $recovering--;
  36748. }
  36749. } else {
  36750. $symbol = $preErrorSymbol;
  36751. $preErrorSymbol = null;
  36752. }
  36753. break;
  36754. case 2:
  36755. $len = $this->productions_[$action[1]][1];
  36756. $yyval->token = $this->vstack[count($this->vstack) - $len];
  36757. $yyval->store = array(
  36758. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  36759. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  36760. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  36761. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  36762. );
  36763. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  36764. if (!$r instanceof Undefined) {
  36765. return $r;
  36766. }
  36767. if ($len) {
  36768. $this->popStack($len);
  36769. }
  36770. $this->stack[] = $this->productions_[$action[1]][0];
  36771. $this->vstack[] = $yyval->token;
  36772. $this->lstack[] = $yyval->store;
  36773. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  36774. $this->stack[] = $newState;
  36775. break;
  36776. case 3:
  36777. return true;
  36778. }
  36779. }
  36780. return true;
  36781. }
  36782. protected function parseError($str, $hash)
  36783. {
  36784. throw new ParsingException($str, $hash);
  36785. }
  36786. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  36787. {
  36788. $len = count($tokens) - 1;
  36789. switch ($yystate) {
  36790. case 1:
  36791. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  36792. $yyval->token = $yytext;
  36793. break;
  36794. case 2:
  36795. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  36796. $yyval->token = floatval($yytext);
  36797. } else {
  36798. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  36799. }
  36800. break;
  36801. case 3:
  36802. $yyval->token = null;
  36803. break;
  36804. case 4:
  36805. $yyval->token = true;
  36806. break;
  36807. case 5:
  36808. $yyval->token = false;
  36809. break;
  36810. case 6:
  36811. return $yyval->token = $tokens[$len-1];
  36812. case 13:
  36813. if ($this->flags & self::PARSE_TO_ASSOC) {
  36814. $yyval->token = array();
  36815. } else {
  36816. $yyval->token = new stdClass;
  36817. }
  36818. break;
  36819. case 14:
  36820. $yyval->token = $tokens[$len-1];
  36821. break;
  36822. case 15:
  36823. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  36824. break;
  36825. case 16:
  36826. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  36827. if ($this->flags & self::PARSE_TO_ASSOC) {
  36828. $yyval->token = array();
  36829. $yyval->token[$property] = $tokens[$len][1];
  36830. } else {
  36831. $yyval->token = new stdClass;
  36832. $yyval->token->$property = $tokens[$len][1];
  36833. }
  36834. break;
  36835. case 17:
  36836. if ($this->flags & self::PARSE_TO_ASSOC) {
  36837. $yyval->token =& $tokens[$len-2];
  36838. $key = $tokens[$len][0];
  36839. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  36840. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  36841. $errStr .= $this->lexer->showPosition() . "\n";
  36842. $errStr .= "Duplicate key: ".$tokens[$len][0];
  36843. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  36844. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  36845. $duplicateCount = 1;
  36846. do {
  36847. $duplicateKey = $key . '.' . $duplicateCount++;
  36848. } while (isset($tokens[$len-2][$duplicateKey]));
  36849. $key = $duplicateKey;
  36850. }
  36851. $tokens[$len-2][$key] = $tokens[$len][1];
  36852. } else {
  36853. $yyval->token = $tokens[$len-2];
  36854. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  36855. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  36856. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  36857. $errStr .= $this->lexer->showPosition() . "\n";
  36858. $errStr .= "Duplicate key: ".$tokens[$len][0];
  36859. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  36860. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  36861. $duplicateCount = 1;
  36862. do {
  36863. $duplicateKey = $key . '.' . $duplicateCount++;
  36864. } while (isset($tokens[$len-2]->$duplicateKey));
  36865. $key = $duplicateKey;
  36866. }
  36867. $tokens[$len-2]->$key = $tokens[$len][1];
  36868. }
  36869. break;
  36870. case 18:
  36871. $yyval->token = array();
  36872. break;
  36873. case 19:
  36874. $yyval->token = $tokens[$len-1];
  36875. break;
  36876. case 20:
  36877. $yyval->token = array($tokens[$len]);
  36878. break;
  36879. case 21:
  36880. $tokens[$len-2][] = $tokens[$len];
  36881. $yyval->token = $tokens[$len-2];
  36882. break;
  36883. }
  36884. return new Undefined();
  36885. }
  36886. private function stringInterpolation($match)
  36887. {
  36888. switch ($match[0]) {
  36889. case '\\\\':
  36890. return '\\';
  36891. case '\"':
  36892. return '"';
  36893. case '\b':
  36894. return chr(8);
  36895. case '\f':
  36896. return chr(12);
  36897. case '\n':
  36898. return "\n";
  36899. case '\r':
  36900. return "\r";
  36901. case '\t':
  36902. return "\t";
  36903. case '\/':
  36904. return "/";
  36905. default:
  36906. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  36907. }
  36908. }
  36909. private function popStack($n)
  36910. {
  36911. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  36912. $this->vstack = array_slice($this->vstack, 0, - $n);
  36913. $this->lstack = array_slice($this->lstack, 0, - $n);
  36914. }
  36915. private function lex()
  36916. {
  36917. $token = $this->lexer->lex() ?: 1;
  36918. if (!is_numeric($token)) {
  36919. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  36920. }
  36921. return $token;
  36922. }
  36923. private function failOnBOM($input)
  36924. {
  36925. $bom = "\xEF\xBB\xBF";
  36926. if (substr($input, 0, 3) === $bom) {
  36927. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  36928. }
  36929. }
  36930. }
  36931. <?php
  36932. namespace Seld\JsonLint;
  36933. class Lexer
  36934. {
  36935. private $EOF = 1;
  36936. private $rules = array(
  36937. 0 => '/^\s+/',
  36938. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  36939. 2 => '{^"(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x09\x0a-\x1f\\\\"]+)*"}',
  36940. 3 => '/^\{/',
  36941. 4 => '/^\}/',
  36942. 5 => '/^\[/',
  36943. 6 => '/^\]/',
  36944. 7 => '/^,/',
  36945. 8 => '/^:/',
  36946. 9 => '/^true\b/',
  36947. 10 => '/^false\b/',
  36948. 11 => '/^null\b/',
  36949. 12 => '/^$/',
  36950. 13 => '/^./',
  36951. );
  36952. private $conditions = array(
  36953. "INITIAL" => array(
  36954. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  36955. "inclusive" => true,
  36956. ),
  36957. );
  36958. private $conditionStack;
  36959. private $input;
  36960. private $more;
  36961. private $done;
  36962. private $matched;
  36963. public $match;
  36964. public $yylineno;
  36965. public $yyleng;
  36966. public $yytext;
  36967. public $yylloc;
  36968. public function lex()
  36969. {
  36970. $r = $this->next();
  36971. if (!$r instanceof Undefined) {
  36972. return $r;
  36973. }
  36974. return $this->lex();
  36975. }
  36976. public function setInput($input)
  36977. {
  36978. $this->input = $input;
  36979. $this->more = false;
  36980. $this->done = false;
  36981. $this->yylineno = $this->yyleng = 0;
  36982. $this->yytext = $this->matched = $this->match = '';
  36983. $this->conditionStack = array('INITIAL');
  36984. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  36985. return $this;
  36986. }
  36987. public function showPosition()
  36988. {
  36989. $pre = str_replace("\n", '', $this->getPastInput());
  36990. $c = str_repeat('-', max(0, strlen($pre) - 1));
  36991. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  36992. }
  36993. public function getPastInput()
  36994. {
  36995. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  36996. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  36997. }
  36998. public function getUpcomingInput()
  36999. {
  37000. $next = $this->match;
  37001. if (strlen($next) < 20) {
  37002. $next .= substr($this->input, 0, 20 - strlen($next));
  37003. }
  37004. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  37005. }
  37006. protected function parseError($str, $hash)
  37007. {
  37008. throw new \Exception($str);
  37009. }
  37010. private function next()
  37011. {
  37012. if ($this->done) {
  37013. return $this->EOF;
  37014. }
  37015. if (!$this->input) {
  37016. $this->done = true;
  37017. }
  37018. $token = null;
  37019. $match = null;
  37020. $col = null;
  37021. $lines = null;
  37022. if (!$this->more) {
  37023. $this->yytext = '';
  37024. $this->match = '';
  37025. }
  37026. $rules = $this->getCurrentRules();
  37027. $rulesLen = count($rules);
  37028. for ($i=0; $i < $rulesLen; $i++) {
  37029. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  37030. preg_match_all('/\n.*/', $match[0], $lines);
  37031. $lines = $lines[0];
  37032. if ($lines) {
  37033. $this->yylineno += count($lines);
  37034. }
  37035. $this->yylloc = array(
  37036. 'first_line' => $this->yylloc['last_line'],
  37037. 'last_line' => $this->yylineno+1,
  37038. 'first_column' => $this->yylloc['last_column'],
  37039. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  37040. );
  37041. $this->yytext .= $match[0];
  37042. $this->match .= $match[0];
  37043. $this->yyleng = strlen($this->yytext);
  37044. $this->more = false;
  37045. $this->input = substr($this->input, strlen($match[0]));
  37046. $this->matched .= $match[0];
  37047. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  37048. if ($token) {
  37049. return $token;
  37050. }
  37051. return new Undefined();
  37052. }
  37053. }
  37054. if ($this->input === "") {
  37055. return $this->EOF;
  37056. }
  37057. $this->parseError(
  37058. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  37059. array(
  37060. 'text' => "",
  37061. 'token' => null,
  37062. 'line' => $this->yylineno,
  37063. )
  37064. );
  37065. }
  37066. private function getCurrentRules()
  37067. {
  37068. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  37069. }
  37070. private function performAction($avoiding_name_collisions, $YY_START)
  37071. {
  37072. switch ($avoiding_name_collisions) {
  37073. case 0:
  37074. break;
  37075. case 1:
  37076. return 6;
  37077. break;
  37078. case 2:
  37079. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  37080. return 4;
  37081. case 3:
  37082. return 17;
  37083. case 4:
  37084. return 18;
  37085. case 5:
  37086. return 23;
  37087. case 6:
  37088. return 24;
  37089. case 7:
  37090. return 22;
  37091. case 8:
  37092. return 21;
  37093. case 9:
  37094. return 10;
  37095. case 10:
  37096. return 11;
  37097. case 11:
  37098. return 8;
  37099. case 12:
  37100. return 14;
  37101. case 13:
  37102. return 'INVALID';
  37103. }
  37104. }
  37105. }
  37106. <?php
  37107. namespace Seld\JsonLint;
  37108. class ParsingException extends \Exception
  37109. {
  37110. protected $details;
  37111. public function __construct($message, $details = array())
  37112. {
  37113. $this->details = $details;
  37114. parent::__construct($message);
  37115. }
  37116. public function getDetails()
  37117. {
  37118. return $this->details;
  37119. }
  37120. }
  37121. <?php
  37122. namespace Seld\JsonLint;
  37123. class Undefined
  37124. {
  37125. }
  37126. Copyright (c) 2015 Jordi Boggiano
  37127. Permission is hereby granted, free of charge, to any person obtaining a copy
  37128. of this software and associated documentation files (the "Software"), to deal
  37129. in the Software without restriction, including without limitation the rights
  37130. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  37131. copies of the Software, and to permit persons to whom the Software is furnished
  37132. to do so, subject to the following conditions:
  37133. The above copyright notice and this permission notice shall be included in all
  37134. copies or substantial portions of the Software.
  37135. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37136. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  37137. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37138. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  37139. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  37140. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  37141. THE SOFTWARE.
  37142. <?php
  37143. require __DIR__.'/../vendor/autoload.php';
  37144. echo 'Say hello (visible): ';
  37145. $answer = Seld\CliPrompt\CliPrompt::prompt();
  37146. echo 'You answered: '.$answer . PHP_EOL;
  37147. echo 'Say hello (hidden): ';
  37148. $answer = Seld\CliPrompt\CliPrompt::hiddenPrompt();
  37149. echo 'You answered: '.$answer . PHP_EOL;
  37150. <?php
  37151. namespace Seld\CliPrompt;
  37152. class CliPrompt
  37153. {
  37154. public static function prompt()
  37155. {
  37156. $stdin = fopen('php://stdin', 'r');
  37157. $answer = self::trimAnswer(fgets($stdin, 4096));
  37158. fclose($stdin);
  37159. return $answer;
  37160. }
  37161. public static function hiddenPrompt($allowFallback = false)
  37162. {
  37163. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  37164. $exe = __DIR__.'\\..\\res\\hiddeninput.exe';
  37165. if ('phar:' === substr(__FILE__, 0, 5)) {
  37166. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  37167. $source = fopen($exe, 'r');
  37168. $target = fopen($tmpExe, 'w+');
  37169. stream_copy_to_stream($source, $target);
  37170. fclose($source);
  37171. fclose($target);
  37172. unset($source, $target);
  37173. $exe = $tmpExe;
  37174. }
  37175. $answer = self::trimAnswer(shell_exec($exe));
  37176. if (isset($tmpExe)) {
  37177. unlink($tmpExe);
  37178. }
  37179. echo PHP_EOL;
  37180. return $answer;
  37181. }
  37182. if (file_exists('/usr/bin/env')) {
  37183. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  37184. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  37185. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  37186. $shell = $sh;
  37187. break;
  37188. }
  37189. }
  37190. if (isset($shell)) {
  37191. $readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read -r mypassword';
  37192. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  37193. $value = self::trimAnswer(shell_exec($command));
  37194. echo PHP_EOL;
  37195. return $value;
  37196. }
  37197. }
  37198. if (!$allowFallback) {
  37199. throw new \RuntimeException('Could not prompt for input in a secure fashion, aborting');
  37200. }
  37201. return self::prompt();
  37202. }
  37203. private static function trimAnswer($str)
  37204. {
  37205. return preg_replace('{\r?\n$}D', '', $str);
  37206. }
  37207. }
  37208. Copyright (c) 2008, Gradua Networks
  37209. Author: Bruno Prieto Reis
  37210. All rights reserved.
  37211. Redistribution and use in source and binary forms, with or without
  37212. modification, are permitted provided that the following conditions are met:
  37213. * Redistributions of source code must retain the above copyright notice, this
  37214. list of conditions and the following disclaimer.
  37215. * Redistributions in binary form must reproduce the above copyright notice,
  37216. this list of conditions and the following disclaimer in the documentation
  37217. and/or other materials provided with the distribution.
  37218. * Neither the name of the Gradua Networks nor the names of its contributors
  37219. may be used to endorse or promote products derived from this software
  37220. without specific prior written permission.
  37221. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  37222. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  37223. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  37224. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  37225. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  37226. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  37227. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  37228. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  37229. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  37230. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  37231. <?php
  37232. namespace JsonSchema\Constraints;
  37233. class CollectionConstraint extends Constraint
  37234. {
  37235. public function check($value, $schema = null, $path = null, $i = null)
  37236. {
  37237. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  37238. $this->addError($path, "There must be a minimum of " . $schema->minItems . " items in the array", 'minItems', array('minItems' => $schema->minItems,));
  37239. }
  37240. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  37241. $this->addError($path, "There must be a maximum of " . $schema->maxItems . " items in the array", 'maxItems', array('maxItems' => $schema->maxItems,));
  37242. }
  37243. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  37244. $unique = $value;
  37245. if (is_array($value) && count($value)) {
  37246. $unique = array_map(function($e) { return var_export($e, true); }, $value);
  37247. }
  37248. if (count(array_unique($unique)) != count($value)) {
  37249. $this->addError($path, "There are no duplicates allowed in the array", 'uniqueItems');
  37250. }
  37251. }
  37252. if (isset($schema->items)) {
  37253. $this->validateItems($value, $schema, $path, $i);
  37254. }
  37255. }
  37256. protected function validateItems($value, $schema = null, $path = null, $i = null)
  37257. {
  37258. if (is_object($schema->items)) {
  37259. foreach ($value as $k => $v) {
  37260. $initErrors = $this->getErrors();
  37261. $this->checkUndefined($v, $schema->items, $path, $k);
  37262. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  37263. $secondErrors = $this->getErrors();
  37264. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  37265. }
  37266. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  37267. $this->errors = $secondErrors;
  37268. } else if (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  37269. $this->errors = $initErrors;
  37270. }
  37271. }
  37272. } else {
  37273. foreach ($value as $k => $v) {
  37274. if (array_key_exists($k, $schema->items)) {
  37275. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  37276. } else {
  37277. if (property_exists($schema, 'additionalItems')) {
  37278. if ($schema->additionalItems !== false) {
  37279. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  37280. } else {
  37281. $this->addError(
  37282. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems,));
  37283. }
  37284. } else {
  37285. $this->checkUndefined($v, new \stdClass(), $path, $k);
  37286. }
  37287. }
  37288. }
  37289. if(count($value) > 0) {
  37290. for ($k = count($value); $k < count($schema->items); $k++) {
  37291. $this->checkUndefined(new UndefinedConstraint(), $schema->items[$k], $path, $k);
  37292. }
  37293. }
  37294. }
  37295. }
  37296. }
  37297. <?php
  37298. namespace JsonSchema\Constraints;
  37299. use JsonSchema\Uri\UriRetriever;
  37300. abstract class Constraint implements ConstraintInterface
  37301. {
  37302. protected $checkMode = self::CHECK_MODE_NORMAL;
  37303. protected $uriRetriever;
  37304. protected $errors = array();
  37305. protected $inlineSchemaProperty = '$schema';
  37306. const CHECK_MODE_NORMAL = 1;
  37307. const CHECK_MODE_TYPE_CAST = 2;
  37308. private $factory;
  37309. public function __construct($checkMode = self::CHECK_MODE_NORMAL, UriRetriever $uriRetriever = null, Factory $factory = null)
  37310. {
  37311. $this->checkMode = $checkMode;
  37312. $this->uriRetriever = $uriRetriever;
  37313. $this->factory = $factory;
  37314. }
  37315. public function getUriRetriever()
  37316. {
  37317. if (is_null($this->uriRetriever))
  37318. {
  37319. $this->setUriRetriever(new UriRetriever);
  37320. }
  37321. return $this->uriRetriever;
  37322. }
  37323. public function getFactory()
  37324. {
  37325. if (!$this->factory) {
  37326. $this->factory = new Factory($this->getUriRetriever());
  37327. }
  37328. return $this->factory;
  37329. }
  37330. public function setUriRetriever(UriRetriever $uriRetriever)
  37331. {
  37332. $this->uriRetriever = $uriRetriever;
  37333. }
  37334. public function addError($path, $message, $constraint='', array $more=null)
  37335. {
  37336. $error = array(
  37337. 'property' => $path,
  37338. 'message' => $message,
  37339. 'constraint' => $constraint,
  37340. );
  37341. if (is_array($more) && count($more) > 0)
  37342. {
  37343. $error += $more;
  37344. }
  37345. $this->errors[] = $error;
  37346. }
  37347. public function addErrors(array $errors)
  37348. {
  37349. $this->errors = array_merge($this->errors, $errors);
  37350. }
  37351. public function getErrors()
  37352. {
  37353. return $this->errors;
  37354. }
  37355. public function isValid()
  37356. {
  37357. return !$this->getErrors();
  37358. }
  37359. public function reset()
  37360. {
  37361. $this->errors = array();
  37362. }
  37363. protected function incrementPath($path, $i)
  37364. {
  37365. if ($path !== '') {
  37366. if (is_int($i)) {
  37367. $path .= '[' . $i . ']';
  37368. } elseif ($i == '') {
  37369. $path .= '';
  37370. } else {
  37371. $path .= '.' . $i;
  37372. }
  37373. } else {
  37374. $path = $i;
  37375. }
  37376. return $path;
  37377. }
  37378. protected function checkArray($value, $schema = null, $path = null, $i = null)
  37379. {
  37380. $validator = $this->getFactory()->createInstanceFor('collection');
  37381. $validator->check($value, $schema, $path, $i);
  37382. $this->addErrors($validator->getErrors());
  37383. }
  37384. protected function checkObject($value, $schema = null, $path = null, $i = null, $patternProperties = null)
  37385. {
  37386. $validator = $this->getFactory()->createInstanceFor('object');
  37387. $validator->check($value, $schema, $path, $i, $patternProperties);
  37388. $this->addErrors($validator->getErrors());
  37389. }
  37390. protected function checkType($value, $schema = null, $path = null, $i = null)
  37391. {
  37392. $validator = $this->getFactory()->createInstanceFor('type');
  37393. $validator->check($value, $schema, $path, $i);
  37394. $this->addErrors($validator->getErrors());
  37395. }
  37396. protected function checkUndefined($value, $schema = null, $path = null, $i = null)
  37397. {
  37398. $validator = $this->getFactory()->createInstanceFor('undefined');
  37399. $validator->check($value, $schema, $path, $i);
  37400. $this->addErrors($validator->getErrors());
  37401. }
  37402. protected function checkString($value, $schema = null, $path = null, $i = null)
  37403. {
  37404. $validator = $this->getFactory()->createInstanceFor('string');
  37405. $validator->check($value, $schema, $path, $i);
  37406. $this->addErrors($validator->getErrors());
  37407. }
  37408. protected function checkNumber($value, $schema = null, $path = null, $i = null)
  37409. {
  37410. $validator = $this->getFactory()->createInstanceFor('number');
  37411. $validator->check($value, $schema, $path, $i);
  37412. $this->addErrors($validator->getErrors());
  37413. }
  37414. protected function checkEnum($value, $schema = null, $path = null, $i = null)
  37415. {
  37416. $validator = $this->getFactory()->createInstanceFor('enum');
  37417. $validator->check($value, $schema, $path, $i);
  37418. $this->addErrors($validator->getErrors());
  37419. }
  37420. protected function checkFormat($value, $schema = null, $path = null, $i = null)
  37421. {
  37422. $validator = $this->getFactory()->createInstanceFor('format');
  37423. $validator->check($value, $schema, $path, $i);
  37424. $this->addErrors($validator->getErrors());
  37425. }
  37426. protected function retrieveUri($uri)
  37427. {
  37428. if (null === $this->uriRetriever) {
  37429. $this->setUriRetriever(new UriRetriever);
  37430. }
  37431. $jsonSchema = $this->uriRetriever->retrieve($uri);
  37432. return $jsonSchema;
  37433. }
  37434. }
  37435. <?php
  37436. namespace JsonSchema\Constraints;
  37437. interface ConstraintInterface
  37438. {
  37439. public function getErrors();
  37440. public function addErrors(array $errors);
  37441. public function addError($path, $message, $constraint='', array $more=null);
  37442. public function isValid();
  37443. public function check($value, $schema = null, $path = null, $i = null);
  37444. }<?php
  37445. namespace JsonSchema\Constraints;
  37446. class EnumConstraint extends Constraint
  37447. {
  37448. public function check($element, $schema = null, $path = null, $i = null)
  37449. {
  37450. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  37451. return;
  37452. }
  37453. foreach ($schema->enum as $enum) {
  37454. $type = gettype($element);
  37455. if ($type === gettype($enum)) {
  37456. if ($type == "object") {
  37457. if ($element == $enum)
  37458. return;
  37459. } else {
  37460. if ($element === $enum)
  37461. return;
  37462. }
  37463. }
  37464. }
  37465. $this->addError($path, "Does not have a value in the enumeration " . print_r($schema->enum, true), 'enum', array('enum' => $schema->enum,));
  37466. }
  37467. }
  37468. <?php
  37469. namespace JsonSchema\Constraints;
  37470. use JsonSchema\Exception\InvalidArgumentException;
  37471. use JsonSchema\Uri\UriRetriever;
  37472. use JsonSchema\Validator;
  37473. class Factory
  37474. {
  37475. protected $uriRetriever;
  37476. public function __construct(UriRetriever $uriRetriever = null)
  37477. {
  37478. if (!$uriRetriever) {
  37479. $uriRetriever = new UriRetriever();
  37480. }
  37481. $this->uriRetriever = $uriRetriever;
  37482. }
  37483. public function getUriRetriever()
  37484. {
  37485. return $this->uriRetriever;
  37486. }
  37487. public function createInstanceFor($constraintName)
  37488. {
  37489. switch ($constraintName) {
  37490. case 'array':
  37491. case 'collection':
  37492. return new CollectionConstraint(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37493. case 'object':
  37494. return new ObjectConstraint(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37495. case 'type':
  37496. return new TypeConstraint(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37497. case 'undefined':
  37498. return new UndefinedConstraint(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37499. case 'string':
  37500. return new StringConstraint(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37501. case 'number':
  37502. return new NumberConstraint(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37503. case 'enum':
  37504. return new EnumConstraint(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37505. case 'format':
  37506. return new FormatConstraint(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37507. case 'schema':
  37508. return new SchemaConstraint(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37509. case 'validator':
  37510. return new Validator(Constraint::CHECK_MODE_NORMAL, $this->uriRetriever, $this);
  37511. }
  37512. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  37513. }
  37514. }
  37515. <?php
  37516. namespace JsonSchema\Constraints;
  37517. class FormatConstraint extends Constraint
  37518. {
  37519. public function check($element, $schema = null, $path = null, $i = null)
  37520. {
  37521. if (!isset($schema->format)) {
  37522. return;
  37523. }
  37524. switch ($schema->format) {
  37525. case 'date':
  37526. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  37527. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format,));
  37528. }
  37529. break;
  37530. case 'time':
  37531. if (!$this->validateDateTime($element, 'H:i:s')) {
  37532. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format,));
  37533. }
  37534. break;
  37535. case 'date-time':
  37536. if (!$this->validateDateTime($element, 'Y-m-d\TH:i:s\Z') &&
  37537. !$this->validateDateTime($element, 'Y-m-d\TH:i:s.u\Z') &&
  37538. !$this->validateDateTime($element, 'Y-m-d\TH:i:sP') &&
  37539. !$this->validateDateTime($element, 'Y-m-d\TH:i:sO')
  37540. ) {
  37541. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format,));
  37542. }
  37543. break;
  37544. case 'utc-millisec':
  37545. if (!$this->validateDateTime($element, 'U')) {
  37546. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format,));
  37547. }
  37548. break;
  37549. case 'regex':
  37550. if (!$this->validateRegex($element)) {
  37551. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format,));
  37552. }
  37553. break;
  37554. case 'color':
  37555. if (!$this->validateColor($element)) {
  37556. $this->addError($path, "Invalid color", 'format', array('format' => $schema->format,));
  37557. }
  37558. break;
  37559. case 'style':
  37560. if (!$this->validateStyle($element)) {
  37561. $this->addError($path, "Invalid style", 'format', array('format' => $schema->format,));
  37562. }
  37563. break;
  37564. case 'phone':
  37565. if (!$this->validatePhone($element)) {
  37566. $this->addError($path, "Invalid phone number", 'format', array('format' => $schema->format,));
  37567. }
  37568. break;
  37569. case 'uri':
  37570. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  37571. $this->addError($path, "Invalid URL format", 'format', array('format' => $schema->format,));
  37572. }
  37573. break;
  37574. case 'email':
  37575. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE)) {
  37576. $this->addError($path, "Invalid email", 'format', array('format' => $schema->format,));
  37577. }
  37578. break;
  37579. case 'ip-address':
  37580. case 'ipv4':
  37581. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  37582. $this->addError($path, "Invalid IP address", 'format', array('format' => $schema->format,));
  37583. }
  37584. break;
  37585. case 'ipv6':
  37586. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  37587. $this->addError($path, "Invalid IP address", 'format', array('format' => $schema->format,));
  37588. }
  37589. break;
  37590. case 'host-name':
  37591. case 'hostname':
  37592. if (!$this->validateHostname($element)) {
  37593. $this->addError($path, "Invalid hostname", 'format', array('format' => $schema->format,));
  37594. }
  37595. break;
  37596. default:
  37597. break;
  37598. }
  37599. }
  37600. protected function validateDateTime($datetime, $format)
  37601. {
  37602. $dt = \DateTime::createFromFormat($format, $datetime);
  37603. if (!$dt) {
  37604. return false;
  37605. }
  37606. if ($datetime === $dt->format($format)) {
  37607. return true;
  37608. }
  37609. if ((strpos('u', $format) !== -1) && (intval($dt->format('u')) > 0)) {
  37610. return true;
  37611. }
  37612. return false;
  37613. }
  37614. protected function validateRegex($regex)
  37615. {
  37616. return false !== @preg_match('/' . $regex . '/', '');
  37617. }
  37618. protected function validateColor($color)
  37619. {
  37620. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  37621. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  37622. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  37623. return true;
  37624. }
  37625. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  37626. }
  37627. protected function validateStyle($style)
  37628. {
  37629. $properties = explode(';', rtrim($style, ';'));
  37630. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  37631. return empty($invalidEntries);
  37632. }
  37633. protected function validatePhone($phone)
  37634. {
  37635. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  37636. }
  37637. protected function validateHostname($host)
  37638. {
  37639. return preg_match('/^[_a-z]+\.([_a-z]+\.?)+$/i', $host);
  37640. }
  37641. }
  37642. <?php
  37643. namespace JsonSchema\Constraints;
  37644. class NumberConstraint extends Constraint
  37645. {
  37646. public function check($element, $schema = null, $path = null, $i = null)
  37647. {
  37648. if (isset($schema->exclusiveMinimum)) {
  37649. if (isset($schema->minimum)) {
  37650. if ($schema->exclusiveMinimum && $element === $schema->minimum) {
  37651. $this->addError($path, "Must have a minimum value greater than boundary value of " . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum,));
  37652. } else if ($element < $schema->minimum) {
  37653. $this->addError($path, "Must have a minimum value of " . $schema->minimum, 'minimum', array('minimum' => $schema->minimum,));
  37654. }
  37655. } else {
  37656. $this->addError($path, "Use of exclusiveMinimum requires presence of minimum", 'missingMinimum');
  37657. }
  37658. } else if (isset($schema->minimum) && $element < $schema->minimum) {
  37659. $this->addError($path, "Must have a minimum value of " . $schema->minimum, 'minimum', array('minimum' => $schema->minimum,));
  37660. }
  37661. if (isset($schema->exclusiveMaximum)) {
  37662. if (isset($schema->maximum)) {
  37663. if ($schema->exclusiveMaximum && $element === $schema->maximum) {
  37664. $this->addError($path, "Must have a maximum value less than boundary value of " . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum,));
  37665. } else if ($element > $schema->maximum) {
  37666. $this->addError($path, "Must have a maximum value of " . $schema->maximum, 'maximum', array('maximum' => $schema->maximum,));
  37667. }
  37668. } else {
  37669. $this->addError($path, "Use of exclusiveMaximum requires presence of maximum", 'missingMinimum');
  37670. }
  37671. } else if (isset($schema->maximum) && $element > $schema->maximum) {
  37672. $this->addError($path, "Must have a maximum value of " . $schema->maximum, 'maximum', array('maximum' => $schema->maximum,));
  37673. }
  37674. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  37675. $this->addError($path, "Is not divisible by " . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy,));
  37676. }
  37677. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  37678. $this->addError($path, "Must be a multiple of " . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf,));
  37679. }
  37680. $this->checkFormat($element, $schema, $path, $i);
  37681. }
  37682. private function fmod($number1, $number2)
  37683. {
  37684. $modulus = fmod($number1, $number2);
  37685. $precision = abs(0.0000000001);
  37686. $diff = (float)($modulus - $number2);
  37687. if (-$precision < $diff && $diff < $precision) {
  37688. return 0.0;
  37689. }
  37690. $decimals1 = mb_strpos($number1, ".") ? mb_strlen($number1) - mb_strpos($number1, ".") - 1 : 0;
  37691. $decimals2 = mb_strpos($number2, ".") ? mb_strlen($number2) - mb_strpos($number2, ".") - 1 : 0;
  37692. return (float)round($modulus, max($decimals1, $decimals2));
  37693. }
  37694. }
  37695. <?php
  37696. namespace JsonSchema\Constraints;
  37697. class ObjectConstraint extends Constraint
  37698. {
  37699. function check($element, $definition = null, $path = null, $additionalProp = null, $patternProperties = null)
  37700. {
  37701. if ($element instanceof UndefinedConstraint) {
  37702. return;
  37703. }
  37704. $matches = array();
  37705. if ($patternProperties) {
  37706. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  37707. }
  37708. if ($definition) {
  37709. $this->validateDefinition($element, $definition, $path);
  37710. }
  37711. $this->validateElement($element, $matches, $definition, $path, $additionalProp);
  37712. }
  37713. public function validatePatternProperties($element, $path, $patternProperties)
  37714. {
  37715. $try = array('/','#','+','~','%');
  37716. $matches = array();
  37717. foreach ($patternProperties as $pregex => $schema) {
  37718. $delimiter = '/';
  37719. foreach ($try as $delimiter) {
  37720. if (strpos($pregex, $delimiter) === false) {
  37721. break;
  37722. }
  37723. }
  37724. if (@preg_match($delimiter. $pregex . $delimiter, '') === false) {
  37725. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex,));
  37726. continue;
  37727. }
  37728. foreach ($element as $i => $value) {
  37729. if (preg_match($delimiter . $pregex . $delimiter, $i)) {
  37730. $matches[] = $i;
  37731. $this->checkUndefined($value, $schema ? : new \stdClass(), $path, $i);
  37732. }
  37733. }
  37734. }
  37735. return $matches;
  37736. }
  37737. public function validateElement($element, $matches, $objectDefinition = null, $path = null, $additionalProp = null)
  37738. {
  37739. foreach ($element as $i => $value) {
  37740. $property = $this->getProperty($element, $i, new UndefinedConstraint());
  37741. $definition = $this->getProperty($objectDefinition, $i);
  37742. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  37743. $this->addError($path, "The property " . $i . " is not defined and the definition does not allow additional properties", 'additionalProp');
  37744. }
  37745. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  37746. if ($additionalProp === true) {
  37747. $this->checkUndefined($value, null, $path, $i);
  37748. } else {
  37749. $this->checkUndefined($value, $additionalProp, $path, $i);
  37750. }
  37751. }
  37752. $require = $this->getProperty($definition, 'requires');
  37753. if ($require && !$this->getProperty($element, $require)) {
  37754. $this->addError($path, "The presence of the property " . $i . " requires that " . $require . " also be present", 'requires');
  37755. }
  37756. if (!$definition) {
  37757. $this->checkUndefined($value, new \stdClass(), $path, $i);
  37758. }
  37759. }
  37760. }
  37761. public function validateDefinition($element, $objectDefinition = null, $path = null)
  37762. {
  37763. foreach ($objectDefinition as $i => $value) {
  37764. $property = $this->getProperty($element, $i, new UndefinedConstraint());
  37765. $definition = $this->getProperty($objectDefinition, $i);
  37766. $this->checkUndefined($property, $definition, $path, $i);
  37767. }
  37768. }
  37769. protected function getProperty($element, $property, $fallback = null)
  37770. {
  37771. if (is_array($element) ) {
  37772. return array_key_exists($property, $element) ? $element[$property] : $fallback;
  37773. } elseif (is_object($element)) {
  37774. return property_exists($element, $property) ? $element->$property : $fallback;
  37775. }
  37776. return $fallback;
  37777. }
  37778. }
  37779. <?php
  37780. namespace JsonSchema\Constraints;
  37781. use JsonSchema\Exception\InvalidArgumentException;
  37782. class SchemaConstraint extends Constraint
  37783. {
  37784. public function check($element, $schema = null, $path = null, $i = null)
  37785. {
  37786. if ($schema !== null) {
  37787. $this->checkUndefined($element, $schema, '', '');
  37788. } elseif (property_exists($element, $this->inlineSchemaProperty)) {
  37789. $this->checkUndefined($element, $element->{$this->inlineSchemaProperty}, '', '');
  37790. } else {
  37791. throw new InvalidArgumentException('no schema found to verify against');
  37792. }
  37793. }
  37794. }<?php
  37795. namespace JsonSchema\Constraints;
  37796. class StringConstraint extends Constraint
  37797. {
  37798. public function check($element, $schema = null, $path = null, $i = null)
  37799. {
  37800. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  37801. $this->addError($path, "Must be at most " . $schema->maxLength . " characters long", 'maxLength', array(
  37802. 'maxLength' => $schema->maxLength,
  37803. ));
  37804. }
  37805. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  37806. $this->addError($path, "Must be at least " . $schema->minLength . " characters long", 'minLength', array(
  37807. 'minLength' => $schema->minLength,
  37808. ));
  37809. }
  37810. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#', $element)) {
  37811. $this->addError($path, "Does not match the regex pattern " . $schema->pattern, 'pattern', array(
  37812. 'pattern' => $schema->pattern,
  37813. ));
  37814. }
  37815. $this->checkFormat($element, $schema, $path, $i);
  37816. }
  37817. private function strlen($string)
  37818. {
  37819. if (extension_loaded('mbstring')) {
  37820. return mb_strlen($string, mb_detect_encoding($string));
  37821. } else {
  37822. return strlen($string);
  37823. }
  37824. }
  37825. }
  37826. <?php
  37827. namespace JsonSchema\Constraints;
  37828. use JsonSchema\Exception\InvalidArgumentException;
  37829. use UnexpectedValueException as StandardUnexpectedValueException;
  37830. class TypeConstraint extends Constraint
  37831. {
  37832. static $wording = array(
  37833. 'integer' => 'an integer',
  37834. 'number' => 'a number',
  37835. 'boolean' => 'a boolean',
  37836. 'object' => 'an object',
  37837. 'array' => 'an array',
  37838. 'string' => 'a string',
  37839. 'null' => 'a null',
  37840. 'any' => NULL,
  37841. 0 => NULL,
  37842. );
  37843. public function check($value = null, $schema = null, $path = null, $i = null)
  37844. {
  37845. $type = isset($schema->type) ? $schema->type : null;
  37846. $isValid = true;
  37847. if (is_array($type)) {
  37848. $validatedOneType = false;
  37849. $errors = array();
  37850. foreach ($type as $tp) {
  37851. $validator = new TypeConstraint($this->checkMode);
  37852. $subSchema = new \stdClass();
  37853. $subSchema->type = $tp;
  37854. $validator->check($value, $subSchema, $path, null);
  37855. $error = $validator->getErrors();
  37856. if (!count($error)) {
  37857. $validatedOneType = true;
  37858. break;
  37859. }
  37860. $errors = $error;
  37861. }
  37862. if (!$validatedOneType) {
  37863. $this->addErrors($errors);
  37864. return;
  37865. }
  37866. } elseif (is_object($type)) {
  37867. $this->checkUndefined($value, $type, $path);
  37868. } else {
  37869. $isValid = $this->validateType($value, $type);
  37870. }
  37871. if ($isValid === false) {
  37872. if (!isset(self::$wording[$type])) {
  37873. throw new StandardUnexpectedValueException(
  37874. sprintf(
  37875. "No wording for %s available, expected wordings are: [%s]",
  37876. var_export($type, true),
  37877. implode(', ', array_filter(self::$wording)))
  37878. );
  37879. }
  37880. $this->addError($path, ucwords(gettype($value)) . " value found, but " . self::$wording[$type] . " is required", 'type');
  37881. }
  37882. }
  37883. protected function validateType($value, $type)
  37884. {
  37885. if (!$type) {
  37886. return true;
  37887. }
  37888. if ('integer' === $type) {
  37889. return is_int($value);
  37890. }
  37891. if ('number' === $type) {
  37892. return is_numeric($value) && !is_string($value);
  37893. }
  37894. if ('boolean' === $type) {
  37895. return is_bool($value);
  37896. }
  37897. if ('object' === $type) {
  37898. return is_object($value);
  37899. }
  37900. if ('array' === $type) {
  37901. return is_array($value);
  37902. }
  37903. if ('string' === $type) {
  37904. return is_string($value);
  37905. }
  37906. if ('email' === $type) {
  37907. return is_string($value);
  37908. }
  37909. if ('null' === $type) {
  37910. return is_null($value);
  37911. }
  37912. if ('any' === $type) {
  37913. return true;
  37914. }
  37915. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  37916. }
  37917. }
  37918. <?php
  37919. namespace JsonSchema\Constraints;
  37920. use JsonSchema\Exception\InvalidArgumentException;
  37921. use JsonSchema\Uri\UriResolver;
  37922. class UndefinedConstraint extends Constraint
  37923. {
  37924. public function check($value, $schema = null, $path = null, $i = null)
  37925. {
  37926. if (is_null($schema)) {
  37927. return;
  37928. }
  37929. if (!is_object($schema)) {
  37930. throw new InvalidArgumentException(
  37931. 'Given schema must be an object in ' . $path
  37932. . ' but is a ' . gettype($schema)
  37933. );
  37934. }
  37935. $i = is_null($i) ? "" : $i;
  37936. $path = $this->incrementPath($path, $i);
  37937. $this->validateCommonProperties($value, $schema, $path);
  37938. $this->validateOfProperties($value, $schema, $path);
  37939. $this->validateTypes($value, $schema, $path, $i);
  37940. }
  37941. public function validateTypes($value, $schema = null, $path = null, $i = null)
  37942. {
  37943. if (is_array($value)) {
  37944. $this->checkArray($value, $schema, $path, $i);
  37945. }
  37946. if (is_object($value) && (isset($schema->properties) || isset($schema->patternProperties) || isset($schema->additionalProperties))) {
  37947. $this->checkObject(
  37948. $value,
  37949. isset($schema->properties) ? $schema->properties : null,
  37950. $path,
  37951. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  37952. isset($schema->patternProperties) ? $schema->patternProperties : null
  37953. );
  37954. }
  37955. if (is_string($value)) {
  37956. $this->checkString($value, $schema, $path, $i);
  37957. }
  37958. if (is_numeric($value)) {
  37959. $this->checkNumber($value, $schema, $path, $i);
  37960. }
  37961. if (isset($schema->enum)) {
  37962. $this->checkEnum($value, $schema, $path, $i);
  37963. }
  37964. }
  37965. protected function validateCommonProperties($value, $schema = null, $path = null, $i = "")
  37966. {
  37967. if (isset($schema->extends)) {
  37968. if (is_string($schema->extends)) {
  37969. $schema->extends = $this->validateUri($schema, $schema->extends);
  37970. }
  37971. if (is_array($schema->extends)) {
  37972. foreach ($schema->extends as $extends) {
  37973. $this->checkUndefined($value, $extends, $path, $i);
  37974. }
  37975. } else {
  37976. $this->checkUndefined($value, $schema->extends, $path, $i);
  37977. }
  37978. }
  37979. if (is_object($value)) {
  37980. if (!($value instanceof UndefinedConstraint) && isset($schema->required) && is_array($schema->required) ) {
  37981. foreach ($schema->required as $required) {
  37982. if (!property_exists($value, $required)) {
  37983. $this->addError((!$path) ? $required : "$path.$required", "The property " . $required . " is required", 'required');
  37984. }
  37985. }
  37986. } else if (isset($schema->required) && !is_array($schema->required)) {
  37987. if ( $schema->required && $value instanceof UndefinedConstraint) {
  37988. $this->addError($path, "Is missing and it is required", 'required');
  37989. }
  37990. }
  37991. }
  37992. if (!($value instanceof UndefinedConstraint)) {
  37993. $this->checkType($value, $schema, $path);
  37994. }
  37995. if (isset($schema->disallow)) {
  37996. $initErrors = $this->getErrors();
  37997. $typeSchema = new \stdClass();
  37998. $typeSchema->type = $schema->disallow;
  37999. $this->checkType($value, $typeSchema, $path);
  38000. if (count($this->getErrors()) == count($initErrors)) {
  38001. $this->addError($path, "Disallowed value was matched", 'disallow');
  38002. } else {
  38003. $this->errors = $initErrors;
  38004. }
  38005. }
  38006. if (isset($schema->not)) {
  38007. $initErrors = $this->getErrors();
  38008. $this->checkUndefined($value, $schema->not, $path, $i);
  38009. if (count($this->getErrors()) == count($initErrors)) {
  38010. $this->addError($path, "Matched a schema which it should not", 'not');
  38011. } else {
  38012. $this->errors = $initErrors;
  38013. }
  38014. }
  38015. if (is_object($value)) {
  38016. if (isset($schema->minProperties)) {
  38017. if (count(get_object_vars($value)) < $schema->minProperties) {
  38018. $this->addError($path, "Must contain a minimum of " . $schema->minProperties . " properties", 'minProperties', array('minProperties' => $schema->minProperties,));
  38019. }
  38020. }
  38021. if (isset($schema->maxProperties)) {
  38022. if (count(get_object_vars($value)) > $schema->maxProperties) {
  38023. $this->addError($path, "Must contain no more than " . $schema->maxProperties . " properties", 'maxProperties', array('maxProperties' => $schema->maxProperties,));
  38024. }
  38025. }
  38026. }
  38027. if (is_object($value) && isset($schema->dependencies)) {
  38028. $this->validateDependencies($value, $schema->dependencies, $path);
  38029. }
  38030. }
  38031. protected function validateOfProperties($value, $schema, $path, $i = "")
  38032. {
  38033. if ($value instanceof UndefinedConstraint) {
  38034. return;
  38035. }
  38036. if (isset($schema->allOf)) {
  38037. $isValid = true;
  38038. foreach ($schema->allOf as $allOf) {
  38039. $initErrors = $this->getErrors();
  38040. $this->checkUndefined($value, $allOf, $path, $i);
  38041. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  38042. }
  38043. if (!$isValid) {
  38044. $this->addError($path, "Failed to match all schemas", 'allOf');
  38045. }
  38046. }
  38047. if (isset($schema->anyOf)) {
  38048. $isValid = false;
  38049. $startErrors = $this->getErrors();
  38050. foreach ($schema->anyOf as $anyOf) {
  38051. $initErrors = $this->getErrors();
  38052. $this->checkUndefined($value, $anyOf, $path, $i);
  38053. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  38054. break;
  38055. }
  38056. }
  38057. if (!$isValid) {
  38058. $this->addError($path, "Failed to match at least one schema", 'anyOf');
  38059. } else {
  38060. $this->errors = $startErrors;
  38061. }
  38062. }
  38063. if (isset($schema->oneOf)) {
  38064. $allErrors = array();
  38065. $matchedSchemas = 0;
  38066. $startErrors = $this->getErrors();
  38067. foreach ($schema->oneOf as $oneOf) {
  38068. $this->errors = array();
  38069. $this->checkUndefined($value, $oneOf, $path, $i);
  38070. if (count($this->getErrors()) == 0) {
  38071. $matchedSchemas++;
  38072. }
  38073. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  38074. }
  38075. if ($matchedSchemas !== 1) {
  38076. $this->addErrors(
  38077. array_merge(
  38078. $allErrors,
  38079. array(array(
  38080. 'property' => $path,
  38081. 'message' => "Failed to match exactly one schema",
  38082. 'constraint' => 'oneOf',
  38083. ),),
  38084. $startErrors
  38085. )
  38086. );
  38087. } else {
  38088. $this->errors = $startErrors;
  38089. }
  38090. }
  38091. }
  38092. protected function validateDependencies($value, $dependencies, $path, $i = "")
  38093. {
  38094. foreach ($dependencies as $key => $dependency) {
  38095. if (property_exists($value, $key)) {
  38096. if (is_string($dependency)) {
  38097. if (!property_exists($value, $dependency)) {
  38098. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  38099. }
  38100. } else if (is_array($dependency)) {
  38101. foreach ($dependency as $d) {
  38102. if (!property_exists($value, $d)) {
  38103. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  38104. }
  38105. }
  38106. } else if (is_object($dependency)) {
  38107. $this->checkUndefined($value, $dependency, $path, $i);
  38108. }
  38109. }
  38110. }
  38111. }
  38112. protected function validateUri($schema, $schemaUri = null)
  38113. {
  38114. $resolver = new UriResolver();
  38115. $retriever = $this->getUriRetriever();
  38116. $jsonSchema = null;
  38117. if ($resolver->isValid($schemaUri)) {
  38118. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  38119. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  38120. }
  38121. return $jsonSchema;
  38122. }
  38123. }
  38124. <?php
  38125. namespace JsonSchema\Exception;
  38126. class InvalidArgumentException extends \InvalidArgumentException
  38127. {
  38128. }<?php
  38129. namespace JsonSchema\Exception;
  38130. class InvalidSchemaMediaTypeException extends \RuntimeException
  38131. {
  38132. }<?php
  38133. namespace JsonSchema\Exception;
  38134. class InvalidSourceUriException extends InvalidArgumentException
  38135. {
  38136. }
  38137. <?php
  38138. namespace JsonSchema\Exception;
  38139. class JsonDecodingException extends \RuntimeException
  38140. {
  38141. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  38142. {
  38143. switch ($code) {
  38144. case JSON_ERROR_DEPTH:
  38145. $message = 'The maximum stack depth has been exceeded';
  38146. break;
  38147. case JSON_ERROR_STATE_MISMATCH:
  38148. $message = 'Invalid or malformed JSON';
  38149. break;
  38150. case JSON_ERROR_CTRL_CHAR:
  38151. $message = 'Control character error, possibly incorrectly encoded';
  38152. break;
  38153. case JSON_ERROR_UTF8:
  38154. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  38155. break;
  38156. case JSON_ERROR_SYNTAX:
  38157. $message = 'JSON syntax is malformed';
  38158. break;
  38159. default:
  38160. $message = 'Syntax error';
  38161. }
  38162. parent::__construct($message, $code, $previous);
  38163. }
  38164. }<?php
  38165. namespace JsonSchema\Exception;
  38166. class ResourceNotFoundException extends \RuntimeException
  38167. {
  38168. }<?php
  38169. namespace JsonSchema\Exception;
  38170. class UriResolverException extends \RuntimeException
  38171. {
  38172. }<?php
  38173. namespace JsonSchema;
  38174. use JsonSchema\Exception\JsonDecodingException;
  38175. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  38176. use JsonSchema\Uri\UriRetriever;
  38177. class RefResolver
  38178. {
  38179. protected static $depth = 0;
  38180. public static $maxDepth = 7;
  38181. protected $uriRetriever = null;
  38182. protected $rootSchema = null;
  38183. public function __construct($retriever = null)
  38184. {
  38185. $this->uriRetriever = $retriever;
  38186. }
  38187. public function fetchRef($ref, $sourceUri)
  38188. {
  38189. $retriever = $this->getUriRetriever();
  38190. $jsonSchema = $retriever->retrieve($ref, $sourceUri);
  38191. $this->resolve($jsonSchema);
  38192. return $jsonSchema;
  38193. }
  38194. public function getUriRetriever()
  38195. {
  38196. if (is_null($this->uriRetriever)) {
  38197. $this->setUriRetriever(new UriRetriever);
  38198. }
  38199. return $this->uriRetriever;
  38200. }
  38201. public function resolve($schema, $sourceUri = null)
  38202. {
  38203. if (self::$depth > self::$maxDepth) {
  38204. self::$depth = 0;
  38205. throw new JsonDecodingException(JSON_ERROR_DEPTH);
  38206. }
  38207. ++self::$depth;
  38208. if (! is_object($schema)) {
  38209. --self::$depth;
  38210. return;
  38211. }
  38212. if (null === $sourceUri && ! empty($schema->id)) {
  38213. $sourceUri = $schema->id;
  38214. }
  38215. if (null === $this->rootSchema) {
  38216. $this->rootSchema = $schema;
  38217. }
  38218. $this->resolveRef($schema, $sourceUri);
  38219. foreach (array('additionalItems', 'additionalProperties', 'extends', 'items') as $propertyName) {
  38220. $this->resolveProperty($schema, $propertyName, $sourceUri);
  38221. }
  38222. foreach (array('disallow', 'extends', 'items', 'type', 'allOf', 'anyOf', 'oneOf') as $propertyName) {
  38223. $this->resolveArrayOfSchemas($schema, $propertyName, $sourceUri);
  38224. }
  38225. foreach (array('dependencies', 'patternProperties', 'properties') as $propertyName) {
  38226. $this->resolveObjectOfSchemas($schema, $propertyName, $sourceUri);
  38227. }
  38228. --self::$depth;
  38229. }
  38230. public function resolveArrayOfSchemas($schema, $propertyName, $sourceUri)
  38231. {
  38232. if (! isset($schema->$propertyName) || ! is_array($schema->$propertyName)) {
  38233. return;
  38234. }
  38235. foreach ($schema->$propertyName as $possiblySchema) {
  38236. $this->resolve($possiblySchema, $sourceUri);
  38237. }
  38238. }
  38239. public function resolveObjectOfSchemas($schema, $propertyName, $sourceUri)
  38240. {
  38241. if (! isset($schema->$propertyName) || ! is_object($schema->$propertyName)) {
  38242. return;
  38243. }
  38244. foreach (get_object_vars($schema->$propertyName) as $possiblySchema) {
  38245. $this->resolve($possiblySchema, $sourceUri);
  38246. }
  38247. }
  38248. public function resolveProperty($schema, $propertyName, $sourceUri)
  38249. {
  38250. if (! isset($schema->$propertyName)) {
  38251. return;
  38252. }
  38253. $this->resolve($schema->$propertyName, $sourceUri);
  38254. }
  38255. public function resolveRef($schema, $sourceUri)
  38256. {
  38257. $ref = '$ref';
  38258. if (empty($schema->$ref)) {
  38259. return;
  38260. }
  38261. $splitRef = explode('#', $schema->$ref, 2);
  38262. $refDoc = $splitRef[0];
  38263. $refPath = null;
  38264. if (count($splitRef) === 2) {
  38265. $refPath = explode('/', $splitRef[1]);
  38266. array_shift($refPath);
  38267. }
  38268. if (empty($refDoc) && empty($refPath)) {
  38269. return;
  38270. }
  38271. if (!empty($refDoc)) {
  38272. $refSchema = $this->fetchRef($refDoc, $sourceUri);
  38273. } else {
  38274. $refSchema = $this->rootSchema;
  38275. }
  38276. if (null !== $refPath) {
  38277. $refSchema = $this->resolveRefSegment($refSchema, $refPath);
  38278. }
  38279. unset($schema->$ref);
  38280. foreach (get_object_vars($refSchema) as $prop => $value) {
  38281. $schema->$prop = $value;
  38282. }
  38283. }
  38284. public function setUriRetriever(UriRetriever $retriever)
  38285. {
  38286. $this->uriRetriever = $retriever;
  38287. return $this;
  38288. }
  38289. protected function resolveRefSegment($data, $pathParts)
  38290. {
  38291. foreach ($pathParts as $path) {
  38292. $path = strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  38293. if (is_array($data)) {
  38294. $data = $data[$path];
  38295. } else {
  38296. $data = $data->{$path};
  38297. }
  38298. }
  38299. return $data;
  38300. }
  38301. }
  38302. <?php
  38303. namespace JsonSchema\Uri\Retrievers;
  38304. abstract class AbstractRetriever implements UriRetrieverInterface
  38305. {
  38306. protected $contentType;
  38307. public function getContentType()
  38308. {
  38309. return $this->contentType;
  38310. }
  38311. }
  38312. <?php
  38313. namespace JsonSchema\Uri\Retrievers;
  38314. use JsonSchema\Validator;
  38315. class Curl extends AbstractRetriever
  38316. {
  38317. protected $messageBody;
  38318. public function __construct()
  38319. {
  38320. if (!function_exists('curl_init')) {
  38321. throw new \RuntimeException("cURL not installed");
  38322. }
  38323. }
  38324. public function retrieve($uri)
  38325. {
  38326. $ch = curl_init();
  38327. curl_setopt($ch, CURLOPT_URL, $uri);
  38328. curl_setopt($ch, CURLOPT_HEADER, true);
  38329. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  38330. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  38331. $response = curl_exec($ch);
  38332. if (false === $response) {
  38333. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  38334. }
  38335. $this->fetchMessageBody($response);
  38336. $this->fetchContentType($response);
  38337. curl_close($ch);
  38338. return $this->messageBody;
  38339. }
  38340. private function fetchMessageBody($response)
  38341. {
  38342. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  38343. $this->messageBody = $match[1];
  38344. }
  38345. protected function fetchContentType($response)
  38346. {
  38347. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  38348. $this->contentType = trim($match[1]);
  38349. return true;
  38350. }
  38351. return false;
  38352. }
  38353. }<?php
  38354. namespace JsonSchema\Uri\Retrievers;
  38355. use JsonSchema\Exception\ResourceNotFoundException;
  38356. use JsonSchema\Validator;
  38357. class FileGetContents extends AbstractRetriever
  38358. {
  38359. protected $messageBody;
  38360. public function retrieve($uri)
  38361. {
  38362. $context = stream_context_create(array(
  38363. 'http' => array(
  38364. 'method' => 'GET',
  38365. 'header' => "Accept: " . Validator::SCHEMA_MEDIA_TYPE
  38366. )));
  38367. set_error_handler(function() use ($uri) {
  38368. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  38369. });
  38370. $response = file_get_contents($uri);
  38371. restore_error_handler();
  38372. if (false === $response) {
  38373. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  38374. }
  38375. if ($response == ''
  38376. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  38377. ) {
  38378. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  38379. }
  38380. $this->messageBody = $response;
  38381. if (! empty($http_response_header)) {
  38382. $this->fetchContentType($http_response_header);
  38383. } else {
  38384. $this->contentType = null;
  38385. }
  38386. return $this->messageBody;
  38387. }
  38388. private function fetchContentType(array $headers)
  38389. {
  38390. foreach ($headers as $header) {
  38391. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  38392. return true;
  38393. }
  38394. }
  38395. return false;
  38396. }
  38397. protected static function getContentTypeMatchInHeader($header)
  38398. {
  38399. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  38400. return trim($match[1]);
  38401. }
  38402. }
  38403. }
  38404. <?php
  38405. namespace JsonSchema\Uri\Retrievers;
  38406. use JsonSchema\Validator;
  38407. class PredefinedArray extends AbstractRetriever
  38408. {
  38409. private $schemas;
  38410. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  38411. {
  38412. $this->schemas = $schemas;
  38413. $this->contentType = $contentType;
  38414. }
  38415. public function retrieve($uri)
  38416. {
  38417. if (!array_key_exists($uri, $this->schemas)) {
  38418. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  38419. 'The JSON schema "%s" was not found.',
  38420. $uri
  38421. ));
  38422. }
  38423. return $this->schemas[$uri];
  38424. }
  38425. }
  38426. <?php
  38427. namespace JsonSchema\Uri\Retrievers;
  38428. interface UriRetrieverInterface
  38429. {
  38430. public function retrieve($uri);
  38431. public function getContentType();
  38432. }<?php
  38433. namespace JsonSchema\Uri;
  38434. use JsonSchema\Exception\UriResolverException;
  38435. class UriResolver
  38436. {
  38437. public function parse($uri)
  38438. {
  38439. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  38440. $components = array();
  38441. if (5 < count($match)) {
  38442. $components = array(
  38443. 'scheme' => $match[2],
  38444. 'authority' => $match[4],
  38445. 'path' => $match[5]
  38446. );
  38447. }
  38448. if (7 < count($match)) {
  38449. $components['query'] = $match[7];
  38450. }
  38451. if (9 < count($match)) {
  38452. $components['fragment'] = $match[9];
  38453. }
  38454. return $components;
  38455. }
  38456. public function generate(array $components)
  38457. {
  38458. $uri = $components['scheme'] . '://'
  38459. . $components['authority']
  38460. . $components['path'];
  38461. if (array_key_exists('query', $components)) {
  38462. $uri .= $components['query'];
  38463. }
  38464. if (array_key_exists('fragment', $components)) {
  38465. $uri .= '#' . $components['fragment'];
  38466. }
  38467. return $uri;
  38468. }
  38469. public function resolve($uri, $baseUri = null)
  38470. {
  38471. if ($uri == '') {
  38472. return $baseUri;
  38473. }
  38474. $components = $this->parse($uri);
  38475. $path = $components['path'];
  38476. if (! empty($components['scheme'])) {
  38477. return $uri;
  38478. }
  38479. $baseComponents = $this->parse($baseUri);
  38480. $basePath = $baseComponents['path'];
  38481. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  38482. if (isset($components['fragment'])) {
  38483. $baseComponents['fragment'] = $components['fragment'];
  38484. }
  38485. return $this->generate($baseComponents);
  38486. }
  38487. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  38488. {
  38489. $relativePath = self::normalizePath($relativePath);
  38490. if ($relativePath == '') {
  38491. return $basePath;
  38492. }
  38493. if ($relativePath{0} == '/') {
  38494. return $relativePath;
  38495. }
  38496. $basePathSegments = explode('/', $basePath);
  38497. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  38498. $numLevelUp = strlen($match[0]) /3 + 1;
  38499. if ($numLevelUp >= count($basePathSegments)) {
  38500. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  38501. }
  38502. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  38503. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  38504. return implode('/', $basePathSegments) . '/' . $path;
  38505. }
  38506. private static function normalizePath($path)
  38507. {
  38508. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  38509. $path = preg_replace('|//|', '/', $path);
  38510. return $path;
  38511. }
  38512. public function isValid($uri)
  38513. {
  38514. $components = $this->parse($uri);
  38515. return !empty($components);
  38516. }
  38517. }
  38518. <?php
  38519. namespace JsonSchema\Uri;
  38520. use JsonSchema\Uri\Retrievers\FileGetContents;
  38521. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  38522. use JsonSchema\Validator;
  38523. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  38524. use JsonSchema\Exception\JsonDecodingException;
  38525. use JsonSchema\Exception\ResourceNotFoundException;
  38526. class UriRetriever
  38527. {
  38528. protected $uriRetriever = null;
  38529. private $schemaCache = array();
  38530. public function confirmMediaType($uriRetriever, $uri)
  38531. {
  38532. $contentType = $uriRetriever->getContentType();
  38533. if (is_null($contentType)) {
  38534. return;
  38535. }
  38536. if (Validator::SCHEMA_MEDIA_TYPE === $contentType) {
  38537. return;
  38538. }
  38539. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  38540. return true;
  38541. }
  38542. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  38543. }
  38544. public function getUriRetriever()
  38545. {
  38546. if (is_null($this->uriRetriever)) {
  38547. $this->setUriRetriever(new FileGetContents);
  38548. }
  38549. return $this->uriRetriever;
  38550. }
  38551. public function resolvePointer($jsonSchema, $uri)
  38552. {
  38553. $resolver = new UriResolver();
  38554. $parsed = $resolver->parse($uri);
  38555. if (empty($parsed['fragment'])) {
  38556. return $jsonSchema;
  38557. }
  38558. $path = explode('/', $parsed['fragment']);
  38559. while ($path) {
  38560. $pathElement = array_shift($path);
  38561. if (! empty($pathElement)) {
  38562. $pathElement = str_replace('~1', '/', $pathElement);
  38563. $pathElement = str_replace('~0', '~', $pathElement);
  38564. if (! empty($jsonSchema->$pathElement)) {
  38565. $jsonSchema = $jsonSchema->$pathElement;
  38566. } else {
  38567. throw new ResourceNotFoundException(
  38568. 'Fragment "' . $parsed['fragment'] . '" not found'
  38569. . ' in ' . $uri
  38570. );
  38571. }
  38572. if (! is_object($jsonSchema)) {
  38573. throw new ResourceNotFoundException(
  38574. 'Fragment part "' . $pathElement . '" is no object '
  38575. . ' in ' . $uri
  38576. );
  38577. }
  38578. }
  38579. }
  38580. return $jsonSchema;
  38581. }
  38582. public function retrieve($uri, $baseUri = null)
  38583. {
  38584. $resolver = new UriResolver();
  38585. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  38586. $arParts = $resolver->parse($resolvedUri);
  38587. if (isset($arParts['fragment'])) {
  38588. unset($arParts['fragment']);
  38589. $fetchUri = $resolver->generate($arParts);
  38590. }
  38591. $jsonSchema = $this->loadSchema($fetchUri);
  38592. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  38593. if ($jsonSchema instanceof \stdClass) {
  38594. $jsonSchema->id = $resolvedUri;
  38595. }
  38596. return $jsonSchema;
  38597. }
  38598. protected function loadSchema($fetchUri)
  38599. {
  38600. if (isset($this->schemaCache[$fetchUri])) {
  38601. return $this->schemaCache[$fetchUri];
  38602. }
  38603. $uriRetriever = $this->getUriRetriever();
  38604. $contents = $this->uriRetriever->retrieve($fetchUri);
  38605. $this->confirmMediaType($uriRetriever, $fetchUri);
  38606. $jsonSchema = json_decode($contents);
  38607. if (JSON_ERROR_NONE < $error = json_last_error()) {
  38608. throw new JsonDecodingException($error);
  38609. }
  38610. $this->schemaCache[$fetchUri] = $jsonSchema;
  38611. return $jsonSchema;
  38612. }
  38613. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  38614. {
  38615. $this->uriRetriever = $uriRetriever;
  38616. return $this;
  38617. }
  38618. public function parse($uri)
  38619. {
  38620. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  38621. $components = array();
  38622. if (5 < count($match)) {
  38623. $components = array(
  38624. 'scheme' => $match[2],
  38625. 'authority' => $match[4],
  38626. 'path' => $match[5]
  38627. );
  38628. }
  38629. if (7 < count($match)) {
  38630. $components['query'] = $match[7];
  38631. }
  38632. if (9 < count($match)) {
  38633. $components['fragment'] = $match[9];
  38634. }
  38635. return $components;
  38636. }
  38637. public function generate(array $components)
  38638. {
  38639. $uri = $components['scheme'] . '://'
  38640. . $components['authority']
  38641. . $components['path'];
  38642. if (array_key_exists('query', $components)) {
  38643. $uri .= $components['query'];
  38644. }
  38645. if (array_key_exists('fragment', $components)) {
  38646. $uri .= $components['fragment'];
  38647. }
  38648. return $uri;
  38649. }
  38650. public function resolve($uri, $baseUri = null)
  38651. {
  38652. $components = $this->parse($uri);
  38653. $path = $components['path'];
  38654. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  38655. return $uri;
  38656. }
  38657. $baseComponents = $this->parse($baseUri);
  38658. $basePath = $baseComponents['path'];
  38659. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  38660. return $this->generate($baseComponents);
  38661. }
  38662. public function isValid($uri)
  38663. {
  38664. $components = $this->parse($uri);
  38665. return !empty($components);
  38666. }
  38667. }
  38668. <?php
  38669. namespace JsonSchema;
  38670. use JsonSchema\Constraints\SchemaConstraint;
  38671. use JsonSchema\Constraints\Constraint;
  38672. class Validator extends Constraint
  38673. {
  38674. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  38675. public function check($value, $schema = null, $path = null, $i = null)
  38676. {
  38677. $validator = $this->getFactory()->createInstanceFor('schema');
  38678. $validator->check($value, $schema);
  38679. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  38680. }
  38681. }
  38682. Copyright (C) 2015 Composer
  38683. Permission is hereby granted, free of charge, to any person obtaining a copy of
  38684. this software and associated documentation files (the "Software"), to deal in
  38685. the Software without restriction, including without limitation the rights to
  38686. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  38687. of the Software, and to permit persons to whom the Software is furnished to do
  38688. so, subject to the following conditions:
  38689. The above copyright notice and this permission notice shall be included in all
  38690. copies or substantial portions of the Software.
  38691. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38692. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38693. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  38694. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38695. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  38696. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  38697. SOFTWARE.
  38698. <?php
  38699. namespace Composer\Spdx;
  38700. class SpdxLicenses
  38701. {
  38702. const LICENSES_FILE = 'spdx-licenses.json';
  38703. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  38704. private $licenses;
  38705. private $licensesExpression;
  38706. private $exceptions;
  38707. private $exceptionsExpression;
  38708. public function __construct()
  38709. {
  38710. $this->loadLicenses();
  38711. $this->loadExceptions();
  38712. }
  38713. public function getLicenseByIdentifier($identifier)
  38714. {
  38715. if (!isset($this->licenses[$identifier])) {
  38716. return;
  38717. }
  38718. $license = $this->licenses[$identifier];
  38719. $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseText';
  38720. return $license;
  38721. }
  38722. public function getExceptionByIdentifier($identifier)
  38723. {
  38724. if (!isset($this->exceptions[$identifier])) {
  38725. return;
  38726. }
  38727. $license = $this->exceptions[$identifier];
  38728. $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText';
  38729. return $license;
  38730. }
  38731. public function getIdentifierByName($name)
  38732. {
  38733. foreach ($this->licenses as $identifier => $licenseData) {
  38734. if ($licenseData[0] === $name) {
  38735. return $identifier;
  38736. }
  38737. }
  38738. foreach ($this->exceptions as $identifier => $licenseData) {
  38739. if ($licenseData[0] === $name) {
  38740. return $identifier;
  38741. }
  38742. }
  38743. }
  38744. public function isOsiApprovedByIdentifier($identifier)
  38745. {
  38746. return $this->licenses[$identifier][1];
  38747. }
  38748. public function validate($license)
  38749. {
  38750. if (is_array($license)) {
  38751. $count = count($license);
  38752. if ($count !== count(array_filter($license, 'is_string'))) {
  38753. throw new \InvalidArgumentException('Array of strings expected.');
  38754. }
  38755. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  38756. }
  38757. if (!is_string($license)) {
  38758. throw new \InvalidArgumentException(sprintf(
  38759. 'Array or String expected, %s given.',
  38760. gettype($license)
  38761. ));
  38762. }
  38763. return $this->isValidLicenseString($license);
  38764. }
  38765. public static function getResourcesDir()
  38766. {
  38767. return dirname(__DIR__) . '/res';
  38768. }
  38769. private function loadLicenses()
  38770. {
  38771. if (null === $this->licenses) {
  38772. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  38773. $this->licenses = json_decode($json, true);
  38774. }
  38775. }
  38776. private function loadExceptions()
  38777. {
  38778. if (null === $this->exceptions) {
  38779. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  38780. $this->exceptions = json_decode($json, true);
  38781. }
  38782. }
  38783. private function getLicensesExpression()
  38784. {
  38785. if (null === $this->licensesExpression) {
  38786. $licenses = array_map('preg_quote', array_keys($this->licenses));
  38787. rsort($licenses);
  38788. $licenses = implode('|', $licenses);
  38789. $this->licensesExpression = $licenses;
  38790. }
  38791. return $this->licensesExpression;
  38792. }
  38793. private function getExceptionsExpression()
  38794. {
  38795. if (null === $this->exceptionsExpression) {
  38796. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  38797. rsort($exceptions);
  38798. $exceptions = implode('|', $exceptions);
  38799. $this->exceptionsExpression = $exceptions;
  38800. }
  38801. return $this->exceptionsExpression;
  38802. }
  38803. private function isValidLicenseString($license)
  38804. {
  38805. if (isset($this->licenses[$license])) {
  38806. return true;
  38807. }
  38808. $licenses = $this->getLicensesExpression();
  38809. $exceptions = $this->getExceptionsExpression();
  38810. $regex = <<<REGEX
  38811. {
  38812. (?(DEFINE)
  38813. # idstring: 1*( ALPHA / DIGIT / - / . )
  38814. (?<idstring>[\pL\pN.-]{1,})
  38815. # license-id: taken from list
  38816. (?<licenseid>${licenses})
  38817. # license-exception-id: taken from list
  38818. (?<licenseexceptionid>${exceptions})
  38819. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  38820. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  38821. # simple-expresssion: license-id / license-id+ / license-ref
  38822. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  38823. # compound-expression: 1*(
  38824. # simple-expression /
  38825. # simple-expression WITH license-exception-id /
  38826. # compound-expression AND compound-expression /
  38827. # compound-expression OR compound-expression
  38828. # ) / ( compound-expression ) )
  38829. (?<compound_head>
  38830. (?&simple_expression) ( \s+ (?:with|WITH) \s+ (?&licenseexceptionid))?
  38831. | \( \s* (?&compound_expression) \s* \)
  38832. )
  38833. (?<compound_expression>
  38834. (?&compound_head) (?: \s+ (?:and|AND|or|OR) \s+ (?&compound_expression))?
  38835. )
  38836. # license-expression: 1*1(simple-expression / compound-expression)
  38837. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  38838. ) # end of define
  38839. ^(NONE | NOASSERTION | (?&license_expression))$
  38840. }x
  38841. REGEX;
  38842. $match = preg_match($regex, $license);
  38843. if (0 === $match) {
  38844. return false;
  38845. }
  38846. if (false === $match) {
  38847. throw new \RuntimeException('Regex failed to compile/run.');
  38848. }
  38849. return true;
  38850. }
  38851. }
  38852. Copyright (C) 2015 Composer
  38853. Permission is hereby granted, free of charge, to any person obtaining a copy of
  38854. this software and associated documentation files (the "Software"), to deal in
  38855. the Software without restriction, including without limitation the rights to
  38856. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  38857. of the Software, and to permit persons to whom the Software is furnished to do
  38858. so, subject to the following conditions:
  38859. The above copyright notice and this permission notice shall be included in all
  38860. copies or substantial portions of the Software.
  38861. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38862. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38863. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  38864. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38865. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  38866. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  38867. SOFTWARE.
  38868. <?php
  38869. namespace Composer\Semver;
  38870. use Composer\Semver\Constraint\Constraint;
  38871. class Comparator
  38872. {
  38873. public static function greaterThan($version1, $version2)
  38874. {
  38875. return self::compare($version1, '>', $version2);
  38876. }
  38877. public static function greaterThanOrEqualTo($version1, $version2)
  38878. {
  38879. return self::compare($version1, '>=', $version2);
  38880. }
  38881. public static function lessThan($version1, $version2)
  38882. {
  38883. return self::compare($version1, '<', $version2);
  38884. }
  38885. public static function lessThanOrEqualTo($version1, $version2)
  38886. {
  38887. return self::compare($version1, '<=', $version2);
  38888. }
  38889. public static function equalTo($version1, $version2)
  38890. {
  38891. return self::compare($version1, '==', $version2);
  38892. }
  38893. public static function notEqualTo($version1, $version2)
  38894. {
  38895. return self::compare($version1, '!=', $version2);
  38896. }
  38897. public static function compare($version1, $operator, $version2)
  38898. {
  38899. $constraint = new Constraint($operator, $version2);
  38900. return $constraint->matches(new Constraint('==', $version1));
  38901. }
  38902. }
  38903. <?php
  38904. namespace Composer\Semver\Constraint;
  38905. trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  38906. abstract class AbstractConstraint implements ConstraintInterface
  38907. {
  38908. protected $prettyString;
  38909. public function matches(ConstraintInterface $provider)
  38910. {
  38911. if ($provider instanceof $this) {
  38912. return $this->matchSpecific($provider);
  38913. }
  38914. return $provider->matches($this);
  38915. }
  38916. public function setPrettyString($prettyString)
  38917. {
  38918. $this->prettyString = $prettyString;
  38919. }
  38920. public function getPrettyString()
  38921. {
  38922. if ($this->prettyString) {
  38923. return $this->prettyString;
  38924. }
  38925. return $this->__toString();
  38926. }
  38927. }
  38928. <?php
  38929. namespace Composer\Semver\Constraint;
  38930. class Constraint implements ConstraintInterface
  38931. {
  38932. const OP_EQ = 0;
  38933. const OP_LT = 1;
  38934. const OP_LE = 2;
  38935. const OP_GT = 3;
  38936. const OP_GE = 4;
  38937. const OP_NE = 5;
  38938. private static $transOpStr = array(
  38939. '=' => self::OP_EQ,
  38940. '==' => self::OP_EQ,
  38941. '<' => self::OP_LT,
  38942. '<=' => self::OP_LE,
  38943. '>' => self::OP_GT,
  38944. '>=' => self::OP_GE,
  38945. '<>' => self::OP_NE,
  38946. '!=' => self::OP_NE,
  38947. );
  38948. private static $transOpInt = array(
  38949. self::OP_EQ => '==',
  38950. self::OP_LT => '<',
  38951. self::OP_LE => '<=',
  38952. self::OP_GT => '>',
  38953. self::OP_GE => '>=',
  38954. self::OP_NE => '!=',
  38955. );
  38956. protected $operator;
  38957. protected $version;
  38958. protected $prettyString;
  38959. public function matches(ConstraintInterface $provider)
  38960. {
  38961. if ($provider instanceof $this) {
  38962. return $this->matchSpecific($provider);
  38963. }
  38964. return $provider->matches($this);
  38965. }
  38966. public function setPrettyString($prettyString)
  38967. {
  38968. $this->prettyString = $prettyString;
  38969. }
  38970. public function getPrettyString()
  38971. {
  38972. if ($this->prettyString) {
  38973. return $this->prettyString;
  38974. }
  38975. return $this->__toString();
  38976. }
  38977. public static function getSupportedOperators()
  38978. {
  38979. return array_keys(self::$transOpStr);
  38980. }
  38981. public function __construct($operator, $version)
  38982. {
  38983. if (!isset(self::$transOpStr[$operator])) {
  38984. throw new \InvalidArgumentException(sprintf(
  38985. 'Invalid operator "%s" given, expected one of: %s',
  38986. $operator,
  38987. implode(', ', self::getSupportedOperators())
  38988. ));
  38989. }
  38990. $this->operator = self::$transOpStr[$operator];
  38991. $this->version = $version;
  38992. }
  38993. public function versionCompare($a, $b, $operator, $compareBranches = false)
  38994. {
  38995. if (!isset(self::$transOpStr[$operator])) {
  38996. throw new \InvalidArgumentException(sprintf(
  38997. 'Invalid operator "%s" given, expected one of: %s',
  38998. $operator,
  38999. implode(', ', self::getSupportedOperators())
  39000. ));
  39001. }
  39002. $aIsBranch = 'dev-' === substr($a, 0, 4);
  39003. $bIsBranch = 'dev-' === substr($b, 0, 4);
  39004. if ($aIsBranch && $bIsBranch) {
  39005. return $operator === '==' && $a === $b;
  39006. }
  39007. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  39008. return false;
  39009. }
  39010. return version_compare($a, $b, $operator);
  39011. }
  39012. public function matchSpecific(Constraint $provider, $compareBranches = false)
  39013. {
  39014. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  39015. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  39016. $isEqualOp = self::OP_EQ === $this->operator;
  39017. $isNonEqualOp = self::OP_NE === $this->operator;
  39018. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  39019. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  39020. if ($isNonEqualOp || $isProviderNonEqualOp) {
  39021. return !$isEqualOp && !$isProviderEqualOp
  39022. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  39023. }
  39024. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  39025. return true;
  39026. }
  39027. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  39028. if ($provider->version === $this->version
  39029. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  39030. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  39031. return false;
  39032. }
  39033. return true;
  39034. }
  39035. return false;
  39036. }
  39037. public function __toString()
  39038. {
  39039. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  39040. }
  39041. }
  39042. <?php
  39043. namespace Composer\Semver\Constraint;
  39044. interface ConstraintInterface
  39045. {
  39046. public function matches(ConstraintInterface $provider);
  39047. public function getPrettyString();
  39048. public function __toString();
  39049. }
  39050. <?php
  39051. namespace Composer\Semver\Constraint;
  39052. class EmptyConstraint implements ConstraintInterface
  39053. {
  39054. protected $prettyString;
  39055. public function matches(ConstraintInterface $provider)
  39056. {
  39057. return true;
  39058. }
  39059. public function setPrettyString($prettyString)
  39060. {
  39061. $this->prettyString = $prettyString;
  39062. }
  39063. public function getPrettyString()
  39064. {
  39065. if ($this->prettyString) {
  39066. return $this->prettyString;
  39067. }
  39068. return $this->__toString();
  39069. }
  39070. public function __toString()
  39071. {
  39072. return '[]';
  39073. }
  39074. }
  39075. <?php
  39076. namespace Composer\Semver\Constraint;
  39077. class MultiConstraint implements ConstraintInterface
  39078. {
  39079. protected $constraints;
  39080. protected $prettyString;
  39081. protected $conjunctive;
  39082. public function __construct(array $constraints, $conjunctive = true)
  39083. {
  39084. $this->constraints = $constraints;
  39085. $this->conjunctive = $conjunctive;
  39086. }
  39087. public function matches(ConstraintInterface $provider)
  39088. {
  39089. if (false === $this->conjunctive) {
  39090. foreach ($this->constraints as $constraint) {
  39091. if ($constraint->matches($provider)) {
  39092. return true;
  39093. }
  39094. }
  39095. return false;
  39096. }
  39097. foreach ($this->constraints as $constraint) {
  39098. if (!$constraint->matches($provider)) {
  39099. return false;
  39100. }
  39101. }
  39102. return true;
  39103. }
  39104. public function setPrettyString($prettyString)
  39105. {
  39106. $this->prettyString = $prettyString;
  39107. }
  39108. public function getPrettyString()
  39109. {
  39110. if ($this->prettyString) {
  39111. return $this->prettyString;
  39112. }
  39113. return $this->__toString();
  39114. }
  39115. public function __toString()
  39116. {
  39117. $constraints = array();
  39118. foreach ($this->constraints as $constraint) {
  39119. $constraints[] = (string) $constraint;
  39120. }
  39121. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  39122. }
  39123. }
  39124. <?php
  39125. namespace Composer\Semver;
  39126. use Composer\Semver\Constraint\Constraint;
  39127. class Semver
  39128. {
  39129. const SORT_ASC = 1;
  39130. const SORT_DESC = -1;
  39131. private static $versionParser;
  39132. public static function satisfies($version, $constraints)
  39133. {
  39134. if (null === self::$versionParser) {
  39135. self::$versionParser = new VersionParser();
  39136. }
  39137. $versionParser = self::$versionParser;
  39138. $provider = new Constraint('==', $versionParser->normalize($version));
  39139. $constraints = $versionParser->parseConstraints($constraints);
  39140. return $constraints->matches($provider);
  39141. }
  39142. public static function satisfiedBy(array $versions, $constraints)
  39143. {
  39144. $versions = array_filter($versions, function ($version) use ($constraints) {
  39145. return Semver::satisfies($version, $constraints);
  39146. });
  39147. return array_values($versions);
  39148. }
  39149. public static function sort(array $versions)
  39150. {
  39151. return self::usort($versions, self::SORT_ASC);
  39152. }
  39153. public static function rsort(array $versions)
  39154. {
  39155. return self::usort($versions, self::SORT_DESC);
  39156. }
  39157. private static function usort(array $versions, $direction)
  39158. {
  39159. if (null === self::$versionParser) {
  39160. self::$versionParser = new VersionParser();
  39161. }
  39162. $versionParser = self::$versionParser;
  39163. $normalized = array();
  39164. foreach ($versions as $key => $version) {
  39165. $normalized[] = array($versionParser->normalize($version), $key);
  39166. }
  39167. usort($normalized, function (array $left, array $right) use ($direction) {
  39168. if ($left[0] === $right[0]) {
  39169. return 0;
  39170. }
  39171. if (Comparator::lessThan($left[0], $right[0])) {
  39172. return -$direction;
  39173. }
  39174. return $direction;
  39175. });
  39176. $sorted = array();
  39177. foreach ($normalized as $item) {
  39178. $sorted[] = $versions[$item[1]];
  39179. }
  39180. return $sorted;
  39181. }
  39182. }
  39183. <?php
  39184. namespace Composer\Semver;
  39185. use Composer\Semver\Constraint\ConstraintInterface;
  39186. use Composer\Semver\Constraint\EmptyConstraint;
  39187. use Composer\Semver\Constraint\MultiConstraint;
  39188. use Composer\Semver\Constraint\Constraint;
  39189. class VersionParser
  39190. {
  39191. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  39192. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  39193. public static function parseStability($version)
  39194. {
  39195. $version = preg_replace('{#.+$}i', '', $version);
  39196. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  39197. return 'dev';
  39198. }
  39199. preg_match('{' . self::$modifierRegex . '$}i', strtolower($version), $match);
  39200. if (!empty($match[3])) {
  39201. return 'dev';
  39202. }
  39203. if (!empty($match[1])) {
  39204. if ('beta' === $match[1] || 'b' === $match[1]) {
  39205. return 'beta';
  39206. }
  39207. if ('alpha' === $match[1] || 'a' === $match[1]) {
  39208. return 'alpha';
  39209. }
  39210. if ('rc' === $match[1]) {
  39211. return 'RC';
  39212. }
  39213. }
  39214. return 'stable';
  39215. }
  39216. public static function normalizeStability($stability)
  39217. {
  39218. $stability = strtolower($stability);
  39219. return $stability === 'rc' ? 'RC' : $stability;
  39220. }
  39221. public function normalize($version, $fullVersion = null)
  39222. {
  39223. $version = trim($version);
  39224. if (null === $fullVersion) {
  39225. $fullVersion = $version;
  39226. }
  39227. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  39228. $version = $match[1];
  39229. }
  39230. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  39231. $version = $match[1];
  39232. }
  39233. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  39234. return '9999999-dev';
  39235. }
  39236. if ('dev-' === strtolower(substr($version, 0, 4))) {
  39237. return 'dev-' . substr($version, 4);
  39238. }
  39239. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  39240. $version = $matches[1]
  39241. . (!empty($matches[2]) ? $matches[2] : '.0')
  39242. . (!empty($matches[3]) ? $matches[3] : '.0')
  39243. . (!empty($matches[4]) ? $matches[4] : '.0');
  39244. $index = 5;
  39245. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  39246. $version = preg_replace('{\D}', '.', $matches[1]);
  39247. $index = 2;
  39248. }
  39249. if (isset($index)) {
  39250. if (!empty($matches[$index])) {
  39251. if ('stable' === $matches[$index]) {
  39252. return $version;
  39253. }
  39254. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  39255. }
  39256. if (!empty($matches[$index + 2])) {
  39257. $version .= '-dev';
  39258. }
  39259. return $version;
  39260. }
  39261. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  39262. try {
  39263. return $this->normalizeBranch($match[1]);
  39264. } catch (\Exception $e) {
  39265. }
  39266. }
  39267. $extraMessage = '';
  39268. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  39269. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  39270. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  39271. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  39272. }
  39273. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  39274. }
  39275. public function parseNumericAliasPrefix($branch)
  39276. {
  39277. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  39278. return $matches['version'] . '.';
  39279. }
  39280. return false;
  39281. }
  39282. public function normalizeBranch($name)
  39283. {
  39284. $name = trim($name);
  39285. if (in_array($name, array('master', 'trunk', 'default'))) {
  39286. return $this->normalize($name);
  39287. }
  39288. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  39289. $version = '';
  39290. for ($i = 1; $i < 5; ++$i) {
  39291. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  39292. }
  39293. return str_replace('x', '9999999', $version) . '-dev';
  39294. }
  39295. return 'dev-' . $name;
  39296. }
  39297. public function parseConstraints($constraints)
  39298. {
  39299. $prettyConstraint = $constraints;
  39300. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  39301. $constraints = empty($match[1]) ? '*' : $match[1];
  39302. }
  39303. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  39304. $constraints = $match[1];
  39305. }
  39306. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  39307. $orGroups = array();
  39308. foreach ($orConstraints as $constraints) {
  39309. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  39310. if (count($andConstraints) > 1) {
  39311. $constraintObjects = array();
  39312. foreach ($andConstraints as $constraint) {
  39313. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  39314. $constraintObjects[] = $parsedConstraint;
  39315. }
  39316. }
  39317. } else {
  39318. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  39319. }
  39320. if (1 === count($constraintObjects)) {
  39321. $constraint = $constraintObjects[0];
  39322. } else {
  39323. $constraint = new MultiConstraint($constraintObjects);
  39324. }
  39325. $orGroups[] = $constraint;
  39326. }
  39327. if (1 === count($orGroups)) {
  39328. $constraint = $orGroups[0];
  39329. } else {
  39330. $constraint = new MultiConstraint($orGroups, false);
  39331. }
  39332. $constraint->setPrettyString($prettyConstraint);
  39333. return $constraint;
  39334. }
  39335. private function parseConstraint($constraint)
  39336. {
  39337. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  39338. $constraint = $match[1];
  39339. if ($match[2] !== 'stable') {
  39340. $stabilityModifier = $match[2];
  39341. }
  39342. }
  39343. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  39344. return array(new EmptyConstraint());
  39345. }
  39346. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  39347. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  39348. if (substr($constraint, 0, 2) === '~>') {
  39349. throw new \UnexpectedValueException(
  39350. 'Could not parse version constraint ' . $constraint . ': ' .
  39351. 'Invalid operator "~>", you probably meant to use the "~" operator'
  39352. );
  39353. }
  39354. if (isset($matches[4]) && '' !== $matches[4]) {
  39355. $position = 4;
  39356. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  39357. $position = 3;
  39358. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  39359. $position = 2;
  39360. } else {
  39361. $position = 1;
  39362. }
  39363. $stabilitySuffix = '';
  39364. if (!empty($matches[5])) {
  39365. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  39366. }
  39367. if (!empty($matches[7])) {
  39368. $stabilitySuffix .= '-dev';
  39369. }
  39370. if (!$stabilitySuffix) {
  39371. $stabilitySuffix = '-dev';
  39372. }
  39373. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  39374. $lowerBound = new Constraint('>=', $lowVersion);
  39375. $highPosition = max(1, $position - 1);
  39376. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  39377. $upperBound = new Constraint('<', $highVersion);
  39378. return array(
  39379. $lowerBound,
  39380. $upperBound,
  39381. );
  39382. }
  39383. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  39384. if ('0' !== $matches[1] || '' === $matches[2]) {
  39385. $position = 1;
  39386. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  39387. $position = 2;
  39388. } else {
  39389. $position = 3;
  39390. }
  39391. $stabilitySuffix = '';
  39392. if (empty($matches[5]) && empty($matches[7])) {
  39393. $stabilitySuffix .= '-dev';
  39394. }
  39395. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  39396. $lowerBound = new Constraint('>=', $lowVersion);
  39397. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  39398. $upperBound = new Constraint('<', $highVersion);
  39399. return array(
  39400. $lowerBound,
  39401. $upperBound,
  39402. );
  39403. }
  39404. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  39405. if (isset($matches[3]) && '' !== $matches[3]) {
  39406. $position = 3;
  39407. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  39408. $position = 2;
  39409. } else {
  39410. $position = 1;
  39411. }
  39412. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  39413. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  39414. if ($lowVersion === '0.0.0.0-dev') {
  39415. return array(new Constraint('<', $highVersion));
  39416. }
  39417. return array(
  39418. new Constraint('>=', $lowVersion),
  39419. new Constraint('<', $highVersion),
  39420. );
  39421. }
  39422. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  39423. $lowStabilitySuffix = '';
  39424. if (empty($matches[6]) && empty($matches[8])) {
  39425. $lowStabilitySuffix = '-dev';
  39426. }
  39427. $lowVersion = $this->normalize($matches['from']);
  39428. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  39429. $empty = function ($x) {
  39430. return ($x === 0 || $x === '0') ? false : empty($x);
  39431. };
  39432. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  39433. $highVersion = $this->normalize($matches['to']);
  39434. $upperBound = new Constraint('<=', $highVersion);
  39435. } else {
  39436. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  39437. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  39438. $upperBound = new Constraint('<', $highVersion);
  39439. }
  39440. return array(
  39441. $lowerBound,
  39442. $upperBound,
  39443. );
  39444. }
  39445. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  39446. try {
  39447. $version = $this->normalize($matches[2]);
  39448. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  39449. $version .= '-' . $stabilityModifier;
  39450. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  39451. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  39452. if (substr($matches[2], 0, 4) !== 'dev-') {
  39453. $version .= '-dev';
  39454. }
  39455. }
  39456. }
  39457. return array(new Constraint($matches[1] ?: '=', $version));
  39458. } catch (\Exception $e) {
  39459. }
  39460. }
  39461. $message = 'Could not parse version constraint ' . $constraint;
  39462. if (isset($e)) {
  39463. $message .= ': ' . $e->getMessage();
  39464. }
  39465. throw new \UnexpectedValueException($message);
  39466. }
  39467. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  39468. {
  39469. for ($i = 4; $i > 0; --$i) {
  39470. if ($i > $position) {
  39471. $matches[$i] = $pad;
  39472. } elseif ($i === $position && $increment) {
  39473. $matches[$i] += $increment;
  39474. if ($matches[$i] < 0) {
  39475. $matches[$i] = $pad;
  39476. --$position;
  39477. if ($i === 1) {
  39478. return;
  39479. }
  39480. }
  39481. }
  39482. }
  39483. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  39484. }
  39485. private function expandStability($stability)
  39486. {
  39487. $stability = strtolower($stability);
  39488. switch ($stability) {
  39489. case 'a':
  39490. return 'alpha';
  39491. case 'b':
  39492. return 'beta';
  39493. case 'p':
  39494. case 'pl':
  39495. return 'patch';
  39496. case 'rc':
  39497. return 'RC';
  39498. default:
  39499. return $stability;
  39500. }
  39501. }
  39502. }
  39503. <?php
  39504. require_once __DIR__ . '/composer' . '/autoload_real.php';
  39505. return ComposerAutoloaderInitComposerPhar1456343641::getLoader();
  39506. <?php
  39507. $vendorDir = dirname(dirname(__FILE__));
  39508. $baseDir = dirname($vendorDir);
  39509. return array(
  39510. );
  39511. <?php
  39512. $vendorDir = dirname(dirname(__FILE__));
  39513. $baseDir = dirname($vendorDir);
  39514. return array(
  39515. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  39516. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  39517. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  39518. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  39519. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  39520. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  39521. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  39522. 'Seld\\CliPrompt\\' => array($vendorDir . '/seld/cli-prompt/src'),
  39523. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  39524. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  39525. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  39526. 'Composer\\' => array($baseDir . '/src/Composer'),
  39527. );
  39528. <?php
  39529. $vendorDir = dirname(dirname(__FILE__));
  39530. $baseDir = dirname($vendorDir);
  39531. return array(
  39532. );
  39533. <?php
  39534. $vendorDir = dirname(dirname(__FILE__));
  39535. $baseDir = dirname($vendorDir);
  39536. return array(
  39537. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  39538. );
  39539. <?php
  39540. class ComposerAutoloaderInitComposerPhar1456343641
  39541. {
  39542. private static $loader;
  39543. public static function loadClassLoader($class)
  39544. {
  39545. if ('Composer\Autoload\ClassLoader' === $class) {
  39546. require __DIR__ . '/ClassLoader.php';
  39547. }
  39548. }
  39549. public static function getLoader()
  39550. {
  39551. if (null !== self::$loader) {
  39552. return self::$loader;
  39553. }
  39554. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1456343641', 'loadClassLoader'), true, true);
  39555. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  39556. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1456343641', 'loadClassLoader'));
  39557. $map = require __DIR__ . '/autoload_namespaces.php';
  39558. foreach ($map as $namespace => $path) {
  39559. $loader->set($namespace, $path);
  39560. }
  39561. $map = require __DIR__ . '/autoload_psr4.php';
  39562. foreach ($map as $namespace => $path) {
  39563. $loader->setPsr4($namespace, $path);
  39564. }
  39565. $classMap = require __DIR__ . '/autoload_classmap.php';
  39566. if ($classMap) {
  39567. $loader->addClassMap($classMap);
  39568. }
  39569. $loader->register(true);
  39570. $includeFiles = require __DIR__ . '/autoload_files.php';
  39571. foreach ($includeFiles as $fileIdentifier => $file) {
  39572. composerRequireComposerPhar1456343641($fileIdentifier, $file);
  39573. }
  39574. return $loader;
  39575. }
  39576. }
  39577. function composerRequireComposerPhar1456343641($fileIdentifier, $file)
  39578. {
  39579. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  39580. require $file;
  39581. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  39582. }
  39583. }
  39584. <?php
  39585. namespace Composer\Autoload;
  39586. class ClassLoader
  39587. {
  39588. private $prefixLengthsPsr4 = array();
  39589. private $prefixDirsPsr4 = array();
  39590. private $fallbackDirsPsr4 = array();
  39591. private $prefixesPsr0 = array();
  39592. private $fallbackDirsPsr0 = array();
  39593. private $useIncludePath = false;
  39594. private $classMap = array();
  39595. private $classMapAuthoritative = false;
  39596. public function getPrefixes()
  39597. {
  39598. if (!empty($this->prefixesPsr0)) {
  39599. return call_user_func_array('array_merge', $this->prefixesPsr0);
  39600. }
  39601. return array();
  39602. }
  39603. public function getPrefixesPsr4()
  39604. {
  39605. return $this->prefixDirsPsr4;
  39606. }
  39607. public function getFallbackDirs()
  39608. {
  39609. return $this->fallbackDirsPsr0;
  39610. }
  39611. public function getFallbackDirsPsr4()
  39612. {
  39613. return $this->fallbackDirsPsr4;
  39614. }
  39615. public function getClassMap()
  39616. {
  39617. return $this->classMap;
  39618. }
  39619. public function addClassMap(array $classMap)
  39620. {
  39621. if ($this->classMap) {
  39622. $this->classMap = array_merge($this->classMap, $classMap);
  39623. } else {
  39624. $this->classMap = $classMap;
  39625. }
  39626. }
  39627. public function add($prefix, $paths, $prepend = false)
  39628. {
  39629. if (!$prefix) {
  39630. if ($prepend) {
  39631. $this->fallbackDirsPsr0 = array_merge(
  39632. (array) $paths,
  39633. $this->fallbackDirsPsr0
  39634. );
  39635. } else {
  39636. $this->fallbackDirsPsr0 = array_merge(
  39637. $this->fallbackDirsPsr0,
  39638. (array) $paths
  39639. );
  39640. }
  39641. return;
  39642. }
  39643. $first = $prefix[0];
  39644. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  39645. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  39646. return;
  39647. }
  39648. if ($prepend) {
  39649. $this->prefixesPsr0[$first][$prefix] = array_merge(
  39650. (array) $paths,
  39651. $this->prefixesPsr0[$first][$prefix]
  39652. );
  39653. } else {
  39654. $this->prefixesPsr0[$first][$prefix] = array_merge(
  39655. $this->prefixesPsr0[$first][$prefix],
  39656. (array) $paths
  39657. );
  39658. }
  39659. }
  39660. public function addPsr4($prefix, $paths, $prepend = false)
  39661. {
  39662. if (!$prefix) {
  39663. if ($prepend) {
  39664. $this->fallbackDirsPsr4 = array_merge(
  39665. (array) $paths,
  39666. $this->fallbackDirsPsr4
  39667. );
  39668. } else {
  39669. $this->fallbackDirsPsr4 = array_merge(
  39670. $this->fallbackDirsPsr4,
  39671. (array) $paths
  39672. );
  39673. }
  39674. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  39675. $length = strlen($prefix);
  39676. if ('\\' !== $prefix[$length - 1]) {
  39677. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  39678. }
  39679. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  39680. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  39681. } elseif ($prepend) {
  39682. $this->prefixDirsPsr4[$prefix] = array_merge(
  39683. (array) $paths,
  39684. $this->prefixDirsPsr4[$prefix]
  39685. );
  39686. } else {
  39687. $this->prefixDirsPsr4[$prefix] = array_merge(
  39688. $this->prefixDirsPsr4[$prefix],
  39689. (array) $paths
  39690. );
  39691. }
  39692. }
  39693. public function set($prefix, $paths)
  39694. {
  39695. if (!$prefix) {
  39696. $this->fallbackDirsPsr0 = (array) $paths;
  39697. } else {
  39698. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  39699. }
  39700. }
  39701. public function setPsr4($prefix, $paths)
  39702. {
  39703. if (!$prefix) {
  39704. $this->fallbackDirsPsr4 = (array) $paths;
  39705. } else {
  39706. $length = strlen($prefix);
  39707. if ('\\' !== $prefix[$length - 1]) {
  39708. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  39709. }
  39710. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  39711. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  39712. }
  39713. }
  39714. public function setUseIncludePath($useIncludePath)
  39715. {
  39716. $this->useIncludePath = $useIncludePath;
  39717. }
  39718. public function getUseIncludePath()
  39719. {
  39720. return $this->useIncludePath;
  39721. }
  39722. public function setClassMapAuthoritative($classMapAuthoritative)
  39723. {
  39724. $this->classMapAuthoritative = $classMapAuthoritative;
  39725. }
  39726. public function isClassMapAuthoritative()
  39727. {
  39728. return $this->classMapAuthoritative;
  39729. }
  39730. public function register($prepend = false)
  39731. {
  39732. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  39733. }
  39734. public function unregister()
  39735. {
  39736. spl_autoload_unregister(array($this, 'loadClass'));
  39737. }
  39738. public function loadClass($class)
  39739. {
  39740. if ($file = $this->findFile($class)) {
  39741. includeFile($file);
  39742. return true;
  39743. }
  39744. }
  39745. public function findFile($class)
  39746. {
  39747. if ('\\' == $class[0]) {
  39748. $class = substr($class, 1);
  39749. }
  39750. if (isset($this->classMap[$class])) {
  39751. return $this->classMap[$class];
  39752. }
  39753. if ($this->classMapAuthoritative) {
  39754. return false;
  39755. }
  39756. $file = $this->findFileWithExtension($class, '.php');
  39757. if ($file === null && defined('HHVM_VERSION')) {
  39758. $file = $this->findFileWithExtension($class, '.hh');
  39759. }
  39760. if ($file === null) {
  39761. return $this->classMap[$class] = false;
  39762. }
  39763. return $file;
  39764. }
  39765. private function findFileWithExtension($class, $ext)
  39766. {
  39767. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  39768. $first = $class[0];
  39769. if (isset($this->prefixLengthsPsr4[$first])) {
  39770. foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
  39771. if (0 === strpos($class, $prefix)) {
  39772. foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
  39773. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
  39774. return $file;
  39775. }
  39776. }
  39777. }
  39778. }
  39779. }
  39780. foreach ($this->fallbackDirsPsr4 as $dir) {
  39781. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  39782. return $file;
  39783. }
  39784. }
  39785. if (false !== $pos = strrpos($class, '\\')) {
  39786. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  39787. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  39788. } else {
  39789. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  39790. }
  39791. if (isset($this->prefixesPsr0[$first])) {
  39792. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  39793. if (0 === strpos($class, $prefix)) {
  39794. foreach ($dirs as $dir) {
  39795. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  39796. return $file;
  39797. }
  39798. }
  39799. }
  39800. }
  39801. }
  39802. foreach ($this->fallbackDirsPsr0 as $dir) {
  39803. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  39804. return $file;
  39805. }
  39806. }
  39807. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  39808. return $file;
  39809. }
  39810. }
  39811. }
  39812. function includeFile($file)
  39813. {
  39814. include $file;
  39815. }
  39816. ##
  39817. ## Bundle of CA Root Certificates
  39818. ##
  39819. ## Certificate data from Mozilla as of: Wed Oct 28 22:42:42 2015
  39820. ##
  39821. ## This is a bundle of X.509 certificates of public Certificate Authorities
  39822. ## (CA). These were automatically extracted from Mozilla's root certificates
  39823. ## file (certdata.txt). This file can be found at
  39824. ## https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt
  39825. ##
  39826. ## It contains the certificates in PEM format and therefore
  39827. ## can be directly used with curl / libcurl / php_curl, or with
  39828. ## an Apache+mod_ssl webserver for SSL client authentication.
  39829. ## Just configure this file as the SSLCACertificateFile.
  39830. ##
  39831. ## Conversion done with mk-ca-bundle.pl version 1.25.
  39832. ## SHA1: 6d7d2f0a4fae587e7431be191a081ac1257d300a
  39833. ##
  39834. Equifax Secure CA
  39835. =================
  39836. -----BEGIN CERTIFICATE-----
  39837. MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
  39838. ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
  39839. MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
  39840. B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
  39841. nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
  39842. fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
  39843. 8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
  39844. A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
  39845. CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
  39846. A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
  39847. spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
  39848. Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
  39849. zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB
  39850. BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95
  39851. 70+sB3c4
  39852. -----END CERTIFICATE-----
  39853. GlobalSign Root CA
  39854. ==================
  39855. -----BEGIN CERTIFICATE-----
  39856. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  39857. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  39858. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  39859. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  39860. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  39861. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  39862. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  39863. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  39864. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  39865. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  39866. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  39867. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  39868. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  39869. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  39870. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  39871. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  39872. -----END CERTIFICATE-----
  39873. GlobalSign Root CA - R2
  39874. =======================
  39875. -----BEGIN CERTIFICATE-----
  39876. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  39877. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  39878. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  39879. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  39880. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  39881. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  39882. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  39883. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  39884. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  39885. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  39886. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  39887. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  39888. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  39889. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  39890. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  39891. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  39892. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  39893. -----END CERTIFICATE-----
  39894. Verisign Class 3 Public Primary Certification Authority - G3
  39895. ============================================================
  39896. -----BEGIN CERTIFICATE-----
  39897. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  39898. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  39899. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  39900. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  39901. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  39902. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  39903. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  39904. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  39905. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  39906. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  39907. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  39908. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  39909. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  39910. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  39911. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  39912. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  39913. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  39914. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  39915. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  39916. -----END CERTIFICATE-----
  39917. Verisign Class 4 Public Primary Certification Authority - G3
  39918. ============================================================
  39919. -----BEGIN CERTIFICATE-----
  39920. MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  39921. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  39922. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  39923. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  39924. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  39925. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  39926. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  39927. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkg
  39928. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  39929. ggEBAK3LpRFpxlmr8Y+1GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaS
  39930. tBO3IFsJ+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0GbdU6LM
  39931. 8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLmNxdLMEYH5IBtptiW
  39932. Lugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XYufTsgsbSPZUd5cBPhMnZo0QoBmrX
  39933. Razwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  39934. j/ola09b5KROJ1WrIhVZPMq1CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXtt
  39935. mhwwjIDLk5Mqg6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm
  39936. fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c2NU8Qh0XwRJd
  39937. RTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/bLvSHgCwIe34QWKCudiyxLtG
  39938. UPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg==
  39939. -----END CERTIFICATE-----
  39940. Entrust.net Premium 2048 Secure Server CA
  39941. =========================================
  39942. -----BEGIN CERTIFICATE-----
  39943. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  39944. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  39945. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  39946. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  39947. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  39948. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  39949. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  39950. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  39951. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  39952. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  39953. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  39954. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  39955. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  39956. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  39957. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  39958. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  39959. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  39960. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  39961. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  39962. -----END CERTIFICATE-----
  39963. Baltimore CyberTrust Root
  39964. =========================
  39965. -----BEGIN CERTIFICATE-----
  39966. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  39967. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  39968. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  39969. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  39970. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  39971. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  39972. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  39973. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  39974. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  39975. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  39976. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  39977. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  39978. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  39979. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  39980. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  39981. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  39982. -----END CERTIFICATE-----
  39983. AddTrust Low-Value Services Root
  39984. ================================
  39985. -----BEGIN CERTIFICATE-----
  39986. MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  39987. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU
  39988. cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw
  39989. CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO
  39990. ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB
  39991. AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6
  39992. 54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr
  39993. oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1
  39994. Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui
  39995. GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w
  39996. HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD
  39997. AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT
  39998. RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw
  39999. HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt
  40000. ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph
  40001. iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY
  40002. eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr
  40003. mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj
  40004. ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk=
  40005. -----END CERTIFICATE-----
  40006. AddTrust External Root
  40007. ======================
  40008. -----BEGIN CERTIFICATE-----
  40009. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  40010. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  40011. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  40012. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  40013. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  40014. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  40015. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  40016. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  40017. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  40018. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  40019. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  40020. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  40021. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  40022. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  40023. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  40024. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  40025. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  40026. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  40027. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  40028. -----END CERTIFICATE-----
  40029. AddTrust Public Services Root
  40030. =============================
  40031. -----BEGIN CERTIFICATE-----
  40032. MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  40033. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU
  40034. cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ
  40035. BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l
  40036. dHdvcmsxIDAeBgNVBAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEF
  40037. AAOCAQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV6tsfSlbu
  40038. nyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nXGCwwfQ56HmIexkvA/X1i
  40039. d9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnPdzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSG
  40040. Aa2Il+tmzV7R/9x98oTaunet3IAIx6eH1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAw
  40041. HM+A+WD+eeSI8t0A65RF62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0G
  40042. A1UdDgQWBBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  40043. /zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDELMAkGA1UEBhMCU0Ux
  40044. FDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29yazEgMB4G
  40045. A1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4
  40046. JNojVhaTdt02KLmuG7jD8WS6IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL
  40047. +YPoRNWyQSW/iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao
  40048. GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh4SINhwBk/ox9
  40049. Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQmXiLsks3/QppEIW1cxeMiHV9H
  40050. EufOX1362KqxMy3ZdvJOOjMMK7MtkAY=
  40051. -----END CERTIFICATE-----
  40052. AddTrust Qualified Certificates Root
  40053. ====================================
  40054. -----BEGIN CERTIFICATE-----
  40055. MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  40056. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU
  40057. cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx
  40058. CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ
  40059. IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG
  40060. 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx
  40061. 64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3
  40062. KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o
  40063. L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR
  40064. wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU
  40065. MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/
  40066. BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE
  40067. BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y
  40068. azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD
  40069. ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG
  40070. GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X
  40071. dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze
  40072. RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB
  40073. iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE=
  40074. -----END CERTIFICATE-----
  40075. Entrust Root Certification Authority
  40076. ====================================
  40077. -----BEGIN CERTIFICATE-----
  40078. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  40079. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  40080. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  40081. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  40082. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  40083. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  40084. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  40085. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  40086. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  40087. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  40088. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  40089. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  40090. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  40091. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  40092. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  40093. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  40094. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  40095. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  40096. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  40097. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  40098. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  40099. -----END CERTIFICATE-----
  40100. RSA Security 2048 v3
  40101. ====================
  40102. -----BEGIN CERTIFICATE-----
  40103. MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK
  40104. ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy
  40105. MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb
  40106. BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
  40107. AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7
  40108. Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb
  40109. WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH
  40110. KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP
  40111. +Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/
  40112. MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E
  40113. FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY
  40114. v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj
  40115. 0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj
  40116. VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395
  40117. nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA
  40118. pKnXwiJPZ9d37CAFYd4=
  40119. -----END CERTIFICATE-----
  40120. GeoTrust Global CA
  40121. ==================
  40122. -----BEGIN CERTIFICATE-----
  40123. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  40124. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  40125. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  40126. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  40127. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  40128. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  40129. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  40130. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  40131. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  40132. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  40133. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  40134. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  40135. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  40136. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  40137. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  40138. Mw==
  40139. -----END CERTIFICATE-----
  40140. GeoTrust Global CA 2
  40141. ====================
  40142. -----BEGIN CERTIFICATE-----
  40143. MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  40144. R2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwHhcNMDQwMzA0MDUw
  40145. MDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  40146. LjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  40147. ggEKAoIBAQDvPE1APRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/
  40148. NTL8Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hLTytCOb1k
  40149. LUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL5mkWRxHCJ1kDs6ZgwiFA
  40150. Vvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7S4wMcoKK+xfNAGw6EzywhIdLFnopsk/b
  40151. HdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQF
  40152. MAMBAf8wHQYDVR0OBBYEFHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNH
  40153. K266ZUapEBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6tdEPx7
  40154. srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv/NgdRN3ggX+d6Yvh
  40155. ZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywNA0ZF66D0f0hExghAzN4bcLUprbqL
  40156. OzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkC
  40157. x1YAzUm5s2x7UwQa4qjJqhIFI8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqF
  40158. H4z1Ir+rzoPz4iIprn2DQKi6bA==
  40159. -----END CERTIFICATE-----
  40160. GeoTrust Universal CA
  40161. =====================
  40162. -----BEGIN CERTIFICATE-----
  40163. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  40164. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  40165. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  40166. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  40167. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  40168. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  40169. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  40170. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  40171. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  40172. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  40173. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  40174. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  40175. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  40176. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  40177. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  40178. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  40179. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  40180. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  40181. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  40182. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  40183. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  40184. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  40185. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  40186. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  40187. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  40188. -----END CERTIFICATE-----
  40189. GeoTrust Universal CA 2
  40190. =======================
  40191. -----BEGIN CERTIFICATE-----
  40192. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  40193. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  40194. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  40195. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  40196. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  40197. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  40198. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  40199. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  40200. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  40201. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  40202. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  40203. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  40204. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  40205. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  40206. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  40207. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  40208. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  40209. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  40210. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  40211. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  40212. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  40213. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  40214. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  40215. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  40216. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  40217. -----END CERTIFICATE-----
  40218. Visa eCommerce Root
  40219. ===================
  40220. -----BEGIN CERTIFICATE-----
  40221. MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
  40222. EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
  40223. QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
  40224. WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
  40225. VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
  40226. bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
  40227. F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
  40228. RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
  40229. TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
  40230. /k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
  40231. GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
  40232. MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
  40233. CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
  40234. YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
  40235. zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
  40236. YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
  40237. 398znM/jra6O1I7mT1GvFpLgXPYHDw==
  40238. -----END CERTIFICATE-----
  40239. Certum Root CA
  40240. ==============
  40241. -----BEGIN CERTIFICATE-----
  40242. MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
  40243. ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
  40244. Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
  40245. by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
  40246. wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
  40247. kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
  40248. 89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
  40249. Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
  40250. NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
  40251. hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
  40252. GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
  40253. GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
  40254. 0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
  40255. qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
  40256. -----END CERTIFICATE-----
  40257. Comodo AAA Services root
  40258. ========================
  40259. -----BEGIN CERTIFICATE-----
  40260. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  40261. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  40262. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  40263. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  40264. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  40265. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  40266. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  40267. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  40268. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  40269. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  40270. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  40271. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  40272. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  40273. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  40274. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  40275. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  40276. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  40277. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  40278. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  40279. -----END CERTIFICATE-----
  40280. Comodo Secure Services root
  40281. ===========================
  40282. -----BEGIN CERTIFICATE-----
  40283. MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  40284. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  40285. TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw
  40286. MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu
  40287. Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi
  40288. BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
  40289. ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP
  40290. 9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc
  40291. rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC
  40292. oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V
  40293. p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E
  40294. FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  40295. gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj
  40296. YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm
  40297. aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm
  40298. 4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj
  40299. Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL
  40300. DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw
  40301. pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H
  40302. RR3B7Hzs/Sk=
  40303. -----END CERTIFICATE-----
  40304. Comodo Trusted Services root
  40305. ============================
  40306. -----BEGIN CERTIFICATE-----
  40307. MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  40308. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  40309. TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw
  40310. MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1h
  40311. bmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUw
  40312. IwYDVQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOC
  40313. AQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWWfnJSoBVC21ndZHoa0Lh7
  40314. 3TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMtTGo87IvDktJTdyR0nAducPy9C1t2ul/y
  40315. /9c3S0pgePfw+spwtOpZqqPOSC+pw7ILfhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6
  40316. juljatEPmsbS9Is6FARW1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsS
  40317. ivnkBbA7kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0GA1Ud
  40318. DgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  40319. /zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21vZG9jYS5jb20vVHJ1c3RlZENlcnRp
  40320. ZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRodHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENl
  40321. cnRpZmljYXRlU2VydmljZXMuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8Ntw
  40322. uleGFTQQuS9/HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32
  40323. pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxISjBc/lDb+XbDA
  40324. BHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+xqFx7D+gIIxmOom0jtTYsU0l
  40325. R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O
  40326. 9y5Xt5hwXsjEeLBi
  40327. -----END CERTIFICATE-----
  40328. QuoVadis Root CA
  40329. ================
  40330. -----BEGIN CERTIFICATE-----
  40331. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  40332. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  40333. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  40334. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  40335. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  40336. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  40337. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  40338. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  40339. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  40340. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  40341. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  40342. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  40343. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  40344. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  40345. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  40346. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  40347. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  40348. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  40349. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  40350. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  40351. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  40352. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  40353. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  40354. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  40355. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  40356. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  40357. 5nrQNiOKSnQ2+Q==
  40358. -----END CERTIFICATE-----
  40359. QuoVadis Root CA 2
  40360. ==================
  40361. -----BEGIN CERTIFICATE-----
  40362. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  40363. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  40364. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  40365. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  40366. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  40367. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  40368. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  40369. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  40370. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  40371. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  40372. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  40373. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  40374. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  40375. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  40376. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  40377. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  40378. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  40379. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  40380. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  40381. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  40382. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  40383. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  40384. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  40385. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  40386. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  40387. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  40388. -----END CERTIFICATE-----
  40389. QuoVadis Root CA 3
  40390. ==================
  40391. -----BEGIN CERTIFICATE-----
  40392. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  40393. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  40394. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  40395. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  40396. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  40397. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  40398. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  40399. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  40400. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  40401. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  40402. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  40403. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  40404. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  40405. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  40406. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  40407. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  40408. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  40409. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  40410. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  40411. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  40412. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  40413. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  40414. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  40415. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  40416. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  40417. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  40418. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  40419. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  40420. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  40421. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  40422. -----END CERTIFICATE-----
  40423. Security Communication Root CA
  40424. ==============================
  40425. -----BEGIN CERTIFICATE-----
  40426. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  40427. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  40428. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  40429. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  40430. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  40431. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  40432. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  40433. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  40434. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  40435. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  40436. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  40437. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  40438. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  40439. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  40440. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  40441. FL39vmwLAw==
  40442. -----END CERTIFICATE-----
  40443. Sonera Class 2 Root CA
  40444. ======================
  40445. -----BEGIN CERTIFICATE-----
  40446. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  40447. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  40448. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  40449. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  40450. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  40451. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  40452. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  40453. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  40454. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  40455. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  40456. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  40457. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  40458. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  40459. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  40460. llpwrN9M
  40461. -----END CERTIFICATE-----
  40462. Staat der Nederlanden Root CA
  40463. =============================
  40464. -----BEGIN CERTIFICATE-----
  40465. MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJOTDEeMBwGA1UE
  40466. ChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  40467. Um9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEyMTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4w
  40468. HAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxh
  40469. bmRlbiBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFt
  40470. vsznExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw719tV2U02P
  40471. jLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MOhXeiD+EwR+4A5zN9RGca
  40472. C1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+UtFE5A3+y3qcym7RHjm+0Sq7lr7HcsBth
  40473. vJly3uSJt3omXdozSVtSnA71iq3DuD3oBmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn6
  40474. 22r+I/q85Ej0ZytqERAhSQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRV
  40475. HSAAMDwwOgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMvcm9v
  40476. dC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA7Jbg0zTBLL9s+DAN
  40477. BgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k/rvuFbQvBgwp8qiSpGEN/KtcCFtR
  40478. EytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzmeafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbw
  40479. MVcoEoJz6TMvplW0C5GUR5z6u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3y
  40480. nGQI0DvDKcWy7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR
  40481. iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw==
  40482. -----END CERTIFICATE-----
  40483. UTN DATACorp SGC Root CA
  40484. ========================
  40485. -----BEGIN CERTIFICATE-----
  40486. MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCBkzELMAkGA1UE
  40487. BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
  40488. IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZ
  40489. BgNVBAMTElVUTiAtIERBVEFDb3JwIFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBa
  40490. MIGTMQswCQYDVQQGEwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4w
  40491. HAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRy
  40492. dXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOC
  40493. AQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ys
  40494. raP6LnD43m77VkIVni5c7yPeIbkFdicZD0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlo
  40495. wHDyUwDAXlCCpVZvNvlK4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA
  40496. 9P4yPykqlXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulWbfXv
  40497. 33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQABo4GrMIGoMAsGA1Ud
  40498. DwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRTMtGzz3/64PGgXYVOktKeRR20TzA9
  40499. BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dD
  40500. LmNybDAqBgNVHSUEIzAhBggrBgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3
  40501. DQEBBQUAA4IBAQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft
  40502. Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyjj98C5OBxOvG0
  40503. I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVHKWss5nbZqSl9Mt3JNjy9rjXx
  40504. EZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwP
  40505. DPafepE39peC4N1xaf92P2BNPM/3mfnGV/TJVTl4uix5yaaIK/QI
  40506. -----END CERTIFICATE-----
  40507. UTN USERFirst Hardware Root CA
  40508. ==============================
  40509. -----BEGIN CERTIFICATE-----
  40510. MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE
  40511. BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
  40512. IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd
  40513. BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx
  40514. OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0
  40515. eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVz
  40516. ZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwggEiMA0GCSqGSIb3
  40517. DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlI
  40518. wrthdBKWHTxqctU8EGc6Oe0rE81m65UJM6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFd
  40519. tqdt++BxF2uiiPsA3/4aMXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8
  40520. i4fDidNdoI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqIDsjf
  40521. Pe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9KsyoUhbAgMBAAGjgbkw
  40522. gbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKFyXyYbKJhDlV0HN9WF
  40523. lp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNF
  40524. UkZpcnN0LUhhcmR3YXJlLmNybDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUF
  40525. BwMGBggrBgEFBQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
  40526. //bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28GpgoiskliCE7/yMgUsogW
  40527. XecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gECJChicsZUN/KHAG8HQQZexB2
  40528. lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kn
  40529. iCrVWFCVH/A7HFe7fRQ5YiuayZSSKqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67
  40530. nfhmqA==
  40531. -----END CERTIFICATE-----
  40532. Camerfirma Chambers of Commerce Root
  40533. ====================================
  40534. -----BEGIN CERTIFICATE-----
  40535. MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  40536. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  40537. ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
  40538. NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
  40539. cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
  40540. MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
  40541. AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
  40542. xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
  40543. NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
  40544. DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
  40545. d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
  40546. EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
  40547. cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
  40548. AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
  40549. bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
  40550. VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
  40551. aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
  40552. fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
  40553. L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
  40554. UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
  40555. ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
  40556. erfutGWaIZDgqtCYvDi1czyL+Nw=
  40557. -----END CERTIFICATE-----
  40558. Camerfirma Global Chambersign Root
  40559. ==================================
  40560. -----BEGIN CERTIFICATE-----
  40561. MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  40562. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  40563. ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
  40564. NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
  40565. YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
  40566. MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
  40567. ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
  40568. 1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
  40569. by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
  40570. 6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
  40571. 8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
  40572. BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
  40573. aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
  40574. Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
  40575. aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
  40576. ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
  40577. bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
  40578. PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
  40579. gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
  40580. PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
  40581. IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
  40582. t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
  40583. -----END CERTIFICATE-----
  40584. NetLock Notary (Class A) Root
  40585. =============================
  40586. -----BEGIN CERTIFICATE-----
  40587. MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQI
  40588. EwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6
  40589. dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9j
  40590. ayBLb3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oX
  40591. DTE5MDIxOTIzMTQ0N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQH
  40592. EwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYD
  40593. VQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFz
  40594. cyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSM
  40595. D7tM9DceqQWC2ObhbHDqeLVu0ThEDaiDzl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZ
  40596. z+qMkjvN9wfcZnSX9EUi3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC
  40597. /tmwqcm8WgD/qaiYdPv2LD4VOQ22BFWoDpggQrOxJa1+mm9dU7GrDPzr4PN6s6iz/0b2Y6LYOph7
  40598. tqyF/7AlT3Rj5xMHpQqPBffAZG9+pyeAlt7ULoZgx2srXnN7F+eRP2QM2EsiNCubMvJIH5+hCoR6
  40599. 4sKtlz2O1cH5VqNQ6ca0+pii7pXmKgOM3wIDAQABo4ICnzCCApswDgYDVR0PAQH/BAQDAgAGMBIG
  40600. A1UdEwEB/wQIMAYBAf8CAQQwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaC
  40601. Ak1GSUdZRUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pv
  40602. bGdhbHRhdGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQu
  40603. IEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2Vn
  40604. LWJpenRvc2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0
  40605. ZXRlbGUgYXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFz
  40606. IGxlaXJhc2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBh
  40607. IGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVu
  40608. b3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBh
  40609. bmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sg
  40610. Q1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFp
  40611. bCBhdCBjcHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5
  40612. ayZrU3/b39/zcT0mwBQOxmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjP
  40613. ytoUMaFP0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQQeJB
  40614. CWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxkf1qbFFgBJ34TUMdr
  40615. KuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK8CtmdWOMovsEPoMOmzbwGOQmIMOM
  40616. 8CgHrTwXZoi1/baI
  40617. -----END CERTIFICATE-----
  40618. XRamp Global CA Root
  40619. ====================
  40620. -----BEGIN CERTIFICATE-----
  40621. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  40622. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  40623. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  40624. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  40625. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  40626. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  40627. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  40628. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  40629. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  40630. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  40631. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  40632. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  40633. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  40634. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  40635. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  40636. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  40637. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  40638. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  40639. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  40640. -----END CERTIFICATE-----
  40641. Go Daddy Class 2 CA
  40642. ===================
  40643. -----BEGIN CERTIFICATE-----
  40644. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  40645. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  40646. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  40647. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  40648. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  40649. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  40650. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  40651. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  40652. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  40653. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  40654. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  40655. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  40656. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  40657. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  40658. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  40659. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  40660. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  40661. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  40662. vZ8=
  40663. -----END CERTIFICATE-----
  40664. Starfield Class 2 CA
  40665. ====================
  40666. -----BEGIN CERTIFICATE-----
  40667. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  40668. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  40669. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  40670. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  40671. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  40672. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  40673. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  40674. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  40675. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  40676. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  40677. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  40678. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  40679. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  40680. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  40681. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  40682. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  40683. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  40684. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  40685. QBFGmh95DmK/D5fs4C8fF5Q=
  40686. -----END CERTIFICATE-----
  40687. StartCom Certification Authority
  40688. ================================
  40689. -----BEGIN CERTIFICATE-----
  40690. MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  40691. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  40692. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  40693. NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  40694. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  40695. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  40696. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  40697. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  40698. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  40699. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  40700. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  40701. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  40702. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  40703. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  40704. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  40705. 37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
  40706. FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
  40707. Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
  40708. YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
  40709. AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
  40710. Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
  40711. U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
  40712. LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
  40713. cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
  40714. cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
  40715. dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
  40716. AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
  40717. 3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
  40718. vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
  40719. fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
  40720. fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
  40721. EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
  40722. yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
  40723. 1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
  40724. lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
  40725. g14=
  40726. -----END CERTIFICATE-----
  40727. Taiwan GRCA
  40728. ===========
  40729. -----BEGIN CERTIFICATE-----
  40730. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  40731. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  40732. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  40733. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  40734. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  40735. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  40736. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  40737. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  40738. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  40739. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  40740. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  40741. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  40742. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  40743. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  40744. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  40745. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  40746. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  40747. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  40748. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  40749. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  40750. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  40751. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  40752. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  40753. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  40754. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  40755. -----END CERTIFICATE-----
  40756. Swisscom Root CA 1
  40757. ==================
  40758. -----BEGIN CERTIFICATE-----
  40759. MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQG
  40760. EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
  40761. dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4
  40762. MTgyMjA2MjBaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
  40763. aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIIC
  40764. IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9m2BtRsiM
  40765. MW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdihFvkcxC7mlSpnzNApbjyF
  40766. NDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/TilftKaNXXsLmREDA/7n29uj/x2lzZAe
  40767. AR81sH8A25Bvxn570e56eqeqDFdvpG3FEzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkC
  40768. b6dJtDZd0KTeByy2dbcokdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn
  40769. 7uHbHaBuHYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNFvJbN
  40770. cA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo19AOeCMgkckkKmUp
  40771. WyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjCL3UcPX7ape8eYIVpQtPM+GP+HkM5
  40772. haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJWbjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNY
  40773. MUJDLXT5xp6mig/p/r+D5kNXJLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
  40774. HQYDVR0hBBYwFDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j
  40775. BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzcK6FptWfUjNP9
  40776. MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzfky9NfEBWMXrrpA9gzXrzvsMn
  40777. jgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7IkVh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQ
  40778. MbFamIp1TpBcahQq4FJHgmDmHtqBsfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4H
  40779. VtA4oJVwIHaM190e3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtl
  40780. vrsRls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ipmXeascCl
  40781. OS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HHb6D0jqTsNFFbjCYDcKF3
  40782. 1QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksfrK/7DZBaZmBwXarNeNQk7shBoJMBkpxq
  40783. nvy5JMWzFYJ+vq6VK+uxwNrjAWALXmmshFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCy
  40784. x/yP2FS1k2Kdzs9Z+z0YzirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMW
  40785. NY6E0F/6MBr1mmz0DlP5OlvRHA==
  40786. -----END CERTIFICATE-----
  40787. DigiCert Assured ID Root CA
  40788. ===========================
  40789. -----BEGIN CERTIFICATE-----
  40790. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  40791. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  40792. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  40793. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  40794. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  40795. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  40796. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  40797. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  40798. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  40799. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  40800. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  40801. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  40802. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  40803. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  40804. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  40805. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  40806. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  40807. -----END CERTIFICATE-----
  40808. DigiCert Global Root CA
  40809. =======================
  40810. -----BEGIN CERTIFICATE-----
  40811. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  40812. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  40813. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  40814. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  40815. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  40816. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  40817. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  40818. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  40819. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  40820. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  40821. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  40822. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  40823. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  40824. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  40825. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  40826. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  40827. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  40828. -----END CERTIFICATE-----
  40829. DigiCert High Assurance EV Root CA
  40830. ==================================
  40831. -----BEGIN CERTIFICATE-----
  40832. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  40833. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  40834. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  40835. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  40836. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  40837. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  40838. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  40839. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  40840. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  40841. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  40842. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  40843. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  40844. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  40845. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  40846. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  40847. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  40848. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  40849. -----END CERTIFICATE-----
  40850. Certplus Class 2 Primary CA
  40851. ===========================
  40852. -----BEGIN CERTIFICATE-----
  40853. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  40854. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  40855. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  40856. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  40857. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  40858. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  40859. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  40860. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  40861. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  40862. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  40863. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  40864. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  40865. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  40866. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  40867. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  40868. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  40869. l7+ijrRU
  40870. -----END CERTIFICATE-----
  40871. DST Root CA X3
  40872. ==============
  40873. -----BEGIN CERTIFICATE-----
  40874. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  40875. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  40876. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  40877. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  40878. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  40879. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  40880. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  40881. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  40882. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  40883. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  40884. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  40885. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  40886. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  40887. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  40888. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  40889. -----END CERTIFICATE-----
  40890. DST ACES CA X6
  40891. ==============
  40892. -----BEGIN CERTIFICATE-----
  40893. MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
  40894. EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
  40895. MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
  40896. MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
  40897. CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
  40898. AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
  40899. DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
  40900. pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
  40901. GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
  40902. MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
  40903. EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
  40904. Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
  40905. dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
  40906. CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
  40907. 5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
  40908. Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
  40909. nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
  40910. vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
  40911. oKfN5XozNmr6mis=
  40912. -----END CERTIFICATE-----
  40913. TURKTRUST Certificate Services Provider Root 2
  40914. ==============================================
  40915. -----BEGIN CERTIFICATE-----
  40916. MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBF
  40917. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
  40918. MA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
  40919. QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcN
  40920. MDUxMTA3MTAwNzU3WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVr
  40921. dHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEPMA0G
  40922. A1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls
  40923. acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwggEiMA0G
  40924. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqe
  40925. LCDe2JAOCtFp0if7qnefJ1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKI
  40926. x+XlZEdhR3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJQv2g
  40927. QrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGXJHpsmxcPbe9TmJEr
  40928. 5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1pzpwACPI2/z7woQ8arBT9pmAPAgMB
  40929. AAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58SFq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8G
  40930. A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/ntt
  40931. Rbj2hWyfIvwqECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE4
  40932. Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFzgw2lGh1uEpJ+
  40933. hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotHuFEJjOp9zYhys2AzsfAKRO8P
  40934. 9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LSy3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk5
  40935. UrbnBEI=
  40936. -----END CERTIFICATE-----
  40937. SwissSign Gold CA - G2
  40938. ======================
  40939. -----BEGIN CERTIFICATE-----
  40940. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  40941. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  40942. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  40943. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  40944. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  40945. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  40946. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  40947. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  40948. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  40949. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  40950. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  40951. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  40952. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  40953. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  40954. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  40955. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  40956. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  40957. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  40958. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  40959. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  40960. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  40961. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  40962. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  40963. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  40964. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  40965. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  40966. -----END CERTIFICATE-----
  40967. SwissSign Silver CA - G2
  40968. ========================
  40969. -----BEGIN CERTIFICATE-----
  40970. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  40971. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  40972. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  40973. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  40974. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  40975. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  40976. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  40977. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  40978. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  40979. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  40980. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  40981. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  40982. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  40983. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  40984. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  40985. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  40986. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  40987. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  40988. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  40989. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  40990. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  40991. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  40992. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  40993. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  40994. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  40995. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  40996. -----END CERTIFICATE-----
  40997. GeoTrust Primary Certification Authority
  40998. ========================================
  40999. -----BEGIN CERTIFICATE-----
  41000. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  41001. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  41002. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  41003. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  41004. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  41005. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  41006. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  41007. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  41008. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  41009. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  41010. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  41011. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  41012. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  41013. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  41014. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  41015. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  41016. -----END CERTIFICATE-----
  41017. thawte Primary Root CA
  41018. ======================
  41019. -----BEGIN CERTIFICATE-----
  41020. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  41021. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  41022. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  41023. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  41024. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  41025. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  41026. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  41027. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  41028. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  41029. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  41030. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  41031. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  41032. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  41033. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  41034. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  41035. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  41036. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  41037. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  41038. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  41039. -----END CERTIFICATE-----
  41040. VeriSign Class 3 Public Primary Certification Authority - G5
  41041. ============================================================
  41042. -----BEGIN CERTIFICATE-----
  41043. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  41044. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  41045. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  41046. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  41047. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  41048. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  41049. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  41050. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  41051. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  41052. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  41053. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  41054. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  41055. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  41056. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  41057. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  41058. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  41059. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  41060. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  41061. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  41062. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  41063. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  41064. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  41065. -----END CERTIFICATE-----
  41066. SecureTrust CA
  41067. ==============
  41068. -----BEGIN CERTIFICATE-----
  41069. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  41070. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  41071. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  41072. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  41073. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  41074. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  41075. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  41076. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  41077. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  41078. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  41079. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  41080. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  41081. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  41082. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  41083. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  41084. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  41085. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  41086. -----END CERTIFICATE-----
  41087. Secure Global CA
  41088. ================
  41089. -----BEGIN CERTIFICATE-----
  41090. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  41091. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  41092. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  41093. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  41094. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  41095. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  41096. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  41097. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  41098. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  41099. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  41100. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  41101. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  41102. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  41103. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  41104. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  41105. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  41106. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  41107. -----END CERTIFICATE-----
  41108. COMODO Certification Authority
  41109. ==============================
  41110. -----BEGIN CERTIFICATE-----
  41111. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  41112. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  41113. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  41114. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  41115. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  41116. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  41117. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  41118. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  41119. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  41120. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  41121. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  41122. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  41123. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  41124. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  41125. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  41126. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  41127. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  41128. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  41129. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  41130. -----END CERTIFICATE-----
  41131. Network Solutions Certificate Authority
  41132. =======================================
  41133. -----BEGIN CERTIFICATE-----
  41134. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  41135. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  41136. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  41137. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  41138. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  41139. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  41140. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  41141. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  41142. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  41143. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  41144. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  41145. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  41146. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  41147. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  41148. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  41149. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  41150. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  41151. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  41152. -----END CERTIFICATE-----
  41153. WellsSecure Public Root Certificate Authority
  41154. =============================================
  41155. -----BEGIN CERTIFICATE-----
  41156. MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM
  41157. F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw
  41158. NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
  41159. MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dl
  41160. bGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYD
  41161. VQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  41162. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+rWxxTkqxtnt3CxC5FlAM1
  41163. iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjUDk/41itMpBb570OYj7OeUt9tkTmPOL13
  41164. i0Nj67eT/DBMHAGTthP796EfvyXhdDcsHqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8
  41165. bJVhHlfXBIEyg1J55oNjz7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiB
  41166. K0HmOFafSZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/SlwxlAgMB
  41167. AAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwu
  41168. cGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBQm
  41169. lRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0jBIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGB
  41170. i6SBiDCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRww
  41171. GgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg
  41172. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEBALkVsUSRzCPI
  41173. K0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0
  41174. bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj
  41175. qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es
  41176. E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ
  41177. tylv2G0xffX8oRAHh84vWdw+WNs=
  41178. -----END CERTIFICATE-----
  41179. COMODO ECC Certification Authority
  41180. ==================================
  41181. -----BEGIN CERTIFICATE-----
  41182. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  41183. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  41184. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  41185. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  41186. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  41187. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  41188. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  41189. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  41190. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  41191. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  41192. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  41193. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  41194. -----END CERTIFICATE-----
  41195. IGC/A
  41196. =====
  41197. -----BEGIN CERTIFICATE-----
  41198. MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD
  41199. VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE
  41200. Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy
  41201. MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI
  41202. EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT
  41203. STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB
  41204. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2
  41205. TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW
  41206. So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy
  41207. HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd
  41208. frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ
  41209. tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB
  41210. egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC
  41211. iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK
  41212. q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q
  41213. MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg
  41214. Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI
  41215. lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF
  41216. 0mBWWg==
  41217. -----END CERTIFICATE-----
  41218. Security Communication EV RootCA1
  41219. =================================
  41220. -----BEGIN CERTIFICATE-----
  41221. MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  41222. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
  41223. dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
  41224. BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
  41225. Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  41226. AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
  41227. /VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
  41228. WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
  41229. ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
  41230. bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
  41231. 9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
  41232. SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
  41233. iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
  41234. Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
  41235. mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
  41236. T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
  41237. -----END CERTIFICATE-----
  41238. OISTE WISeKey Global Root GA CA
  41239. ===============================
  41240. -----BEGIN CERTIFICATE-----
  41241. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  41242. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  41243. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  41244. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  41245. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  41246. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  41247. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  41248. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  41249. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  41250. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  41251. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  41252. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  41253. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  41254. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  41255. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  41256. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  41257. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  41258. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  41259. -----END CERTIFICATE-----
  41260. Microsec e-Szigno Root CA
  41261. =========================
  41262. -----BEGIN CERTIFICATE-----
  41263. MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE
  41264. BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL
  41265. EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0
  41266. MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz
  41267. dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT
  41268. GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
  41269. AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG
  41270. d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N
  41271. oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc
  41272. QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ
  41273. PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb
  41274. MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG
  41275. IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD
  41276. VR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIBAQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3
  41277. LmUtc3ppZ25vLmh1L1NaU1ovMIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0A
  41278. dAB2AOEAbgB5ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn
  41279. AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABTAHoAbwBsAGcA
  41280. 4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABhACAAcwB6AGUAcgBpAG4AdAAg
  41281. AGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABoAHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMA
  41282. egBpAGcAbgBvAC4AaAB1AC8AUwBaAFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6
  41283. Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NO
  41284. PU1pY3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxPPU1pY3Jv
  41285. c2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdDtiaW5h
  41286. cnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuBEGluZm9AZS1zemlnbm8uaHWkdzB1MSMw
  41287. IQYDVQQDDBpNaWNyb3NlYyBlLVN6aWduw7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhT
  41288. WjEWMBQGA1UEChMNTWljcm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhV
  41289. MIGsBgNVHSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJIVTER
  41290. MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp
  41291. Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal
  41292. HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT
  41293. nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE
  41294. aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a
  41295. 86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK
  41296. yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB
  41297. S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU=
  41298. -----END CERTIFICATE-----
  41299. Certigna
  41300. ========
  41301. -----BEGIN CERTIFICATE-----
  41302. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  41303. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  41304. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  41305. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  41306. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  41307. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  41308. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  41309. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  41310. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  41311. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  41312. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  41313. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  41314. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  41315. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  41316. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  41317. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  41318. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  41319. -----END CERTIFICATE-----
  41320. Deutsche Telekom Root CA 2
  41321. ==========================
  41322. -----BEGIN CERTIFICATE-----
  41323. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  41324. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  41325. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  41326. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  41327. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  41328. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  41329. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  41330. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  41331. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  41332. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  41333. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  41334. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  41335. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  41336. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  41337. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  41338. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  41339. Cm26OWMohpLzGITY+9HPBVZkVw==
  41340. -----END CERTIFICATE-----
  41341. Cybertrust Global Root
  41342. ======================
  41343. -----BEGIN CERTIFICATE-----
  41344. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  41345. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  41346. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  41347. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  41348. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  41349. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  41350. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  41351. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  41352. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  41353. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  41354. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  41355. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  41356. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  41357. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  41358. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  41359. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  41360. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  41361. -----END CERTIFICATE-----
  41362. ePKI Root Certification Authority
  41363. =================================
  41364. -----BEGIN CERTIFICATE-----
  41365. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  41366. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  41367. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  41368. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  41369. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  41370. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  41371. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  41372. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  41373. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  41374. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  41375. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  41376. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  41377. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  41378. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  41379. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  41380. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  41381. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  41382. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  41383. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  41384. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  41385. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  41386. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  41387. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  41388. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  41389. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  41390. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  41391. -----END CERTIFICATE-----
  41392. T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3
  41393. =============================================================================================================================
  41394. -----BEGIN CERTIFICATE-----
  41395. MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
  41396. DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
  41397. aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
  41398. b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
  41399. BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
  41400. S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
  41401. MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
  41402. IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
  41403. n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
  41404. IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
  41405. dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
  41406. cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
  41407. AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
  41408. Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
  41409. xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
  41410. 6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
  41411. hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
  41412. BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  41413. MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
  41414. N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
  41415. y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
  41416. LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
  41417. dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
  41418. -----END CERTIFICATE-----
  41419. Buypass Class 2 CA 1
  41420. ====================
  41421. -----BEGIN CERTIFICATE-----
  41422. MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  41423. QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2
  41424. MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
  41425. c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI
  41426. hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M
  41427. cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83
  41428. 0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4
  41429. 0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R
  41430. uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC
  41431. MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P
  41432. AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV
  41433. 1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt
  41434. 7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2
  41435. fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w
  41436. wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho
  41437. -----END CERTIFICATE-----
  41438. EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1
  41439. ==========================================================================
  41440. -----BEGIN CERTIFICATE-----
  41441. MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNVBAMML0VCRyBF
  41442. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMTcwNQYDVQQKDC5FQkcg
  41443. QmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXptZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAe
  41444. Fw0wNjA4MTcwMDIxMDlaFw0xNjA4MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25p
  41445. ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2lt
  41446. IFRla25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIiMA0GCSqG
  41447. SIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h4fuXd7hxlugTlkaDT7by
  41448. X3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAktiHq6yOU/im/+4mRDGSaBUorzAzu8T2b
  41449. gmmkTPiab+ci2hC6X5L8GCcKqKpE+i4stPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfr
  41450. eYteIAbTdgtsApWjluTLdlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZ
  41451. TqNGFav4c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8UmTDGy
  41452. Y5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z+kI2sSXFCjEmN1Zn
  41453. uqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0OLna9XvNRiYuoP1Vzv9s6xiQFlpJI
  41454. qkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMWOeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vm
  41455. ExH8nYQKE3vwO9D8owrXieqWfo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0
  41456. Nokb+Clsi7n2l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  41457. /wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgwFoAU587GT/wW
  41458. Z5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+8ygjdsZs93/mQJ7ANtyVDR2t
  41459. FcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgm
  41460. zJNSroIBk5DKd8pNSe/iWtkqvTDOTLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64k
  41461. XPBfrAowzIpAoHMEwfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqT
  41462. bCmYIai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJnxk1Gj7sU
  41463. RT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4QDgZxGhBM/nV+/x5XOULK
  41464. 1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9qKd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt
  41465. 2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11thie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQ
  41466. Y9iJSrSq3RZj9W6+YKH47ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9
  41467. AahH3eU7QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT
  41468. -----END CERTIFICATE-----
  41469. certSIGN ROOT CA
  41470. ================
  41471. -----BEGIN CERTIFICATE-----
  41472. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  41473. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  41474. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  41475. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  41476. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  41477. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  41478. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  41479. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  41480. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  41481. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  41482. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  41483. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  41484. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  41485. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  41486. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  41487. -----END CERTIFICATE-----
  41488. CNNIC ROOT
  41489. ==========
  41490. -----BEGIN CERTIFICATE-----
  41491. MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJDTjEOMAwGA1UE
  41492. ChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2MDcwOTE0WhcNMjcwNDE2MDcw
  41493. OTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1Qw
  41494. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzD
  41495. o+/hn7E7SIX1mlwhIhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tiz
  41496. VHa6dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZOV/kbZKKT
  41497. VrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrCGHn2emU1z5DrvTOTn1Or
  41498. czvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gNv7Sg2Ca+I19zN38m5pIEo3/PIKe38zrK
  41499. y5nLAgMBAAGjczBxMBEGCWCGSAGG+EIBAQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscC
  41500. wQ7vptU7ETAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991S
  41501. lgrHAsEO76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnKOOK5
  41502. Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvHugDnuL8BV8F3RTIM
  41503. O/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7HgviyJA/qIYM/PmLXoXLT1tLYhFHxUV8
  41504. BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2
  41505. G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m
  41506. mxE=
  41507. -----END CERTIFICATE-----
  41508. ApplicationCA - Japanese Government
  41509. ===================================
  41510. -----BEGIN CERTIFICATE-----
  41511. MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT
  41512. SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw
  41513. MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl
  41514. cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  41515. CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4
  41516. fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN
  41517. wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE
  41518. jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu
  41519. nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU
  41520. WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV
  41521. BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD
  41522. vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs
  41523. o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g
  41524. /DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD
  41525. io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW
  41526. dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL
  41527. rosot4LKGAfmt1t06SAZf7IbiVQ=
  41528. -----END CERTIFICATE-----
  41529. GeoTrust Primary Certification Authority - G3
  41530. =============================================
  41531. -----BEGIN CERTIFICATE-----
  41532. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  41533. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  41534. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  41535. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  41536. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  41537. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  41538. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  41539. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  41540. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  41541. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  41542. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  41543. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  41544. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  41545. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  41546. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  41547. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  41548. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  41549. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  41550. -----END CERTIFICATE-----
  41551. thawte Primary Root CA - G2
  41552. ===========================
  41553. -----BEGIN CERTIFICATE-----
  41554. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  41555. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  41556. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  41557. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  41558. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  41559. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  41560. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  41561. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  41562. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  41563. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  41564. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  41565. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  41566. -----END CERTIFICATE-----
  41567. thawte Primary Root CA - G3
  41568. ===========================
  41569. -----BEGIN CERTIFICATE-----
  41570. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  41571. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  41572. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  41573. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  41574. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  41575. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  41576. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  41577. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  41578. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  41579. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  41580. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  41581. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  41582. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  41583. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  41584. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  41585. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  41586. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  41587. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  41588. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  41589. -----END CERTIFICATE-----
  41590. GeoTrust Primary Certification Authority - G2
  41591. =============================================
  41592. -----BEGIN CERTIFICATE-----
  41593. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  41594. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  41595. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  41596. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  41597. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  41598. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  41599. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  41600. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  41601. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  41602. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  41603. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  41604. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  41605. npaqBA+K
  41606. -----END CERTIFICATE-----
  41607. VeriSign Universal Root Certification Authority
  41608. ===============================================
  41609. -----BEGIN CERTIFICATE-----
  41610. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  41611. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  41612. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  41613. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  41614. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  41615. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  41616. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  41617. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  41618. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  41619. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  41620. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  41621. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  41622. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  41623. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  41624. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  41625. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  41626. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  41627. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  41628. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  41629. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  41630. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  41631. mJO37M2CYfE45k+XmCpajQ==
  41632. -----END CERTIFICATE-----
  41633. VeriSign Class 3 Public Primary Certification Authority - G4
  41634. ============================================================
  41635. -----BEGIN CERTIFICATE-----
  41636. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  41637. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  41638. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  41639. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  41640. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  41641. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  41642. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  41643. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  41644. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  41645. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  41646. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  41647. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  41648. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  41649. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  41650. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  41651. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  41652. -----END CERTIFICATE-----
  41653. NetLock Arany (Class Gold) Főtanúsítvány
  41654. ============================================
  41655. -----BEGIN CERTIFICATE-----
  41656. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  41657. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  41658. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  41659. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  41660. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  41661. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  41662. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  41663. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  41664. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  41665. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  41666. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  41667. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  41668. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  41669. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  41670. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  41671. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  41672. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  41673. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  41674. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  41675. -----END CERTIFICATE-----
  41676. Staat der Nederlanden Root CA - G2
  41677. ==================================
  41678. -----BEGIN CERTIFICATE-----
  41679. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  41680. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  41681. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  41682. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  41683. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  41684. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  41685. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  41686. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  41687. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  41688. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  41689. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  41690. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  41691. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  41692. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  41693. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  41694. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  41695. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  41696. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  41697. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  41698. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  41699. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  41700. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  41701. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  41702. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  41703. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  41704. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  41705. 66+KAQ==
  41706. -----END CERTIFICATE-----
  41707. CA Disig
  41708. ========
  41709. -----BEGIN CERTIFICATE-----
  41710. MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMK
  41711. QnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwHhcNMDYw
  41712. MzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlz
  41713. bGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3
  41714. DQEBAQUAA4IBDwAwggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgm
  41715. GErENx+hSkS943EE9UQX4j/8SFhvXJ56CbpRNyIjZkMhsDxkovhqFQ4/61HhVKndBpnXmjxUizkD
  41716. Pw/Fzsbrg3ICqB9x8y34dQjbYkzo+s7552oftms1grrijxaSfQUMbEYDXcDtab86wYqg6I7ZuUUo
  41717. hwjstMoVvoLdtUSLLa2GDGhibYVW8qwUYzrG0ZmsNHhWS8+2rT+MitcE5eN4TPWGqvWP+j1scaMt
  41718. ymfraHtuM6kMgiioTGohQBUgDCZbg8KpFhXAJIJdKxatymP2dACw30PEEGBWZ2NFAgMBAAGjgf8w
  41719. gfwwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUjbJJaJ1yCCW5wCf1UJNWSEZx+Y8wDgYDVR0P
  41720. AQH/BAQDAgEGMDYGA1UdEQQvMC2BE2Nhb3BlcmF0b3JAZGlzaWcuc2uGFmh0dHA6Ly93d3cuZGlz
  41721. aWcuc2svY2EwZgYDVR0fBF8wXTAtoCugKYYnaHR0cDovL3d3dy5kaXNpZy5zay9jYS9jcmwvY2Ff
  41722. ZGlzaWcuY3JsMCygKqAohiZodHRwOi8vY2EuZGlzaWcuc2svY2EvY3JsL2NhX2Rpc2lnLmNybDAa
  41723. BgNVHSAEEzARMA8GDSuBHpGT5goAAAABAQEwDQYJKoZIhvcNAQEFBQADggEBAF00dGFMrzvY/59t
  41724. WDYcPQuBDRIrRhCA/ec8J9B6yKm2fnQwM6M6int0wHl5QpNt/7EpFIKrIYwvF/k/Ji/1WcbvgAa3
  41725. mkkp7M5+cTxqEEHA9tOasnxakZzArFvITV734VP/Q3f8nktnbNfzg9Gg4H8l37iYC5oyOGwwoPP/
  41726. CBUz91BKez6jPiCp3C9WgArtQVCwyfTssuMmRAAOb54GvCKWU3BlxFAKRmukLyeBEicTXxChds6K
  41727. ezfqwzlhA5WYOudsiCUI/HloDYd9Yvi0X/vF2Ey9WLw/Q1vUHgFNPGO+I++MzVpQuGhU+QqZMxEA
  41728. 4Z7CRneC9VkGjCFMhwnN5ag=
  41729. -----END CERTIFICATE-----
  41730. Juur-SK
  41731. =======
  41732. -----BEGIN CERTIFICATE-----
  41733. MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcNAQkBFglwa2lA
  41734. c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRAw
  41735. DgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMwMVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqG
  41736. SIb3DQEJARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVy
  41737. aW1pc2tlc2t1czEQMA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  41738. ggEBAIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOBSvZiF3tf
  41739. TQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkzABpTpyHhOEvWgxutr2TC
  41740. +Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvHLCu3GFH+4Hv2qEivbDtPL+/40UceJlfw
  41741. UR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMPPbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDa
  41742. Tpxt4brNj3pssAki14sL2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQF
  41743. MAMBAf8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwICMIHD
  41744. HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh
  41745. AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA
  41746. cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr
  41747. AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw
  41748. cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE
  41749. FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G
  41750. A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo
  41751. ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL
  41752. abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678
  41753. IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh
  41754. Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2
  41755. yyqcjg==
  41756. -----END CERTIFICATE-----
  41757. Hongkong Post Root CA 1
  41758. =======================
  41759. -----BEGIN CERTIFICATE-----
  41760. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  41761. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  41762. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  41763. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  41764. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  41765. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  41766. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  41767. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  41768. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  41769. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  41770. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  41771. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  41772. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  41773. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  41774. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  41775. -----END CERTIFICATE-----
  41776. SecureSign RootCA11
  41777. ===================
  41778. -----BEGIN CERTIFICATE-----
  41779. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  41780. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  41781. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  41782. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  41783. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  41784. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  41785. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  41786. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  41787. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  41788. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  41789. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  41790. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  41791. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  41792. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  41793. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  41794. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  41795. -----END CERTIFICATE-----
  41796. ACEDICOM Root
  41797. =============
  41798. -----BEGIN CERTIFICATE-----
  41799. MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
  41800. T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
  41801. MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
  41802. A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
  41803. AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
  41804. WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
  41805. YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
  41806. MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
  41807. m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
  41808. HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
  41809. xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
  41810. 3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
  41811. 2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
  41812. TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
  41813. 4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
  41814. 9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
  41815. bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
  41816. aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
  41817. eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
  41818. zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
  41819. ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
  41820. KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
  41821. nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
  41822. I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
  41823. MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
  41824. tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
  41825. -----END CERTIFICATE-----
  41826. Microsec e-Szigno Root CA 2009
  41827. ==============================
  41828. -----BEGIN CERTIFICATE-----
  41829. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  41830. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  41831. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  41832. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  41833. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  41834. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  41835. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  41836. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  41837. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  41838. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  41839. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  41840. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  41841. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  41842. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  41843. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  41844. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  41845. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  41846. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  41847. LXpUq3DDfSJlgnCW
  41848. -----END CERTIFICATE-----
  41849. GlobalSign Root CA - R3
  41850. =======================
  41851. -----BEGIN CERTIFICATE-----
  41852. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  41853. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  41854. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  41855. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  41856. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  41857. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  41858. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  41859. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  41860. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  41861. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  41862. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  41863. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  41864. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  41865. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  41866. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  41867. kpeDMdmztcpHWD9f
  41868. -----END CERTIFICATE-----
  41869. Autoridad de Certificacion Firmaprofesional CIF A62634068
  41870. =========================================================
  41871. -----BEGIN CERTIFICATE-----
  41872. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  41873. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  41874. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  41875. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  41876. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  41877. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  41878. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  41879. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  41880. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  41881. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  41882. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  41883. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  41884. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  41885. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  41886. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  41887. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  41888. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  41889. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  41890. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  41891. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  41892. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  41893. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  41894. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  41895. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  41896. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  41897. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  41898. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  41899. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  41900. -----END CERTIFICATE-----
  41901. Izenpe.com
  41902. ==========
  41903. -----BEGIN CERTIFICATE-----
  41904. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  41905. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  41906. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  41907. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  41908. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  41909. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  41910. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  41911. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  41912. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  41913. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  41914. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  41915. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  41916. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  41917. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  41918. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  41919. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  41920. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  41921. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  41922. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  41923. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  41924. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  41925. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  41926. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  41927. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  41928. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  41929. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  41930. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  41931. -----END CERTIFICATE-----
  41932. Chambers of Commerce Root - 2008
  41933. ================================
  41934. -----BEGIN CERTIFICATE-----
  41935. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  41936. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  41937. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  41938. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  41939. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  41940. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  41941. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  41942. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  41943. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  41944. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  41945. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  41946. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  41947. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  41948. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  41949. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  41950. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  41951. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  41952. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  41953. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  41954. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  41955. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  41956. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  41957. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  41958. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  41959. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  41960. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  41961. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  41962. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  41963. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  41964. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  41965. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  41966. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  41967. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  41968. -----END CERTIFICATE-----
  41969. Global Chambersign Root - 2008
  41970. ==============================
  41971. -----BEGIN CERTIFICATE-----
  41972. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  41973. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  41974. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  41975. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  41976. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  41977. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  41978. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  41979. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  41980. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  41981. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  41982. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  41983. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  41984. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  41985. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  41986. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  41987. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  41988. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  41989. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  41990. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  41991. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  41992. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  41993. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  41994. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  41995. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  41996. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  41997. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  41998. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  41999. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  42000. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  42001. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  42002. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  42003. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  42004. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  42005. -----END CERTIFICATE-----
  42006. Go Daddy Root Certificate Authority - G2
  42007. ========================================
  42008. -----BEGIN CERTIFICATE-----
  42009. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  42010. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  42011. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  42012. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  42013. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  42014. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  42015. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  42016. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  42017. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  42018. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  42019. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  42020. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  42021. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  42022. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  42023. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  42024. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  42025. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  42026. -----END CERTIFICATE-----
  42027. Starfield Root Certificate Authority - G2
  42028. =========================================
  42029. -----BEGIN CERTIFICATE-----
  42030. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  42031. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  42032. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  42033. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  42034. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  42035. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  42036. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  42037. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  42038. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  42039. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  42040. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  42041. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  42042. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  42043. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  42044. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  42045. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  42046. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  42047. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  42048. -----END CERTIFICATE-----
  42049. Starfield Services Root Certificate Authority - G2
  42050. ==================================================
  42051. -----BEGIN CERTIFICATE-----
  42052. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  42053. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  42054. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  42055. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  42056. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  42057. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  42058. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  42059. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  42060. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  42061. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  42062. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  42063. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  42064. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  42065. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  42066. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  42067. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  42068. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  42069. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  42070. -----END CERTIFICATE-----
  42071. AffirmTrust Commercial
  42072. ======================
  42073. -----BEGIN CERTIFICATE-----
  42074. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  42075. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  42076. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  42077. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  42078. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  42079. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  42080. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  42081. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  42082. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  42083. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  42084. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  42085. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  42086. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  42087. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  42088. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  42089. -----END CERTIFICATE-----
  42090. AffirmTrust Networking
  42091. ======================
  42092. -----BEGIN CERTIFICATE-----
  42093. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  42094. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  42095. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  42096. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  42097. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  42098. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  42099. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  42100. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  42101. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  42102. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  42103. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  42104. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  42105. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  42106. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  42107. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  42108. -----END CERTIFICATE-----
  42109. AffirmTrust Premium
  42110. ===================
  42111. -----BEGIN CERTIFICATE-----
  42112. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  42113. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  42114. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  42115. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  42116. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  42117. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  42118. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  42119. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  42120. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  42121. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  42122. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  42123. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  42124. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  42125. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  42126. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  42127. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  42128. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  42129. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  42130. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  42131. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  42132. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  42133. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  42134. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  42135. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  42136. -----END CERTIFICATE-----
  42137. AffirmTrust Premium ECC
  42138. =======================
  42139. -----BEGIN CERTIFICATE-----
  42140. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  42141. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  42142. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  42143. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  42144. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  42145. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  42146. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  42147. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  42148. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  42149. eQ==
  42150. -----END CERTIFICATE-----
  42151. Certum Trusted Network CA
  42152. =========================
  42153. -----BEGIN CERTIFICATE-----
  42154. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  42155. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  42156. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  42157. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  42158. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  42159. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  42160. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  42161. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  42162. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  42163. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  42164. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  42165. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  42166. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  42167. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  42168. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  42169. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  42170. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  42171. -----END CERTIFICATE-----
  42172. Certinomis - Autorité Racine
  42173. =============================
  42174. -----BEGIN CERTIFICATE-----
  42175. MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  42176. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
  42177. LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
  42178. A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
  42179. JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
  42180. ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
  42181. wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
  42182. Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
  42183. 2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
  42184. jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
  42185. c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
  42186. lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
  42187. xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
  42188. 530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
  42189. 4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  42190. A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
  42191. KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
  42192. WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
  42193. R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
  42194. nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
  42195. CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
  42196. JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
  42197. qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
  42198. WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
  42199. wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
  42200. vgt2Fl43N+bYdJeimUV5
  42201. -----END CERTIFICATE-----
  42202. Root CA Generalitat Valenciana
  42203. ==============================
  42204. -----BEGIN CERTIFICATE-----
  42205. MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE
  42206. ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290
  42207. IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3
  42208. WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE
  42209. CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G
  42210. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2
  42211. F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B
  42212. ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ
  42213. D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte
  42214. JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMB
  42215. AAGjggM7MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBraS5n
  42216. dmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIICIwYKKwYBBAG/VQIB
  42217. ADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBl
  42218. AHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIAYQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIA
  42219. YQBsAGkAdABhAHQAIABWAGEAbABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQBy
  42220. AGEAYwBpAPMAbgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA
  42221. aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMAaQBvAG4AYQBt
  42222. AGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQAZQAgAEEAdQB0AG8AcgBpAGQA
  42223. YQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBu
  42224. AHQAcgBhACAAZQBuACAAbABhACAAZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAA
  42225. OgAvAC8AdwB3AHcALgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0
  42226. dHA6Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+yeAT8MIGV
  42227. BgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQswCQYDVQQGEwJFUzEfMB0G
  42228. A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S
  42229. b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh
  42230. TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz
  42231. Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63
  42232. NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH
  42233. iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt
  42234. +GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM=
  42235. -----END CERTIFICATE-----
  42236. A-Trust-nQual-03
  42237. ================
  42238. -----BEGIN CERTIFICATE-----
  42239. MIIDzzCCAregAwIBAgIDAWweMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJBVDFIMEYGA1UE
  42240. Cgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBpbSBlbGVrdHIuIERhdGVudmVy
  42241. a2VociBHbWJIMRkwFwYDVQQLDBBBLVRydXN0LW5RdWFsLTAzMRkwFwYDVQQDDBBBLVRydXN0LW5R
  42242. dWFsLTAzMB4XDTA1MDgxNzIyMDAwMFoXDTE1MDgxNzIyMDAwMFowgY0xCzAJBgNVBAYTAkFUMUgw
  42243. RgYDVQQKDD9BLVRydXN0IEdlcy4gZi4gU2ljaGVyaGVpdHNzeXN0ZW1lIGltIGVsZWt0ci4gRGF0
  42244. ZW52ZXJrZWhyIEdtYkgxGTAXBgNVBAsMEEEtVHJ1c3QtblF1YWwtMDMxGTAXBgNVBAMMEEEtVHJ1
  42245. c3QtblF1YWwtMDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtPWFuA/OQO8BBC4SA
  42246. zewqo51ru27CQoT3URThoKgtUaNR8t4j8DRE/5TrzAUjlUC5B3ilJfYKvUWG6Nm9wASOhURh73+n
  42247. yfrBJcyFLGM/BWBzSQXgYHiVEEvc+RFZznF/QJuKqiTfC0Li21a8StKlDJu3Qz7dg9MmEALP6iPE
  42248. SU7l0+m0iKsMrmKS1GWH2WrX9IWf5DMiJaXlyDO6w8dB3F/GaswADm0yqLaHNgBid5seHzTLkDx4
  42249. iHQF63n1k3Flyp3HaxgtPVxO59X4PzF9j4fsCiIvI+n+u33J4PTs63zEsMMtYrWacdaxaujs2e3V
  42250. cuy+VwHOBVWf3tFgiBCzAgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0OBAoECERqlWdV
  42251. eRFPMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAVdRU0VlIXLOThaq/Yy/kgM40
  42252. ozRiPvbY7meIMQQDbwvUB/tOdQ/TLtPAF8fGKOwGDREkDg6lXb+MshOWcdzUzg4NCmgybLlBMRmr
  42253. sQd7TZjTXLDR8KdCoLXEjq/+8T/0709GAHbrAvv5ndJAlseIOrifEXnzgGWovR/TeIGgUUw3tKZd
  42254. JXDRZslo+S4RFGjxVJgIrCaSD96JntT6s3kr0qN51OyLrIdTaEJMUVF0HhsnLuP1Hyl0Te2v9+GS
  42255. mYHovjrHF1D2t8b8m7CKa9aIA5GPBnc6hQLdmNVDeD/GMBWsm2vLV7eJUYs66MmEDNuxUCAKGkq6
  42256. ahq97BvIxYSazQ==
  42257. -----END CERTIFICATE-----
  42258. TWCA Root Certification Authority
  42259. =================================
  42260. -----BEGIN CERTIFICATE-----
  42261. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  42262. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  42263. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  42264. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  42265. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  42266. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  42267. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  42268. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  42269. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  42270. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  42271. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  42272. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  42273. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  42274. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  42275. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  42276. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  42277. -----END CERTIFICATE-----
  42278. Security Communication RootCA2
  42279. ==============================
  42280. -----BEGIN CERTIFICATE-----
  42281. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  42282. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  42283. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  42284. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  42285. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  42286. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  42287. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  42288. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  42289. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  42290. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  42291. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  42292. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  42293. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  42294. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  42295. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  42296. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  42297. -----END CERTIFICATE-----
  42298. EC-ACC
  42299. ======
  42300. -----BEGIN CERTIFICATE-----
  42301. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  42302. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  42303. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  42304. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  42305. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  42306. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  42307. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  42308. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  42309. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  42310. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  42311. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  42312. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  42313. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  42314. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  42315. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  42316. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  42317. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  42318. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  42319. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  42320. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  42321. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  42322. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  42323. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  42324. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  42325. 5EI=
  42326. -----END CERTIFICATE-----
  42327. Hellenic Academic and Research Institutions RootCA 2011
  42328. =======================================================
  42329. -----BEGIN CERTIFICATE-----
  42330. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  42331. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  42332. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  42333. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  42334. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  42335. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  42336. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  42337. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  42338. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  42339. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  42340. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  42341. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  42342. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  42343. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  42344. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  42345. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  42346. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  42347. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  42348. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  42349. -----END CERTIFICATE-----
  42350. Actalis Authentication Root CA
  42351. ==============================
  42352. -----BEGIN CERTIFICATE-----
  42353. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  42354. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  42355. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  42356. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  42357. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  42358. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  42359. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  42360. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  42361. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  42362. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  42363. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  42364. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  42365. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  42366. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  42367. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  42368. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  42369. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  42370. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  42371. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  42372. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  42373. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  42374. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  42375. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  42376. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  42377. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  42378. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  42379. -----END CERTIFICATE-----
  42380. Trustis FPS Root CA
  42381. ===================
  42382. -----BEGIN CERTIFICATE-----
  42383. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  42384. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  42385. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  42386. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  42387. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  42388. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  42389. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  42390. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  42391. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  42392. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  42393. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  42394. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  42395. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  42396. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  42397. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  42398. iB6XzCGcKQENZetX2fNXlrtIzYE=
  42399. -----END CERTIFICATE-----
  42400. StartCom Certification Authority
  42401. ================================
  42402. -----BEGIN CERTIFICATE-----
  42403. MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  42404. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  42405. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  42406. NjM3WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  42407. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  42408. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  42409. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  42410. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  42411. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  42412. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  42413. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  42414. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  42415. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  42416. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  42417. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  42418. 37uMdBNSSwIDAQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD
  42419. VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFulF2mHMMo0aEPQ
  42420. Qa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCCATgwLgYIKwYBBQUHAgEWImh0
  42421. dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cu
  42422. c3RhcnRzc2wuY29tL2ludGVybWVkaWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENv
  42423. bW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0
  42424. aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0aWZpY2F0
  42425. aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93d3cuc3RhcnRzc2wuY29t
  42426. L3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBG
  42427. cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5
  42428. fPGFf59Jb2vKXfuM/gTFwWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWm
  42429. N3PH/UvSTa0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst0OcN
  42430. Org+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNcpRJvkrKTlMeIFw6T
  42431. tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX
  42432. e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA
  42433. 2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs
  42434. HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE
  42435. JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib
  42436. D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8=
  42437. -----END CERTIFICATE-----
  42438. StartCom Certification Authority G2
  42439. ===================================
  42440. -----BEGIN CERTIFICATE-----
  42441. MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  42442. U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
  42443. RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE
  42444. ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  42445. dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O
  42446. o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG
  42447. 4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi
  42448. Aez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/Q0kGi4xDuFby2X8hQxfqp0iVAXV16iul
  42449. Q5XqFYSdCI0mblWbq9zSOdIxHWDirMxWRST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbs
  42450. O+wmETRIjfaAKxojAuuKHDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8H
  42451. vKTlXcxNnw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM0D4L
  42452. nMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/iUUjXuG+v+E5+M5iS
  42453. FGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9Ha90OrInwMEePnWjFqmveiJdnxMa
  42454. z6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHgTuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8E
  42455. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJ
  42456. KoZIhvcNAQELBQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K
  42457. 2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfXUfEpY9Z1zRbk
  42458. J4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl6/2o1PXWT6RbdejF0mCy2wl+
  42459. JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG
  42460. /+gyRr61M3Z3qAFdlsHB1b6uJcDJHgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTc
  42461. nIhT76IxW1hPkWLIwpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/Xld
  42462. blhYXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc
  42463. l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm
  42464. 7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm
  42465. obp573PYtlNXLfbQ4ddI
  42466. -----END CERTIFICATE-----
  42467. Buypass Class 2 Root CA
  42468. =======================
  42469. -----BEGIN CERTIFICATE-----
  42470. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  42471. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  42472. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  42473. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  42474. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  42475. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  42476. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  42477. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  42478. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  42479. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  42480. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  42481. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  42482. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  42483. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  42484. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  42485. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  42486. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  42487. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  42488. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  42489. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  42490. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  42491. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  42492. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  42493. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  42494. rJgWVqA=
  42495. -----END CERTIFICATE-----
  42496. Buypass Class 3 Root CA
  42497. =======================
  42498. -----BEGIN CERTIFICATE-----
  42499. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  42500. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  42501. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  42502. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  42503. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  42504. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  42505. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  42506. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  42507. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  42508. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  42509. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  42510. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  42511. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  42512. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  42513. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  42514. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  42515. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  42516. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  42517. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  42518. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  42519. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  42520. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  42521. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  42522. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  42523. Cp/HuZc=
  42524. -----END CERTIFICATE-----
  42525. T-TeleSec GlobalRoot Class 3
  42526. ============================
  42527. -----BEGIN CERTIFICATE-----
  42528. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  42529. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  42530. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  42531. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  42532. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  42533. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  42534. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  42535. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  42536. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  42537. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  42538. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  42539. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  42540. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  42541. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  42542. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  42543. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  42544. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  42545. -----END CERTIFICATE-----
  42546. EE Certification Centre Root CA
  42547. ===============================
  42548. -----BEGIN CERTIFICATE-----
  42549. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  42550. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  42551. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  42552. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  42553. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  42554. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  42555. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  42556. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  42557. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  42558. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  42559. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  42560. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  42561. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  42562. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  42563. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  42564. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  42565. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  42566. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  42567. dcGWxZ0=
  42568. -----END CERTIFICATE-----
  42569. TURKTRUST Certificate Services Provider Root 2007
  42570. =================================================
  42571. -----BEGIN CERTIFICATE-----
  42572. MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
  42573. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
  42574. MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
  42575. QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X
  42576. DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl
  42577. a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN
  42578. BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  42579. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw
  42580. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N
  42581. YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv
  42582. KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya
  42583. KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT
  42584. rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC
  42585. AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP
  42586. BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s
  42587. Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I
  42588. aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO
  42589. Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb
  42590. BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK
  42591. poRq0Tl9
  42592. -----END CERTIFICATE-----
  42593. D-TRUST Root Class 3 CA 2 2009
  42594. ==============================
  42595. -----BEGIN CERTIFICATE-----
  42596. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  42597. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  42598. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  42599. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  42600. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  42601. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  42602. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  42603. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  42604. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  42605. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  42606. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  42607. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  42608. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  42609. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  42610. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  42611. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  42612. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  42613. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  42614. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  42615. -----END CERTIFICATE-----
  42616. D-TRUST Root Class 3 CA 2 EV 2009
  42617. =================================
  42618. -----BEGIN CERTIFICATE-----
  42619. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  42620. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  42621. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  42622. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  42623. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  42624. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  42625. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  42626. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  42627. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  42628. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  42629. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  42630. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  42631. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  42632. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  42633. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  42634. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  42635. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  42636. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  42637. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  42638. w9y4AyHqnxbxLFS1
  42639. -----END CERTIFICATE-----
  42640. PSCProcert
  42641. ==========
  42642. -----BEGIN CERTIFICATE-----
  42643. MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1dG9yaWRhZCBk
  42644. ZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9sYW5vMQswCQYDVQQGEwJWRTEQ
  42645. MA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlzdHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lz
  42646. dGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBl
  42647. cmludGVuZGVuY2lhIGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUw
  42648. IwYJKoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEwMFoXDTIw
  42649. MTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHByb2NlcnQubmV0LnZlMQ8w
  42650. DQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGExKjAoBgNVBAsTIVByb3ZlZWRvciBkZSBD
  42651. ZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZp
  42652. Y2FjaW9uIEVsZWN0cm9uaWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIw
  42653. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo97BVC
  42654. wfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74BCXfgI8Qhd19L3uA
  42655. 3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38GieU89RLAu9MLmV+QfI4tL3czkkoh
  42656. RqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmO
  42657. EO8GqQKJ/+MMbpfg353bIdD0PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG2
  42658. 0qCZyFSTXai20b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH
  42659. 0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/6mnbVSKVUyqU
  42660. td+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1mv6JpIzi4mWCZDlZTOpx+FIyw
  42661. Bm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvp
  42662. r2uKGcfLFFb14dq12fy/czja+eevbqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/
  42663. AgEBMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAz
  42664. Ni0wMB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFDgBStuyId
  42665. xuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRp
  42666. ZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQH
  42667. EwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5h
  42668. Y2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5k
  42669. ZW5jaWEgZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG
  42670. 9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQDAgEGME0GA1UdEQRG
  42671. MESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0wMDAwMDKgGwYFYIZeAgKgEgwQUklG
  42672. LUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEagRKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52
  42673. ZS9sY3IvQ0VSVElGSUNBRE8tUkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNy
  42674. YWl6LnN1c2NlcnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v
  42675. Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsGAQUFBwIBFh5o
  42676. dHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcNAQELBQADggIBACtZ6yKZu4Sq
  42677. T96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmN
  42678. g7+mvTV+LFwxNG9s2/NkAZiqlCxB3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4q
  42679. uxtxj7mkoP3YldmvWb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1
  42680. n8GhHVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHmpHmJWhSn
  42681. FFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXzsOfIt+FTvZLm8wyWuevo
  42682. 5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bEqCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq
  42683. 3TNWOByyrYDT13K9mmyZY+gAu0F2BbdbmRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5
  42684. poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y
  42685. eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km
  42686. -----END CERTIFICATE-----
  42687. China Internet Network Information Center EV Certificates Root
  42688. ==============================================================
  42689. -----BEGIN CERTIFICATE-----
  42690. MIID9zCCAt+gAwIBAgIESJ8AATANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMCQ04xMjAwBgNV
  42691. BAoMKUNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyMUcwRQYDVQQDDD5D
  42692. aGluYSBJbnRlcm5ldCBOZXR3b3JrIEluZm9ybWF0aW9uIENlbnRlciBFViBDZXJ0aWZpY2F0ZXMg
  42693. Um9vdDAeFw0xMDA4MzEwNzExMjVaFw0zMDA4MzEwNzExMjVaMIGKMQswCQYDVQQGEwJDTjEyMDAG
  42694. A1UECgwpQ2hpbmEgSW50ZXJuZXQgTmV0d29yayBJbmZvcm1hdGlvbiBDZW50ZXIxRzBFBgNVBAMM
  42695. PkNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyIEVWIENlcnRpZmljYXRl
  42696. cyBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm35z7r07eKpkQ0H1UN+U8i6y
  42697. jUqORlTSIRLIOTJCBumD1Z9S7eVnAztUwYyZmczpwA//DdmEEbK40ctb3B75aDFk4Zv6dOtouSCV
  42698. 98YPjUesWgbdYavi7NifFy2cyjw1l1VxzUOFsUcW9SxTgHbP0wBkvUCZ3czY28Sf1hNfQYOL+Q2H
  42699. klY0bBoQCxfVWhyXWIQ8hBouXJE0bhlffxdpxWXvayHG1VA6v2G5BY3vbzQ6sm8UY78WO5upKv23
  42700. KzhmBsUs4qpnHkWnjQRmQvaPK++IIGmPMowUc9orhpFjIpryp9vOiYurXccUwVswah+xt54ugQEC
  42701. 7c+WXmPbqOY4twIDAQABo2MwYTAfBgNVHSMEGDAWgBR8cks5x8DbYqVPm6oYNJKiyoOCWTAPBgNV
  42702. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUfHJLOcfA22KlT5uqGDSSosqD
  42703. glkwDQYJKoZIhvcNAQEFBQADggEBACrDx0M3j92tpLIM7twUbY8opJhJywyA6vPtI2Z1fcXTIWd5
  42704. 0XPFtQO3WKwMVC/GVhMPMdoG52U7HW8228gd+f2ABsqjPWYWqJ1MFn3AlUa1UeTiH9fqBk1jjZaM
  42705. 7+czV0I664zBechNdn3e9rG3geCg+aF4RhcaVpjwTj2rHO3sOdwHSPdj/gauwqRcalsyiMXHM4Ws
  42706. ZkJHwlgkmeHlPuV1LI5D1l08eB6olYIpUNHRFrrvwb562bTYzB5MRuF3sTGrvSrIzo9uoV1/A3U0
  42707. 5K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATywy39FCqQmbkHzJ8=
  42708. -----END CERTIFICATE-----
  42709. Swisscom Root CA 2
  42710. ==================
  42711. -----BEGIN CERTIFICATE-----
  42712. MIIF2TCCA8GgAwIBAgIQHp4o6Ejy5e/DfEoeWhhntjANBgkqhkiG9w0BAQsFADBkMQswCQYDVQQG
  42713. EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
  42714. dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMjAeFw0xMTA2MjQwODM4MTRaFw0zMTA2
  42715. MjUwNzM4MTRaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
  42716. aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAyMIIC
  42717. IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlUJOhJ1R5tMJ6HJaI2nbeHCOFvErjw0DzpPM
  42718. LgAIe6szjPTpQOYXTKueuEcUMncy3SgM3hhLX3af+Dk7/E6J2HzFZ++r0rk0X2s682Q2zsKwzxNo
  42719. ysjL67XiPS4h3+os1OD5cJZM/2pYmLcX5BtS5X4HAB1f2uY+lQS3aYg5oUFgJWFLlTloYhyxCwWJ
  42720. wDaCFCE/rtuh/bxvHGCGtlOUSbkrRsVPACu/obvLP+DHVxxX6NZp+MEkUp2IVd3Chy50I9AU/SpH
  42721. Wrumnf2U5NGKpV+GY3aFy6//SSj8gO1MedK75MDvAe5QQQg1I3ArqRa0jG6F6bYRzzHdUyYb3y1a
  42722. SgJA/MTAtukxGggo5WDDH8SQjhBiYEQN7Aq+VRhxLKX0srwVYv8c474d2h5Xszx+zYIdkeNL6yxS
  42723. NLCK/RJOlrDrcH+eOfdmQrGrrFLadkBXeyq96G4DsguAhYidDMfCd7Camlf0uPoTXGiTOmekl9Ab
  42724. mbeGMktg2M7v0Ax/lZ9vh0+Hio5fCHyqW/xavqGRn1V9TrALacywlKinh/LTSlDcX3KwFnUey7QY
  42725. Ypqwpzmqm59m2I2mbJYV4+by+PGDYmy7Velhk6M99bFXi08jsJvllGov34zflVEpYKELKeRcVVi3
  42726. qPyZ7iVNTA6z00yPhOgpD/0QVAKFyPnlw4vP5w8CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
  42727. HQYDVR0hBBYwFDASBgdghXQBUwIBBgdghXQBUwIBMBIGA1UdEwEB/wQIMAYBAf8CAQcwHQYDVR0O
  42728. BBYEFE0mICKJS9PVpAqhb97iEoHF8TwuMB8GA1UdIwQYMBaAFE0mICKJS9PVpAqhb97iEoHF8Twu
  42729. MA0GCSqGSIb3DQEBCwUAA4ICAQAyCrKkG8t9voJXiblqf/P0wS4RfbgZPnm3qKhyN2abGu2sEzsO
  42730. v2LwnN+ee6FTSA5BesogpxcbtnjsQJHzQq0Qw1zv/2BZf82Fo4s9SBwlAjxnffUy6S8w5X2lejjQ
  42731. 82YqZh6NM4OKb3xuqFp1mrjX2lhIREeoTPpMSQpKwhI3qEAMw8jh0FcNlzKVxzqfl9NX+Ave5XLz
  42732. o9v/tdhZsnPdTSpxsrpJ9csc1fV5yJmz/MFMdOO0vSk3FQQoHt5FRnDsr7p4DooqzgB53MBfGWcs
  42733. a0vvaGgLQ+OswWIJ76bdZWGgr4RVSJFSHMYlkSrQwSIjYVmvRRGFHQEkNI/Ps/8XciATwoCqISxx
  42734. OQ7Qj1zB09GOInJGTB2Wrk9xseEFKZZZ9LuedT3PDTcNYtsmjGOpI99nBjx8Oto0QuFmtEYE3saW
  42735. mA9LSHokMnWRn6z3aOkquVVlzl1h0ydw2Df+n7mvoC5Wt6NlUe07qxS/TFED6F+KBZvuim6c779o
  42736. +sjaC+NCydAXFJy3SuCvkychVSa1ZC+N8f+mQAWFBVzKBxlcCxMoTFh/wqXvRdpg065lYZ1Tg3TC
  42737. rvJcwhbtkj6EPnNgiLx29CzP0H1907he0ZESEOnN3col49XtmS++dYFLJPlFRpTJKSFTnCZFqhMX
  42738. 5OfNeOI5wSsSnqaeG8XmDtkx2Q==
  42739. -----END CERTIFICATE-----
  42740. Swisscom Root EV CA 2
  42741. =====================
  42742. -----BEGIN CERTIFICATE-----
  42743. MIIF4DCCA8igAwIBAgIRAPL6ZOJ0Y9ON/RAdBB92ylgwDQYJKoZIhvcNAQELBQAwZzELMAkGA1UE
  42744. BhMCY2gxETAPBgNVBAoTCFN3aXNzY29tMSUwIwYDVQQLExxEaWdpdGFsIENlcnRpZmljYXRlIFNl
  42745. cnZpY2VzMR4wHAYDVQQDExVTd2lzc2NvbSBSb290IEVWIENBIDIwHhcNMTEwNjI0MDk0NTA4WhcN
  42746. MzEwNjI1MDg0NTA4WjBnMQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsT
  42747. HERpZ2l0YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxHjAcBgNVBAMTFVN3aXNzY29tIFJvb3QgRVYg
  42748. Q0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMT3HS9X6lds93BdY7BxUglgRCgz
  42749. o3pOCvrY6myLURYaVa5UJsTMRQdBTxB5f3HSek4/OE6zAMaVylvNwSqD1ycfMQ4jFrclyxy0uYAy
  42750. Xhqdk/HoPGAsp15XGVhRXrwsVgu42O+LgrQ8uMIkqBPHoCE2G3pXKSinLr9xJZDzRINpUKTk4Rti
  42751. GZQJo/PDvO/0vezbE53PnUgJUmfANykRHvvSEaeFGHR55E+FFOtSN+KxRdjMDUN/rhPSays/p8Li
  42752. qG12W0OfvrSdsyaGOx9/5fLoZigWJdBLlzin5M8J0TbDC77aO0RYjb7xnglrPvMyxyuHxuxenPaH
  42753. Za0zKcQvidm5y8kDnftslFGXEBuGCxobP/YCfnvUxVFkKJ3106yDgYjTdLRZncHrYTNaRdHLOdAG
  42754. alNgHa/2+2m8atwBz735j9m9W8E6X47aD0upm50qKGsaCnw8qyIL5XctcfaCNYGu+HuB5ur+rPQa
  42755. m3Rc6I8k9l2dRsQs0h4rIWqDJ2dVSqTjyDKXZpBy2uPUZC5f46Fq9mDU5zXNysRojddxyNMkM3Ox
  42756. bPlq4SjbX8Y96L5V5jcb7STZDxmPX2MYWFCBUWVv8p9+agTnNCRxunZLWB4ZvRVgRaoMEkABnRDi
  42757. xzgHcgplwLa7JSnaFp6LNYth7eVxV4O1PHGf40+/fh6Bn0GXAgMBAAGjgYYwgYMwDgYDVR0PAQH/
  42758. BAQDAgGGMB0GA1UdIQQWMBQwEgYHYIV0AVMCAgYHYIV0AVMCAjASBgNVHRMBAf8ECDAGAQH/AgED
  42759. MB0GA1UdDgQWBBRF2aWBbj2ITY1x0kbBbkUe88SAnTAfBgNVHSMEGDAWgBRF2aWBbj2ITY1x0kbB
  42760. bkUe88SAnTANBgkqhkiG9w0BAQsFAAOCAgEAlDpzBp9SSzBc1P6xXCX5145v9Ydkn+0UjrgEjihL
  42761. j6p7jjm02Vj2e6E1CqGdivdj5eu9OYLU43otb98TPLr+flaYC/NUn81ETm484T4VvwYmneTwkLbU
  42762. wp4wLh/vx3rEUMfqe9pQy3omywC0Wqu1kx+AiYQElY2NfwmTv9SoqORjbdlk5LgpWgi/UOGED1V7
  42763. XwgiG/W9mR4U9s70WBCCswo9GcG/W6uqmdjyMb3lOGbcWAXH7WMaLgqXfIeTK7KK4/HsGOV1timH
  42764. 59yLGn602MnTihdsfSlEvoqq9X46Lmgxk7lq2prg2+kupYTNHAq4Sgj5nPFhJpiTt3tm7JFe3VE/
  42765. 23MPrQRYCd0EApUKPtN236YQHoA96M2kZNEzx5LH4k5E4wnJTsJdhw4Snr8PyQUQ3nqjsTzyP6Wq
  42766. J3mtMX0f/fwZacXduT98zca0wjAefm6S139hdlqP65VNvBFuIXxZN5nQBrz5Bm0yFqXZaajh3DyA
  42767. HmBR3NdUIR7KYndP+tiPsys6DXhyyWhBWkdKwqPrGtcKqzwyVcgKEZzfdNbwQBUdyLmPtTbFr/gi
  42768. uMod89a2GQ+fYWVq6nTIfI/DT11lgh/ZDYnadXL77/FHZxOzyNEZiCcmmpl5fx7kLD977vHeTYuW
  42769. l8PVP3wbI+2ksx0WckNLIOFZfsLorSa/ovc=
  42770. -----END CERTIFICATE-----
  42771. CA Disig Root R1
  42772. ================
  42773. -----BEGIN CERTIFICATE-----
  42774. MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw
  42775. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  42776. ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx
  42777. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  42778. c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy
  42779. 3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8
  42780. u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2
  42781. m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk
  42782. CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa
  42783. YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6
  42784. vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL
  42785. LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX
  42786. ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is
  42787. XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV
  42788. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ
  42789. 04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR
  42790. xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B
  42791. LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM
  42792. CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb
  42793. VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85
  42794. YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS
  42795. ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix
  42796. lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N
  42797. UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ
  42798. a7+h89n07eLw4+1knj0vllJPgFOL
  42799. -----END CERTIFICATE-----
  42800. CA Disig Root R2
  42801. ================
  42802. -----BEGIN CERTIFICATE-----
  42803. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  42804. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  42805. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  42806. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  42807. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  42808. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  42809. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  42810. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  42811. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  42812. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  42813. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  42814. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  42815. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  42816. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  42817. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  42818. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  42819. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  42820. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  42821. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  42822. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  42823. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  42824. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  42825. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  42826. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  42827. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  42828. -----END CERTIFICATE-----
  42829. ACCVRAIZ1
  42830. =========
  42831. -----BEGIN CERTIFICATE-----
  42832. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  42833. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  42834. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  42835. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  42836. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  42837. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  42838. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  42839. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  42840. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  42841. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  42842. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  42843. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  42844. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  42845. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  42846. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  42847. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  42848. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  42849. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  42850. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  42851. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  42852. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  42853. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  42854. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  42855. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  42856. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  42857. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  42858. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  42859. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  42860. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  42861. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  42862. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  42863. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  42864. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  42865. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  42866. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  42867. EfbRD0tVNEYqi4Y7
  42868. -----END CERTIFICATE-----
  42869. TWCA Global Root CA
  42870. ===================
  42871. -----BEGIN CERTIFICATE-----
  42872. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  42873. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  42874. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  42875. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  42876. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  42877. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  42878. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  42879. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  42880. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  42881. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  42882. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  42883. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  42884. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  42885. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  42886. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  42887. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  42888. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  42889. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  42890. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  42891. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  42892. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  42893. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  42894. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  42895. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  42896. -----END CERTIFICATE-----
  42897. TeliaSonera Root CA v1
  42898. ======================
  42899. -----BEGIN CERTIFICATE-----
  42900. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  42901. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  42902. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  42903. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  42904. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  42905. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  42906. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  42907. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  42908. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  42909. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  42910. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  42911. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  42912. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  42913. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  42914. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  42915. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  42916. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  42917. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  42918. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  42919. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  42920. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  42921. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  42922. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  42923. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  42924. -----END CERTIFICATE-----
  42925. E-Tugra Certification Authority
  42926. ===============================
  42927. -----BEGIN CERTIFICATE-----
  42928. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  42929. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  42930. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  42931. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  42932. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  42933. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  42934. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  42935. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  42936. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  42937. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  42938. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  42939. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  42940. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  42941. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  42942. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  42943. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  42944. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  42945. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  42946. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  42947. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  42948. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  42949. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  42950. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  42951. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  42952. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  42953. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  42954. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  42955. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  42956. C7TbO6Orb1wdtn7os4I07QZcJA==
  42957. -----END CERTIFICATE-----
  42958. T-TeleSec GlobalRoot Class 2
  42959. ============================
  42960. -----BEGIN CERTIFICATE-----
  42961. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  42962. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  42963. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  42964. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  42965. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  42966. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  42967. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  42968. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  42969. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  42970. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  42971. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  42972. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  42973. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  42974. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  42975. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  42976. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  42977. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  42978. -----END CERTIFICATE-----
  42979. Atos TrustedRoot 2011
  42980. =====================
  42981. -----BEGIN CERTIFICATE-----
  42982. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  42983. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  42984. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  42985. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  42986. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  42987. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  42988. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  42989. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  42990. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  42991. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  42992. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  42993. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  42994. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  42995. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  42996. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  42997. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  42998. -----END CERTIFICATE-----
  42999. QuoVadis Root CA 1 G3
  43000. =====================
  43001. -----BEGIN CERTIFICATE-----
  43002. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  43003. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  43004. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  43005. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  43006. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  43007. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  43008. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  43009. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  43010. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  43011. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  43012. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  43013. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  43014. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  43015. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  43016. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  43017. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  43018. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  43019. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  43020. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  43021. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  43022. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  43023. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  43024. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  43025. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  43026. hMJKzRwuJIczYOXD
  43027. -----END CERTIFICATE-----
  43028. QuoVadis Root CA 2 G3
  43029. =====================
  43030. -----BEGIN CERTIFICATE-----
  43031. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  43032. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  43033. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  43034. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  43035. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  43036. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  43037. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  43038. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  43039. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  43040. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  43041. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  43042. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  43043. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  43044. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  43045. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  43046. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  43047. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  43048. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  43049. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  43050. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  43051. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  43052. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  43053. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  43054. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  43055. O3jtZsSOeWmD3n+M
  43056. -----END CERTIFICATE-----
  43057. QuoVadis Root CA 3 G3
  43058. =====================
  43059. -----BEGIN CERTIFICATE-----
  43060. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  43061. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  43062. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  43063. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  43064. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  43065. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  43066. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  43067. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  43068. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  43069. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  43070. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  43071. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  43072. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  43073. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  43074. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  43075. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  43076. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  43077. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  43078. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  43079. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  43080. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  43081. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  43082. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  43083. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  43084. PpxxVJkES/1Y+Zj0
  43085. -----END CERTIFICATE-----
  43086. DigiCert Assured ID Root G2
  43087. ===========================
  43088. -----BEGIN CERTIFICATE-----
  43089. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  43090. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  43091. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  43092. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  43093. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  43094. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  43095. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  43096. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  43097. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  43098. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  43099. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  43100. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  43101. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  43102. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  43103. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  43104. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  43105. IhNzbM8m9Yop5w==
  43106. -----END CERTIFICATE-----
  43107. DigiCert Assured ID Root G3
  43108. ===========================
  43109. -----BEGIN CERTIFICATE-----
  43110. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  43111. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  43112. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  43113. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  43114. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  43115. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  43116. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  43117. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  43118. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  43119. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  43120. 1vUhZscv6pZjamVFkpUBtA==
  43121. -----END CERTIFICATE-----
  43122. DigiCert Global Root G2
  43123. =======================
  43124. -----BEGIN CERTIFICATE-----
  43125. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  43126. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  43127. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  43128. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  43129. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  43130. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  43131. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  43132. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  43133. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  43134. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  43135. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  43136. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  43137. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  43138. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  43139. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  43140. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  43141. MrY=
  43142. -----END CERTIFICATE-----
  43143. DigiCert Global Root G3
  43144. =======================
  43145. -----BEGIN CERTIFICATE-----
  43146. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  43147. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  43148. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  43149. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  43150. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  43151. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  43152. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  43153. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  43154. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  43155. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  43156. VOKa5Vt8sycX
  43157. -----END CERTIFICATE-----
  43158. DigiCert Trusted Root G4
  43159. ========================
  43160. -----BEGIN CERTIFICATE-----
  43161. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  43162. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  43163. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  43164. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  43165. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  43166. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  43167. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  43168. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  43169. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  43170. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  43171. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  43172. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  43173. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  43174. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  43175. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  43176. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  43177. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  43178. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  43179. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  43180. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  43181. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  43182. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  43183. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  43184. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  43185. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  43186. 82Z+
  43187. -----END CERTIFICATE-----
  43188. WoSign
  43189. ======
  43190. -----BEGIN CERTIFICATE-----
  43191. MIIFdjCCA16gAwIBAgIQXmjWEXGUY1BWAGjzPsnFkTANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQG
  43192. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxKjAoBgNVBAMTIUNlcnRpZmljYXRpb24g
  43193. QXV0aG9yaXR5IG9mIFdvU2lnbjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMFUxCzAJ
  43194. BgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEqMCgGA1UEAxMhQ2VydGlmaWNh
  43195. dGlvbiBBdXRob3JpdHkgb2YgV29TaWduMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
  43196. vcqNrLiRFVaXe2tcesLea9mhsMMQI/qnobLMMfo+2aYpbxY94Gv4uEBf2zmoAHqLoE1UfcIiePyO
  43197. CbiohdfMlZdLdNiefvAA5A6JrkkoRBoQmTIPJYhTpA2zDxIIFgsDcSccf+Hb0v1naMQFXQoOXXDX
  43198. 2JegvFNBmpGN9J42Znp+VsGQX+axaCA2pIwkLCxHC1l2ZjC1vt7tj/id07sBMOby8w7gLJKA84X5
  43199. KIq0VC6a7fd2/BVoFutKbOsuEo/Uz/4Mx1wdC34FMr5esAkqQtXJTpCzWQ27en7N1QhatH/YHGkR
  43200. +ScPewavVIMYe+HdVHpRaG53/Ma/UkpmRqGyZxq7o093oL5d//xWC0Nyd5DKnvnyOfUNqfTq1+ez
  43201. EC8wQjchzDBwyYaYD8xYTYO7feUapTeNtqwylwA6Y3EkHp43xP901DfA4v6IRmAR3Qg/UDaruHqk
  43202. lWJqbrDKaiFaafPz+x1wOZXzp26mgYmhiMU7ccqjUu6Du/2gd/Tkb+dC221KmYo0SLwX3OSACCK2
  43203. 8jHAPwQ+658geda4BmRkAjHXqc1S+4RFaQkAKtxVi8QGRkvASh0JWzko/amrzgD5LkhLJuYwTKVY
  43204. yrREgk/nkR4zw7CT/xH8gdLKH3Ep3XZPkiWvHYG3Dy+MwwbMLyejSuQOmbp8HkUff6oZRZb9/D0C
  43205. AwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFOFmzw7R
  43206. 8bNLtwYgFP6HEtX2/vs+MA0GCSqGSIb3DQEBBQUAA4ICAQCoy3JAsnbBfnv8rWTjMnvMPLZdRtP1
  43207. LOJwXcgu2AZ9mNELIaCJWSQBnfmvCX0KI4I01fx8cpm5o9dU9OpScA7F9dY74ToJMuYhOZO9sxXq
  43208. T2r09Ys/L3yNWC7F4TmgPsc9SnOeQHrAK2GpZ8nzJLmzbVUsWh2eJXLOC62qx1ViC777Y7NhRCOj
  43209. y+EaDveaBk3e1CNOIZZbOVtXHS9dCF4Jef98l7VNg64N1uajeeAz0JmWAjCnPv/So0M/BVoG6kQC
  43210. 2nz4SNAzqfkHx5Xh9T71XXG68pWpdIhhWeO/yloTunK0jF02h+mmxTwTv97QRCbut+wucPrXnbes
  43211. 5cVAWubXbHssw1abR80LzvobtCHXt2a49CUwi1wNuepnsvRtrtWhnk/Yn+knArAdBtaP4/tIEp9/
  43212. EaEQPkxROpaw0RPxx9gmrjrKkcRpnd8BKWRRb2jaFOwIQZeQjdCygPLPwj2/kWjFgGcexGATVdVh
  43213. mVd8upUPYUk6ynW8yQqTP2cOEvIo4jEbwFcW3wh8GcF+Dx+FHgo2fFt+J7x6v+Db9NpSvd4MVHAx
  43214. kUOVyLzwPt0JfjBkUO1/AaQzZ01oT74V77D2AhGiGxMlOtzCWfHjXEa7ZywCRuoeSKbmW9m1vFGi
  43215. kpbbqsY3Iqb+zCB0oy2pLmvLwIIRIbWTee5Ehr7XHuQe+w==
  43216. -----END CERTIFICATE-----
  43217. WoSign China
  43218. ============
  43219. -----BEGIN CERTIFICATE-----
  43220. MIIFWDCCA0CgAwIBAgIQUHBrzdgT/BtOOzNy0hFIjTANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQG
  43221. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMMEkNBIOayg+mAmuagueiv
  43222. geS5pjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMEYxCzAJBgNVBAYTAkNOMRowGAYD
  43223. VQQKExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAwwSQ0Eg5rKD6YCa5qC56K+B5LmmMIICIjAN
  43224. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0EkhHiX8h8EqwqzbdoYGTufQdDTc7WU1/FDWiD+k
  43225. 8H/rD195L4mx/bxjWDeTmzj4t1up+thxx7S8gJeNbEvxUNUqKaqoGXqW5pWOdO2XCld19AXbbQs5
  43226. uQF/qvbW2mzmBeCkTVL829B0txGMe41P/4eDrv8FAxNXUDf+jJZSEExfv5RxadmWPgxDT74wwJ85
  43227. dE8GRV2j1lY5aAfMh09Qd5Nx2UQIsYo06Yms25tO4dnkUkWMLhQfkWsZHWgpLFbE4h4TV2TwYeO5
  43228. Ed+w4VegG63XX9Gv2ystP9Bojg/qnw+LNVgbExz03jWhCl3W6t8Sb8D7aQdGctyB9gQjF+BNdeFy
  43229. b7Ao65vh4YOhn0pdr8yb+gIgthhid5E7o9Vlrdx8kHccREGkSovrlXLp9glk3Kgtn3R46MGiCWOc
  43230. 76DbT52VqyBPt7D3h1ymoOQ3OMdc4zUPLK2jgKLsLl3Az+2LBcLmc272idX10kaO6m1jGx6KyX2m
  43231. +Jzr5dVjhU1zZmkR/sgO9MHHZklTfuQZa/HpelmjbX7FF+Ynxu8b22/8DU0GAbQOXDBGVWCvOGU6
  43232. yke6rCzMRh+yRpY/8+0mBe53oWprfi1tWFxK1I5nuPHa1UaKJ/kR8slC/k7e3x9cxKSGhxYzoacX
  43233. GKUN5AXlK8IrC6KVkLn9YDxOiT7nnO4fuwECAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1Ud
  43234. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFOBNv9ybQV0T6GTwp+kVpOGBwboxMA0GCSqGSIb3DQEBCwUA
  43235. A4ICAQBqinA4WbbaixjIvirTthnVZil6Xc1bL3McJk6jfW+rtylNpumlEYOnOXOvEESS5iVdT2H6
  43236. yAa+Tkvv/vMx/sZ8cApBWNromUuWyXi8mHwCKe0JgOYKOoICKuLJL8hWGSbueBwj/feTZU7n85iY
  43237. r83d2Z5AiDEoOqsuC7CsDCT6eiaY8xJhEPRdF/d+4niXVOKM6Cm6jBAyvd0zaziGfjk9DgNyp115
  43238. j0WKWa5bIW4xRtVZjc8VX90xJc/bYNaBRHIpAlf2ltTW/+op2znFuCyKGo3Oy+dCMYYFaA6eFN0A
  43239. kLppRQjbbpCBhqcqBT/mhDn4t/lXX0ykeVoQDF7Va/81XwVRHmyjdanPUIPTfPRm94KNPQx96N97
  43240. qA4bLJyuQHCH2u2nFoJavjVsIE4iYdm8UXrNemHcSxH5/mc0zy4EZmFcV5cjjPOGG0jfKq+nwf/Y
  43241. jj4Du9gqsPoUJbJRa4ZDhS4HIxaAjUz7tGM7zMN07RujHv41D198HRaG9Q7DlfEvr10lO1Hm13ZB
  43242. ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv
  43243. T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO
  43244. kI26oQ==
  43245. -----END CERTIFICATE-----
  43246. COMODO RSA Certification Authority
  43247. ==================================
  43248. -----BEGIN CERTIFICATE-----
  43249. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  43250. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  43251. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  43252. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  43253. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  43254. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  43255. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  43256. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  43257. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  43258. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  43259. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  43260. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  43261. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  43262. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  43263. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  43264. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  43265. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  43266. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  43267. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  43268. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  43269. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  43270. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  43271. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  43272. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  43273. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  43274. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  43275. LaZRfyHBNVOFBkpdn627G190
  43276. -----END CERTIFICATE-----
  43277. USERTrust RSA Certification Authority
  43278. =====================================
  43279. -----BEGIN CERTIFICATE-----
  43280. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  43281. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  43282. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  43283. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  43284. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  43285. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  43286. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  43287. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  43288. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  43289. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  43290. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  43291. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  43292. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  43293. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  43294. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  43295. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  43296. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  43297. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  43298. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  43299. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  43300. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  43301. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  43302. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  43303. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  43304. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  43305. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  43306. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  43307. -----END CERTIFICATE-----
  43308. USERTrust ECC Certification Authority
  43309. =====================================
  43310. -----BEGIN CERTIFICATE-----
  43311. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  43312. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  43313. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  43314. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  43315. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  43316. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  43317. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  43318. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  43319. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  43320. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  43321. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  43322. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  43323. -----END CERTIFICATE-----
  43324. GlobalSign ECC Root CA - R4
  43325. ===========================
  43326. -----BEGIN CERTIFICATE-----
  43327. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  43328. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  43329. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  43330. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  43331. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  43332. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  43333. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  43334. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  43335. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  43336. -----END CERTIFICATE-----
  43337. GlobalSign ECC Root CA - R5
  43338. ===========================
  43339. -----BEGIN CERTIFICATE-----
  43340. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  43341. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  43342. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  43343. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  43344. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  43345. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  43346. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  43347. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  43348. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  43349. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  43350. -----END CERTIFICATE-----
  43351. Staat der Nederlanden Root CA - G3
  43352. ==================================
  43353. -----BEGIN CERTIFICATE-----
  43354. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  43355. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  43356. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  43357. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  43358. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  43359. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  43360. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  43361. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  43362. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  43363. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  43364. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  43365. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  43366. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  43367. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  43368. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  43369. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  43370. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  43371. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  43372. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  43373. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  43374. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  43375. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  43376. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  43377. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  43378. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  43379. -----END CERTIFICATE-----
  43380. Staat der Nederlanden EV Root CA
  43381. ================================
  43382. -----BEGIN CERTIFICATE-----
  43383. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  43384. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  43385. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  43386. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  43387. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  43388. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  43389. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  43390. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  43391. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  43392. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  43393. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  43394. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  43395. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  43396. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  43397. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  43398. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  43399. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  43400. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  43401. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  43402. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  43403. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  43404. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  43405. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  43406. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  43407. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  43408. -----END CERTIFICATE-----
  43409. IdenTrust Commercial Root CA 1
  43410. ==============================
  43411. -----BEGIN CERTIFICATE-----
  43412. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  43413. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  43414. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  43415. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  43416. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  43417. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  43418. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  43419. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  43420. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  43421. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  43422. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  43423. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  43424. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  43425. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  43426. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  43427. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  43428. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  43429. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  43430. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  43431. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  43432. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  43433. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  43434. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  43435. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  43436. cGzM7vRX+Bi6hG6H
  43437. -----END CERTIFICATE-----
  43438. IdenTrust Public Sector Root CA 1
  43439. =================================
  43440. -----BEGIN CERTIFICATE-----
  43441. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  43442. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  43443. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  43444. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  43445. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  43446. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  43447. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  43448. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  43449. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  43450. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  43451. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  43452. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  43453. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  43454. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  43455. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  43456. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  43457. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  43458. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  43459. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  43460. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  43461. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  43462. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  43463. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  43464. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  43465. 3Wl9af0AVqW3rLatt8o+Ae+c
  43466. -----END CERTIFICATE-----
  43467. Entrust Root Certification Authority - G2
  43468. =========================================
  43469. -----BEGIN CERTIFICATE-----
  43470. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  43471. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  43472. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  43473. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  43474. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  43475. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  43476. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  43477. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  43478. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  43479. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  43480. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  43481. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  43482. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  43483. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  43484. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  43485. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  43486. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  43487. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  43488. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  43489. e4pIb4tF9g==
  43490. -----END CERTIFICATE-----
  43491. Entrust Root Certification Authority - EC1
  43492. ==========================================
  43493. -----BEGIN CERTIFICATE-----
  43494. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  43495. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  43496. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  43497. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  43498. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  43499. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  43500. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  43501. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  43502. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  43503. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  43504. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  43505. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  43506. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  43507. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  43508. -----END CERTIFICATE-----
  43509. CFCA EV ROOT
  43510. ============
  43511. -----BEGIN CERTIFICATE-----
  43512. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  43513. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  43514. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  43515. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  43516. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  43517. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  43518. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  43519. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  43520. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  43521. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  43522. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  43523. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  43524. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  43525. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  43526. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  43527. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  43528. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  43529. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  43530. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  43531. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  43532. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  43533. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  43534. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  43535. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  43536. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  43537. -----END CERTIFICATE-----
  43538. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5
  43539. =========================================================
  43540. -----BEGIN CERTIFICATE-----
  43541. MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UEBhMCVFIxDzAN
  43542. BgNVBAcMBkFua2FyYTFNMEsGA1UECgxEVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  43543. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4xQjBABgNVBAMMOVTDnFJLVFJVU1Qg
  43544. RWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSBINTAeFw0xMzA0MzAw
  43545. ODA3MDFaFw0yMzA0MjgwODA3MDFaMIGxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0w
  43546. SwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnE
  43547. n2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBFbGVrdHJvbmlrIFNlcnRp
  43548. ZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg1MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  43549. CgKCAQEApCUZ4WWe60ghUEoI5RHwWrom/4NZzkQqL/7hzmAD/I0Dpe3/a6i6zDQGn1k19uwsu537
  43550. jVJp45wnEFPzpALFp/kRGml1bsMdi9GYjZOHp3GXDSHHmflS0yxjXVW86B8BSLlg/kJK9siArs1m
  43551. ep5Fimh34khon6La8eHBEJ/rPCmBp+EyCNSgBbGM+42WAA4+Jd9ThiI7/PS98wl+d+yG6w8z5UNP
  43552. 9FR1bSmZLmZaQ9/LXMrI5Tjxfjs1nQ/0xVqhzPMggCTTV+wVunUlm+hkS7M0hO8EuPbJbKoCPrZV
  43553. 4jI3X/xml1/N1p7HIL9Nxqw/dV8c7TKcfGkAaZHjIxhT6QIDAQABo0IwQDAdBgNVHQ4EFgQUVpkH
  43554. HtOsDGlktAxQR95DLL4gwPswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI
  43555. hvcNAQELBQADggEBAJ5FdnsXSDLyOIspve6WSk6BGLFRRyDN0GSxDsnZAdkJzsiZ3GglE9Rc8qPo
  43556. BP5yCccLqh0lVX6Wmle3usURehnmp349hQ71+S4pL+f5bFgWV1Al9j4uPqrtd3GqqpmWRgqujuwq
  43557. URawXs3qZwQcWDD1YIq9pr1N5Za0/EKJAWv2cMhQOQwt1WbZyNKzMrcbGW3LM/nfpeYVhDfwwvJl
  43558. lpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CFYv4HAqGEVka+lgqaE9chTLd8
  43559. B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW+qtB4Uu2NQvAmxU=
  43560. -----END CERTIFICATE-----
  43561. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6
  43562. =========================================================
  43563. -----BEGIN CERTIFICATE-----
  43564. MIIEJjCCAw6gAwIBAgIGfaHyZeyKMA0GCSqGSIb3DQEBCwUAMIGxMQswCQYDVQQGEwJUUjEPMA0G
  43565. A1UEBwwGQW5rYXJhMU0wSwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls
  43566. acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBF
  43567. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg2MB4XDTEzMTIxODA5
  43568. MDQxMFoXDTIzMTIxNjA5MDQxMFowgbExCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExTTBL
  43569. BgNVBAoMRFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBCaWxpxZ9pbSBHw7x2ZW5sacSf
  43570. aSBIaXptZXRsZXJpIEEuxZ4uMUIwQAYDVQQDDDlUw5xSS1RSVVNUIEVsZWt0cm9uaWsgU2VydGlm
  43571. aWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLEgSDYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  43572. AoIBAQCdsGjW6L0UlqMACprx9MfMkU1xeHe59yEmFXNRFpQJRwXiM/VomjX/3EsvMsew7eKC5W/a
  43573. 2uqsxgbPJQ1BgfbBOCK9+bGlprMBvD9QFyv26WZV1DOzXPhDIHiTVRZwGTLmiddk671IUP320EED
  43574. wnS3/faAz1vFq6TWlRKb55cTMgPp1KtDWxbtMyJkKbbSk60vbNg9tvYdDjTu0n2pVQ8g9P0pu5Fb
  43575. HH3GQjhtQiht1AH7zYiXSX6484P4tZgvsycLSF5W506jM7NE1qXyGJTtHB6plVxiSvgNZ1GpryHV
  43576. +DKdeboaX+UEVU0TRv/yz3THGmNtwx8XEsMeED5gCLMxAgMBAAGjQjBAMB0GA1UdDgQWBBTdVRcT
  43577. 9qzoSCHK77Wv0QAy7Z6MtTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG
  43578. 9w0BAQsFAAOCAQEAb1gNl0OqFlQ+v6nfkkU/hQu7VtMMUszIv3ZnXuaqs6fvuay0EBQNdH49ba3R
  43579. fdCaqaXKGDsCQC4qnFAUi/5XfldcEQlLNkVS9z2sFP1E34uXI9TDwe7UU5X+LEr+DXCqu4svLcsy
  43580. o4LyVN/Y8t3XSHLuSqMplsNEzm61kod2pLv0kmzOLBQJZo6NrRa1xxsJYTvjIKIDgI6tflEATseW
  43581. hvtDmHd9KMeP2Cpu54Rvl0EpABZeTeIT6lnAY2c6RPuY/ATTMHKm9ocJV612ph1jmv3XZch4gyt1
  43582. O6VbuA1df74jrlZVlFjvH4GMKrLN5ptjnhi85WsGtAuYSyher4hYyw==
  43583. -----END CERTIFICATE-----
  43584. Certinomis - Root CA
  43585. ====================
  43586. -----BEGIN CERTIFICATE-----
  43587. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  43588. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  43589. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  43590. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  43591. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  43592. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  43593. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  43594. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  43595. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  43596. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  43597. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  43598. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  43599. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  43600. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  43601. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  43602. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  43603. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  43604. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  43605. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  43606. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  43607. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  43608. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  43609. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  43610. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  43611. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  43612. hkIGuUE=
  43613. -----END CERTIFICATE-----
  43614. <?php
  43615. if (PHP_SAPI !== 'cli') {
  43616. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  43617. }
  43618. require __DIR__.'/../src/bootstrap.php';
  43619. use Composer\Console\Application;
  43620. error_reporting(-1);
  43621. if (function_exists('ini_set')) {
  43622. @ini_set('display_errors', 1);
  43623. $memoryInBytes = function ($value) {
  43624. $unit = strtolower(substr($value, -1, 1));
  43625. $value = (int) $value;
  43626. switch($unit) {
  43627. case 'g':
  43628. $value *= 1024;
  43629. // no break (cumulative multiplier)
  43630. case 'm':
  43631. $value *= 1024;
  43632. // no break (cumulative multiplier)
  43633. case 'k':
  43634. $value *= 1024;
  43635. }
  43636. return $value;
  43637. };
  43638. $memoryLimit = trim(ini_get('memory_limit'));
  43639. // Increase memory_limit if it is lower than 1GB
  43640. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1024) {
  43641. @ini_set('memory_limit', '1G');
  43642. }
  43643. unset($memoryInBytes, $memoryLimit);
  43644. }
  43645. // run the command application
  43646. $application = new Application();
  43647. $application->run();
  43648. Copyright (c) 2015 Nils Adermann, Jordi Boggiano
  43649. Permission is hereby granted, free of charge, to any person obtaining a copy
  43650. of this software and associated documentation files (the "Software"), to deal
  43651. in the Software without restriction, including without limitation the rights
  43652. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  43653. copies of the Software, and to permit persons to whom the Software is furnished
  43654. to do so, subject to the following conditions:
  43655. The above copyright notice and this permission notice shall be included in all
  43656. copies or substantial portions of the Software.
  43657. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43658. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43659. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43660. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43661. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43662. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  43663. THE SOFTWARE.
  43664. uÐ{j:ª[Ð$ÿØ*”TT.)fñ���GBMB