composer.phar 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296752977529875299753007530175302753037530475305753067530775308753097531075311753127531375314753157531675317753187531975320753217532275323753247532575326753277532875329753307533175332753337533475335753367533775338753397534075341753427534375344753457534675347753487534975350753517535275353753547535575356753577535875359753607536175362753637536475365753667536775368753697537075371753727537375374753757537675377753787537975380753817538275383753847538575386753877538875389753907539175392753937539475395753967539775398753997540075401754027540375404754057540675407754087540975410754117541275413754147541575416754177541875419754207542175422754237542475425754267542775428754297543075431754327543375434754357543675437754387543975440754417544275443754447544575446754477544875449754507545175452754537545475455754567545775458754597546075461754627546375464754657546675467754687546975470754717547275473754747547575476754777547875479754807548175482754837548475485754867548775488754897549075491754927549375494754957549675497754987549975500755017550275503755047550575506755077550875509755107551175512755137551475515755167551775518755197552075521755227552375524755257552675527755287552975530755317553275533755347553575536755377553875539755407554175542755437554475545755467554775548755497555075551755527555375554755557555675557755587555975560755617556275563755647556575566755677556875569755707557175572755737557475575755767557775578755797558075581755827558375584755857558675587755887558975590755917559275593755947559575596755977559875599756007560175602756037560475605756067560775608756097561075611756127561375614756157561675617756187561975620756217562275623756247562575626756277562875629756307563175632756337563475635756367563775638756397564075641756427564375644756457564675647756487564975650756517565275653756547565575656756577565875659756607566175662756637566475665756667566775668756697567075671756727567375674756757567675677756787567975680756817568275683756847568575686756877568875689756907569175692756937569475695756967569775698756997570075701757027570375704757057570675707757087570975710757117571275713757147571575716757177571875719757207572175722757237572475725757267572775728757297573075731757327573375734757357573675737757387573975740757417574275743757447574575746757477574875749757507575175752757537575475755757567575775758757597576075761757627576375764757657576675767757687576975770757717577275773757747577575776757777577875779757807578175782757837578475785757867578775788757897579075791757927579375794757957579675797757987579975800758017580275803758047580575806758077580875809758107581175812758137581475815758167581775818758197582075821758227582375824758257582675827758287582975830758317583275833758347583575836758377583875839758407584175842758437584475845758467584775848758497585075851758527585375854758557585675857758587585975860758617586275863758647586575866758677586875869758707587175872758737587475875758767587775878758797588075881758827588375884758857588675887758887588975890758917589275893758947589575896758977589875899759007590175902759037590475905759067590775908759097591075911759127591375914759157591675917759187591975920759217592275923759247592575926759277592875929759307593175932759337593475935759367593775938759397594075941759427594375944759457594675947759487594975950759517595275953759547595575956759577595875959759607596175962759637596475965759667596775968759697597075971759727597375974759757597675977759787597975980759817598275983759847598575986759877598875989759907599175992759937599475995759967599775998759997600076001760027600376004760057600676007760087600976010760117601276013760147601576016760177601876019760207602176022760237602476025760267602776028760297603076031760327603376034760357603676037760387603976040760417604276043760447604576046760477604876049760507605176052760537605476055760567605776058760597606076061760627606376064760657606676067760687606976070760717607276073760747607576076760777607876079760807608176082760837608476085760867608776088760897609076091760927609376094760957609676097760987609976100761017610276103761047610576106761077610876109761107611176112761137611476115761167611776118761197612076121761227612376124761257612676127761287612976130761317613276133761347613576136761377613876139761407614176142761437614476145761467614776148761497615076151761527615376154761557615676157761587615976160761617616276163761647616576166761677616876169761707617176172761737617476175761767617776178761797618076181761827618376184761857618676187761887618976190761917619276193761947619576196761977619876199762007620176202762037620476205762067620776208762097621076211762127621376214762157621676217762187621976220762217622276223762247622576226762277622876229762307623176232762337623476235762367623776238762397624076241762427624376244762457624676247762487624976250762517625276253762547625576256762577625876259762607626176262762637626476265762667626776268762697627076271762727627376274762757627676277762787627976280762817628276283762847628576286762877628876289762907629176292762937629476295762967629776298762997630076301763027630376304763057630676307763087630976310763117631276313763147631576316763177631876319763207632176322763237632476325763267632776328763297633076331763327633376334763357633676337763387633976340763417634276343763447634576346763477634876349763507635176352763537635476355763567635776358763597636076361763627636376364763657636676367763687636976370763717637276373763747637576376763777637876379763807638176382763837638476385763867638776388763897639076391763927639376394763957639676397763987639976400764017640276403764047640576406764077640876409764107641176412764137641476415764167641776418764197642076421764227642376424764257642676427764287642976430764317643276433764347643576436764377643876439764407644176442764437644476445764467644776448764497645076451764527645376454764557645676457764587645976460764617646276463764647646576466764677646876469764707647176472764737647476475764767647776478764797648076481764827648376484764857648676487764887648976490764917649276493764947649576496764977649876499765007650176502765037650476505765067650776508765097651076511765127651376514765157651676517765187651976520765217652276523765247652576526765277652876529765307653176532765337653476535765367653776538765397654076541765427654376544765457654676547765487654976550765517655276553765547655576556765577655876559765607656176562765637656476565765667656776568765697657076571765727657376574765757657676577765787657976580765817658276583765847658576586765877658876589765907659176592765937659476595765967659776598765997660076601766027660376604766057660676607766087660976610766117661276613766147661576616766177661876619766207662176622766237662476625766267662776628766297663076631766327663376634766357663676637766387663976640766417664276643766447664576646766477664876649766507665176652766537665476655766567665776658766597666076661766627666376664766657666676667766687666976670766717667276673766747667576676766777667876679766807668176682766837668476685766867668776688766897669076691766927669376694766957669676697766987669976700767017670276703767047670576706767077670876709767107671176712767137671476715767167671776718767197672076721767227672376724767257672676727767287672976730767317673276733767347673576736767377673876739767407674176742767437674476745767467674776748767497675076751767527675376754767557675676757767587675976760767617676276763767647676576766767677676876769767707677176772767737677476775767767677776778767797678076781767827678376784767857678676787767887678976790767917679276793767947679576796767977679876799768007680176802768037680476805768067680776808768097681076811768127681376814768157681676817768187681976820768217682276823768247682576826768277682876829768307683176832768337683476835768367683776838768397684076841768427684376844768457684676847768487684976850768517685276853768547685576856768577685876859768607686176862768637686476865768667686776868768697687076871768727687376874768757687676877768787687976880768817688276883768847688576886768877688876889768907689176892768937689476895768967689776898768997690076901769027690376904769057690676907769087690976910769117691276913769147691576916769177691876919769207692176922769237692476925769267692776928769297693076931769327693376934769357693676937769387693976940769417694276943769447694576946769477694876949769507695176952769537695476955769567695776958769597696076961769627696376964769657696676967769687696976970769717697276973769747697576976769777697876979769807698176982769837698476985769867698776988769897699076991769927699376994769957699676997769987699977000770017700277003770047700577006770077700877009770107701177012770137701477015770167701777018770197702077021770227702377024770257702677027770287702977030770317703277033770347703577036770377703877039770407704177042770437704477045770467704777048770497705077051770527705377054770557705677057770587705977060770617706277063770647706577066770677706877069770707707177072770737707477075770767707777078770797708077081770827708377084770857708677087770887708977090770917709277093770947709577096770977709877099771007710177102771037710477105771067710777108771097711077111771127711377114771157711677117771187711977120771217712277123771247712577126771277712877129771307713177132771337713477135771367713777138771397714077141771427714377144771457714677147771487714977150771517715277153771547715577156771577715877159771607716177162771637716477165771667716777168771697717077171771727717377174771757717677177771787717977180771817718277183771847718577186771877718877189771907719177192771937719477195771967719777198771997720077201772027720377204772057720677207772087720977210772117721277213772147721577216772177721877219772207722177222772237722477225772267722777228772297723077231772327723377234772357723677237772387723977240772417724277243772447724577246772477724877249772507725177252772537725477255772567725777258772597726077261772627726377264772657726677267772687726977270772717727277273772747727577276772777727877279772807728177282772837728477285772867728777288772897729077291772927729377294772957729677297772987729977300773017730277303773047730577306773077730877309773107731177312773137731477315773167731777318773197732077321773227732377324773257732677327773287732977330773317733277333773347733577336773377733877339773407734177342773437734477345773467734777348773497735077351773527735377354773557735677357773587735977360773617736277363773647736577366773677736877369773707737177372773737737477375773767737777378773797738077381773827738377384773857738677387773887738977390773917739277393773947739577396773977739877399774007740177402774037740477405774067740777408774097741077411774127741377414774157741677417774187741977420774217742277423774247742577426774277742877429774307743177432774337743477435774367743777438774397744077441774427744377444774457744677447774487744977450774517745277453774547745577456774577745877459774607746177462774637746477465774667746777468774697747077471774727747377474774757747677477774787747977480774817748277483774847748577486774877748877489774907749177492774937749477495774967749777498774997750077501775027750377504775057750677507775087750977510775117751277513775147751577516775177751877519775207752177522775237752477525775267752777528775297753077531775327753377534775357753677537775387753977540775417754277543775447754577546775477754877549775507755177552775537755477555775567755777558775597756077561775627756377564775657756677567775687756977570775717757277573775747757577576775777757877579775807758177582775837758477585775867758777588775897759077591775927759377594775957759677597775987759977600776017760277603776047760577606776077760877609776107761177612776137761477615776167761777618776197762077621776227762377624776257762677627776287762977630776317763277633776347763577636776377763877639776407764177642776437764477645776467764777648776497765077651776527765377654776557765677657776587765977660776617766277663776647766577666776677766877669776707767177672776737767477675776767767777678776797768077681776827768377684776857768677687776887768977690776917769277693776947769577696776977769877699777007770177702777037770477705777067770777708777097771077711777127771377714777157771677717777187771977720777217772277723777247772577726777277772877729777307773177732777337773477735777367773777738777397774077741777427774377744777457774677747777487774977750777517775277753777547775577756777577775877759777607776177762777637776477765777667776777768777697777077771777727777377774777757777677777777787777977780777817778277783777847778577786777877778877789777907779177792777937779477795777967779777798777997780077801778027780377804778057780677807778087780977810778117781277813778147781577816778177781877819778207782177822778237782477825778267782777828778297783077831778327783377834778357783677837778387783977840778417784277843778447784577846778477784877849778507785177852778537785477855778567785777858778597786077861778627786377864778657786677867778687786977870778717787277873778747787577876778777787877879778807788177882778837788477885778867788777888778897789077891778927789377894778957789677897778987789977900779017790277903779047790577906779077790877909779107791177912779137791477915779167791777918779197792077921779227792377924779257792677927779287792977930779317793277933779347793577936779377793877939779407794177942779437794477945779467794777948779497795077951779527795377954779557795677957779587795977960779617796277963779647796577966779677796877969779707797177972779737797477975779767797777978779797798077981779827798377984779857798677987779887798977990779917799277993779947799577996779977799877999780007800178002780037800478005780067800778008780097801078011780127801378014780157801678017780187801978020780217802278023780247802578026780277802878029780307803178032780337803478035780367803778038780397804078041780427804378044780457804678047780487804978050780517805278053780547805578056780577805878059780607806178062780637806478065780667806778068780697807078071780727807378074780757807678077780787807978080780817808278083780847808578086780877808878089780907809178092780937809478095780967809778098780997810078101781027810378104781057810678107781087810978110781117811278113781147811578116781177811878119781207812178122781237812478125781267812778128781297813078131781327813378134781357813678137781387813978140781417814278143781447814578146781477814878149781507815178152781537815478155781567815778158781597816078161781627816378164781657816678167781687816978170781717817278173781747817578176781777817878179781807818178182781837818478185781867818778188781897819078191781927819378194781957819678197781987819978200782017820278203782047820578206782077820878209782107821178212782137821478215782167821778218782197822078221782227822378224782257822678227782287822978230782317823278233782347823578236782377823878239782407824178242782437824478245782467824778248782497825078251782527825378254782557825678257782587825978260782617826278263782647826578266782677826878269782707827178272782737827478275782767827778278782797828078281782827828378284782857828678287782887828978290782917829278293782947829578296782977829878299783007830178302783037830478305783067830778308783097831078311783127831378314783157831678317783187831978320783217832278323783247832578326783277832878329783307833178332783337833478335783367833778338783397834078341783427834378344783457834678347783487834978350783517835278353783547835578356783577835878359783607836178362783637836478365783667836778368783697837078371783727837378374783757837678377783787837978380783817838278383783847838578386783877838878389783907839178392783937839478395783967839778398783997840078401784027840378404784057840678407784087840978410784117841278413784147841578416784177841878419784207842178422784237842478425784267842778428784297843078431784327843378434784357843678437784387843978440784417844278443784447844578446784477844878449784507845178452784537845478455784567845778458784597846078461784627846378464784657846678467784687846978470784717847278473784747847578476784777847878479784807848178482784837848478485784867848778488784897849078491784927849378494784957849678497784987849978500785017850278503785047850578506785077850878509785107851178512785137851478515785167851778518785197852078521785227852378524785257852678527785287852978530785317853278533785347853578536785377853878539785407854178542785437854478545785467854778548785497855078551785527855378554785557855678557785587855978560785617856278563785647856578566785677856878569785707857178572785737857478575785767857778578785797858078581785827858378584785857858678587785887858978590785917859278593785947859578596785977859878599786007860178602786037860478605786067860778608786097861078611786127861378614786157861678617786187861978620786217862278623786247862578626786277862878629786307863178632786337863478635786367863778638786397864078641786427864378644786457864678647786487864978650786517865278653786547865578656786577865878659786607866178662786637866478665786667866778668786697867078671786727867378674786757867678677786787867978680786817868278683786847868578686786877868878689786907869178692786937869478695786967869778698786997870078701787027870378704787057870678707787087870978710787117871278713787147871578716787177871878719787207872178722787237872478725787267872778728787297873078731787327873378734787357873678737787387873978740787417874278743787447874578746787477874878749787507875178752787537875478755787567875778758787597876078761787627876378764787657876678767787687876978770787717877278773787747877578776787777877878779787807878178782787837878478785787867878778788787897879078791787927879378794787957879678797787987879978800788017880278803788047880578806788077880878809788107881178812788137881478815788167881778818788197882078821788227882378824788257882678827788287882978830788317883278833788347883578836788377883878839788407884178842788437884478845788467884778848788497885078851788527885378854788557885678857788587885978860788617886278863788647886578866788677886878869788707887178872788737887478875788767887778878788797888078881788827888378884788857888678887788887888978890788917889278893788947889578896788977889878899789007890178902789037890478905789067890778908789097891078911789127891378914789157891678917789187891978920789217892278923789247892578926789277892878929789307893178932789337893478935789367893778938789397894078941789427894378944789457894678947789487894978950789517895278953789547895578956789577895878959789607896178962789637896478965789667896778968789697897078971789727897378974789757897678977789787897978980789817898278983789847898578986789877898878989789907899178992789937899478995789967899778998789997900079001790027900379004790057900679007790087900979010790117901279013790147901579016790177901879019790207902179022790237902479025790267902779028790297903079031790327903379034790357903679037790387903979040790417904279043790447904579046790477904879049790507905179052790537905479055790567905779058790597906079061790627906379064790657906679067790687906979070790717907279073790747907579076790777907879079790807908179082790837908479085790867908779088790897909079091790927909379094790957909679097790987909979100791017910279103791047910579106791077910879109791107911179112791137911479115791167911779118791197912079121791227912379124791257912679127791287912979130791317913279133791347913579136791377913879139791407914179142791437914479145791467914779148791497915079151791527915379154791557915679157791587915979160791617916279163791647916579166791677916879169791707917179172791737917479175791767917779178791797918079181791827918379184791857918679187791887918979190791917919279193791947919579196791977919879199792007920179202792037920479205792067920779208792097921079211792127921379214792157921679217792187921979220792217922279223792247922579226792277922879229792307923179232792337923479235792367923779238792397924079241792427924379244792457924679247792487924979250792517925279253792547925579256792577925879259792607926179262792637926479265792667926779268792697927079271792727927379274792757927679277792787927979280792817928279283792847928579286792877928879289792907929179292792937929479295792967929779298792997930079301793027930379304793057930679307793087930979310793117931279313793147931579316793177931879319793207932179322793237932479325793267932779328793297933079331793327933379334793357933679337793387933979340793417934279343793447934579346793477934879349793507935179352793537935479355793567935779358793597936079361793627936379364793657936679367793687936979370793717937279373793747937579376793777937879379793807938179382793837938479385793867938779388793897939079391793927939379394793957939679397793987939979400794017940279403794047940579406794077940879409794107941179412794137941479415794167941779418794197942079421794227942379424794257942679427794287942979430794317943279433794347943579436794377943879439794407944179442794437944479445794467944779448794497945079451794527945379454794557945679457794587945979460794617946279463794647946579466794677946879469794707947179472794737947479475794767947779478794797948079481794827948379484794857948679487794887948979490794917949279493794947949579496794977949879499795007950179502795037950479505795067950779508795097951079511795127951379514795157951679517795187951979520795217952279523795247952579526795277952879529795307953179532795337953479535795367953779538795397954079541795427954379544795457954679547795487954979550795517955279553795547955579556795577955879559795607956179562795637956479565795667956779568795697957079571795727957379574795757957679577795787957979580795817958279583795847958579586795877958879589795907959179592795937959479595795967959779598795997960079601796027960379604796057960679607796087960979610796117961279613796147961579616796177961879619796207962179622796237962479625796267962779628796297963079631796327963379634796357963679637796387963979640796417964279643796447964579646796477964879649796507965179652796537965479655796567965779658796597966079661796627966379664796657966679667796687966979670796717967279673796747967579676796777967879679796807968179682796837968479685796867968779688796897969079691796927969379694796957969679697796987969979700797017970279703797047970579706797077970879709797107971179712797137971479715797167971779718797197972079721797227972379724797257972679727797287972979730797317973279733797347973579736797377973879739797407974179742797437974479745797467974779748797497975079751797527975379754797557975679757797587975979760797617976279763797647976579766797677976879769797707977179772797737977479775797767977779778797797978079781797827978379784797857978679787797887978979790797917979279793797947979579796797977979879799798007980179802798037980479805798067980779808798097981079811798127981379814798157981679817798187981979820798217982279823798247982579826798277982879829798307983179832798337983479835798367983779838798397984079841798427984379844798457984679847798487984979850798517985279853798547985579856798577985879859798607986179862798637986479865798667986779868798697987079871798727987379874798757987679877798787987979880798817988279883798847988579886798877988879889798907989179892798937989479895798967989779898798997990079901799027990379904799057990679907799087990979910799117991279913799147991579916799177991879919799207992179922799237992479925799267992779928799297993079931799327993379934799357993679937799387993979940799417994279943799447994579946799477994879949799507995179952799537995479955799567995779958799597996079961799627996379964799657996679967799687996979970799717997279973799747997579976799777997879979799807998179982799837998479985799867998779988799897999079991799927999379994799957999679997799987999980000800018000280003800048000580006800078000880009800108001180012800138001480015800168001780018800198002080021800228002380024800258002680027800288002980030800318003280033800348003580036800378003880039800408004180042800438004480045800468004780048800498005080051800528005380054800558005680057800588005980060800618006280063800648006580066800678006880069800708007180072800738007480075800768007780078800798008080081800828008380084800858008680087800888008980090800918009280093800948009580096800978009880099801008010180102801038010480105801068010780108801098011080111801128011380114801158011680117801188011980120801218012280123801248012580126801278012880129801308013180132801338013480135801368013780138801398014080141801428014380144801458014680147801488014980150801518015280153801548015580156801578015880159801608016180162801638016480165801668016780168801698017080171801728017380174801758017680177801788017980180801818018280183801848018580186801878018880189801908019180192801938019480195801968019780198801998020080201802028020380204802058020680207802088020980210802118021280213802148021580216802178021880219802208022180222802238022480225802268022780228802298023080231802328023380234802358023680237802388023980240802418024280243802448024580246802478024880249802508025180252802538025480255802568025780258802598026080261802628026380264802658026680267802688026980270802718027280273802748027580276802778027880279802808028180282802838028480285802868028780288802898029080291802928029380294802958029680297802988029980300803018030280303803048030580306803078030880309803108031180312803138031480315803168031780318803198032080321803228032380324803258032680327803288032980330803318033280333803348033580336803378033880339803408034180342803438034480345803468034780348803498035080351803528035380354803558035680357803588035980360803618036280363803648036580366803678036880369803708037180372803738037480375803768037780378803798038080381803828038380384803858038680387803888038980390803918039280393803948039580396803978039880399804008040180402804038040480405804068040780408804098041080411804128041380414804158041680417804188041980420804218042280423804248042580426804278042880429804308043180432804338043480435804368043780438804398044080441804428044380444804458044680447804488044980450804518045280453804548045580456804578045880459804608046180462804638046480465804668046780468804698047080471804728047380474804758047680477804788047980480804818048280483804848048580486804878048880489804908049180492804938049480495804968049780498804998050080501805028050380504805058050680507805088050980510805118051280513805148051580516805178051880519805208052180522805238052480525805268052780528805298053080531805328053380534805358053680537805388053980540805418054280543805448054580546805478054880549805508055180552805538055480555805568055780558805598056080561805628056380564805658056680567805688056980570805718057280573805748057580576805778057880579805808058180582805838058480585805868058780588805898059080591805928059380594805958059680597805988059980600806018060280603806048060580606806078060880609806108061180612806138061480615806168061780618806198062080621806228062380624806258062680627806288062980630806318063280633806348063580636806378063880639806408064180642806438064480645806468064780648806498065080651806528065380654806558065680657806588065980660806618066280663806648066580666806678066880669806708067180672806738067480675806768067780678806798068080681806828068380684806858068680687806888068980690806918069280693806948069580696806978069880699807008070180702807038070480705807068070780708807098071080711807128071380714807158071680717807188071980720807218072280723807248072580726807278072880729807308073180732807338073480735807368073780738807398074080741807428074380744807458074680747807488074980750807518075280753807548075580756807578075880759807608076180762807638076480765807668076780768807698077080771807728077380774807758077680777807788077980780807818078280783807848078580786807878078880789807908079180792807938079480795807968079780798807998080080801808028080380804808058080680807808088080980810808118081280813808148081580816808178081880819808208082180822808238082480825808268082780828808298083080831808328083380834808358083680837808388083980840808418084280843808448084580846808478084880849808508085180852808538085480855808568085780858808598086080861808628086380864808658086680867808688086980870808718087280873808748087580876808778087880879808808088180882808838088480885808868088780888808898089080891808928089380894808958089680897808988089980900809018090280903809048090580906809078090880909809108091180912809138091480915809168091780918809198092080921809228092380924809258092680927809288092980930809318093280933809348093580936809378093880939809408094180942809438094480945809468094780948809498095080951809528095380954809558095680957809588095980960809618096280963809648096580966809678096880969809708097180972809738097480975809768097780978809798098080981809828098380984809858098680987809888098980990809918099280993809948099580996809978099880999810008100181002810038100481005810068100781008810098101081011810128101381014810158101681017810188101981020810218102281023810248102581026810278102881029810308103181032810338103481035810368103781038810398104081041810428104381044810458104681047810488104981050810518105281053810548105581056810578105881059810608106181062810638106481065810668106781068810698107081071810728107381074810758107681077810788107981080810818108281083810848108581086810878108881089810908109181092810938109481095810968109781098810998110081101811028110381104811058110681107811088110981110811118111281113811148111581116811178111881119811208112181122811238112481125811268112781128811298113081131811328113381134811358113681137811388113981140811418114281143811448114581146811478114881149811508115181152811538115481155811568115781158811598116081161811628116381164811658116681167811688116981170811718117281173811748117581176811778117881179811808118181182811838118481185811868118781188811898119081191811928119381194811958119681197811988119981200812018120281203812048120581206812078120881209812108121181212812138121481215812168121781218812198122081221812228122381224812258122681227812288122981230812318123281233812348123581236812378123881239812408124181242812438124481245812468124781248812498125081251812528125381254812558125681257812588125981260812618126281263812648126581266812678126881269812708127181272812738127481275812768127781278812798128081281812828128381284812858128681287812888128981290812918129281293812948129581296812978129881299813008130181302813038130481305813068130781308813098131081311813128131381314813158131681317813188131981320813218132281323813248132581326813278132881329813308133181332813338133481335813368133781338813398134081341813428134381344813458134681347813488134981350813518135281353813548135581356813578135881359813608136181362813638136481365813668136781368813698137081371813728137381374813758137681377813788137981380813818138281383813848138581386813878138881389813908139181392813938139481395813968139781398813998140081401814028140381404814058140681407814088140981410814118141281413814148141581416814178141881419814208142181422814238142481425814268142781428814298143081431814328143381434814358143681437814388143981440814418144281443814448144581446814478144881449814508145181452814538145481455814568145781458814598146081461814628146381464814658146681467814688146981470814718147281473814748147581476814778147881479814808148181482814838148481485814868148781488814898149081491814928149381494814958149681497814988149981500815018150281503815048150581506815078150881509815108151181512815138151481515815168151781518815198152081521815228152381524815258152681527815288152981530815318153281533815348153581536815378153881539815408154181542815438154481545815468154781548815498155081551815528155381554815558155681557815588155981560815618156281563815648156581566815678156881569815708157181572815738157481575815768157781578815798158081581815828158381584815858158681587815888158981590815918159281593815948159581596815978159881599816008160181602816038160481605816068160781608816098161081611816128161381614816158161681617816188161981620816218162281623816248162581626816278162881629816308163181632816338163481635816368163781638816398164081641816428164381644816458164681647816488164981650816518165281653816548165581656816578165881659816608166181662816638166481665816668166781668816698167081671816728167381674816758167681677816788167981680816818168281683816848168581686816878168881689816908169181692816938169481695816968169781698816998170081701817028170381704817058170681707817088170981710817118171281713817148171581716817178171881719817208172181722817238172481725817268172781728817298173081731817328173381734817358173681737817388173981740817418174281743817448174581746817478174881749817508175181752817538175481755817568175781758817598176081761817628176381764817658176681767817688176981770817718177281773817748177581776817778177881779817808178181782817838178481785817868178781788817898179081791817928179381794817958179681797817988179981800818018180281803818048180581806818078180881809818108181181812818138181481815818168181781818818198182081821818228182381824818258182681827818288182981830818318183281833818348183581836818378183881839818408184181842818438184481845818468184781848818498185081851818528185381854818558185681857818588185981860818618186281863818648186581866818678186881869818708187181872818738187481875818768187781878818798188081881818828188381884818858188681887818888188981890818918189281893818948189581896818978189881899819008190181902819038190481905819068190781908819098191081911819128191381914819158191681917819188191981920819218192281923819248192581926819278192881929819308193181932819338193481935819368193781938819398194081941819428194381944819458194681947819488194981950819518195281953819548195581956819578195881959819608196181962819638196481965819668196781968819698197081971819728197381974819758197681977819788197981980819818198281983819848198581986819878198881989819908199181992819938199481995819968199781998819998200082001820028200382004820058200682007820088200982010820118201282013820148201582016820178201882019820208202182022820238202482025820268202782028820298203082031820328203382034820358203682037820388203982040820418204282043820448204582046820478204882049820508205182052820538205482055820568205782058820598206082061820628206382064820658206682067820688206982070820718207282073820748207582076820778207882079820808208182082820838208482085820868208782088820898209082091820928209382094820958209682097820988209982100821018210282103821048210582106821078210882109821108211182112821138211482115821168211782118821198212082121821228212382124821258212682127821288212982130821318213282133821348213582136821378213882139821408214182142821438214482145821468214782148821498215082151821528215382154821558215682157821588215982160821618216282163821648216582166821678216882169821708217182172821738217482175821768217782178821798218082181821828218382184821858218682187821888218982190821918219282193821948219582196821978219882199822008220182202822038220482205822068220782208822098221082211822128221382214822158221682217822188221982220822218222282223822248222582226822278222882229822308223182232822338223482235822368223782238822398224082241822428224382244822458224682247822488224982250822518225282253822548225582256822578225882259822608226182262822638226482265822668226782268822698227082271822728227382274822758227682277822788227982280822818228282283822848228582286822878228882289822908229182292822938229482295822968229782298822998230082301823028230382304823058230682307823088230982310823118231282313823148231582316823178231882319823208232182322823238232482325823268232782328823298233082331823328233382334823358233682337823388233982340823418234282343823448234582346823478234882349823508235182352823538235482355823568235782358823598236082361823628236382364823658236682367823688236982370823718237282373823748237582376823778237882379823808238182382823838238482385823868238782388823898239082391823928239382394823958239682397823988239982400824018240282403824048240582406824078240882409824108241182412824138241482415824168241782418824198242082421824228242382424824258242682427824288242982430824318243282433824348243582436824378243882439824408244182442824438244482445824468244782448824498245082451824528245382454824558245682457824588245982460824618246282463824648246582466824678246882469824708247182472824738247482475824768247782478824798248082481824828248382484824858248682487824888248982490824918249282493824948249582496824978249882499825008250182502825038250482505825068250782508825098251082511825128251382514825158251682517825188251982520825218252282523825248252582526825278252882529825308253182532825338253482535825368253782538825398254082541825428254382544825458254682547825488254982550825518255282553825548255582556825578255882559825608256182562825638256482565825668256782568825698257082571825728257382574825758257682577825788257982580825818258282583825848258582586825878258882589825908259182592825938259482595825968259782598825998260082601826028260382604826058260682607826088260982610826118261282613826148261582616826178261882619826208262182622826238262482625826268262782628826298263082631826328263382634826358263682637826388263982640826418264282643826448264582646826478264882649826508265182652826538265482655826568265782658826598266082661826628266382664826658266682667826688266982670826718267282673826748267582676826778267882679826808268182682826838268482685826868268782688826898269082691826928269382694826958269682697826988269982700827018270282703827048270582706827078270882709827108271182712827138271482715827168271782718827198272082721827228272382724827258272682727827288272982730827318273282733827348273582736827378273882739827408274182742827438274482745827468274782748827498275082751827528275382754827558275682757827588275982760827618276282763827648276582766827678276882769827708277182772827738277482775827768277782778827798278082781827828278382784827858278682787827888278982790827918279282793827948279582796827978279882799828008280182802828038280482805828068280782808828098281082811828128281382814828158281682817828188281982820828218282282823828248282582826828278282882829828308283182832828338283482835828368283782838828398284082841828428284382844828458284682847828488284982850828518285282853828548285582856828578285882859828608286182862828638286482865828668286782868828698287082871828728287382874828758287682877828788287982880828818288282883828848288582886828878288882889828908289182892828938289482895828968289782898828998290082901829028290382904829058290682907829088290982910829118291282913829148291582916829178291882919829208292182922829238292482925829268292782928829298293082931829328293382934829358293682937829388293982940829418294282943829448294582946829478294882949829508295182952829538295482955829568295782958829598296082961829628296382964829658296682967829688296982970829718297282973829748297582976829778297882979829808298182982829838298482985829868298782988829898299082991829928299382994829958299682997829988299983000830018300283003830048300583006830078300883009830108301183012830138301483015830168301783018830198302083021830228302383024830258302683027830288302983030830318303283033830348303583036830378303883039830408304183042830438304483045830468304783048830498305083051830528305383054830558305683057830588305983060830618306283063830648306583066830678306883069830708307183072830738307483075830768307783078830798308083081830828308383084830858308683087830888308983090830918309283093830948309583096830978309883099831008310183102831038310483105831068310783108831098311083111831128311383114831158311683117831188311983120831218312283123831248312583126831278312883129831308313183132831338313483135831368313783138831398314083141831428314383144831458314683147831488314983150831518315283153831548315583156831578315883159831608316183162831638316483165831668316783168831698317083171831728317383174831758317683177831788317983180831818318283183831848318583186831878318883189831908319183192831938319483195831968319783198831998320083201832028320383204832058320683207832088320983210832118321283213832148321583216832178321883219832208322183222832238322483225832268322783228832298323083231832328323383234832358323683237832388323983240832418324283243832448324583246832478324883249832508325183252832538325483255832568325783258832598326083261832628326383264832658326683267832688326983270832718327283273832748327583276832778327883279832808328183282832838328483285832868328783288832898329083291832928329383294832958329683297832988329983300833018330283303833048330583306833078330883309833108331183312833138331483315833168331783318833198332083321833228332383324833258332683327833288332983330833318333283333833348333583336833378333883339833408334183342833438334483345833468334783348833498335083351833528335383354833558335683357833588335983360833618336283363833648336583366833678336883369833708337183372833738337483375833768337783378833798338083381833828338383384833858338683387833888338983390833918339283393833948339583396833978339883399834008340183402834038340483405834068340783408834098341083411834128341383414834158341683417834188341983420834218342283423834248342583426834278342883429834308343183432834338343483435834368343783438834398344083441834428344383444834458344683447834488344983450834518345283453834548345583456834578345883459834608346183462834638346483465834668346783468834698347083471834728347383474834758347683477834788347983480834818348283483834848348583486834878348883489834908349183492834938349483495834968349783498834998350083501835028350383504835058350683507835088350983510835118351283513835148351583516835178351883519835208352183522835238352483525835268352783528835298353083531835328353383534835358353683537835388353983540835418354283543835448354583546835478354883549835508355183552835538355483555835568355783558835598356083561835628356383564835658356683567835688356983570835718357283573835748357583576835778357883579835808358183582835838358483585835868358783588835898359083591835928359383594835958359683597835988359983600836018360283603836048360583606836078360883609836108361183612836138361483615836168361783618836198362083621836228362383624836258362683627836288362983630836318363283633836348363583636836378363883639836408364183642836438364483645836468364783648836498365083651836528365383654836558365683657836588365983660836618366283663836648366583666836678366883669836708367183672836738367483675836768367783678836798368083681836828368383684836858368683687836888368983690836918369283693836948369583696836978369883699837008370183702837038370483705837068370783708837098371083711837128371383714837158371683717837188371983720837218372283723837248372583726837278372883729837308373183732837338373483735837368373783738837398374083741837428374383744837458374683747837488374983750837518375283753837548375583756837578375883759837608376183762837638376483765837668376783768837698377083771837728377383774837758377683777837788377983780837818378283783837848378583786837878378883789837908379183792837938379483795837968379783798837998380083801838028380383804838058380683807838088380983810838118381283813838148381583816838178381883819838208382183822838238382483825838268382783828838298383083831838328383383834838358383683837838388383983840838418384283843838448384583846838478384883849838508385183852838538385483855838568385783858838598386083861838628386383864838658386683867838688386983870838718387283873838748387583876838778387883879838808388183882838838388483885838868388783888838898389083891838928389383894838958389683897838988389983900839018390283903839048390583906839078390883909839108391183912839138391483915839168391783918839198392083921839228392383924839258392683927839288392983930839318393283933839348393583936839378393883939839408394183942839438394483945839468394783948839498395083951839528395383954839558395683957839588395983960839618396283963839648396583966839678396883969839708397183972839738397483975839768397783978839798398083981839828398383984839858398683987839888398983990839918399283993839948399583996839978399883999840008400184002840038400484005840068400784008840098401084011840128401384014840158401684017840188401984020840218402284023840248402584026840278402884029840308403184032840338403484035840368403784038840398404084041840428404384044840458404684047840488404984050840518405284053840548405584056840578405884059840608406184062840638406484065840668406784068840698407084071840728407384074840758407684077840788407984080840818408284083840848408584086840878408884089840908409184092840938409484095840968409784098840998410084101841028410384104841058410684107841088410984110841118411284113841148411584116841178411884119841208412184122841238412484125841268412784128841298413084131841328413384134841358413684137841388413984140841418414284143841448414584146841478414884149841508415184152841538415484155841568415784158841598416084161841628416384164841658416684167841688416984170841718417284173841748417584176841778417884179841808418184182841838418484185841868418784188841898419084191841928419384194841958419684197841988419984200842018420284203842048420584206842078420884209842108421184212842138421484215842168421784218842198422084221842228422384224842258422684227842288422984230842318423284233842348423584236842378423884239842408424184242842438424484245842468424784248842498425084251842528425384254842558425684257842588425984260842618426284263842648426584266842678426884269842708427184272842738427484275842768427784278842798428084281842828428384284842858428684287842888428984290842918429284293842948429584296842978429884299843008430184302843038430484305843068430784308843098431084311843128431384314843158431684317843188431984320843218432284323843248432584326843278432884329843308433184332843338433484335843368433784338843398434084341843428434384344843458434684347843488434984350843518435284353843548435584356843578435884359843608436184362843638436484365843668436784368843698437084371843728437384374843758437684377843788437984380843818438284383843848438584386843878438884389843908439184392843938439484395843968439784398843998440084401844028440384404844058440684407844088440984410844118441284413844148441584416844178441884419844208442184422844238442484425844268442784428844298443084431844328443384434844358443684437844388443984440844418444284443844448444584446844478444884449844508445184452844538445484455844568445784458844598446084461844628446384464844658446684467844688446984470844718447284473844748447584476844778447884479844808448184482844838448484485844868448784488844898449084491844928449384494844958449684497844988449984500845018450284503845048450584506845078450884509845108451184512845138451484515845168451784518845198452084521845228452384524845258452684527845288452984530845318453284533845348453584536845378453884539845408454184542845438454484545845468454784548845498455084551845528455384554845558455684557845588455984560845618456284563845648456584566845678456884569845708457184572845738457484575845768457784578845798458084581845828458384584845858458684587845888458984590845918459284593845948459584596845978459884599846008460184602846038460484605846068460784608846098461084611846128461384614846158461684617846188461984620846218462284623846248462584626846278462884629846308463184632846338463484635846368463784638846398464084641846428464384644846458464684647846488464984650846518465284653846548465584656846578465884659846608466184662846638466484665846668466784668846698467084671846728467384674846758467684677846788467984680846818468284683846848468584686846878468884689846908469184692846938469484695846968469784698846998470084701847028470384704847058470684707847088470984710847118471284713847148471584716847178471884719847208472184722847238472484725847268472784728847298473084731847328473384734847358473684737847388473984740847418474284743847448474584746847478474884749847508475184752847538475484755847568475784758847598476084761847628476384764847658476684767847688476984770847718477284773847748477584776847778477884779847808478184782847838478484785847868478784788847898479084791847928479384794847958479684797847988479984800848018480284803848048480584806848078480884809848108481184812848138481484815848168481784818848198482084821848228482384824848258482684827848288482984830848318483284833848348483584836848378483884839848408484184842848438484484845848468484784848848498485084851848528485384854848558485684857848588485984860848618486284863848648486584866848678486884869848708487184872848738487484875848768487784878848798488084881848828488384884848858488684887848888488984890848918489284893848948489584896848978489884899849008490184902849038490484905849068490784908849098491084911849128491384914849158491684917849188491984920849218492284923849248492584926849278492884929849308493184932849338493484935849368493784938849398494084941849428494384944849458494684947849488494984950849518495284953849548495584956849578495884959849608496184962849638496484965849668496784968849698497084971849728497384974849758497684977849788497984980849818498284983849848498584986849878498884989849908499184992849938499484995849968499784998849998500085001850028500385004850058500685007850088500985010850118501285013850148501585016850178501885019850208502185022850238502485025850268502785028850298503085031850328503385034850358503685037850388503985040850418504285043850448504585046850478504885049850508505185052850538505485055850568505785058850598506085061850628506385064850658506685067850688506985070850718507285073850748507585076850778507885079850808508185082850838508485085850868508785088850898509085091850928509385094850958509685097850988509985100851018510285103851048510585106851078510885109851108511185112851138511485115851168511785118851198512085121851228512385124851258512685127851288512985130851318513285133851348513585136851378513885139851408514185142851438514485145851468514785148851498515085151851528515385154851558515685157851588515985160851618516285163851648516585166851678516885169851708517185172851738517485175851768517785178851798518085181851828518385184851858518685187851888518985190851918519285193851948519585196851978519885199852008520185202852038520485205852068520785208852098521085211852128521385214852158521685217852188521985220852218522285223852248522585226852278522885229852308523185232852338523485235852368523785238852398524085241852428524385244852458524685247852488524985250852518525285253852548525585256852578525885259852608526185262852638526485265852668526785268852698527085271852728527385274852758527685277852788527985280852818528285283852848528585286852878528885289852908529185292852938529485295852968529785298852998530085301853028530385304853058530685307853088530985310853118531285313853148531585316853178531885319853208532185322853238532485325853268532785328853298533085331853328533385334853358533685337853388533985340853418534285343853448534585346853478534885349853508535185352853538535485355853568535785358853598536085361853628536385364853658536685367853688536985370853718537285373853748537585376853778537885379853808538185382853838538485385853868538785388853898539085391853928539385394853958539685397853988539985400854018540285403854048540585406854078540885409854108541185412854138541485415854168541785418854198542085421854228542385424854258542685427854288542985430854318543285433854348543585436854378543885439854408544185442854438544485445854468544785448854498545085451854528545385454854558545685457854588545985460854618546285463854648546585466854678546885469854708547185472854738547485475854768547785478854798548085481854828548385484854858548685487854888548985490854918549285493854948549585496854978549885499855008550185502855038550485505855068550785508855098551085511855128551385514855158551685517855188551985520855218552285523855248552585526855278552885529855308553185532855338553485535855368553785538855398554085541855428554385544855458554685547855488554985550855518555285553855548555585556855578555885559855608556185562855638556485565855668556785568855698557085571855728557385574855758557685577855788557985580855818558285583855848558585586855878558885589855908559185592855938559485595855968559785598855998560085601856028560385604856058560685607856088560985610856118561285613856148561585616856178561885619856208562185622856238562485625856268562785628856298563085631856328563385634856358563685637856388563985640856418564285643856448564585646856478564885649856508565185652856538565485655856568565785658856598566085661856628566385664856658566685667856688566985670856718567285673856748567585676856778567885679856808568185682856838568485685856868568785688856898569085691856928569385694856958569685697856988569985700857018570285703857048570585706857078570885709857108571185712857138571485715857168571785718857198572085721857228572385724857258572685727857288572985730857318573285733857348573585736857378573885739857408574185742857438574485745857468574785748857498575085751857528575385754857558575685757857588575985760857618576285763857648576585766857678576885769857708577185772857738577485775857768577785778857798578085781857828578385784857858578685787857888578985790857918579285793857948579585796857978579885799858008580185802858038580485805858068580785808858098581085811858128581385814858158581685817858188581985820858218582285823858248582585826858278582885829858308583185832858338583485835858368583785838858398584085841858428584385844858458584685847858488584985850858518585285853858548585585856858578585885859858608586185862858638586485865858668586785868858698587085871858728587385874858758587685877858788587985880858818588285883858848588585886858878588885889858908589185892858938589485895858968589785898858998590085901859028590385904859058590685907859088590985910859118591285913859148591585916859178591885919859208592185922859238592485925859268592785928859298593085931859328593385934859358593685937859388593985940859418594285943859448594585946859478594885949
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <[email protected]>
  7. * Jordi Boggiano <[email protected]>
  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. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. ‘��è������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.phpfa��ëYfa��1�é4¶������+���src/Composer/Autoload/ClassMapGenerator.php•��ëY•��î$»'¶���������src/Composer/Cache.phpø��ëYø��.f—ݶ������%���src/Composer/Command/AboutCommand.phpÁ��ëYÁ��¾þò¶������'���src/Composer/Command/ArchiveCommand.php¸��ëY¸��ÖN¨ ¶������$���src/Composer/Command/BaseCommand.phpÉ ��ëYÉ ��—P!£¶������.���src/Composer/Command/BaseDependencyCommand.phpÉ��ëYÉ��D{²Ð¶������*���src/Composer/Command/ClearCacheCommand.php^��ëY^��ƒ÷�¶������&���src/Composer/Command/ConfigCommand.phpªG��ëYªG��Ð5$4¶������-���src/Composer/Command/CreateProjectCommand.phpë4��ëYë4��‡&ªö¶������'���src/Composer/Command/DependsCommand.php·��ëY·��o±¹ú¶������(���src/Composer/Command/DiagnoseCommand.phpÍF��ëYÍF��²E>F¶������,���src/Composer/Command/DumpAutoloadCommand.php¨ ��ëY¨ ��g/”+¶������$���src/Composer/Command/ExecCommand.phph��ëYh��íB=¶������&���src/Composer/Command/GlobalCommand.phpü��ëYü��ÝH�\¶������$���src/Composer/Command/HomeCommand.php��ëY��c¼±¶������$���src/Composer/Command/InitCommand.php»=��ëY»=��ð“=¶������'���src/Composer/Command/InstallCommand.phpý��ëYý��0ö:‰¶������(���src/Composer/Command/LicensesCommand.php%��ëY%��nx
  25. E¶������(���src/Composer/Command/OutdatedCommand.php°
  26. ��ëY°
  27. ��7àzk¶������)���src/Composer/Command/ProhibitsCommand.phpË��ëYË��g�ð¶������&���src/Composer/Command/RemoveCommand.php��ëY�� O4 ¶������'���src/Composer/Command/RequireCommand.php£��ëY£��š@p¶������)���src/Composer/Command/RunScriptCommand.phpŸ ��ëYŸ ��ÎÀñ˶������+���src/Composer/Command/ScriptAliasCommand.php��ëY��®%þ›¶������&���src/Composer/Command/SearchCommand.phpá��ëYá��ˆ ª¶������*���src/Composer/Command/SelfUpdateCommand.phpï0��ëYï0��û­ ¶������$���src/Composer/Command/ShowCommand.phped��ëYed��SÆÝ¶������&���src/Composer/Command/StatusCommand.php.��ëY.��&Æ�8¶������(���src/Composer/Command/SuggestsCommand.php¨ ��ëY¨ ��£.¿¶������&���src/Composer/Command/UpdateCommand.php["��ëY["��IyYì¶������(���src/Composer/Command/ValidateCommand.php��ëY��lpœ/¶���������src/Composer/Composer.phpÿ��ëYÿ��ò5¤@¶���������src/Composer/Config.php�"��ëY�"��Þ4Jö¶������-���src/Composer/Config/ConfigSourceInterface.php��ëY��³ [/¶������(���src/Composer/Config/JsonConfigSource.php!��ëY!��¾S N¶������$���src/Composer/Console/Application.php$0��ëY$0��ífû¶������,���src/Composer/Console/HtmlOutputFormatter.php3��ëY3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.phpQ��ëYQ��?˜¬$¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��ëY��õÝv¶������/���src/Composer/DependencyResolver/GenericRule.php·��ëY·��Ì~¯³¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��ëYC��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��ëY÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��ëYý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���ëYÓ���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��ëY¹��&¢e
  28. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��ëYI��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��ëYh��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��ëY­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php°"��ëY°"�� Ž%¶������+���src/Composer/DependencyResolver/Problem.php™��ëY™��´‡Ä¶������+���src/Composer/DependencyResolver/Request.phpƒ��ëYƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.phpn��ëYn��—3"u¶������1���src/Composer/DependencyResolver/Rule2Literals.php§��ëY§��~Ð'ò¶������+���src/Composer/DependencyResolver/RuleSet.phpª
  29. ��ëYª
  30. ��_΂¶������4���src/Composer/DependencyResolver/RuleSetGenerator.phpO��ëYO��³Q[â¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��ëY��}õÇù¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��ëYi��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��ëYá��‰rôv¶������1���src/Composer/DependencyResolver/RuleWatchNode.phpñ��ëYñ��ë•“¶������*���src/Composer/DependencyResolver/Solver.phpŸ8��ëYŸ8��pöb¶������6���src/Composer/DependencyResolver/SolverBugException.php˜��ëY˜��"qN¶������;���src/Composer/DependencyResolver/SolverProblemsException.php¤��ëY¤��Ä~¶������/���src/Composer/DependencyResolver/Transaction.phpô��ëYô��cïTܶ������-���src/Composer/Downloader/ArchiveDownloader.php¸��ëY¸��±°Y¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���ëYÌ���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.phpG��ëYG��Š(í»¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��ëYÊ��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���ëYÑ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.phpì��ëYì��4ø¶������/���src/Composer/Downloader/FilesystemException.php
  31. ��ëY
  32. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.php` ��ëY` ��ÿI©u¶������)���src/Composer/Downloader/GitDownloader.php�3��ëY�3��1mU¥¶������*���src/Composer/Downloader/GzipDownloader.phpó��ëYó��}Úo¶������(���src/Composer/Downloader/HgDownloader.php8 ��ëY8 ��ëyàn¶������*���src/Composer/Downloader/PathDownloader.phpS��ëYS��Êfý|¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��ëYu��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.phpÃ��ëYÃ��‘Èý¶������*���src/Composer/Downloader/PharDownloader.phpå���ëYå���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.phpž��ëYž��6 3U¶������)���src/Composer/Downloader/SvnDownloader.phpG��ëYG��†íV–¶������)���src/Composer/Downloader/TarDownloader.phpã���ëYã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��ëY=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���ëYÔ���`§ôö¶������)���src/Composer/Downloader/VcsDownloader.php"��ëY"��œŸp¶������(���src/Composer/Downloader/XzDownloader.php§��ëY§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.phpù ��ëYù ��>Å¡¶������&���src/Composer/EventDispatcher/Event.php ��ëY ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.phpß0��ëYß0��}f¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���ëY©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���ëYv���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���ëYf���ËíM�¶���������src/Composer/Factory.php¦<��ëY¦<��i‡@˶���������src/Composer/IO/BaseIO.phpŒ��ëYŒ��(‚l‘¶���������src/Composer/IO/BufferIO.php*��ëY*��¢®hT¶���������src/Composer/IO/ConsoleIO.php;��ëY;��Ê›*¶���������src/Composer/IO/IOInterface.phpì��ëYì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��ëYÀ��F`sʶ���������src/Composer/Installer.php×��ëY×��¿OJ¸¶������*���src/Composer/Installer/BinaryInstaller.php��ëY��³ *¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���ëYË���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��ëY-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��ëY��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���ëYÞ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��ëYã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php^��ëY^��Ír¶������/���src/Composer/Installer/MetapackageInstaller.phpœ��ëYœ��ÆÅ!¶������(���src/Composer/Installer/NoopInstaller.php+��ëY+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��ëYe��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��ëY¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpâ ��ëYâ ��;øiU¶������(���src/Composer/Installer/PearInstaller.php¢��ëY¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.phpŸ��ëYŸ��<tú,¶������+���src/Composer/Installer/ProjectInstaller.php��ëY��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.php��ëY��+±]Ķ���������src/Composer/Json/JsonFile.php��ëY��VVN¶������#���src/Composer/Json/JsonFormatter.php��ëY��Ðqu¶������%���src/Composer/Json/JsonManipulator.phpþ0��ëYþ0���kÌc¶������-���src/Composer/Json/JsonValidationException.php\��ëY\��.Xóܶ������%���src/Composer/Package/AliasPackage.php��ëY��¹—~š¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��ëY ��yY+¦¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��ëYÞ�� ²²¹¶������0���src/Composer/Package/Archiver/ArchiveManager.php° ��ëY° ��gþÒ)¶������3���src/Composer/Package/Archiver/ArchiverInterface.php��ëY��ñ´> ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��ëY–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��ëY��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpq��ëYq��5¾i&¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php��ëY��~”¸¶������.���src/Composer/Package/Archiver/PharArchiver.php>��ëY>�� 5‰í¶������-���src/Composer/Package/Archiver/ZipArchiver.php¼��ëY¼��‘XÝë¶������$���src/Composer/Package/BasePackage.php& ��ëY& ��'ݶ������(���src/Composer/Package/CompletePackage.phpü��ëYü��þM˶¶������1���src/Composer/Package/CompletePackageInterface.phpõ��ëYõ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpë ��ëYë ��Ó8WE¶���������src/Composer/Package/Link.phpˆ��ëYˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��ëY‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��ëYd��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��ëY‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��ëYi��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��ëYX��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.php¸��ëY¸��6 ¤¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��ëYE��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��ëYù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���ëY²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.php½��ëY½��I¢�i¶������5���src/Composer/Package/Loader/ValidatingArrayLoader.php½1��ëY½1��ÅnÚѶ���������src/Composer/Package/Locker.phpª!��ëYª!���7e¾¶������ ���src/Composer/Package/Package.phpÉ��ëYÉ��cÃ�h¶������)���src/Composer/Package/PackageInterface.php ��ëY ��ûÇ^ƶ������)���src/Composer/Package/RootAliasPackage.php ��ëY �� _€ø¶������$���src/Composer/Package/RootPackage.php��ëY��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��ëY¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpµ��ëYµ��.â_ ¶������.���src/Composer/Package/Version/VersionParser.phpø��ëYø��¾3l¶������0���src/Composer/Package/Version/VersionSelector.phpK ��ëYK ��²<ȶ������-���src/Composer/Plugin/Capability/Capability.phpW���ëYW���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���ëY—���ûOâ>¶���������src/Composer/Plugin/Capable.php���ëY���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��ëYâ��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpÂ���ëYÂ���^Íþ¶������'���src/Composer/Plugin/PluginInterface.phpô���ëYô���)'*ض������%���src/Composer/Plugin/PluginManager.php$��ëY$��ëŽ"»¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��ëY`���9-ζ������4���src/Composer/Question/StrictConfirmationQuestion.php��ëY��'.³è¶������+���src/Composer/Repository/ArrayRepository.php��ëY��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.php» ��ëY» ��ˆÝ÷<¶������*���src/Composer/Repository/BaseRepository.php_ ��ëY_ ��–ûß¶������.���src/Composer/Repository/ComposerRepository.php[T��ëY[T��fN¾³¶������/���src/Composer/Repository/CompositeRepository.php;��ëY;��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���ëY…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.php×��ëY×��Iœª¶������4���src/Composer/Repository/InstalledArrayRepository.php£���ëY£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���ëY£���V
  33. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���ëY‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���ëYn���à“똶������-���src/Composer/Repository/PackageRepository.phpj��ëYj��¥ôò̶������*���src/Composer/Repository/PathRepository.phpY ��ëYY ��(—¾3¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��ëYI��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��ëYÄ��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��ëYí��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.phpÁ ��ëYÁ ��O€ë¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��ëY& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��ëYq��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��ëYq��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��ëY…��÷$Li¶������,���src/Composer/Repository/Pear/PackageInfo.php°��ëY°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��ëY’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��ëYª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.php��ëY��_Mì¶������-���src/Composer/Repository/RepositoryFactory.phpM��ëYM��^ Æä¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��ëYÛ��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php,
  34. ��ëY,
  35. ��¾…\•¶������7���src/Composer/Repository/RepositorySecurityException.phpo���ëYo���pÕ«ª¶������/���src/Composer/Repository/Vcs/BitbucketDriver.phpô��ëYô��x¤ü¶������,���src/Composer/Repository/Vcs/FossilDriver.php ��ëY ��]‹ÉQ¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpê��ëYê��ÃŽ»¶������)���src/Composer/Repository/Vcs/GitDriver.phpØ��ëYØ��Ý"T̶������,���src/Composer/Repository/Vcs/GitHubDriver.phpz+��ëYz+��Úb¶������,���src/Composer/Repository/Vcs/GitLabDriver.php’��ëY’��«�\3¶������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpä��ëYä��i›üà¶������(���src/Composer/Repository/Vcs/HgDriver.php¥��ëY¥��uߣȶ������.���src/Composer/Repository/Vcs/PerforceDriver.phpO ��ëYO ��@ËóN¶������)���src/Composer/Repository/Vcs/SvnDriver.php��ëY��Õzï¶������)���src/Composer/Repository/Vcs/VcsDriver.phpƒ
  36. ��ëYƒ
  37. ��žŸ‡¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��ëY÷��ÇX[‰¶������)���src/Composer/Repository/VcsRepository.php´��ëY´��ªÖG¶������3���src/Composer/Repository/WritableArrayRepository.php��ëY��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��ëY‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���ëYW���£VZt¶���������src/Composer/Script/Event.phpµ��ëYµ��lt¦M¶������$���src/Composer/Script/PackageEvent.phpœ���ëYœ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��ëYP��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���ëY��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��ëYì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��ëYË��>zx–¶���������src/Composer/Util/Bitbucket.phpõ��ëYõ��’q9…¶������$���src/Composer/Util/ComposerMirror.php±��ëY±��­½øØ¶������%���src/Composer/Util/ConfigValidator.php&��ëY&��î:äü¶������"���src/Composer/Util/ErrorHandler.php‡��ëY‡��He"¶������ ���src/Composer/Util/Filesystem.phps.��ëYs.��›Í®à¶���������src/Composer/Util/Git.phpn$��ëYn$��5XǶ���������src/Composer/Util/GitHub.php¯
  38. ��ëY¯
  39. ��àÏ ¶���������src/Composer/Util/GitLab.php ��ëY ��Yºƒ*¶���������src/Composer/Util/IniHelper.php���ëY���Çþ‚{¶������$���src/Composer/Util/NoProxyPattern.php¾��ëY¾��Z+°m¶���������src/Composer/Util/Perforce.php2��ëY2��­5P¶���������src/Composer/Util/Platform.phpü��ëYü��s­fç¶������%���src/Composer/Util/ProcessExecutor.php ��ëY ��ˆ)sw¶������&���src/Composer/Util/RemoteFilesystem.phpb��ëYb��Þàî´¶���������src/Composer/Util/Silencer.phpò��ëYò��.Žܶ������!���src/Composer/Util/SpdxLicense.php��ëY��¾7
  40. ñ¶������*���src/Composer/Util/StreamContextFactory.phpw��ëYw��Ó;Ѷ���������src/Composer/Util/Svn.php¾��ëY¾��Ík“ܶ���������src/Composer/Util/TlsHelper.phpp
  41. ��ëYp
  42. ��¤eÞæ¶���������src/Composer/XdebugHandler.php“��ëY“��F·­¶���������src/bootstrap.php¹��ëY¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.php‹4��ëY‹4��QŸ”¼¶������#���res/composer-repository-schema.jsonð��ëYð���GÐà¶���������res/composer-schema.json[’��ëY[’��ák¥¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.jsoní��ëYí��ÆÅz±¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.json e��ëY e��ùe!‰¶������*���vendor/seld/cli-prompt/res/hiddeninput.exe�$��ëY�$��•�¥v¶������&���vendor/symfony/console/Application.php.W��ëY.W��´'�ð¶������*���vendor/symfony/console/Command/Command.php•#��ëY•#��Ìí+!¶������.���vendor/symfony/console/Command/HelpCommand.phpÝ��ëYÝ��.Ø™u¶������.���vendor/symfony/console/Command/ListCommand.phpZ��ëYZ��É£ ¶������(���vendor/symfony/console/ConsoleEvents.phpï���ëYï��� ÕH¸¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpß��ëYß��µŒ°7¶������0���vendor/symfony/console/Descriptor/Descriptor.php���ëY���;~Ķ������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���ëYü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpš ��ëYš ��l¬¶������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¹��ëY¹��kŸ.a¶������4���vendor/symfony/console/Descriptor/TextDescriptor.phpi��ëYi�� Îòÿ¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��ëY��‹P$¶������4���vendor/symfony/console/Event/ConsoleCommandEvent.php²��ëY²��Zk‰2¶������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��ëYÅ��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��ëY��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��ëYz��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��ëYÔ��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���ëYf���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���ëY¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���ëY¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���ëY’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���ëY–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php!��ëY!��§îwx¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŠ��ëYŠ��:ß¶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpL��ëYL��Š�8<¶������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php†��ëY†��ÝRÚ­¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.phpL��ëYL��.=b¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpx��ëYx��N©Ø¼¶������2���vendor/symfony/console/Helper/DescriptorHelper.phpz��ëYz��fÉÚý¶������.���vendor/symfony/console/Helper/DialogHelper.phpú��ëYú��hX�ö������1���vendor/symfony/console/Helper/FormatterHelper.phpc��ëYc��“ý«N¶������(���vendor/symfony/console/Helper/Helper.php��ëY��‡Â<£¶������1���vendor/symfony/console/Helper/HelperInterface.phpç���ëYç��� Çã¶������+���vendor/symfony/console/Helper/HelperSet.phpÐ��ëYÐ��aˆ~ ¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��ëYc��ñø�|¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÑ ��ëYÑ ��@±ã�¶������-���vendor/symfony/console/Helper/ProgressBar.phps%��ëYs%��鯦�¶������0���vendor/symfony/console/Helper/ProgressHelper.php\��ëY\��?‹á¶������3���vendor/symfony/console/Helper/ProgressIndicator.phpK��ëYK��íͰ¶������0���vendor/symfony/console/Helper/QuestionHelper.php���ëY���Ôb£¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.phpl
  43. ��ëYl
  44. ��÷ÞL¶������'���vendor/symfony/console/Helper/Table.php*��ëY*��¢¸}¶������+���vendor/symfony/console/Helper/TableCell.php‡��ëY‡��¨*æ¶������-���vendor/symfony/console/Helper/TableHelper.php ��ëY ��¦pm‡¶������0���vendor/symfony/console/Helper/TableSeparator.phpÍ���ëYÍ���Qßa²¶������,���vendor/symfony/console/Helper/TableStyle.php
  45. ��ëY
  46. ��PÞµ¦¶������*���vendor/symfony/console/Input/ArgvInput.php��ëY��¯Üœ¶������+���vendor/symfony/console/Input/ArrayInput.php_
  47. ��ëY_
  48. ��[µðɶ������&���vendor/symfony/console/Input/Input.phpª ��ëYª ��¶¶������.���vendor/symfony/console/Input/InputArgument.php��ëY��ÁÜ�¶������4���vendor/symfony/console/Input/InputAwareInterface.phpš���ëYš���‡jTŸ¶������0���vendor/symfony/console/Input/InputDefinition.php–��ëY–��0Oly¶������/���vendor/symfony/console/Input/InputInterface.phpŸ��ëYŸ��¥R6Û¶������,���vendor/symfony/console/Input/InputOption.php ��ëY ��‡¹§¶������,���vendor/symfony/console/Input/StringInput.php˜��ëY˜�� Ú¤¶���������vendor/symfony/console/LICENSE)��ëY)��·)E`¶������/���vendor/symfony/console/Logger/ConsoleLogger.php< ��ëY< ��:âÇl¶������0���vendor/symfony/console/Output/BufferedOutput.php_��ëY_��ûBÍ·¶������/���vendor/symfony/console/Output/ConsoleOutput.phpµ��ëYµ��
  49. ¢S\¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpå���ëYå���rNô�¶������,���vendor/symfony/console/Output/NullOutput.phpÏ��ëYÏ��®˜‹Z¶������(���vendor/symfony/console/Output/Output.phpš ��ëYš ��01 ý¶������1���vendor/symfony/console/Output/OutputInterface.php��ëY��ÓÚ>¶������.���vendor/symfony/console/Output/StreamOutput.phpÄ��ëYÄ��õí•¶������2���vendor/symfony/console/Question/ChoiceQuestion.php"
  50. ��ëY"
  51. ��_ΰ±¶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpé��ëYé��ƒQ@¶������,���vendor/symfony/console/Question/Question.php#
  52. ��ëY#
  53. ��e¯ ¶������ ���vendor/symfony/console/Shell.phpé��ëYé��½fü‘¶������,���vendor/symfony/console/Style/OutputStyle.php_��ëY_��ûµ¶������/���vendor/symfony/console/Style/StyleInterface.phpÔ��ëYÔ�� ßÊj¶������-���vendor/symfony/console/Style/SymfonyStyle.php¼��ëY¼��öÅPg¶������3���vendor/symfony/console/Tester/ApplicationTester.phpÔ��ëYÔ��¬ì¤d¶������/���vendor/symfony/console/Tester/CommandTester.php®��ëY®��EÙš|¶������(���vendor/symfony/debug/BufferingLogger.phpt��ëYt��=�hܶ���������vendor/symfony/debug/Debug.phpé��ëYé��Àxa?¶������)���vendor/symfony/debug/DebugClassLoader.phpå��ëYå��¦ù3\¶������%���vendor/symfony/debug/ErrorHandler.phpqB��ëYqB��Ÿ\/r¶������9���vendor/symfony/debug/Exception/ClassNotFoundException.php„��ëY„��n�¡…¶������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��ëY˜��-
  54. d2¶������1���vendor/symfony/debug/Exception/DummyException.php��ëY��-"ûd¶������6���vendor/symfony/debug/Exception/FatalErrorException.phpï��ëYï��æ fz¶������6���vendor/symfony/debug/Exception/FatalThrowableError.phpD��ëYD��¡ Âí¶������3���vendor/symfony/debug/Exception/FlattenException.php²��ëY²��HòѶ������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���ëY~���ë¨oâ¶������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpˆ��ëYˆ��¢G‚n¶������;���vendor/symfony/debug/Exception/UndefinedMethodException.php†��ëY†��¨LÚ:¶������)���vendor/symfony/debug/ExceptionHandler.php
  55. 3��ëY
  56. 3��¹¨È£¶������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php7��ëY7��Ñj/=¶������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��ëY��ĹBV¶������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpu��ëYu��éj¶������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpN��ëYN��Ço-ç¶���������vendor/symfony/debug/LICENSE)��ëY)��·)E`¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���ëYi���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��ëY¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��ëY‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���ëY¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.phpÔ.��ëYÔ.��ÏL{¶������!���vendor/symfony/filesystem/LICENSE)��ëY)��·)E`¶������)���vendor/symfony/filesystem/LockHandler.phpŽ��ëYŽ��ü Å¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��ëY\ ��Ɠɀ¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php‘��ëY‘��ao¦È¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php±��ëY±��ä»Ê&¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php2��ëY2��Q/ÇC¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��ëY�� ¡¾¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��ëYô��:?¶������/���vendor/symfony/finder/Comparator/Comparator.phpŒ��ëYŒ��wþT¶������3���vendor/symfony/finder/Comparator/DateComparator.php%��ëY%��L¿EǶ������5���vendor/symfony/finder/Comparator/NumberComparator.php~��ëY~��”‡ x¶������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���ëY„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¯��ëY¯��œôÔÁ¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���ëY„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��ëY)��ìcj=¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpÂ��ëYÂ��v‚ȶ������/���vendor/symfony/finder/Expression/Expression.php��ëY��µoÔ¶������)���vendor/symfony/finder/Expression/Glob.phpi��ëYi��@Šº¶������*���vendor/symfony/finder/Expression/Regex.php��ëY��p8�\¶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��ëYÍ��²~øb¶������ ���vendor/symfony/finder/Finder.phpÂ-��ëYÂ-��˜f´¶���������vendor/symfony/finder/Glob.phpK��ëYK��já±n¶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��ëY]��tà±µ¶������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpz��ëYz��ÂT-¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpð��ëYð��ß0™¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpï��ëYï��¾�Òâ¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php ��ëY ��fQCe¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.php\��ëY\��p‘'˜¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��ëY5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��ëYr��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÀ��ëYÀ��E™½Œ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php/��ëY/��»ÇY¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÏ��ëYÏ��ºªÇ¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��ëY ��eÚ¹ü¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpg��ëYg��!Ô—é¶������3���vendor/symfony/finder/Iterator/SortableIterator.php,��ëY,��–0õ¶���������vendor/symfony/finder/LICENSE)��ëY)��·)E`¶������'���vendor/symfony/finder/Shell/Command.phpS ��ëYS ��cC…™¶������%���vendor/symfony/finder/Shell/Shell.phpp��ëYp��Ó}g¶������%���vendor/symfony/finder/SplFileInfo.phpÿ��ëYÿ��Ë OÀ¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��ëY)��î*L¶������-���vendor/symfony/polyfill-mbstring/Mbstring.phpÁ4��ëYÁ4��^iS¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2A��ëY2A��½=¨¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡A��ëY¡A��Ú Í¶������.���vendor/symfony/polyfill-mbstring/bootstrap.php±��ëY±��|Š©Ò¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���ëYf���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���ëY¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���ëY”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��ëYx��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��ëY��. Ãá¶������5���vendor/symfony/process/Exception/RuntimeException.php˜���ëY˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php›��ëY›��ý‚m›¶���������vendor/symfony/process/LICENSE)��ëY)��·)E`¶������.���vendor/symfony/process/PhpExecutableFinder.phpg��ëYg���çµ¶������%���vendor/symfony/process/PhpProcess.phpü��ëYü��_—9¶������.���vendor/symfony/process/Pipes/AbstractPipes.php^��ëY^��%s…ï¶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��ëYD��vØî¡¶������*���vendor/symfony/process/Pipes/UnixPipes.phpå��ëYå��È¥¶������-���vendor/symfony/process/Pipes/WindowsPipes.php� ��ëY� ��…®h¶������"���vendor/symfony/process/Process.php§R��ëY§R��+Á¥¶������)���vendor/symfony/process/ProcessBuilder.phpã
  57. ��ëYã
  58. ��ʧ°ˆ¶������'���vendor/symfony/process/ProcessUtils.phpK��ëYK��µ½~ò¶���������vendor/seld/jsonlint/LICENSE"��ëY"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��ëY*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2��ëY/2��­ß˜ö¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php���ëY���#ÆŽ�¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��ëY��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���ëY>���ÿqŸŸ¶���������vendor/seld/cli-prompt/LICENSE"��ëY"��ˆñ?e¶������&���vendor/seld/cli-prompt/res/example.php'��ëY'��I£¶������(���vendor/seld/cli-prompt/src/CliPrompt.phpC��ëYC��Ð}�p¶������(���vendor/justinrainbow/json-schema/LICENSE ��ëY ��ºç©¶������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��ëYñ��fC¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php°��ëY°��Ãÿ¦'¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php. ��ëY. ��[÷3í¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.phpß ��ëYß ��—>/¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��ëY¼��ÿ Qœ¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��ëY]��VŽU<¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php7 ��ëY7 ��³�3%¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.phpŸ��ëYŸ��x&÷o¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
  59. ��ëYš
  60. ��z&¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpµ��ëYµ��üø¦É¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php��ëY��N_»¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php{��ëY{�� Ÿ[¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��ëYa�� qö������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phpp��ëYp��rë¶������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��ëY‰��“µ+j¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��ëY&��4˜©T¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php��ëY��/4˶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.php ��ëY ��û}fa¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���ëYI���%|°¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���ëY•���‹àG¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���ëYl���A!L×¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���ëYu���=hç¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���ëYw���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��ëYÞ��\¸
  61. ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���ëYo���píÛù¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���ëY…���%…—¶������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���ëY€���u-#1¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���ëYj���å>�¶������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���ëYf���¬¤„þ¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��ëYþ��M�„õ¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.phpG��ëYG��œ?IǶ������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpN ��ëYN ��ZÈó¬¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��ëY��oŠ+}¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���ëYá���[þA�¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.phpw��ëYw��x¡€¯¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php��ëY��äZšD¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��ëY,��1•5þ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���ëY®���ÿ‹Áå¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php– ��ëY– ��=&ßͶ������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpî��ëYî��Ý¿� ¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���ëYƒ���J€¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���ëY…���íæe¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.php†��ëY†��yÐSR¶������%���vendor/composer/spdx-licenses/LICENSE��ëY��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpç��ëYç��·–U ¶���������vendor/composer/semver/LICENSE��ëY��Bhí¶������)���vendor/composer/semver/src/Comparator.php��ëY��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.php×��ëY×��õî>޶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��ëYª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���ëYß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��ëYé��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��ëY1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��ëYv��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¿*��ëY¿*��)mƶ������!���vendor/composer/ca-bundle/LICENSE��ëY��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php½��ëY½��e¶���������vendor/psr/log/LICENSE=��ëY=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��ëY;��ñ>3[¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���ëY`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���ëYû���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���ëY|���$£ˆ¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���ëY§���T½úB¶������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÆ��ëYÆ��»sg¶������&���vendor/psr/log/Psr/Log/LoggerTrait.phpi��ëYi��35§Þ¶������%���vendor/psr/log/Psr/Log/NullLogger.phpž���ëYž���Çö������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpü ��ëYü ��iq0ض���������vendor/autoload.php‚���ëY‚���W˜¶������'���vendor/composer/autoload_namespaces.phpd���ëYd���Z¡¦H¶������!���vendor/composer/autoload_psr4.php˜��ëY˜��ž{¢¶������%���vendor/composer/autoload_classmap.phpd���ëYd���Z¡¦H¶������"���vendor/composer/autoload_files.phpÃ���ëYÃ���ÒÂür¶������!���vendor/composer/autoload_real.phpI��ëYI��bÔ ò¶������#���vendor/composer/autoload_static.php¬ ��ëY¬ ��‡to¶���������vendor/composer/ClassLoader.phpœ��ëYœ��¥ÂåN¶������(���vendor/composer/ca-bundle/res/cacert.pemÿ�ëYÿ�-=Jn¶������ ���bin/composer‹��ëY‹��íeGš¶���������LICENSE.��ëY.�� Õ¶������<?php
  62. namespace Composer\Autoload;
  63. use Composer\Config;
  64. use Composer\EventDispatcher\EventDispatcher;
  65. use Composer\Installer\InstallationManager;
  66. use Composer\IO\IOInterface;
  67. use Composer\Package\AliasPackage;
  68. use Composer\Package\PackageInterface;
  69. use Composer\Repository\InstalledRepositoryInterface;
  70. use Composer\Util\Filesystem;
  71. use Composer\Script\ScriptEvents;
  72. class AutoloadGenerator
  73. {
  74. private $eventDispatcher;
  75. private $io;
  76. private $devMode = false;
  77. private $classMapAuthoritative = false;
  78. private $apcu = false;
  79. private $runScripts = false;
  80. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  81. {
  82. $this->eventDispatcher = $eventDispatcher;
  83. $this->io = $io;
  84. }
  85. public function setDevMode($devMode = true)
  86. {
  87. $this->devMode = (bool) $devMode;
  88. }
  89. public function setClassMapAuthoritative($classMapAuthoritative)
  90. {
  91. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  92. }
  93. public function setApcu($apcu)
  94. {
  95. $this->apcu = (bool) $apcu;
  96. }
  97. public function setRunScripts($runScripts = true)
  98. {
  99. $this->runScripts = (bool) $runScripts;
  100. }
  101. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  102. {
  103. if ($this->classMapAuthoritative) {
  104. $scanPsr0Packages = true;
  105. }
  106. if ($this->runScripts) {
  107. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  108. 'optimize' => (bool) $scanPsr0Packages,
  109. ));
  110. }
  111. $filesystem = new Filesystem();
  112. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  113. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  114. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  115. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  116. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  117. $targetDir = $vendorPath.'/'.$targetDir;
  118. $filesystem->ensureDirectoryExists($targetDir);
  119. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  120. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  121. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  122. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  123. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  124. $namespacesFile = <<<EOF
  125. <?php
  126. // autoload_namespaces.php @generated by Composer
  127. \$vendorDir = $vendorPathCode52;
  128. \$baseDir = $appBaseDirCode;
  129. return array(
  130. EOF;
  131. $psr4File = <<<EOF
  132. <?php
  133. // autoload_psr4.php @generated by Composer
  134. \$vendorDir = $vendorPathCode52;
  135. \$baseDir = $appBaseDirCode;
  136. return array(
  137. EOF;
  138. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  139. $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
  140. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  141. $exportedPaths = array();
  142. foreach ($paths as $path) {
  143. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  144. }
  145. $exportedPrefix = var_export($namespace, true);
  146. $namespacesFile .= " $exportedPrefix => ";
  147. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  148. }
  149. $namespacesFile .= ");\n";
  150. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  151. $exportedPaths = array();
  152. foreach ($paths as $path) {
  153. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  154. }
  155. $exportedPrefix = var_export($namespace, true);
  156. $psr4File .= " $exportedPrefix => ";
  157. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  158. }
  159. $psr4File .= ");\n";
  160. $classmapFile = <<<EOF
  161. <?php
  162. // autoload_classmap.php @generated by Composer
  163. \$vendorDir = $vendorPathCode52;
  164. \$baseDir = $appBaseDirCode;
  165. return array(
  166. EOF;
  167. $targetDirLoader = null;
  168. $mainAutoload = $mainPackage->getAutoload();
  169. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  170. $levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
  171. $prefixes = implode(', ', array_map(function ($prefix) {
  172. return var_export($prefix, true);
  173. }, array_keys($mainAutoload['psr-0'])));
  174. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  175. $targetDirLoader = <<<EOF
  176. public static function autoload(\$class)
  177. {
  178. \$dir = $baseDirFromTargetDirCode . '/';
  179. \$prefixes = array($prefixes);
  180. foreach (\$prefixes as \$prefix) {
  181. if (0 !== strpos(\$class, \$prefix)) {
  182. continue;
  183. }
  184. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  185. if (!\$path = stream_resolve_include_path(\$path)) {
  186. return false;
  187. }
  188. require \$path;
  189. return true;
  190. }
  191. }
  192. EOF;
  193. }
  194. $blacklist = null;
  195. if (!empty($autoloads['exclude-from-classmap'])) {
  196. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  197. }
  198. $classMap = array();
  199. if ($scanPsr0Packages) {
  200. $namespacesToScan = array();
  201. foreach (array('psr-0', 'psr-4') as $psrType) {
  202. foreach ($autoloads[$psrType] as $namespace => $paths) {
  203. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  204. }
  205. }
  206. krsort($namespacesToScan);
  207. foreach ($namespacesToScan as $namespace => $groups) {
  208. foreach ($groups as $group) {
  209. foreach ($group['paths'] as $dir) {
  210. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  211. if (!is_dir($dir)) {
  212. continue;
  213. }
  214. $namespaceFilter = $namespace === '' ? null : $namespace;
  215. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  216. }
  217. }
  218. }
  219. }
  220. foreach ($autoloads['classmap'] as $dir) {
  221. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  222. }
  223. ksort($classMap);
  224. foreach ($classMap as $class => $code) {
  225. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  226. }
  227. $classmapFile .= ");\n";
  228. if (!$suffix) {
  229. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  230. $content = file_get_contents($vendorPath.'/autoload.php');
  231. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  232. $suffix = $match[1];
  233. }
  234. }
  235. if (!$suffix) {
  236. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  237. }
  238. }
  239. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  240. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  241. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  242. $includePathFilePath = $targetDir.'/include_paths.php';
  243. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  244. file_put_contents($includePathFilePath, $includePathFileContents);
  245. } elseif (file_exists($includePathFilePath)) {
  246. unlink($includePathFilePath);
  247. }
  248. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  249. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  250. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  251. } elseif (file_exists($includeFilesFilePath)) {
  252. unlink($includeFilesFilePath);
  253. }
  254. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  255. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  256. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  257. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  258. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  259. if ($this->runScripts) {
  260. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  261. 'optimize' => (bool) $scanPsr0Packages,
  262. ));
  263. }
  264. }
  265. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  266. {
  267. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  268. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  269. if (!isset($classMap[$class])) {
  270. $classMap[$class] = $pathCode;
  271. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  272. $this->io->writeError(
  273. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  274. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  275. );
  276. }
  277. }
  278. return $classMap;
  279. }
  280. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  281. {
  282. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  283. }
  284. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  285. {
  286. $packageMap = array(array($mainPackage, ''));
  287. foreach ($packages as $package) {
  288. if ($package instanceof AliasPackage) {
  289. continue;
  290. }
  291. $this->validatePackage($package);
  292. $packageMap[] = array(
  293. $package,
  294. $installationManager->getInstallPath($package),
  295. );
  296. }
  297. return $packageMap;
  298. }
  299. protected function validatePackage(PackageInterface $package)
  300. {
  301. $autoload = $package->getAutoload();
  302. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  303. $name = $package->getName();
  304. $package->getTargetDir();
  305. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  306. }
  307. if (!empty($autoload['psr-4'])) {
  308. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  309. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  310. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  311. }
  312. }
  313. }
  314. }
  315. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage)
  316. {
  317. $mainPackageMap = array_shift($packageMap);
  318. $sortedPackageMap = $this->sortPackageMap($packageMap);
  319. $sortedPackageMap[] = $mainPackageMap;
  320. array_unshift($packageMap, $mainPackageMap);
  321. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  322. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  323. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  324. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  325. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  326. krsort($psr0);
  327. krsort($psr4);
  328. return array(
  329. 'psr-0' => $psr0,
  330. 'psr-4' => $psr4,
  331. 'classmap' => $classmap,
  332. 'files' => $files,
  333. 'exclude-from-classmap' => $exclude,
  334. );
  335. }
  336. public function createLoader(array $autoloads)
  337. {
  338. $loader = new ClassLoader();
  339. if (isset($autoloads['psr-0'])) {
  340. foreach ($autoloads['psr-0'] as $namespace => $path) {
  341. $loader->add($namespace, $path);
  342. }
  343. }
  344. if (isset($autoloads['psr-4'])) {
  345. foreach ($autoloads['psr-4'] as $namespace => $path) {
  346. $loader->addPsr4($namespace, $path);
  347. }
  348. }
  349. if (isset($autoloads['classmap'])) {
  350. foreach ($autoloads['classmap'] as $dir) {
  351. try {
  352. $loader->addClassMap($this->generateClassMap($dir, null, null, false));
  353. } catch (\RuntimeException $e) {
  354. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  355. }
  356. }
  357. }
  358. return $loader;
  359. }
  360. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  361. {
  362. $includePaths = array();
  363. foreach ($packageMap as $item) {
  364. list($package, $installPath) = $item;
  365. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  366. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  367. }
  368. foreach ($package->getIncludePaths() as $includePath) {
  369. $includePath = trim($includePath, '/');
  370. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  371. }
  372. }
  373. if (!$includePaths) {
  374. return;
  375. }
  376. $includePathsCode = '';
  377. foreach ($includePaths as $path) {
  378. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  379. }
  380. return <<<EOF
  381. <?php
  382. // include_paths.php @generated by Composer
  383. \$vendorDir = $vendorPathCode;
  384. \$baseDir = $appBaseDirCode;
  385. return array(
  386. $includePathsCode);
  387. EOF;
  388. }
  389. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  390. {
  391. $filesCode = '';
  392. foreach ($files as $fileIdentifier => $functionFile) {
  393. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  394. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  395. }
  396. if (!$filesCode) {
  397. return false;
  398. }
  399. return <<<EOF
  400. <?php
  401. // autoload_files.php @generated by Composer
  402. \$vendorDir = $vendorPathCode;
  403. \$baseDir = $appBaseDirCode;
  404. return array(
  405. $filesCode);
  406. EOF;
  407. }
  408. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  409. {
  410. if (!$filesystem->isAbsolutePath($path)) {
  411. $path = $basePath . '/' . $path;
  412. }
  413. $path = $filesystem->normalizePath($path);
  414. $baseDir = '';
  415. if (strpos($path.'/', $vendorPath.'/') === 0) {
  416. $path = substr($path, strlen($vendorPath));
  417. $baseDir = '$vendorDir';
  418. if ($path !== false) {
  419. $baseDir .= " . ";
  420. }
  421. } else {
  422. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  423. if (!$filesystem->isAbsolutePath($path)) {
  424. $baseDir = '$baseDir . ';
  425. $path = '/' . $path;
  426. }
  427. }
  428. if (preg_match('/\.phar$/', $path)) {
  429. $baseDir = "'phar://' . " . $baseDir;
  430. }
  431. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  432. }
  433. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  434. {
  435. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  436. if ("'" === $lastChar || '"' === $lastChar) {
  437. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  438. } else {
  439. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  440. }
  441. return <<<AUTOLOAD
  442. <?php
  443. // autoload.php @generated by Composer
  444. require_once $vendorPathToTargetDirCode;
  445. return ComposerAutoloaderInit$suffix::getLoader();
  446. AUTOLOAD;
  447. }
  448. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  449. {
  450. $file = <<<HEADER
  451. <?php
  452. // autoload_real.php @generated by Composer
  453. class ComposerAutoloaderInit$suffix
  454. {
  455. private static \$loader;
  456. public static function loadClassLoader(\$class)
  457. {
  458. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  459. require __DIR__ . '/ClassLoader.php';
  460. }
  461. }
  462. public static function getLoader()
  463. {
  464. if (null !== self::\$loader) {
  465. return self::\$loader;
  466. }
  467. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  468. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  469. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  470. HEADER;
  471. if ($useIncludePath) {
  472. $file .= <<<'INCLUDE_PATH'
  473. $includePaths = require __DIR__ . '/include_paths.php';
  474. array_push($includePaths, get_include_path());
  475. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  476. INCLUDE_PATH;
  477. }
  478. $file .= <<<STATIC_INIT
  479. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  480. if (\$useStaticLoader) {
  481. require_once __DIR__ . '/autoload_static.php';
  482. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  483. } else {
  484. STATIC_INIT;
  485. if (!$this->classMapAuthoritative) {
  486. $file .= <<<'PSR04'
  487. $map = require __DIR__ . '/autoload_namespaces.php';
  488. foreach ($map as $namespace => $path) {
  489. $loader->set($namespace, $path);
  490. }
  491. $map = require __DIR__ . '/autoload_psr4.php';
  492. foreach ($map as $namespace => $path) {
  493. $loader->setPsr4($namespace, $path);
  494. }
  495. PSR04;
  496. }
  497. if ($useClassMap) {
  498. $file .= <<<'CLASSMAP'
  499. $classMap = require __DIR__ . '/autoload_classmap.php';
  500. if ($classMap) {
  501. $loader->addClassMap($classMap);
  502. }
  503. CLASSMAP;
  504. }
  505. $file .= " }\n\n";
  506. if ($this->classMapAuthoritative) {
  507. $file .= <<<'CLASSMAPAUTHORITATIVE'
  508. $loader->setClassMapAuthoritative(true);
  509. CLASSMAPAUTHORITATIVE;
  510. }
  511. if ($this->apcu) {
  512. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  513. $file .= <<<APCU
  514. \$loader->setApcuPrefix('$apcuPrefix');
  515. APCU;
  516. }
  517. if ($useGlobalIncludePath) {
  518. $file .= <<<'INCLUDEPATH'
  519. $loader->setUseIncludePath(true);
  520. INCLUDEPATH;
  521. }
  522. if ($targetDirLoader) {
  523. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  524. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  525. REGISTER_TARGET_DIR_AUTOLOAD;
  526. }
  527. $file .= <<<REGISTER_LOADER
  528. \$loader->register($prependAutoloader);
  529. REGISTER_LOADER;
  530. if ($useIncludeFiles) {
  531. $file .= <<<INCLUDE_FILES
  532. if (\$useStaticLoader) {
  533. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  534. } else {
  535. \$includeFiles = require __DIR__ . '/autoload_files.php';
  536. }
  537. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  538. composerRequire$suffix(\$fileIdentifier, \$file);
  539. }
  540. INCLUDE_FILES;
  541. }
  542. $file .= <<<METHOD_FOOTER
  543. return \$loader;
  544. }
  545. METHOD_FOOTER;
  546. $file .= $targetDirLoader;
  547. if ($useIncludeFiles) {
  548. return $file . <<<FOOTER
  549. }
  550. function composerRequire$suffix(\$fileIdentifier, \$file)
  551. {
  552. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  553. require \$file;
  554. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  555. }
  556. }
  557. FOOTER;
  558. }
  559. return $file . <<<FOOTER
  560. }
  561. FOOTER;
  562. }
  563. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  564. {
  565. $staticPhpVersion = 50600;
  566. $file = <<<HEADER
  567. <?php
  568. // autoload_static.php @generated by Composer
  569. namespace Composer\Autoload;
  570. class ComposerStaticInit$suffix
  571. {
  572. HEADER;
  573. $loader = new ClassLoader();
  574. $map = require $targetDir . '/autoload_namespaces.php';
  575. foreach ($map as $namespace => $path) {
  576. $loader->set($namespace, $path);
  577. }
  578. $map = require $targetDir . '/autoload_psr4.php';
  579. foreach ($map as $namespace => $path) {
  580. $loader->setPsr4($namespace, $path);
  581. }
  582. $classMap = require $targetDir . '/autoload_classmap.php';
  583. if ($classMap) {
  584. $loader->addClassMap($classMap);
  585. }
  586. $filesystem = new Filesystem();
  587. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  588. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  589. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  590. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  591. $initializer = '';
  592. $prefix = "\0Composer\Autoload\ClassLoader\0";
  593. $prefixLen = strlen($prefix);
  594. if (file_exists($targetDir . '/autoload_files.php')) {
  595. $maps = array('files' => require $targetDir . '/autoload_files.php');
  596. } else {
  597. $maps = array();
  598. }
  599. foreach ((array) $loader as $prop => $value) {
  600. if ($value && 0 === strpos($prop, $prefix)) {
  601. $maps[substr($prop, $prefixLen)] = $value;
  602. }
  603. }
  604. foreach ($maps as $prop => $value) {
  605. if (count($value) > 32767) {
  606. $staticPhpVersion = 70000;
  607. }
  608. $value = var_export($value, true);
  609. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  610. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  611. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  612. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  613. if ('files' !== $prop) {
  614. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  615. }
  616. }
  617. return $file . <<<INITIALIZER
  618. public static function getInitializer(ClassLoader \$loader)
  619. {
  620. return \Closure::bind(function () use (\$loader) {
  621. $initializer
  622. }, null, ClassLoader::class);
  623. }
  624. }
  625. INITIALIZER;
  626. }
  627. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  628. {
  629. $autoloads = array();
  630. foreach ($packageMap as $item) {
  631. list($package, $installPath) = $item;
  632. $autoload = $package->getAutoload();
  633. if ($this->devMode && $package === $mainPackage) {
  634. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  635. }
  636. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  637. continue;
  638. }
  639. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  640. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  641. }
  642. foreach ($autoload[$type] as $namespace => $paths) {
  643. foreach ((array) $paths as $path) {
  644. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  645. if ($package === $mainPackage) {
  646. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  647. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  648. } else {
  649. $path = $package->getTargetDir() . '/' . $path;
  650. }
  651. }
  652. if ($type === 'exclude-from-classmap') {
  653. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  654. $path = str_replace('\\*\\*', '.+?', $path);
  655. $path = str_replace('\\*', '[^/]+?', $path);
  656. $updir = null;
  657. $path = preg_replace_callback(
  658. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  659. function ($matches) use (&$updir) {
  660. if (isset($matches[1])) {
  661. $updir = str_replace('\\.', '.', $matches[1]);
  662. }
  663. return '';
  664. },
  665. $path
  666. );
  667. if (empty($installPath)) {
  668. $installPath = strtr(getcwd(), '\\', '/');
  669. }
  670. $resolvedPath = realpath($installPath . '/' . $updir);
  671. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  672. continue;
  673. }
  674. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  675. if ($type === 'files') {
  676. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  677. continue;
  678. } elseif ($type === 'classmap') {
  679. $autoloads[] = $relativePath;
  680. continue;
  681. }
  682. $autoloads[$namespace][] = $relativePath;
  683. }
  684. }
  685. }
  686. return $autoloads;
  687. }
  688. protected function getFileIdentifier(PackageInterface $package, $path)
  689. {
  690. return md5($package->getName() . ':' . $path);
  691. }
  692. protected function sortPackageMap(array $packageMap)
  693. {
  694. $packages = array();
  695. $paths = array();
  696. $usageList = array();
  697. foreach ($packageMap as $item) {
  698. list($package, $path) = $item;
  699. $name = $package->getName();
  700. $packages[$name] = $package;
  701. $paths[$name] = $path;
  702. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  703. $target = $link->getTarget();
  704. $usageList[$target][] = $name;
  705. }
  706. }
  707. $computing = array();
  708. $computed = array();
  709. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  710. if (isset($computed[$name])) {
  711. return $computed[$name];
  712. }
  713. if (isset($computing[$name])) {
  714. return 0;
  715. }
  716. $computing[$name] = true;
  717. $weight = 0;
  718. if (isset($usageList[$name])) {
  719. foreach ($usageList[$name] as $user) {
  720. $weight -= 1 - $computeImportance($user);
  721. }
  722. }
  723. unset($computing[$name]);
  724. $computed[$name] = $weight;
  725. return $weight;
  726. };
  727. $weightList = array();
  728. foreach ($packages as $name => $package) {
  729. $weight = $computeImportance($name);
  730. $weightList[$name] = $weight;
  731. }
  732. $stable_sort = function (&$array) {
  733. static $transform, $restore;
  734. $i = 0;
  735. if (!$transform) {
  736. $transform = function (&$v, $k) use (&$i) {
  737. $v = array($v, ++$i, $k, $v);
  738. };
  739. $restore = function (&$v, $k) {
  740. $v = $v[3];
  741. };
  742. }
  743. array_walk($array, $transform);
  744. asort($array);
  745. array_walk($array, $restore);
  746. };
  747. $stable_sort($weightList);
  748. $sortedPackageMap = array();
  749. foreach (array_keys($weightList) as $name) {
  750. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  751. }
  752. return $sortedPackageMap;
  753. }
  754. protected function safeCopy($source, $target)
  755. {
  756. $source = fopen($source, 'r');
  757. $target = fopen($target, 'w+');
  758. stream_copy_to_stream($source, $target);
  759. fclose($source);
  760. fclose($target);
  761. }
  762. }
  763. <?php
  764. namespace Composer\Autoload;
  765. use Symfony\Component\Finder\Finder;
  766. use Composer\IO\IOInterface;
  767. use Composer\Util\Filesystem;
  768. class ClassMapGenerator
  769. {
  770. public static function dump($dirs, $file)
  771. {
  772. $maps = array();
  773. foreach ($dirs as $dir) {
  774. $maps = array_merge($maps, static::createMap($dir));
  775. }
  776. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  777. }
  778. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  779. {
  780. if (is_string($path)) {
  781. if (is_file($path)) {
  782. $path = array(new \SplFileInfo($path));
  783. } elseif (is_dir($path)) {
  784. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  785. } else {
  786. throw new \RuntimeException(
  787. 'Could not scan for classes inside "'.$path.
  788. '" which does not appear to be a file nor a folder'
  789. );
  790. }
  791. }
  792. $map = array();
  793. $filesystem = new Filesystem();
  794. $cwd = getcwd();
  795. foreach ($path as $file) {
  796. $filePath = $file->getPathname();
  797. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  798. continue;
  799. }
  800. if (!$filesystem->isAbsolutePath($filePath)) {
  801. $filePath = $cwd . '/' . $filePath;
  802. $filePath = $filesystem->normalizePath($filePath);
  803. } else {
  804. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  805. }
  806. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  807. continue;
  808. }
  809. $classes = self::findClasses($filePath);
  810. foreach ($classes as $class) {
  811. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  812. continue;
  813. }
  814. if (!isset($map[$class])) {
  815. $map[$class] = $filePath;
  816. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  817. $io->writeError(
  818. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  819. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  820. );
  821. }
  822. }
  823. }
  824. return $map;
  825. }
  826. private static function findClasses($path)
  827. {
  828. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  829. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  830. $extraTypes .= '|enum';
  831. }
  832. $contents = @php_strip_whitespace($path);
  833. if (!$contents) {
  834. if (!file_exists($path)) {
  835. $message = 'File at "%s" does not exist, check your classmap definitions';
  836. } elseif (!is_readable($path)) {
  837. $message = 'File at "%s" is not readable, check its permissions';
  838. } elseif ('' === trim(file_get_contents($path))) {
  839. return array();
  840. } else {
  841. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  842. }
  843. $error = error_get_last();
  844. if (isset($error['message'])) {
  845. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  846. }
  847. throw new \RuntimeException(sprintf($message, $path));
  848. }
  849. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  850. return array();
  851. }
  852. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  853. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  854. if (substr($contents, 0, 2) !== '<?') {
  855. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  856. if ($replacements === 0) {
  857. return array();
  858. }
  859. }
  860. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  861. $pos = strrpos($contents, '?>');
  862. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  863. $contents = substr($contents, 0, $pos);
  864. }
  865. preg_match_all('{
  866. (?:
  867. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  868. | \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*+ [\{;]
  869. )
  870. }ix', $contents, $matches);
  871. $classes = array();
  872. $namespace = '';
  873. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  874. if (!empty($matches['ns'][$i])) {
  875. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  876. } else {
  877. $name = $matches['name'][$i];
  878. if ($name === 'extends' || $name === 'implements') {
  879. continue;
  880. }
  881. if ($name[0] === ':') {
  882. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  883. } elseif ($matches['type'][$i] === 'enum') {
  884. $name = rtrim($name, ':');
  885. }
  886. $classes[] = ltrim($namespace . $name, '\\');
  887. }
  888. }
  889. return $classes;
  890. }
  891. }
  892. <?php
  893. namespace Composer;
  894. use Composer\IO\IOInterface;
  895. use Composer\Util\Filesystem;
  896. use Composer\Util\Silencer;
  897. use Symfony\Component\Finder\Finder;
  898. class Cache
  899. {
  900. private static $cacheCollected = false;
  901. private $io;
  902. private $root;
  903. private $enabled = true;
  904. private $whitelist;
  905. private $filesystem;
  906. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  907. {
  908. $this->io = $io;
  909. $this->root = rtrim($cacheDir, '/\\') . '/';
  910. $this->whitelist = $whitelist;
  911. $this->filesystem = $filesystem ?: new Filesystem();
  912. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  913. $this->enabled = false;
  914. return;
  915. }
  916. if (
  917. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  918. || !is_writable($this->root)
  919. ) {
  920. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  921. $this->enabled = false;
  922. }
  923. }
  924. public function isEnabled()
  925. {
  926. return $this->enabled;
  927. }
  928. public function getRoot()
  929. {
  930. return $this->root;
  931. }
  932. public function read($file)
  933. {
  934. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  935. if ($this->enabled && file_exists($this->root . $file)) {
  936. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  937. return file_get_contents($this->root . $file);
  938. }
  939. return false;
  940. }
  941. public function write($file, $contents)
  942. {
  943. if ($this->enabled) {
  944. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  945. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  946. try {
  947. return file_put_contents($this->root . $file, $contents);
  948. } catch (\ErrorException $e) {
  949. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  950. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  951. unlink($this->root . $file);
  952. $message = sprintf(
  953. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  954. $this->root . $file,
  955. $m[1],
  956. $m[2],
  957. @disk_free_space($this->root . dirname($file))
  958. );
  959. $this->io->writeError($message);
  960. return false;
  961. }
  962. throw $e;
  963. }
  964. }
  965. return false;
  966. }
  967. public function copyFrom($file, $source)
  968. {
  969. if ($this->enabled) {
  970. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  971. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  972. if (!file_exists($source)) {
  973. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  974. } elseif ($this->io->isDebug()) {
  975. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  976. }
  977. return copy($source, $this->root . $file);
  978. }
  979. return false;
  980. }
  981. public function copyTo($file, $target)
  982. {
  983. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  984. if ($this->enabled && file_exists($this->root . $file)) {
  985. try {
  986. touch($this->root . $file, filemtime($this->root . $file), time());
  987. } catch (\ErrorException $e) {
  988. Silencer::call('touch', $this->root . $file);
  989. }
  990. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  991. return copy($this->root . $file, $target);
  992. }
  993. return false;
  994. }
  995. public function gcIsNecessary()
  996. {
  997. return (!self::$cacheCollected && !mt_rand(0, 50));
  998. }
  999. public function remove($file)
  1000. {
  1001. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1002. if ($this->enabled && file_exists($this->root . $file)) {
  1003. return $this->filesystem->unlink($this->root . $file);
  1004. }
  1005. return false;
  1006. }
  1007. public function gc($ttl, $maxSize)
  1008. {
  1009. if ($this->enabled) {
  1010. $expire = new \DateTime();
  1011. $expire->modify('-'.$ttl.' seconds');
  1012. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1013. foreach ($finder as $file) {
  1014. $this->filesystem->unlink($file->getPathname());
  1015. }
  1016. $totalSize = $this->filesystem->size($this->root);
  1017. if ($totalSize > $maxSize) {
  1018. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1019. while ($totalSize > $maxSize && $iterator->valid()) {
  1020. $filepath = $iterator->current()->getPathname();
  1021. $totalSize -= $this->filesystem->size($filepath);
  1022. $this->filesystem->unlink($filepath);
  1023. $iterator->next();
  1024. }
  1025. }
  1026. self::$cacheCollected = true;
  1027. return true;
  1028. }
  1029. return false;
  1030. }
  1031. public function sha1($file)
  1032. {
  1033. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1034. if ($this->enabled && file_exists($this->root . $file)) {
  1035. return sha1_file($this->root . $file);
  1036. }
  1037. return false;
  1038. }
  1039. public function sha256($file)
  1040. {
  1041. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1042. if ($this->enabled && file_exists($this->root . $file)) {
  1043. return hash_file('sha256', $this->root . $file);
  1044. }
  1045. return false;
  1046. }
  1047. protected function getFinder()
  1048. {
  1049. return Finder::create()->in($this->root)->files();
  1050. }
  1051. }
  1052. <?php
  1053. namespace Composer\Command;
  1054. use Symfony\Component\Console\Input\InputInterface;
  1055. use Symfony\Component\Console\Output\OutputInterface;
  1056. class AboutCommand extends BaseCommand
  1057. {
  1058. protected function configure()
  1059. {
  1060. $this
  1061. ->setName('about')
  1062. ->setDescription('Short information about Composer.')
  1063. ->setHelp(<<<EOT
  1064. <info>php composer.phar about</info>
  1065. EOT
  1066. )
  1067. ;
  1068. }
  1069. protected function execute(InputInterface $input, OutputInterface $output)
  1070. {
  1071. $this->getIO()->write(<<<EOT
  1072. <info>Composer - Package Management for PHP</info>
  1073. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1074. See https://getcomposer.org/ for more information.</comment>
  1075. EOT
  1076. );
  1077. }
  1078. }
  1079. <?php
  1080. namespace Composer\Command;
  1081. use Composer\Factory;
  1082. use Composer\IO\IOInterface;
  1083. use Composer\Config;
  1084. use Composer\Repository\CompositeRepository;
  1085. use Composer\Repository\RepositoryFactory;
  1086. use Composer\Script\ScriptEvents;
  1087. use Composer\Plugin\CommandEvent;
  1088. use Composer\Plugin\PluginEvents;
  1089. use Composer\Util\Filesystem;
  1090. use Symfony\Component\Console\Input\InputArgument;
  1091. use Symfony\Component\Console\Input\InputInterface;
  1092. use Symfony\Component\Console\Input\InputOption;
  1093. use Symfony\Component\Console\Output\OutputInterface;
  1094. class ArchiveCommand extends BaseCommand
  1095. {
  1096. protected function configure()
  1097. {
  1098. $this
  1099. ->setName('archive')
  1100. ->setDescription('Create an archive of this composer package.')
  1101. ->setDefinition(array(
  1102. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1103. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1104. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1105. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1106. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1107. .' Note that the format will be appended.'),
  1108. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1109. ))
  1110. ->setHelp(<<<EOT
  1111. The <info>archive</info> command creates an archive of the specified format
  1112. containing the files and directories of the Composer project or the specified
  1113. package in the specified version and writes it to the specified directory.
  1114. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1115. EOT
  1116. )
  1117. ;
  1118. }
  1119. protected function execute(InputInterface $input, OutputInterface $output)
  1120. {
  1121. $config = Factory::createConfig();
  1122. $composer = $this->getComposer(false);
  1123. if ($composer) {
  1124. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1125. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1126. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1127. }
  1128. if (null === $input->getOption('format')) {
  1129. $input->setOption('format', $config->get('archive-format'));
  1130. }
  1131. if (null === $input->getOption('dir')) {
  1132. $input->setOption('dir', $config->get('archive-dir'));
  1133. }
  1134. $returnCode = $this->archive(
  1135. $this->getIO(),
  1136. $config,
  1137. $input->getArgument('package'),
  1138. $input->getArgument('version'),
  1139. $input->getOption('format'),
  1140. $input->getOption('dir'),
  1141. $input->getOption('file'),
  1142. $input->getOption('ignore-filters')
  1143. );
  1144. if (0 === $returnCode && $composer) {
  1145. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1146. }
  1147. return $returnCode;
  1148. }
  1149. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters)
  1150. {
  1151. $factory = new Factory;
  1152. $downloadManager = $factory->createDownloadManager($io, $config);
  1153. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1154. if ($packageName) {
  1155. $package = $this->selectPackage($io, $packageName, $version);
  1156. if (!$package) {
  1157. return 1;
  1158. }
  1159. } else {
  1160. $package = $this->getComposer()->getPackage();
  1161. }
  1162. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1163. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1164. $fs = new Filesystem;
  1165. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1166. $io->writeError('Created: ', false);
  1167. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1168. return 0;
  1169. }
  1170. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1171. {
  1172. $io->writeError('<info>Searching for the specified package.</info>');
  1173. if ($composer = $this->getComposer(false)) {
  1174. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1175. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1176. } else {
  1177. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1178. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1179. $repo = new CompositeRepository($defaultRepos);
  1180. }
  1181. $packages = $repo->findPackages($packageName, $version);
  1182. if (count($packages) > 1) {
  1183. $package = reset($packages);
  1184. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1185. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1186. return $p->getPrettyString();
  1187. }, $packages)).'.');
  1188. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1189. } elseif ($packages) {
  1190. $package = reset($packages);
  1191. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1192. } else {
  1193. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1194. return false;
  1195. }
  1196. return $package;
  1197. }
  1198. }
  1199. <?php
  1200. namespace Composer\Command;
  1201. use Composer\Composer;
  1202. use Composer\Config;
  1203. use Composer\Console\Application;
  1204. use Composer\IO\IOInterface;
  1205. use Composer\IO\NullIO;
  1206. use Symfony\Component\Console\Input\InputInterface;
  1207. use Symfony\Component\Console\Output\OutputInterface;
  1208. use Symfony\Component\Console\Command\Command;
  1209. abstract class BaseCommand extends Command
  1210. {
  1211. private $composer;
  1212. private $io;
  1213. public function getComposer($required = true, $disablePlugins = null)
  1214. {
  1215. if (null === $this->composer) {
  1216. $application = $this->getApplication();
  1217. if ($application instanceof Application) {
  1218. $this->composer = $application->getComposer($required, $disablePlugins);
  1219. } elseif ($required) {
  1220. throw new \RuntimeException(
  1221. 'Could not create a Composer\Composer instance, you must inject '.
  1222. 'one if this command is not used with a Composer\Console\Application instance'
  1223. );
  1224. }
  1225. }
  1226. return $this->composer;
  1227. }
  1228. public function setComposer(Composer $composer)
  1229. {
  1230. $this->composer = $composer;
  1231. }
  1232. public function resetComposer()
  1233. {
  1234. $this->composer = null;
  1235. $this->getApplication()->resetComposer();
  1236. }
  1237. public function isProxyCommand()
  1238. {
  1239. return false;
  1240. }
  1241. public function getIO()
  1242. {
  1243. if (null === $this->io) {
  1244. $application = $this->getApplication();
  1245. if ($application instanceof Application) {
  1246. $this->io = $application->getIO();
  1247. } else {
  1248. $this->io = new NullIO();
  1249. }
  1250. }
  1251. return $this->io;
  1252. }
  1253. public function setIO(IOInterface $io)
  1254. {
  1255. $this->io = $io;
  1256. }
  1257. protected function initialize(InputInterface $input, OutputInterface $output)
  1258. {
  1259. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1260. $input->setOption('no-progress', true);
  1261. }
  1262. parent::initialize($input, $output);
  1263. }
  1264. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1265. {
  1266. $preferSource = false;
  1267. $preferDist = false;
  1268. switch ($config->get('preferred-install')) {
  1269. case 'source':
  1270. $preferSource = true;
  1271. break;
  1272. case 'dist':
  1273. $preferDist = true;
  1274. break;
  1275. case 'auto':
  1276. default:
  1277. break;
  1278. }
  1279. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1280. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1281. $preferDist = $input->getOption('prefer-dist');
  1282. }
  1283. return array($preferSource, $preferDist);
  1284. }
  1285. }
  1286. <?php
  1287. namespace Composer\Command;
  1288. use Composer\DependencyResolver\Pool;
  1289. use Composer\Package\Link;
  1290. use Composer\Package\PackageInterface;
  1291. use Composer\Repository\ArrayRepository;
  1292. use Composer\Repository\CompositeRepository;
  1293. use Composer\Repository\PlatformRepository;
  1294. use Composer\Repository\RepositoryFactory;
  1295. use Composer\Plugin\CommandEvent;
  1296. use Composer\Plugin\PluginEvents;
  1297. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1298. use Composer\Package\Version\VersionParser;
  1299. use Symfony\Component\Console\Helper\Table;
  1300. use Symfony\Component\Console\Input\InputArgument;
  1301. use Symfony\Component\Console\Input\InputInterface;
  1302. use Symfony\Component\Console\Input\InputOption;
  1303. use Symfony\Component\Console\Output\OutputInterface;
  1304. class BaseDependencyCommand extends BaseCommand
  1305. {
  1306. const ARGUMENT_PACKAGE = 'package';
  1307. const ARGUMENT_CONSTRAINT = 'constraint';
  1308. const OPTION_RECURSIVE = 'recursive';
  1309. const OPTION_TREE = 'tree';
  1310. protected $colors;
  1311. protected function configure()
  1312. {
  1313. $this->setDefinition(array(
  1314. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1315. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1316. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1317. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1318. ));
  1319. }
  1320. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1321. {
  1322. $composer = $this->getComposer();
  1323. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1324. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1325. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1326. $repository = new CompositeRepository(array(
  1327. new ArrayRepository(array($composer->getPackage())),
  1328. $composer->getRepositoryManager()->getLocalRepository(),
  1329. new PlatformRepository(array(), $platformOverrides),
  1330. ));
  1331. $pool = new Pool();
  1332. $pool->addRepository($repository);
  1333. list($needle, $textConstraint) = array_pad(
  1334. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1335. 2,
  1336. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1337. );
  1338. $packages = $pool->whatProvides($needle);
  1339. if (empty($packages)) {
  1340. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1341. }
  1342. if (!$repository->findPackage($needle, $textConstraint)) {
  1343. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1344. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1345. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1346. }
  1347. }
  1348. $needles = array($needle);
  1349. if ($inverted) {
  1350. foreach ($packages as $package) {
  1351. $needles = array_merge($needles, array_map(function (Link $link) {
  1352. return $link->getTarget();
  1353. }, $package->getReplaces()));
  1354. }
  1355. }
  1356. if ('*' !== $textConstraint) {
  1357. $versionParser = new VersionParser();
  1358. $constraint = $versionParser->parseConstraints($textConstraint);
  1359. } else {
  1360. $constraint = null;
  1361. }
  1362. $renderTree = $input->getOption(self::OPTION_TREE);
  1363. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1364. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1365. if (empty($results)) {
  1366. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1367. $this->getIO()->writeError(sprintf('<info>There is no installed package depending on "%s"%s</info>',
  1368. $needle, $extra));
  1369. } elseif ($renderTree) {
  1370. $this->initStyles($output);
  1371. $root = $packages[0];
  1372. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1373. $this->printTree($results);
  1374. } else {
  1375. $this->printTable($output, $results);
  1376. }
  1377. return 0;
  1378. }
  1379. protected function printTable(OutputInterface $output, $results)
  1380. {
  1381. $table = array();
  1382. $doubles = array();
  1383. do {
  1384. $queue = array();
  1385. $rows = array();
  1386. foreach ($results as $result) {
  1387. list($package, $link, $children) = $result;
  1388. $unique = (string) $link;
  1389. if (isset($doubles[$unique])) {
  1390. continue;
  1391. }
  1392. $doubles[$unique] = true;
  1393. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1394. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1395. if ($children) {
  1396. $queue = array_merge($queue, $children);
  1397. }
  1398. }
  1399. $results = $queue;
  1400. $table = array_merge($rows, $table);
  1401. } while (!empty($results));
  1402. $renderer = new Table($output);
  1403. $renderer->setStyle('compact');
  1404. $renderer->getStyle()->setVerticalBorderChar('');
  1405. $renderer->getStyle()->setCellRowContentFormat('%s ');
  1406. $renderer->setRows($table)->render();
  1407. }
  1408. protected function initStyles(OutputInterface $output)
  1409. {
  1410. $this->colors = array(
  1411. 'green',
  1412. 'yellow',
  1413. 'cyan',
  1414. 'magenta',
  1415. 'blue',
  1416. );
  1417. foreach ($this->colors as $color) {
  1418. $style = new OutputFormatterStyle($color);
  1419. $output->getFormatter()->setStyle($color, $style);
  1420. }
  1421. }
  1422. protected function printTree($results, $prefix = '', $level = 1)
  1423. {
  1424. $count = count($results);
  1425. $idx = 0;
  1426. foreach ($results as $result) {
  1427. list($package, $link, $children) = $result;
  1428. $color = $this->colors[$level % count($this->colors)];
  1429. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1430. $isLast = (++$idx == $count);
  1431. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1432. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1433. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1434. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1435. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1436. if ($children) {
  1437. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1438. }
  1439. }
  1440. }
  1441. private function writeTreeLine($line)
  1442. {
  1443. $io = $this->getIO();
  1444. if (!$io->isDecorated()) {
  1445. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1446. }
  1447. $io->write($line);
  1448. }
  1449. }
  1450. <?php
  1451. namespace Composer\Command;
  1452. use Composer\Cache;
  1453. use Composer\Factory;
  1454. use Symfony\Component\Console\Input\InputInterface;
  1455. use Symfony\Component\Console\Output\OutputInterface;
  1456. class ClearCacheCommand extends BaseCommand
  1457. {
  1458. protected function configure()
  1459. {
  1460. $this
  1461. ->setName('clear-cache')
  1462. ->setAliases(array('clearcache'))
  1463. ->setDescription('Clears composer\'s internal package cache.')
  1464. ->setHelp(<<<EOT
  1465. The <info>clear-cache</info> deletes all cached packages from composer's
  1466. cache directory.
  1467. EOT
  1468. )
  1469. ;
  1470. }
  1471. protected function execute(InputInterface $input, OutputInterface $output)
  1472. {
  1473. $config = Factory::createConfig();
  1474. $io = $this->getIO();
  1475. $cachePaths = array(
  1476. 'cache-dir' => $config->get('cache-dir'),
  1477. 'cache-files-dir' => $config->get('cache-files-dir'),
  1478. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1479. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1480. );
  1481. foreach ($cachePaths as $key => $cachePath) {
  1482. $cachePath = realpath($cachePath);
  1483. if (!$cachePath) {
  1484. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1485. continue;
  1486. }
  1487. $cache = new Cache($io, $cachePath);
  1488. if (!$cache->isEnabled()) {
  1489. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1490. continue;
  1491. }
  1492. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1493. $cache->gc(0, 0);
  1494. }
  1495. $io->writeError('<info>All caches cleared.</info>');
  1496. }
  1497. }
  1498. <?php
  1499. namespace Composer\Command;
  1500. use Composer\Util\Platform;
  1501. use Composer\Util\Silencer;
  1502. use Symfony\Component\Console\Input\InputInterface;
  1503. use Symfony\Component\Console\Input\InputArgument;
  1504. use Symfony\Component\Console\Input\InputOption;
  1505. use Symfony\Component\Console\Output\OutputInterface;
  1506. use Composer\Config;
  1507. use Composer\Config\JsonConfigSource;
  1508. use Composer\Factory;
  1509. use Composer\Json\JsonFile;
  1510. use Composer\Semver\VersionParser;
  1511. use Composer\Package\BasePackage;
  1512. class ConfigCommand extends BaseCommand
  1513. {
  1514. protected $config;
  1515. protected $configFile;
  1516. protected $configSource;
  1517. protected $authConfigFile;
  1518. protected $authConfigSource;
  1519. protected function configure()
  1520. {
  1521. $this
  1522. ->setName('config')
  1523. ->setDescription('Set config options.')
  1524. ->setDefinition(array(
  1525. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1526. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1527. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1528. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1529. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1530. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1531. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1532. new InputArgument('setting-key', null, 'Setting key'),
  1533. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1534. ))
  1535. ->setHelp(<<<EOT
  1536. This command allows you to edit composer config settings and repositories
  1537. in either the local composer.json file or the global config.json file.
  1538. Additionally it lets you edit most properties in the local composer.json.
  1539. To set a config setting:
  1540. <comment>%command.full_name% bin-dir bin/</comment>
  1541. To read a config setting:
  1542. <comment>%command.full_name% bin-dir</comment>
  1543. Outputs: <info>bin</info>
  1544. To edit the global config.json file:
  1545. <comment>%command.full_name% --global</comment>
  1546. To add a repository:
  1547. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1548. To remove a repository (repo is a short alias for repositories):
  1549. <comment>%command.full_name% --unset repo.foo</comment>
  1550. To disable packagist:
  1551. <comment>%command.full_name% repo.packagist false</comment>
  1552. You can alter repositories in the global config.json file by passing in the
  1553. <info>--global</info> option.
  1554. To edit the file in an external editor:
  1555. <comment>%command.full_name% --editor</comment>
  1556. To choose your editor you can set the "EDITOR" env variable.
  1557. To get a list of configuration values in the file:
  1558. <comment>%command.full_name% --list</comment>
  1559. You can always pass more than one option. As an example, if you want to edit the
  1560. global config.json file.
  1561. <comment>%command.full_name% --editor --global</comment>
  1562. EOT
  1563. )
  1564. ;
  1565. }
  1566. protected function initialize(InputInterface $input, OutputInterface $output)
  1567. {
  1568. parent::initialize($input, $output);
  1569. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1570. throw new \RuntimeException('--file and --global can not be combined');
  1571. }
  1572. $io = $this->getIO();
  1573. $this->config = Factory::createConfig($io);
  1574. $configFile = $input->getOption('global')
  1575. ? ($this->config->get('home') . '/config.json')
  1576. : ($input->getOption('file') ?: trim(getenv('COMPOSER')) ?: 'composer.json');
  1577. if ($configFile === 'composer.json' && !file_exists($configFile) && realpath(getcwd()) === realpath($this->config->get('home'))) {
  1578. file_put_contents($configFile, "{\n}\n");
  1579. }
  1580. $this->configFile = new JsonFile($configFile, null, $io);
  1581. $this->configSource = new JsonConfigSource($this->configFile);
  1582. $authConfigFile = $input->getOption('global')
  1583. ? ($this->config->get('home') . '/auth.json')
  1584. : dirname(realpath($configFile)) . '/auth.json';
  1585. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1586. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1587. if ($input->getOption('global') && !$this->configFile->exists()) {
  1588. touch($this->configFile->getPath());
  1589. $this->configFile->write(array('config' => new \ArrayObject));
  1590. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1591. }
  1592. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1593. touch($this->authConfigFile->getPath());
  1594. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1595. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1596. }
  1597. if (!$this->configFile->exists()) {
  1598. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1599. }
  1600. }
  1601. protected function execute(InputInterface $input, OutputInterface $output)
  1602. {
  1603. if ($input->getOption('editor')) {
  1604. $editor = escapeshellcmd(getenv('EDITOR'));
  1605. if (!$editor) {
  1606. if (Platform::isWindows()) {
  1607. $editor = 'notepad';
  1608. } else {
  1609. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1610. if (exec('which '.$candidate)) {
  1611. $editor = $candidate;
  1612. break;
  1613. }
  1614. }
  1615. }
  1616. }
  1617. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1618. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1619. return 0;
  1620. }
  1621. if (!$input->getOption('global')) {
  1622. $this->config->merge($this->configFile->read());
  1623. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1624. }
  1625. if ($input->getOption('list')) {
  1626. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1627. return 0;
  1628. }
  1629. $settingKey = $input->getArgument('setting-key');
  1630. if (!$settingKey) {
  1631. return 0;
  1632. }
  1633. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1634. throw new \RuntimeException('You can not combine a setting value with --unset');
  1635. }
  1636. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1637. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1638. $rawData = $this->configFile->read();
  1639. $data = $this->config->all();
  1640. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1641. if (!isset($matches[1]) || $matches[1] === '') {
  1642. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1643. } else {
  1644. if (!isset($data['repositories'][$matches[1]])) {
  1645. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1646. }
  1647. $value = $data['repositories'][$matches[1]];
  1648. }
  1649. } elseif (strpos($settingKey, '.')) {
  1650. $bits = explode('.', $settingKey);
  1651. if ($bits[0] === 'extra') {
  1652. $data = $rawData;
  1653. } else {
  1654. $data = $data['config'];
  1655. }
  1656. $match = false;
  1657. foreach ($bits as $bit) {
  1658. $key = isset($key) ? $key.'.'.$bit : $bit;
  1659. $match = false;
  1660. if (isset($data[$key])) {
  1661. $match = true;
  1662. $data = $data[$key];
  1663. unset($key);
  1664. }
  1665. }
  1666. if (!$match) {
  1667. throw new \RuntimeException($settingKey.' is not defined.');
  1668. }
  1669. $value = $data;
  1670. } elseif (isset($data['config'][$settingKey])) {
  1671. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1672. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1673. $value = $rawData[$settingKey];
  1674. } else {
  1675. throw new \RuntimeException($settingKey.' is not defined');
  1676. }
  1677. if (is_array($value)) {
  1678. $value = json_encode($value);
  1679. }
  1680. $this->getIO()->write($value);
  1681. return 0;
  1682. }
  1683. $values = $input->getArgument('setting-value');
  1684. $booleanValidator = function ($val) {
  1685. return in_array($val, array('true', 'false', '1', '0'), true);
  1686. };
  1687. $booleanNormalizer = function ($val) {
  1688. return $val !== 'false' && (bool) $val;
  1689. };
  1690. $uniqueConfigValues = array(
  1691. 'process-timeout' => array('is_numeric', 'intval'),
  1692. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1693. 'preferred-install' => array(
  1694. function ($val) {
  1695. return in_array($val, array('auto', 'source', 'dist'), true);
  1696. },
  1697. function ($val) {
  1698. return $val;
  1699. },
  1700. ),
  1701. 'store-auths' => array(
  1702. function ($val) {
  1703. return in_array($val, array('true', 'false', 'prompt'), true);
  1704. },
  1705. function ($val) {
  1706. if ('prompt' === $val) {
  1707. return 'prompt';
  1708. }
  1709. return $val !== 'false' && (bool) $val;
  1710. },
  1711. ),
  1712. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1713. 'vendor-dir' => array('is_string', function ($val) {
  1714. return $val;
  1715. }),
  1716. 'bin-dir' => array('is_string', function ($val) {
  1717. return $val;
  1718. }),
  1719. 'archive-dir' => array('is_string', function ($val) {
  1720. return $val;
  1721. }),
  1722. 'archive-format' => array('is_string', function ($val) {
  1723. return $val;
  1724. }),
  1725. 'data-dir' => array('is_string', function ($val) {
  1726. return $val;
  1727. }),
  1728. 'cache-dir' => array('is_string', function ($val) {
  1729. return $val;
  1730. }),
  1731. 'cache-files-dir' => array('is_string', function ($val) {
  1732. return $val;
  1733. }),
  1734. 'cache-repo-dir' => array('is_string', function ($val) {
  1735. return $val;
  1736. }),
  1737. 'cache-vcs-dir' => array('is_string', function ($val) {
  1738. return $val;
  1739. }),
  1740. 'cache-ttl' => array('is_numeric', 'intval'),
  1741. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1742. 'cache-files-maxsize' => array(
  1743. function ($val) {
  1744. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1745. },
  1746. function ($val) {
  1747. return $val;
  1748. },
  1749. ),
  1750. 'bin-compat' => array(
  1751. function ($val) {
  1752. return in_array($val, array('auto', 'full'));
  1753. },
  1754. function ($val) {
  1755. return $val;
  1756. },
  1757. ),
  1758. 'discard-changes' => array(
  1759. function ($val) {
  1760. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1761. },
  1762. function ($val) {
  1763. if ('stash' === $val) {
  1764. return 'stash';
  1765. }
  1766. return $val !== 'false' && (bool) $val;
  1767. },
  1768. ),
  1769. 'autoloader-suffix' => array('is_string', function ($val) {
  1770. return $val === 'null' ? null : $val;
  1771. }),
  1772. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1773. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1774. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1775. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1776. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1777. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1778. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1779. 'cafile' => array(
  1780. function ($val) {
  1781. return file_exists($val) && is_readable($val);
  1782. },
  1783. function ($val) {
  1784. return $val === 'null' ? null : $val;
  1785. },
  1786. ),
  1787. 'capath' => array(
  1788. function ($val) {
  1789. return is_dir($val) && is_readable($val);
  1790. },
  1791. function ($val) {
  1792. return $val === 'null' ? null : $val;
  1793. },
  1794. ),
  1795. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1796. );
  1797. $multiConfigValues = array(
  1798. 'github-protocols' => array(
  1799. function ($vals) {
  1800. if (!is_array($vals)) {
  1801. return 'array expected';
  1802. }
  1803. foreach ($vals as $val) {
  1804. if (!in_array($val, array('git', 'https', 'ssh'))) {
  1805. return 'valid protocols include: git, https, ssh';
  1806. }
  1807. }
  1808. return true;
  1809. },
  1810. function ($vals) {
  1811. return $vals;
  1812. },
  1813. ),
  1814. 'github-domains' => array(
  1815. function ($vals) {
  1816. if (!is_array($vals)) {
  1817. return 'array expected';
  1818. }
  1819. return true;
  1820. },
  1821. function ($vals) {
  1822. return $vals;
  1823. },
  1824. ),
  1825. 'gitlab-domains' => array(
  1826. function ($vals) {
  1827. if (!is_array($vals)) {
  1828. return 'array expected';
  1829. }
  1830. return true;
  1831. },
  1832. function ($vals) {
  1833. return $vals;
  1834. },
  1835. ),
  1836. );
  1837. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  1838. return $this->configSource->removeConfigSetting($settingKey);
  1839. }
  1840. if (isset($uniqueConfigValues[$settingKey])) {
  1841. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  1842. }
  1843. if (isset($multiConfigValues[$settingKey])) {
  1844. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  1845. }
  1846. $uniqueProps = array(
  1847. 'name' => array('is_string', function ($val) {
  1848. return $val;
  1849. }),
  1850. 'type' => array('is_string', function ($val) {
  1851. return $val;
  1852. }),
  1853. 'description' => array('is_string', function ($val) {
  1854. return $val;
  1855. }),
  1856. 'homepage' => array('is_string', function ($val) {
  1857. return $val;
  1858. }),
  1859. 'version' => array('is_string', function ($val) {
  1860. return $val;
  1861. }),
  1862. 'minimum-stability' => array(
  1863. function ($val) {
  1864. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  1865. },
  1866. function ($val) {
  1867. return VersionParser::normalizeStability($val);
  1868. },
  1869. ),
  1870. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  1871. );
  1872. $multiProps = array(
  1873. 'keywords' => array(
  1874. function ($vals) {
  1875. if (!is_array($vals)) {
  1876. return 'array expected';
  1877. }
  1878. return true;
  1879. },
  1880. function ($vals) {
  1881. return $vals;
  1882. },
  1883. ),
  1884. 'license' => array(
  1885. function ($vals) {
  1886. if (!is_array($vals)) {
  1887. return 'array expected';
  1888. }
  1889. return true;
  1890. },
  1891. function ($vals) {
  1892. return $vals;
  1893. },
  1894. ),
  1895. );
  1896. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  1897. throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  1898. }
  1899. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  1900. return $this->configSource->removeProperty($settingKey);
  1901. }
  1902. if (isset($uniqueProps[$settingKey])) {
  1903. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  1904. }
  1905. if (isset($multiProps[$settingKey])) {
  1906. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  1907. }
  1908. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  1909. if ($input->getOption('unset')) {
  1910. return $this->configSource->removeRepository($matches[1]);
  1911. }
  1912. if (2 === count($values)) {
  1913. return $this->configSource->addRepository($matches[1], array(
  1914. 'type' => $values[0],
  1915. 'url' => $values[1],
  1916. ));
  1917. }
  1918. if (1 === count($values)) {
  1919. $value = strtolower($values[0]);
  1920. if (true === $booleanValidator($value)) {
  1921. if (false === $booleanNormalizer($value)) {
  1922. return $this->configSource->addRepository($matches[1], false);
  1923. }
  1924. } else {
  1925. $value = JsonFile::parseJson($values[0]);
  1926. return $this->configSource->addRepository($matches[1], $value);
  1927. }
  1928. }
  1929. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  1930. }
  1931. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  1932. if ($input->getOption('unset')) {
  1933. return $this->configSource->removeProperty($settingKey);
  1934. }
  1935. return $this->configSource->addProperty($settingKey, $values[0]);
  1936. }
  1937. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  1938. if ($input->getOption('unset')) {
  1939. return $this->configSource->removeConfigSetting($settingKey);
  1940. }
  1941. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  1942. }
  1943. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  1944. if ($input->getOption('unset')) {
  1945. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1946. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1947. return;
  1948. }
  1949. if ($matches[1] === 'bitbucket-oauth') {
  1950. if (2 !== count($values)) {
  1951. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  1952. }
  1953. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1954. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  1955. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  1956. if (1 !== count($values)) {
  1957. throw new \RuntimeException('Too many arguments, expected only one token');
  1958. }
  1959. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1960. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  1961. } elseif ($matches[1] === 'http-basic') {
  1962. if (2 !== count($values)) {
  1963. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  1964. }
  1965. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  1966. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  1967. }
  1968. return;
  1969. }
  1970. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  1971. }
  1972. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  1973. {
  1974. list($validator, $normalizer) = $callbacks;
  1975. if (1 !== count($values)) {
  1976. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  1977. }
  1978. if (true !== $validation = $validator($values[0])) {
  1979. throw new \RuntimeException(sprintf(
  1980. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  1981. $values[0]
  1982. ));
  1983. }
  1984. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  1985. }
  1986. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  1987. {
  1988. list($validator, $normalizer) = $callbacks;
  1989. if (true !== $validation = $validator($values)) {
  1990. throw new \RuntimeException(sprintf(
  1991. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  1992. json_encode($values)
  1993. ));
  1994. }
  1995. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  1996. }
  1997. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  1998. {
  1999. $origK = $k;
  2000. $io = $this->getIO();
  2001. foreach ($contents as $key => $value) {
  2002. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2003. continue;
  2004. }
  2005. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2006. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2007. $k .= preg_replace('{^config\.}', '', $key . '.');
  2008. $this->listConfiguration($value, $rawVal, $output, $k);
  2009. $k = $origK;
  2010. continue;
  2011. }
  2012. if (is_array($value)) {
  2013. $value = array_map(function ($val) {
  2014. return is_array($val) ? json_encode($val) : $val;
  2015. }, $value);
  2016. $value = '['.implode(', ', $value).']';
  2017. }
  2018. if (is_bool($value)) {
  2019. $value = var_export($value, true);
  2020. }
  2021. if (is_string($rawVal) && $rawVal != $value) {
  2022. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
  2023. } else {
  2024. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
  2025. }
  2026. }
  2027. }
  2028. }
  2029. <?php
  2030. namespace Composer\Command;
  2031. use Composer\Config;
  2032. use Composer\Factory;
  2033. use Composer\Installer;
  2034. use Composer\Installer\ProjectInstaller;
  2035. use Composer\Installer\InstallationManager;
  2036. use Composer\Installer\SuggestedPackagesReporter;
  2037. use Composer\IO\IOInterface;
  2038. use Composer\Package\BasePackage;
  2039. use Composer\DependencyResolver\Pool;
  2040. use Composer\DependencyResolver\Operation\InstallOperation;
  2041. use Composer\Package\Version\VersionSelector;
  2042. use Composer\Package\AliasPackage;
  2043. use Composer\Repository\RepositoryFactory;
  2044. use Composer\Repository\CompositeRepository;
  2045. use Composer\Repository\PlatformRepository;
  2046. use Composer\Repository\InstalledFilesystemRepository;
  2047. use Composer\Script\ScriptEvents;
  2048. use Composer\Util\Silencer;
  2049. use Symfony\Component\Console\Input\InputArgument;
  2050. use Symfony\Component\Console\Input\InputInterface;
  2051. use Symfony\Component\Console\Input\InputOption;
  2052. use Symfony\Component\Console\Output\OutputInterface;
  2053. use Symfony\Component\Finder\Finder;
  2054. use Composer\Json\JsonFile;
  2055. use Composer\Config\JsonConfigSource;
  2056. use Composer\Util\Filesystem;
  2057. use Composer\Package\Version\VersionParser;
  2058. class CreateProjectCommand extends BaseCommand
  2059. {
  2060. protected $suggestedPackagesReporter;
  2061. protected function configure()
  2062. {
  2063. $this
  2064. ->setName('create-project')
  2065. ->setDescription('Create new project from a package into given directory.')
  2066. ->setDefinition(array(
  2067. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2068. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2069. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2070. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2071. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2072. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2073. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2074. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2075. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2076. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2077. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2078. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2079. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2080. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  2081. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deletion vcs folder.'),
  2082. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2083. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2084. ))
  2085. ->setHelp(<<<EOT
  2086. The <info>create-project</info> command creates a new project from a given
  2087. package into a new directory. If executed without params and in a directory
  2088. with a composer.json file it installs the packages for the current project.
  2089. You can use this command to bootstrap new projects or setup a clean
  2090. version-controlled installation for developers of your project.
  2091. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2092. You can also specify the version with the package name using = or : as separator.
  2093. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2094. To install unstable packages, either specify the version you want, or use the
  2095. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2096. To setup a developer workable version you should create the project using the source
  2097. controlled code by appending the <info>'--prefer-source'</info> flag.
  2098. To install a package from another repository than the default one you
  2099. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2100. EOT
  2101. )
  2102. ;
  2103. }
  2104. protected function execute(InputInterface $input, OutputInterface $output)
  2105. {
  2106. $config = Factory::createConfig();
  2107. $io = $this->getIO();
  2108. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2109. if ($input->getOption('dev')) {
  2110. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2111. }
  2112. if ($input->getOption('no-custom-installers')) {
  2113. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2114. $input->setOption('no-plugins', true);
  2115. }
  2116. return $this->installProject(
  2117. $io,
  2118. $config,
  2119. $input,
  2120. $input->getArgument('package'),
  2121. $input->getArgument('directory'),
  2122. $input->getArgument('version'),
  2123. $input->getOption('stability'),
  2124. $preferSource,
  2125. $preferDist,
  2126. !$input->getOption('no-dev'),
  2127. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2128. $input->getOption('no-plugins'),
  2129. $input->getOption('no-scripts'),
  2130. $input->getOption('keep-vcs'),
  2131. $input->getOption('no-progress'),
  2132. $input->getOption('no-install'),
  2133. $input->getOption('ignore-platform-reqs'),
  2134. !$input->getOption('no-secure-http')
  2135. );
  2136. }
  2137. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true)
  2138. {
  2139. $oldCwd = getcwd();
  2140. $io->loadConfiguration($config);
  2141. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2142. if ($packageName !== null) {
  2143. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $keepVcs, $noProgress, $ignorePlatformReqs, $secureHttp);
  2144. } else {
  2145. $installedFromVcs = false;
  2146. }
  2147. $composer = Factory::create($io, null, $disablePlugins);
  2148. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2149. $fs = new Filesystem();
  2150. if ($noScripts === false) {
  2151. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2152. }
  2153. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($composer->getConfig(), $input);
  2154. if ($noInstall === false) {
  2155. $installer = Installer::create($io, $composer);
  2156. $installer->setPreferSource($preferSource)
  2157. ->setPreferDist($preferDist)
  2158. ->setDevMode($installDevPackages)
  2159. ->setRunScripts(!$noScripts)
  2160. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2161. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter);
  2162. if ($disablePlugins) {
  2163. $installer->disablePlugins();
  2164. }
  2165. $status = $installer->run();
  2166. if (0 !== $status) {
  2167. return $status;
  2168. }
  2169. }
  2170. $hasVcs = $installedFromVcs;
  2171. if (!$keepVcs && $installedFromVcs
  2172. && (
  2173. !$io->isInteractive()
  2174. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2175. )
  2176. ) {
  2177. $finder = new Finder();
  2178. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2179. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2180. $finder->name($vcsName);
  2181. }
  2182. try {
  2183. $dirs = iterator_to_array($finder);
  2184. unset($finder);
  2185. foreach ($dirs as $dir) {
  2186. if (!$fs->removeDirectory($dir)) {
  2187. throw new \RuntimeException('Could not remove '.$dir);
  2188. }
  2189. }
  2190. } catch (\Exception $e) {
  2191. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2192. }
  2193. $hasVcs = false;
  2194. }
  2195. if (!$hasVcs) {
  2196. $package = $composer->getPackage();
  2197. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2198. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2199. foreach ($package->{'get'.$meta['method']}() as $link) {
  2200. if ($link->getPrettyConstraint() === 'self.version') {
  2201. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2202. }
  2203. }
  2204. }
  2205. }
  2206. if ($noScripts === false) {
  2207. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2208. }
  2209. chdir($oldCwd);
  2210. $vendorComposerDir = $composer->getConfig()->get('vendor-dir').'/composer';
  2211. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2212. Silencer::call('rmdir', $vendorComposerDir);
  2213. $vendorDir = $composer->getConfig()->get('vendor-dir');
  2214. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2215. Silencer::call('rmdir', $vendorDir);
  2216. }
  2217. }
  2218. return 0;
  2219. }
  2220. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2221. {
  2222. if (!$secureHttp) {
  2223. $config->merge(array('config' => array('secure-http' => false)));
  2224. }
  2225. if (null === $repository) {
  2226. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2227. } else {
  2228. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2229. }
  2230. $parser = new VersionParser();
  2231. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2232. $name = strtolower($requirements[0]['name']);
  2233. if (!$packageVersion && isset($requirements[0]['version'])) {
  2234. $packageVersion = $requirements[0]['version'];
  2235. }
  2236. if (null === $stability) {
  2237. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2238. $stability = $match[1];
  2239. } else {
  2240. $stability = VersionParser::parseStability($packageVersion);
  2241. }
  2242. }
  2243. $stability = VersionParser::normalizeStability($stability);
  2244. if (!isset(BasePackage::$stabilities[$stability])) {
  2245. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2246. }
  2247. $pool = new Pool($stability);
  2248. $pool->addRepository($sourceRepo);
  2249. $phpVersion = null;
  2250. $prettyPhpVersion = null;
  2251. if (!$ignorePlatformReqs) {
  2252. $platformOverrides = $config->get('platform') ?: array();
  2253. $platform = new PlatformRepository(array(), $platformOverrides);
  2254. $phpPackage = $platform->findPackage('php', '*');
  2255. $phpVersion = $phpPackage->getVersion();
  2256. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2257. }
  2258. $versionSelector = new VersionSelector($pool);
  2259. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2260. if (!$package) {
  2261. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2262. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2263. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2264. }
  2265. throw new \InvalidArgumentException($errorMessage .'.');
  2266. }
  2267. if (null === $directory) {
  2268. $parts = explode("/", $name, 2);
  2269. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2270. }
  2271. if (function_exists('pcntl_signal')) {
  2272. declare(ticks=100);
  2273. pcntl_signal(SIGINT, function () use ($directory) {
  2274. $fs = new Filesystem();
  2275. $fs->removeDirectory($directory);
  2276. exit(130);
  2277. });
  2278. }
  2279. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2280. if ($disablePlugins) {
  2281. $io->writeError('<info>Plugins have been disabled.</info>');
  2282. }
  2283. if ($package instanceof AliasPackage) {
  2284. $package = $package->getAliasOf();
  2285. }
  2286. if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
  2287. $package->setSourceReference(substr($package->getPrettyVersion(), 4));
  2288. }
  2289. $dm = $this->createDownloadManager($io, $config);
  2290. $dm->setPreferSource($preferSource)
  2291. ->setPreferDist($preferDist)
  2292. ->setOutputProgress(!$noProgress);
  2293. $projectInstaller = new ProjectInstaller($directory, $dm);
  2294. $im = $this->createInstallationManager();
  2295. $im->addInstaller($projectInstaller);
  2296. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2297. $im->notifyInstalls($io);
  2298. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2299. $installedFromVcs = 'source' === $package->getInstallationSource();
  2300. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2301. chdir($directory);
  2302. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2303. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2304. return $installedFromVcs;
  2305. }
  2306. protected function createDownloadManager(IOInterface $io, Config $config)
  2307. {
  2308. $factory = new Factory();
  2309. return $factory->createDownloadManager($io, $config);
  2310. }
  2311. protected function createInstallationManager()
  2312. {
  2313. return new InstallationManager();
  2314. }
  2315. }
  2316. <?php
  2317. namespace Composer\Command;
  2318. use Symfony\Component\Console\Input\InputInterface;
  2319. use Symfony\Component\Console\Output\OutputInterface;
  2320. class DependsCommand extends BaseDependencyCommand
  2321. {
  2322. protected function configure()
  2323. {
  2324. parent::configure();
  2325. $this
  2326. ->setName('depends')
  2327. ->setAliases(array('why'))
  2328. ->setDescription('Shows which packages cause the given package to be installed.')
  2329. ->setHelp(<<<EOT
  2330. Displays detailed information about where a package is referenced.
  2331. <info>php composer.phar depends composer/composer</info>
  2332. EOT
  2333. )
  2334. ;
  2335. }
  2336. protected function execute(InputInterface $input, OutputInterface $output)
  2337. {
  2338. return parent::doExecute($input, $output, false);
  2339. }
  2340. }
  2341. <?php
  2342. namespace Composer\Command;
  2343. use Composer\Composer;
  2344. use Composer\Factory;
  2345. use Composer\Config;
  2346. use Composer\Downloader\TransportException;
  2347. use Composer\Plugin\CommandEvent;
  2348. use Composer\Plugin\PluginEvents;
  2349. use Composer\Util\ConfigValidator;
  2350. use Composer\Util\IniHelper;
  2351. use Composer\Util\ProcessExecutor;
  2352. use Composer\Util\RemoteFilesystem;
  2353. use Composer\Util\StreamContextFactory;
  2354. use Composer\SelfUpdate\Keys;
  2355. use Composer\SelfUpdate\Versions;
  2356. use Composer\IO\NullIO;
  2357. use Symfony\Component\Console\Input\InputInterface;
  2358. use Symfony\Component\Console\Output\OutputInterface;
  2359. class DiagnoseCommand extends BaseCommand
  2360. {
  2361. protected $rfs;
  2362. protected $process;
  2363. protected $exitCode = 0;
  2364. protected function configure()
  2365. {
  2366. $this
  2367. ->setName('diagnose')
  2368. ->setDescription('Diagnoses the system to identify common errors.')
  2369. ->setHelp(<<<EOT
  2370. The <info>diagnose</info> command checks common errors to help debugging problems.
  2371. The process exit code will be 1 in case of warnings and 2 for errors.
  2372. EOT
  2373. )
  2374. ;
  2375. }
  2376. protected function execute(InputInterface $input, OutputInterface $output)
  2377. {
  2378. $composer = $this->getComposer(false);
  2379. $io = $this->getIO();
  2380. if ($composer) {
  2381. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2382. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2383. $io->write('Checking composer.json: ', false);
  2384. $this->outputResult($this->checkComposerSchema());
  2385. }
  2386. if ($composer) {
  2387. $config = $composer->getConfig();
  2388. } else {
  2389. $config = Factory::createConfig();
  2390. }
  2391. $config->merge(array('config' => array('secure-http' => false)));
  2392. $config->prohibitUrlByConfig('http://packagist.org', new NullIO);
  2393. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2394. $this->process = new ProcessExecutor($io);
  2395. $io->write('Checking platform settings: ', false);
  2396. $this->outputResult($this->checkPlatform());
  2397. $io->write('Checking git settings: ', false);
  2398. $this->outputResult($this->checkGit());
  2399. $io->write('Checking http connectivity to packagist: ', false);
  2400. $this->outputResult($this->checkHttp('http', $config));
  2401. $io->write('Checking https connectivity to packagist: ', false);
  2402. $this->outputResult($this->checkHttp('https', $config));
  2403. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2404. if (!empty($opts['http']['proxy'])) {
  2405. $io->write('Checking HTTP proxy: ', false);
  2406. $this->outputResult($this->checkHttpProxy());
  2407. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2408. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2409. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2410. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2411. }
  2412. if ($oauth = $config->get('github-oauth')) {
  2413. foreach ($oauth as $domain => $token) {
  2414. $io->write('Checking '.$domain.' oauth access: ', false);
  2415. $this->outputResult($this->checkGithubOauth($domain, $token));
  2416. }
  2417. } else {
  2418. $io->write('Checking github.com rate limit: ', false);
  2419. try {
  2420. $rate = $this->getGithubRateLimit('github.com');
  2421. $this->outputResult(true);
  2422. if (10 > $rate['remaining']) {
  2423. $io->write('<warning>WARNING</warning>');
  2424. $io->write(sprintf(
  2425. '<comment>Github has a rate limit on their API. '
  2426. . 'You currently have <options=bold>%u</options=bold> '
  2427. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2428. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2429. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2430. $rate['remaining'],
  2431. $rate['limit']
  2432. ));
  2433. }
  2434. } catch (\Exception $e) {
  2435. if ($e instanceof TransportException && $e->getCode() === 401) {
  2436. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2437. } else {
  2438. $this->outputResult($e);
  2439. }
  2440. }
  2441. }
  2442. $io->write('Checking disk free space: ', false);
  2443. $this->outputResult($this->checkDiskSpace($config));
  2444. if ('phar:' === substr(__FILE__, 0, 5)) {
  2445. $io->write('Checking pubkeys: ', false);
  2446. $this->outputResult($this->checkPubKeys($config));
  2447. $io->write('Checking composer version: ', false);
  2448. $this->outputResult($this->checkVersion($config));
  2449. }
  2450. return $this->exitCode;
  2451. }
  2452. private function checkComposerSchema()
  2453. {
  2454. $validator = new ConfigValidator($this->getIO());
  2455. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2456. if ($errors || $warnings) {
  2457. $messages = array(
  2458. 'error' => $errors,
  2459. 'warning' => $warnings,
  2460. );
  2461. $output = '';
  2462. foreach ($messages as $style => $msgs) {
  2463. foreach ($msgs as $msg) {
  2464. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2465. }
  2466. }
  2467. return rtrim($output);
  2468. }
  2469. return true;
  2470. }
  2471. private function checkGit()
  2472. {
  2473. $this->process->execute('git config color.ui', $output);
  2474. if (strtolower(trim($output)) === 'always') {
  2475. 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>';
  2476. }
  2477. return true;
  2478. }
  2479. private function checkHttp($proto, Config $config)
  2480. {
  2481. $disableTls = false;
  2482. $result = array();
  2483. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2484. $disableTls = true;
  2485. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2486. }
  2487. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2488. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2489. }
  2490. try {
  2491. $this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false);
  2492. } catch (TransportException $e) {
  2493. if (false !== strpos($e->getMessage(), 'cafile')) {
  2494. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2495. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2496. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2497. } else {
  2498. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2499. }
  2500. }
  2501. if (count($result) > 0) {
  2502. return $result;
  2503. }
  2504. return true;
  2505. }
  2506. private function checkHttpProxy()
  2507. {
  2508. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2509. try {
  2510. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false), true);
  2511. $hash = reset($json['provider-includes']);
  2512. $hash = $hash['sha256'];
  2513. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2514. $provider = $this->rfs->getContents('packagist.org', $protocol . '://packagist.org/'.$path, false);
  2515. if (hash('sha256', $provider) !== $hash) {
  2516. return 'It seems that your proxy is modifying http traffic on the fly';
  2517. }
  2518. } catch (\Exception $e) {
  2519. return $e;
  2520. }
  2521. return true;
  2522. }
  2523. private function checkHttpProxyFullUriRequestParam()
  2524. {
  2525. $url = 'http://packagist.org/packages.json';
  2526. try {
  2527. $this->rfs->getContents('packagist.org', $url, false);
  2528. } catch (TransportException $e) {
  2529. try {
  2530. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2531. } catch (TransportException $e) {
  2532. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2533. }
  2534. 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"';
  2535. }
  2536. return true;
  2537. }
  2538. private function checkHttpsProxyFullUriRequestParam()
  2539. {
  2540. if (!extension_loaded('openssl')) {
  2541. return 'You need the openssl extension installed for this check';
  2542. }
  2543. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2544. try {
  2545. $this->rfs->getContents('github.com', $url, false);
  2546. } catch (TransportException $e) {
  2547. try {
  2548. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2549. } catch (TransportException $e) {
  2550. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2551. }
  2552. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2553. }
  2554. return true;
  2555. }
  2556. private function checkGithubOauth($domain, $token)
  2557. {
  2558. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2559. try {
  2560. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2561. return $this->rfs->getContents($domain, $url, false, array(
  2562. 'retry-auth-failure' => false,
  2563. )) ? true : 'Unexpected error';
  2564. } catch (\Exception $e) {
  2565. if ($e instanceof TransportException && $e->getCode() === 401) {
  2566. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2567. }
  2568. return $e;
  2569. }
  2570. }
  2571. private function getGithubRateLimit($domain, $token = null)
  2572. {
  2573. if ($token) {
  2574. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2575. }
  2576. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2577. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2578. $data = json_decode($json, true);
  2579. return $data['resources']['core'];
  2580. }
  2581. private function checkDiskSpace($config)
  2582. {
  2583. $minSpaceFree = 1024 * 1024;
  2584. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2585. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2586. ) {
  2587. return '<error>The disk hosting '.$dir.' is full</error>';
  2588. }
  2589. return true;
  2590. }
  2591. private function checkPubKeys($config)
  2592. {
  2593. $home = $config->get('home');
  2594. $errors = array();
  2595. $io = $this->getIO();
  2596. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2597. $io->write('');
  2598. }
  2599. if (file_exists($home.'/keys.tags.pub')) {
  2600. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2601. } else {
  2602. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2603. }
  2604. if (file_exists($home.'/keys.dev.pub')) {
  2605. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2606. } else {
  2607. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2608. }
  2609. if ($errors) {
  2610. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2611. }
  2612. return $errors ?: true;
  2613. }
  2614. private function checkVersion($config)
  2615. {
  2616. $versionsUtil = new Versions($config, $this->rfs);
  2617. $latest = $versionsUtil->getLatest();
  2618. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2619. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2620. }
  2621. return true;
  2622. }
  2623. private function outputResult($result)
  2624. {
  2625. $io = $this->getIO();
  2626. if (true === $result) {
  2627. $io->write('<info>OK</info>');
  2628. return;
  2629. }
  2630. $hadError = false;
  2631. if ($result instanceof \Exception) {
  2632. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2633. }
  2634. if (!$result) {
  2635. $hadError = true;
  2636. } else {
  2637. if (!is_array($result)) {
  2638. $result = array($result);
  2639. }
  2640. foreach ($result as $message) {
  2641. if (false !== strpos($message, '<error>')) {
  2642. $hadError = true;
  2643. }
  2644. }
  2645. }
  2646. if ($hadError) {
  2647. $io->write('<error>FAIL</error>');
  2648. $this->exitCode = 2;
  2649. } else {
  2650. $io->write('<warning>WARNING</warning>');
  2651. $this->exitCode = 1;
  2652. }
  2653. if ($result) {
  2654. foreach ($result as $message) {
  2655. $io->write($message);
  2656. }
  2657. }
  2658. }
  2659. private function checkPlatform()
  2660. {
  2661. $output = '';
  2662. $out = function ($msg, $style) use (&$output) {
  2663. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2664. };
  2665. $errors = array();
  2666. $warnings = array();
  2667. $displayIniMessage = false;
  2668. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2669. $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.';
  2670. if (!function_exists('json_decode')) {
  2671. $errors['json'] = true;
  2672. }
  2673. if (!extension_loaded('Phar')) {
  2674. $errors['phar'] = true;
  2675. }
  2676. if (!extension_loaded('filter')) {
  2677. $errors['filter'] = true;
  2678. }
  2679. if (!extension_loaded('hash')) {
  2680. $errors['hash'] = true;
  2681. }
  2682. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2683. $errors['iconv_mbstring'] = true;
  2684. }
  2685. if (!ini_get('allow_url_fopen')) {
  2686. $errors['allow_url_fopen'] = true;
  2687. }
  2688. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2689. $errors['ioncube'] = ioncube_loader_version();
  2690. }
  2691. if (PHP_VERSION_ID < 50302) {
  2692. $errors['php'] = PHP_VERSION;
  2693. }
  2694. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2695. $warnings['php'] = PHP_VERSION;
  2696. }
  2697. if (!extension_loaded('openssl')) {
  2698. $errors['openssl'] = true;
  2699. }
  2700. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2701. $warnings['openssl_version'] = true;
  2702. }
  2703. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
  2704. $warnings['apc_cli'] = true;
  2705. }
  2706. if (!extension_loaded('zlib')) {
  2707. $warnings['zlib'] = true;
  2708. }
  2709. ob_start();
  2710. phpinfo(INFO_GENERAL);
  2711. $phpinfo = ob_get_clean();
  2712. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2713. $configure = $match[1];
  2714. if (false !== strpos($configure, '--enable-sigchild')) {
  2715. $warnings['sigchild'] = true;
  2716. }
  2717. if (false !== strpos($configure, '--with-curlwrappers')) {
  2718. $warnings['curlwrappers'] = true;
  2719. }
  2720. }
  2721. if (ini_get('xdebug.profiler_enabled')) {
  2722. $warnings['xdebug_profile'] = true;
  2723. } elseif (extension_loaded('xdebug')) {
  2724. $warnings['xdebug_loaded'] = true;
  2725. }
  2726. if (!empty($errors)) {
  2727. foreach ($errors as $error => $current) {
  2728. switch ($error) {
  2729. case 'json':
  2730. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  2731. $text .= "Install it or recompile php without --disable-json";
  2732. break;
  2733. case 'phar':
  2734. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  2735. $text .= "Install it or recompile php without --disable-phar";
  2736. break;
  2737. case 'filter':
  2738. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  2739. $text .= "Install it or recompile php without --disable-filter";
  2740. break;
  2741. case 'hash':
  2742. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  2743. $text .= "Install it or recompile php without --disable-hash";
  2744. break;
  2745. case 'iconv_mbstring':
  2746. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  2747. $text .= "Install either of them or recompile php without --disable-iconv";
  2748. break;
  2749. case 'unicode':
  2750. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  2751. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2752. $text .= " detect_unicode = Off";
  2753. $displayIniMessage = true;
  2754. break;
  2755. case 'suhosin':
  2756. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  2757. $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;
  2758. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  2759. $displayIniMessage = true;
  2760. break;
  2761. case 'php':
  2762. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  2763. break;
  2764. case 'allow_url_fopen':
  2765. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  2766. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2767. $text .= " allow_url_fopen = On";
  2768. $displayIniMessage = true;
  2769. break;
  2770. case 'ioncube':
  2771. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  2772. $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;
  2773. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  2774. $displayIniMessage = true;
  2775. break;
  2776. case 'openssl':
  2777. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  2778. $text .= "If possible you should enable it or recompile php with --with-openssl";
  2779. break;
  2780. }
  2781. $out($text, 'error');
  2782. }
  2783. $output .= PHP_EOL;
  2784. }
  2785. if (!empty($warnings)) {
  2786. foreach ($warnings as $warning => $current) {
  2787. switch ($warning) {
  2788. case 'apc_cli':
  2789. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  2790. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2791. $text .= " apc.enable_cli = Off";
  2792. $displayIniMessage = true;
  2793. break;
  2794. case 'zlib':
  2795. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  2796. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  2797. $displayIniMessage = true;
  2798. break;
  2799. case 'sigchild':
  2800. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  2801. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  2802. $text .= " https://bugs.php.net/bug.php?id=22999";
  2803. break;
  2804. case 'curlwrappers':
  2805. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  2806. $text .= " Recompile it without this flag if possible";
  2807. break;
  2808. case 'php':
  2809. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  2810. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  2811. break;
  2812. case 'openssl_version':
  2813. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  2814. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  2815. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  2816. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  2817. break;
  2818. case 'xdebug_loaded':
  2819. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  2820. $text .= " Disabling it when using Composer is recommended.";
  2821. break;
  2822. case 'xdebug_profile':
  2823. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  2824. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  2825. $text .= " xdebug.profiler_enabled = 0";
  2826. $displayIniMessage = true;
  2827. break;
  2828. }
  2829. $out($text, 'comment');
  2830. }
  2831. }
  2832. if ($displayIniMessage) {
  2833. $out($iniMessage, 'comment');
  2834. }
  2835. return !$warnings && !$errors ? true : $output;
  2836. }
  2837. }
  2838. <?php
  2839. namespace Composer\Command;
  2840. use Composer\Plugin\CommandEvent;
  2841. use Composer\Plugin\PluginEvents;
  2842. use Symfony\Component\Console\Input\InputInterface;
  2843. use Symfony\Component\Console\Input\InputOption;
  2844. use Symfony\Component\Console\Output\OutputInterface;
  2845. class DumpAutoloadCommand extends BaseCommand
  2846. {
  2847. protected function configure()
  2848. {
  2849. $this
  2850. ->setName('dump-autoload')
  2851. ->setAliases(array('dumpautoload'))
  2852. ->setDescription('Dumps the autoloader.')
  2853. ->setDefinition(array(
  2854. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  2855. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  2856. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  2857. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  2858. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  2859. ))
  2860. ->setHelp(<<<EOT
  2861. <info>php composer.phar dump-autoload</info>
  2862. EOT
  2863. )
  2864. ;
  2865. }
  2866. protected function execute(InputInterface $input, OutputInterface $output)
  2867. {
  2868. $composer = $this->getComposer();
  2869. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  2870. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2871. $installationManager = $composer->getInstallationManager();
  2872. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  2873. $package = $composer->getPackage();
  2874. $config = $composer->getConfig();
  2875. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  2876. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  2877. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  2878. if ($optimize || $authoritative) {
  2879. $this->getIO()->writeError('<info>Generating optimized autoload files</info>');
  2880. } else {
  2881. $this->getIO()->writeError('<info>Generating autoload files</info>');
  2882. }
  2883. $generator = $composer->getAutoloadGenerator();
  2884. $generator->setDevMode(!$input->getOption('no-dev'));
  2885. $generator->setClassMapAuthoritative($authoritative);
  2886. $generator->setApcu($apcu);
  2887. $generator->setRunScripts(!$input->getOption('no-scripts'));
  2888. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  2889. }
  2890. }
  2891. <?php
  2892. namespace Composer\Command;
  2893. use Symfony\Component\Console\Input\InputInterface;
  2894. use Symfony\Component\Console\Input\InputOption;
  2895. use Symfony\Component\Console\Output\OutputInterface;
  2896. use Symfony\Component\Console\Input\InputArgument;
  2897. class ExecCommand extends BaseCommand
  2898. {
  2899. protected function configure()
  2900. {
  2901. $this
  2902. ->setName('exec')
  2903. ->setDescription('Execute a vendored binary/script.')
  2904. ->setDefinition(array(
  2905. new InputOption('list', 'l', InputOption::VALUE_NONE),
  2906. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  2907. new InputArgument(
  2908. 'args',
  2909. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  2910. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  2911. ),
  2912. ))
  2913. ;
  2914. }
  2915. protected function execute(InputInterface $input, OutputInterface $output)
  2916. {
  2917. $composer = $this->getComposer();
  2918. $binDir = $composer->getConfig()->get('bin-dir');
  2919. if ($input->getOption('list') || !$input->getArgument('binary')) {
  2920. $bins = glob($binDir . '/*');
  2921. $bins = array_merge($bins, array_map(function ($e) {
  2922. return "$e (local)";
  2923. }, $composer->getPackage()->getBinaries()));
  2924. if (!$bins) {
  2925. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  2926. }
  2927. $this->getIO()->write(<<<EOT
  2928. <comment>Available binaries:</comment>
  2929. EOT
  2930. );
  2931. foreach ($bins as $bin) {
  2932. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  2933. continue;
  2934. }
  2935. $previousBin = $bin;
  2936. $bin = basename($bin);
  2937. $this->getIO()->write(<<<EOT
  2938. <info>- $bin</info>
  2939. EOT
  2940. );
  2941. }
  2942. return 0;
  2943. }
  2944. $binary = $input->getArgument('binary');
  2945. $dispatcher = $composer->getEventDispatcher();
  2946. $dispatcher->addListener('__exec_command', $binary);
  2947. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  2948. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  2949. }
  2950. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  2951. }
  2952. }
  2953. <?php
  2954. namespace Composer\Command;
  2955. use Composer\Factory;
  2956. use Symfony\Component\Console\Input\InputInterface;
  2957. use Symfony\Component\Console\Input\InputArgument;
  2958. use Symfony\Component\Console\Input\StringInput;
  2959. use Symfony\Component\Console\Output\OutputInterface;
  2960. class GlobalCommand extends BaseCommand
  2961. {
  2962. protected function configure()
  2963. {
  2964. $this
  2965. ->setName('global')
  2966. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  2967. ->setDefinition(array(
  2968. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  2969. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  2970. ))
  2971. ->setHelp(<<<EOT
  2972. Use this command as a wrapper to run other Composer commands
  2973. within the global context of COMPOSER_HOME.
  2974. You can use this to install CLI utilities globally, all you need
  2975. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  2976. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  2977. and /home/<user>/.composer on unix systems.
  2978. If your system uses freedesktop.org standards, then it will first check
  2979. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  2980. Note: This path may vary depending on customizations to bin-dir in
  2981. composer.json or the environmental variable COMPOSER_BIN_DIR.
  2982. EOT
  2983. )
  2984. ;
  2985. }
  2986. public function run(InputInterface $input, OutputInterface $output)
  2987. {
  2988. $tokens = preg_split('{\s+}', $input->__toString());
  2989. $args = array();
  2990. foreach ($tokens as $token) {
  2991. if ($token && $token[0] !== '-') {
  2992. $args[] = $token;
  2993. if (count($args) >= 2) {
  2994. break;
  2995. }
  2996. }
  2997. }
  2998. if (count($args) < 2) {
  2999. return parent::run($input, $output);
  3000. }
  3001. $config = Factory::createConfig();
  3002. chdir($config->get('home'));
  3003. $this->getIO()->writeError('<info>Changed current directory to '.$config->get('home').'</info>');
  3004. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3005. $this->getApplication()->resetComposer();
  3006. return $this->getApplication()->run($input, $output);
  3007. }
  3008. public function isProxyCommand()
  3009. {
  3010. return true;
  3011. }
  3012. }
  3013. <?php
  3014. namespace Composer\Command;
  3015. use Composer\Package\CompletePackageInterface;
  3016. use Composer\Repository\RepositoryInterface;
  3017. use Composer\Repository\ArrayRepository;
  3018. use Composer\Repository\RepositoryFactory;
  3019. use Composer\Util\Platform;
  3020. use Composer\Util\ProcessExecutor;
  3021. use Symfony\Component\Console\Input\InputArgument;
  3022. use Symfony\Component\Console\Input\InputOption;
  3023. use Symfony\Component\Console\Input\InputInterface;
  3024. use Symfony\Component\Console\Output\OutputInterface;
  3025. class HomeCommand extends BaseCommand
  3026. {
  3027. protected function configure()
  3028. {
  3029. $this
  3030. ->setName('browse')
  3031. ->setAliases(array('home'))
  3032. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3033. ->setDefinition(array(
  3034. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Package(s) to browse to.'),
  3035. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3036. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3037. ))
  3038. ->setHelp(<<<EOT
  3039. The home command opens or shows a package's repository URL or
  3040. homepage in your default browser.
  3041. To open the homepage by default, use -H or --homepage.
  3042. To show instead of open the repository or homepage URL, use -s or --show.
  3043. EOT
  3044. );
  3045. }
  3046. protected function execute(InputInterface $input, OutputInterface $output)
  3047. {
  3048. $repos = $this->initializeRepos();
  3049. $io = $this->getIO();
  3050. $return = 0;
  3051. foreach ($input->getArgument('packages') as $packageName) {
  3052. $handled = false;
  3053. $packageExists = false;
  3054. foreach ($repos as $repo) {
  3055. foreach ($repo->findPackages($packageName) as $package) {
  3056. $packageExists = true;
  3057. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3058. $handled = true;
  3059. break 2;
  3060. }
  3061. }
  3062. }
  3063. if (!$packageExists) {
  3064. $return = 1;
  3065. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3066. }
  3067. if (!$handled) {
  3068. $return = 1;
  3069. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3070. }
  3071. }
  3072. return $return;
  3073. }
  3074. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3075. {
  3076. $support = $package->getSupport();
  3077. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3078. if (!$url || $showHomepage) {
  3079. $url = $package->getHomepage();
  3080. }
  3081. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3082. return false;
  3083. }
  3084. if ($showOnly) {
  3085. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3086. } else {
  3087. $this->openBrowser($url);
  3088. }
  3089. return true;
  3090. }
  3091. private function openBrowser($url)
  3092. {
  3093. $url = ProcessExecutor::escape($url);
  3094. $process = new ProcessExecutor($this->getIO());
  3095. if (Platform::isWindows()) {
  3096. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3097. }
  3098. $linux = $process->execute('which xdg-open', $output);
  3099. $osx = $process->execute('which open', $output);
  3100. if (0 === $linux) {
  3101. $process->execute('xdg-open ' . $url, $output);
  3102. } elseif (0 === $osx) {
  3103. $process->execute('open ' . $url, $output);
  3104. } else {
  3105. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3106. }
  3107. }
  3108. private function initializeRepos()
  3109. {
  3110. $composer = $this->getComposer(false);
  3111. if ($composer) {
  3112. return array_merge(
  3113. array(new ArrayRepository(array($composer->getPackage()))),
  3114. array($composer->getRepositoryManager()->getLocalRepository()),
  3115. $composer->getRepositoryManager()->getRepositories()
  3116. );
  3117. }
  3118. return RepositoryFactory::defaultRepos($this->getIO());
  3119. }
  3120. }
  3121. <?php
  3122. namespace Composer\Command;
  3123. use Composer\DependencyResolver\Pool;
  3124. use Composer\Json\JsonFile;
  3125. use Composer\Factory;
  3126. use Composer\Repository\RepositoryFactory;
  3127. use Composer\Package\BasePackage;
  3128. use Composer\Package\Version\VersionParser;
  3129. use Composer\Package\Version\VersionSelector;
  3130. use Composer\Repository\CompositeRepository;
  3131. use Composer\Repository\PlatformRepository;
  3132. use Composer\Util\ProcessExecutor;
  3133. use Symfony\Component\Console\Input\InputInterface;
  3134. use Symfony\Component\Console\Input\InputOption;
  3135. use Symfony\Component\Console\Output\OutputInterface;
  3136. use Symfony\Component\Process\Process;
  3137. use Symfony\Component\Process\ExecutableFinder;
  3138. class InitCommand extends BaseCommand
  3139. {
  3140. protected $repos;
  3141. private $gitConfig;
  3142. private $pool;
  3143. protected function configure()
  3144. {
  3145. $this
  3146. ->setName('init')
  3147. ->setDescription('Creates a basic composer.json file in current directory.')
  3148. ->setDefinition(array(
  3149. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3150. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3151. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3152. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3153. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3154. 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"'),
  3155. 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"'),
  3156. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3157. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3158. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3159. ))
  3160. ->setHelp(<<<EOT
  3161. The <info>init</info> command creates a basic composer.json file
  3162. in the current directory.
  3163. <info>php composer.phar init</info>
  3164. EOT
  3165. )
  3166. ;
  3167. }
  3168. protected function execute(InputInterface $input, OutputInterface $output)
  3169. {
  3170. $io = $this->getIO();
  3171. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3172. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3173. if (isset($options['author'])) {
  3174. $options['authors'] = $this->formatAuthors($options['author']);
  3175. unset($options['author']);
  3176. }
  3177. $repositories = $input->getOption('repository');
  3178. if ($repositories) {
  3179. $config = Factory::createConfig($io);
  3180. foreach ($repositories as $repo) {
  3181. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3182. }
  3183. }
  3184. if (isset($options['stability'])) {
  3185. $options['minimum-stability'] = $options['stability'];
  3186. unset($options['stability']);
  3187. }
  3188. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3189. if (array() === $options['require']) {
  3190. $options['require'] = new \stdClass;
  3191. }
  3192. if (isset($options['require-dev'])) {
  3193. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3194. if (array() === $options['require-dev']) {
  3195. $options['require-dev'] = new \stdClass;
  3196. }
  3197. }
  3198. $file = new JsonFile(Factory::getComposerFile());
  3199. $json = $file->encode($options);
  3200. if ($input->isInteractive()) {
  3201. $io->writeError(array('', $json, ''));
  3202. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3203. $io->writeError('<error>Command aborted</error>');
  3204. return 1;
  3205. }
  3206. }
  3207. $file->write($options);
  3208. if ($input->isInteractive() && is_dir('.git')) {
  3209. $ignoreFile = realpath('.gitignore');
  3210. if (false === $ignoreFile) {
  3211. $ignoreFile = realpath('.') . '/.gitignore';
  3212. }
  3213. if (!$this->hasVendorIgnore($ignoreFile)) {
  3214. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3215. if ($io->askConfirmation($question, true)) {
  3216. $this->addVendorIgnore($ignoreFile);
  3217. }
  3218. }
  3219. }
  3220. }
  3221. protected function interact(InputInterface $input, OutputInterface $output)
  3222. {
  3223. $git = $this->getGitConfig();
  3224. $io = $this->getIO();
  3225. $formatter = $this->getHelperSet()->get('formatter');
  3226. $repositories = $input->getOption('repository');
  3227. if ($repositories) {
  3228. $config = Factory::createConfig($io);
  3229. $repos = array(new PlatformRepository);
  3230. foreach ($repositories as $repo) {
  3231. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3232. }
  3233. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3234. 'type' => 'composer',
  3235. 'url' => 'https://packagist.org',
  3236. ));
  3237. $this->repos = new CompositeRepository($repos);
  3238. unset($repos, $config, $repositories);
  3239. }
  3240. $io->writeError(array(
  3241. '',
  3242. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3243. '',
  3244. ));
  3245. $io->writeError(array(
  3246. '',
  3247. 'This command will guide you through creating your composer.json config.',
  3248. '',
  3249. ));
  3250. $cwd = realpath(".");
  3251. if (!$name = $input->getOption('name')) {
  3252. $name = basename($cwd);
  3253. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3254. $name = strtolower($name);
  3255. if (isset($git['github.user'])) {
  3256. $name = $git['github.user'] . '/' . $name;
  3257. } elseif (!empty($_SERVER['USERNAME'])) {
  3258. $name = $_SERVER['USERNAME'] . '/' . $name;
  3259. } elseif (get_current_user()) {
  3260. $name = get_current_user() . '/' . $name;
  3261. } else {
  3262. $name = $name . '/' . $name;
  3263. }
  3264. $name = strtolower($name);
  3265. } else {
  3266. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
  3267. throw new \InvalidArgumentException(
  3268. '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_.-]+'
  3269. );
  3270. }
  3271. }
  3272. $name = $io->askAndValidate(
  3273. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3274. function ($value) use ($name) {
  3275. if (null === $value) {
  3276. return $name;
  3277. }
  3278. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
  3279. throw new \InvalidArgumentException(
  3280. '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_.-]+'
  3281. );
  3282. }
  3283. return $value;
  3284. },
  3285. null,
  3286. $name
  3287. );
  3288. $input->setOption('name', $name);
  3289. $description = $input->getOption('description') ?: false;
  3290. $description = $io->ask(
  3291. 'Description [<comment>'.$description.'</comment>]: ',
  3292. $description
  3293. );
  3294. $input->setOption('description', $description);
  3295. if (null === $author = $input->getOption('author')) {
  3296. if (isset($git['user.name']) && isset($git['user.email'])) {
  3297. $author = sprintf('%s <%s>', $git['user.name'], $git['user.email']);
  3298. }
  3299. }
  3300. $self = $this;
  3301. $author = $io->askAndValidate(
  3302. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3303. function ($value) use ($self, $author) {
  3304. if ($value === 'n' || $value === 'no') {
  3305. return;
  3306. }
  3307. $value = $value ?: $author;
  3308. $author = $self->parseAuthorString($value);
  3309. return sprintf('%s <%s>', $author['name'], $author['email']);
  3310. },
  3311. null,
  3312. $author
  3313. );
  3314. $input->setOption('author', $author);
  3315. $minimumStability = $input->getOption('stability') ?: null;
  3316. $minimumStability = $io->askAndValidate(
  3317. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3318. function ($value) use ($self, $minimumStability) {
  3319. if (null === $value) {
  3320. return $minimumStability;
  3321. }
  3322. if (!isset(BasePackage::$stabilities[$value])) {
  3323. throw new \InvalidArgumentException(
  3324. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3325. implode(', ', array_keys(BasePackage::$stabilities))
  3326. );
  3327. }
  3328. return $value;
  3329. },
  3330. null,
  3331. $minimumStability
  3332. );
  3333. $input->setOption('stability', $minimumStability);
  3334. $type = $input->getOption('type') ?: false;
  3335. $type = $io->ask(
  3336. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3337. $type
  3338. );
  3339. $input->setOption('type', $type);
  3340. $license = $input->getOption('license') ?: false;
  3341. $license = $io->ask(
  3342. 'License [<comment>'.$license.'</comment>]: ',
  3343. $license
  3344. );
  3345. $input->setOption('license', $license);
  3346. $io->writeError(array('', 'Define your dependencies.', ''));
  3347. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3348. $requirements = array();
  3349. if ($io->askConfirmation($question, true)) {
  3350. $requirements = $this->determineRequirements($input, $output, $input->getOption('require'));
  3351. }
  3352. $input->setOption('require', $requirements);
  3353. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3354. $devRequirements = array();
  3355. if ($io->askConfirmation($question, true)) {
  3356. $devRequirements = $this->determineRequirements($input, $output, $input->getOption('require-dev'));
  3357. }
  3358. $input->setOption('require-dev', $devRequirements);
  3359. }
  3360. public function parseAuthorString($author)
  3361. {
  3362. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3363. if ($this->isValidEmail($match['email'])) {
  3364. return array(
  3365. 'name' => trim($match['name']),
  3366. 'email' => $match['email'],
  3367. );
  3368. }
  3369. }
  3370. throw new \InvalidArgumentException(
  3371. 'Invalid author string. Must be in the format: '.
  3372. 'John Smith <[email protected]>'
  3373. );
  3374. }
  3375. protected function findPackages($name)
  3376. {
  3377. return $this->getRepos()->search($name);
  3378. }
  3379. protected function getRepos()
  3380. {
  3381. if (!$this->repos) {
  3382. $this->repos = new CompositeRepository(array_merge(
  3383. array(new PlatformRepository),
  3384. RepositoryFactory::defaultRepos($this->getIO())
  3385. ));
  3386. }
  3387. return $this->repos;
  3388. }
  3389. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable')
  3390. {
  3391. if ($requires) {
  3392. $requires = $this->normalizeRequirements($requires);
  3393. $result = array();
  3394. $io = $this->getIO();
  3395. foreach ($requires as $requirement) {
  3396. if (!isset($requirement['version'])) {
  3397. $version = $this->findBestVersionForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3398. $requirement['version'] = $version;
  3399. $io->writeError(sprintf(
  3400. 'Using version <info>%s</info> for <info>%s</info>',
  3401. $requirement['version'],
  3402. $requirement['name']
  3403. ));
  3404. }
  3405. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3406. }
  3407. return $result;
  3408. }
  3409. $versionParser = new VersionParser();
  3410. $io = $this->getIO();
  3411. while (null !== $package = $io->ask('Search for a package: ')) {
  3412. $matches = $this->findPackages($package);
  3413. if (count($matches)) {
  3414. $exactMatch = null;
  3415. $choices = array();
  3416. foreach ($matches as $position => $foundPackage) {
  3417. $choices[] = sprintf(' <info>%5s</info> %s', "[$position]", $foundPackage['name']);
  3418. if ($foundPackage['name'] === $package) {
  3419. $exactMatch = true;
  3420. break;
  3421. }
  3422. }
  3423. if (!$exactMatch) {
  3424. $io->writeError(array(
  3425. '',
  3426. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3427. '',
  3428. ));
  3429. $io->writeError($choices);
  3430. $io->writeError('');
  3431. $validator = function ($selection) use ($matches, $versionParser) {
  3432. if ('' === $selection) {
  3433. return false;
  3434. }
  3435. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3436. $package = $matches[(int) $selection];
  3437. return $package['name'];
  3438. }
  3439. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3440. if (isset($packageMatches['version'])) {
  3441. $versionParser->parseConstraints($packageMatches['version']);
  3442. return $packageMatches['name'].' '.$packageMatches['version'];
  3443. }
  3444. return $packageMatches['name'];
  3445. }
  3446. throw new \Exception('Not a valid selection');
  3447. };
  3448. $package = $io->askAndValidate(
  3449. 'Enter package # to add, or the complete package name if it is not listed: ',
  3450. $validator,
  3451. 3,
  3452. false
  3453. );
  3454. }
  3455. if (false !== $package && false === strpos($package, ' ')) {
  3456. $validator = function ($input) {
  3457. $input = trim($input);
  3458. return $input ?: false;
  3459. };
  3460. $constraint = $io->askAndValidate(
  3461. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3462. $validator,
  3463. 3,
  3464. false
  3465. );
  3466. if (false === $constraint) {
  3467. $constraint = $this->findBestVersionForPackage($input, $package, $phpVersion, $preferredStability);
  3468. $io->writeError(sprintf(
  3469. 'Using version <info>%s</info> for <info>%s</info>',
  3470. $constraint,
  3471. $package
  3472. ));
  3473. }
  3474. $package .= ' '.$constraint;
  3475. }
  3476. if (false !== $package) {
  3477. $requires[] = $package;
  3478. }
  3479. }
  3480. }
  3481. return $requires;
  3482. }
  3483. protected function formatAuthors($author)
  3484. {
  3485. return array($this->parseAuthorString($author));
  3486. }
  3487. protected function formatRequirements(array $requirements)
  3488. {
  3489. $requires = array();
  3490. $requirements = $this->normalizeRequirements($requirements);
  3491. foreach ($requirements as $requirement) {
  3492. $requires[$requirement['name']] = $requirement['version'];
  3493. }
  3494. return $requires;
  3495. }
  3496. protected function getGitConfig()
  3497. {
  3498. if (null !== $this->gitConfig) {
  3499. return $this->gitConfig;
  3500. }
  3501. $finder = new ExecutableFinder();
  3502. $gitBin = $finder->find('git');
  3503. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3504. $cmd->run();
  3505. if ($cmd->isSuccessful()) {
  3506. $this->gitConfig = array();
  3507. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3508. foreach ($matches as $match) {
  3509. $this->gitConfig[$match[1]] = $match[2];
  3510. }
  3511. return $this->gitConfig;
  3512. }
  3513. return $this->gitConfig = array();
  3514. }
  3515. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3516. {
  3517. if (!file_exists($ignoreFile)) {
  3518. return false;
  3519. }
  3520. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3521. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3522. foreach ($lines as $line) {
  3523. if (preg_match($pattern, $line)) {
  3524. return true;
  3525. }
  3526. }
  3527. return false;
  3528. }
  3529. protected function normalizeRequirements(array $requirements)
  3530. {
  3531. $parser = new VersionParser();
  3532. return $parser->parseNameVersionPairs($requirements);
  3533. }
  3534. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3535. {
  3536. $contents = "";
  3537. if (file_exists($ignoreFile)) {
  3538. $contents = file_get_contents($ignoreFile);
  3539. if ("\n" !== substr($contents, 0, -1)) {
  3540. $contents .= "\n";
  3541. }
  3542. }
  3543. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3544. }
  3545. protected function isValidEmail($email)
  3546. {
  3547. if (!function_exists('filter_var')) {
  3548. return true;
  3549. }
  3550. if (PHP_VERSION_ID < 50303) {
  3551. return true;
  3552. }
  3553. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3554. }
  3555. private function getPool(InputInterface $input)
  3556. {
  3557. if (!$this->pool) {
  3558. $this->pool = new Pool($this->getMinimumStability($input));
  3559. $this->pool->addRepository($this->getRepos());
  3560. }
  3561. return $this->pool;
  3562. }
  3563. private function getMinimumStability(InputInterface $input)
  3564. {
  3565. if ($input->hasOption('stability')) {
  3566. return $input->getOption('stability') ?: 'stable';
  3567. }
  3568. $file = Factory::getComposerFile();
  3569. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3570. if (!empty($composer['minimum-stability'])) {
  3571. return $composer['minimum-stability'];
  3572. }
  3573. }
  3574. return 'stable';
  3575. }
  3576. private function findBestVersionForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable')
  3577. {
  3578. $versionSelector = new VersionSelector($this->getPool($input));
  3579. $package = $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability);
  3580. if (!$package) {
  3581. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3582. throw new \InvalidArgumentException(sprintf(
  3583. 'Could not find package %s at any version matching your PHP version %s', $name, $phpVersion
  3584. ));
  3585. }
  3586. throw new \InvalidArgumentException(sprintf(
  3587. 'Could not find package %s at any version for your minimum-stability (%s). Check the package spelling or your minimum-stability',
  3588. $name,
  3589. $this->getMinimumStability($input)
  3590. ));
  3591. }
  3592. return $versionSelector->findRecommendedRequireVersion($package);
  3593. }
  3594. }
  3595. <?php
  3596. namespace Composer\Command;
  3597. use Composer\Installer;
  3598. use Composer\Plugin\CommandEvent;
  3599. use Composer\Plugin\PluginEvents;
  3600. use Symfony\Component\Console\Input\InputInterface;
  3601. use Symfony\Component\Console\Input\InputOption;
  3602. use Symfony\Component\Console\Input\InputArgument;
  3603. use Symfony\Component\Console\Output\OutputInterface;
  3604. class InstallCommand extends BaseCommand
  3605. {
  3606. protected function configure()
  3607. {
  3608. $this
  3609. ->setName('install')
  3610. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  3611. ->setDefinition(array(
  3612. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3613. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3614. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  3615. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3616. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3617. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3618. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  3619. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3620. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3621. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  3622. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  3623. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3624. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3625. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3626. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3627. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  3628. ))
  3629. ->setHelp(<<<EOT
  3630. The <info>install</info> command reads the composer.lock file from
  3631. the current directory, processes it, and downloads and installs all the
  3632. libraries and dependencies outlined in that file. If the file does not
  3633. exist it will look for composer.json and do the same.
  3634. <info>php composer.phar install</info>
  3635. EOT
  3636. )
  3637. ;
  3638. }
  3639. protected function execute(InputInterface $input, OutputInterface $output)
  3640. {
  3641. $io = $this->getIO();
  3642. if ($args = $input->getArgument('packages')) {
  3643. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  3644. return 1;
  3645. }
  3646. if ($input->getOption('no-custom-installers')) {
  3647. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3648. $input->setOption('no-plugins', true);
  3649. }
  3650. if ($input->getOption('dev')) {
  3651. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3652. }
  3653. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3654. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3655. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  3656. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3657. $install = Installer::create($io, $composer);
  3658. $config = $composer->getConfig();
  3659. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  3660. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  3661. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3662. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  3663. $install
  3664. ->setDryRun($input->getOption('dry-run'))
  3665. ->setVerbose($input->getOption('verbose'))
  3666. ->setPreferSource($preferSource)
  3667. ->setPreferDist($preferDist)
  3668. ->setDevMode(!$input->getOption('no-dev'))
  3669. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  3670. ->setRunScripts(!$input->getOption('no-scripts'))
  3671. ->setSkipSuggest($input->getOption('no-suggest'))
  3672. ->setOptimizeAutoloader($optimize)
  3673. ->setClassMapAuthoritative($authoritative)
  3674. ->setApcuAutoloader($apcu)
  3675. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3676. ;
  3677. if ($input->getOption('no-plugins')) {
  3678. $install->disablePlugins();
  3679. }
  3680. return $install->run();
  3681. }
  3682. }
  3683. <?php
  3684. namespace Composer\Command;
  3685. use Composer\Json\JsonFile;
  3686. use Composer\Plugin\CommandEvent;
  3687. use Composer\Plugin\PluginEvents;
  3688. use Composer\Package\PackageInterface;
  3689. use Composer\Repository\RepositoryInterface;
  3690. use Symfony\Component\Console\Helper\Table;
  3691. use Symfony\Component\Console\Input\InputInterface;
  3692. use Symfony\Component\Console\Input\InputOption;
  3693. use Symfony\Component\Console\Output\OutputInterface;
  3694. class LicensesCommand extends BaseCommand
  3695. {
  3696. protected function configure()
  3697. {
  3698. $this
  3699. ->setName('licenses')
  3700. ->setDescription('Show information about licenses of dependencies.')
  3701. ->setDefinition(array(
  3702. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  3703. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  3704. ))
  3705. ->setHelp(<<<EOT
  3706. The license command displays detailed information about the licenses of
  3707. the installed dependencies.
  3708. EOT
  3709. )
  3710. ;
  3711. }
  3712. protected function execute(InputInterface $input, OutputInterface $output)
  3713. {
  3714. $composer = $this->getComposer();
  3715. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  3716. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3717. $root = $composer->getPackage();
  3718. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3719. if ($input->getOption('no-dev')) {
  3720. $packages = $this->filterRequiredPackages($repo, $root);
  3721. } else {
  3722. $packages = $this->appendPackages($repo->getPackages(), array());
  3723. }
  3724. ksort($packages);
  3725. $io = $this->getIO();
  3726. switch ($format = $input->getOption('format')) {
  3727. case 'text':
  3728. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  3729. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  3730. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  3731. $io->write('Dependencies:');
  3732. $io->write('');
  3733. $table = new Table($output);
  3734. $table->setStyle('compact');
  3735. $table->getStyle()->setVerticalBorderChar('');
  3736. $table->getStyle()->setCellRowContentFormat('%s ');
  3737. $table->setHeaders(array('Name', 'Version', 'License'));
  3738. foreach ($packages as $package) {
  3739. $table->addRow(array(
  3740. $package->getPrettyName(),
  3741. $package->getFullPrettyVersion(),
  3742. implode(', ', $package->getLicense()) ?: 'none',
  3743. ));
  3744. }
  3745. $table->render();
  3746. break;
  3747. case 'json':
  3748. $dependencies = array();
  3749. foreach ($packages as $package) {
  3750. $dependencies[$package->getPrettyName()] = array(
  3751. 'version' => $package->getFullPrettyVersion(),
  3752. 'license' => $package->getLicense(),
  3753. );
  3754. }
  3755. $io->write(JsonFile::encode(array(
  3756. 'name' => $root->getPrettyName(),
  3757. 'version' => $root->getFullPrettyVersion(),
  3758. 'license' => $root->getLicense(),
  3759. 'dependencies' => $dependencies,
  3760. )));
  3761. break;
  3762. default:
  3763. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  3764. }
  3765. }
  3766. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  3767. {
  3768. $requires = array_keys($package->getRequires());
  3769. $packageListNames = array_keys($bucket);
  3770. $packages = array_filter(
  3771. $repo->getPackages(),
  3772. function ($package) use ($requires, $packageListNames) {
  3773. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  3774. }
  3775. );
  3776. $bucket = $this->appendPackages($packages, $bucket);
  3777. foreach ($packages as $package) {
  3778. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  3779. }
  3780. return $bucket;
  3781. }
  3782. public function appendPackages(array $packages, array $bucket)
  3783. {
  3784. foreach ($packages as $package) {
  3785. $bucket[$package->getName()] = $package;
  3786. }
  3787. return $bucket;
  3788. }
  3789. }
  3790. <?php
  3791. namespace Composer\Command;
  3792. use Symfony\Component\Console\Input\InputInterface;
  3793. use Symfony\Component\Console\Input\InputArgument;
  3794. use Symfony\Component\Console\Input\ArrayInput;
  3795. use Symfony\Component\Console\Input\InputOption;
  3796. use Symfony\Component\Console\Output\OutputInterface;
  3797. class OutdatedCommand extends ShowCommand
  3798. {
  3799. protected function configure()
  3800. {
  3801. $this
  3802. ->setName('outdated')
  3803. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  3804. ->setDefinition(array(
  3805. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  3806. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  3807. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  3808. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  3809. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  3810. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  3811. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  3812. ))
  3813. ->setHelp(<<<EOT
  3814. The outdated command is just a proxy for `composer show -l`
  3815. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  3816. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  3817. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  3818. compatibility breaks according to semver, so upgrade when you can but it
  3819. may involve work.
  3820. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  3821. EOT
  3822. )
  3823. ;
  3824. }
  3825. protected function execute(InputInterface $input, OutputInterface $output)
  3826. {
  3827. $args = array(
  3828. 'show',
  3829. '--latest' => true,
  3830. );
  3831. if (!$input->getOption('all')) {
  3832. $args['--outdated'] = true;
  3833. }
  3834. if ($input->getOption('direct')) {
  3835. $args['--direct'] = true;
  3836. }
  3837. if ($input->getArgument('package')) {
  3838. $args['package'] = $input->getArgument('package');
  3839. }
  3840. if ($input->getOption('strict')) {
  3841. $args['--strict'] = true;
  3842. }
  3843. if ($input->getOption('minor-only')) {
  3844. $args['--minor-only'] = true;
  3845. }
  3846. $args['--format'] = $input->getOption('format');
  3847. $input = new ArrayInput($args);
  3848. return $this->getApplication()->run($input, $output);
  3849. }
  3850. public function isProxyCommand()
  3851. {
  3852. return true;
  3853. }
  3854. }
  3855. <?php
  3856. namespace Composer\Command;
  3857. use Symfony\Component\Console\Input\InputInterface;
  3858. use Symfony\Component\Console\Output\OutputInterface;
  3859. class ProhibitsCommand extends BaseDependencyCommand
  3860. {
  3861. protected function configure()
  3862. {
  3863. parent::configure();
  3864. $this
  3865. ->setName('prohibits')
  3866. ->setAliases(array('why-not'))
  3867. ->setDescription('Shows which packages prevent the given package from being installed.')
  3868. ->setHelp(<<<EOT
  3869. Displays detailed information about why a package cannot be installed.
  3870. <info>php composer.phar prohibits composer/composer</info>
  3871. EOT
  3872. )
  3873. ;
  3874. }
  3875. protected function execute(InputInterface $input, OutputInterface $output)
  3876. {
  3877. return parent::doExecute($input, $output, true);
  3878. }
  3879. }
  3880. <?php
  3881. namespace Composer\Command;
  3882. use Composer\Config\JsonConfigSource;
  3883. use Composer\Installer;
  3884. use Composer\Plugin\CommandEvent;
  3885. use Composer\Plugin\PluginEvents;
  3886. use Composer\Json\JsonFile;
  3887. use Composer\Factory;
  3888. use Symfony\Component\Console\Input\InputInterface;
  3889. use Symfony\Component\Console\Input\InputOption;
  3890. use Symfony\Component\Console\Input\InputArgument;
  3891. use Symfony\Component\Console\Output\OutputInterface;
  3892. class RemoveCommand extends BaseCommand
  3893. {
  3894. protected function configure()
  3895. {
  3896. $this
  3897. ->setName('remove')
  3898. ->setDescription('Removes a package from the require or require-dev.')
  3899. ->setDefinition(array(
  3900. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  3901. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  3902. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3903. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  3904. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3905. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  3906. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  3907. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  3908. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3909. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3910. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3911. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3912. ))
  3913. ->setHelp(<<<EOT
  3914. The <info>remove</info> command removes a package from the current
  3915. list of installed packages
  3916. <info>php composer.phar remove</info>
  3917. EOT
  3918. )
  3919. ;
  3920. }
  3921. protected function execute(InputInterface $input, OutputInterface $output)
  3922. {
  3923. $packages = $input->getArgument('packages');
  3924. $packages = array_map('strtolower', $packages);
  3925. $file = Factory::getComposerFile();
  3926. $jsonFile = new JsonFile($file);
  3927. $composer = $jsonFile->read();
  3928. $composerBackup = file_get_contents($jsonFile->getPath());
  3929. $json = new JsonConfigSource($jsonFile);
  3930. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  3931. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  3932. $io = $this->getIO();
  3933. if ($input->getOption('update-with-dependencies')) {
  3934. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  3935. }
  3936. foreach (array('require', 'require-dev') as $linkType) {
  3937. if (isset($composer[$linkType])) {
  3938. foreach ($composer[$linkType] as $name => $version) {
  3939. $composer[$linkType][strtolower($name)] = $name;
  3940. }
  3941. }
  3942. }
  3943. foreach ($packages as $package) {
  3944. if (isset($composer[$type][$package])) {
  3945. $json->removeLink($type, $composer[$type][$package]);
  3946. } elseif (isset($composer[$altType][$package])) {
  3947. $io->writeError('<warning>'.$composer[$altType][$package].' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
  3948. if ($io->isInteractive()) {
  3949. if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
  3950. $json->removeLink($altType, $composer[$altType][$package]);
  3951. }
  3952. }
  3953. } else {
  3954. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  3955. }
  3956. }
  3957. if ($input->getOption('no-update')) {
  3958. return 0;
  3959. }
  3960. $this->resetComposer();
  3961. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3962. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3963. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  3964. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3965. $install = Installer::create($io, $composer);
  3966. $updateDevMode = !$input->getOption('update-no-dev');
  3967. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  3968. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  3969. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  3970. $install
  3971. ->setVerbose($input->getOption('verbose'))
  3972. ->setDevMode($updateDevMode)
  3973. ->setOptimizeAutoloader($optimize)
  3974. ->setClassMapAuthoritative($authoritative)
  3975. ->setApcuAutoloader($apcu)
  3976. ->setUpdate(true)
  3977. ->setUpdateWhitelist($packages)
  3978. ->setWhitelistDependencies(!$input->getOption('no-update-with-dependencies'))
  3979. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3980. ->setRunScripts(!$input->getOption('no-scripts'))
  3981. ;
  3982. $exception = null;
  3983. try {
  3984. $status = $install->run();
  3985. } catch (\Exception $exception) {
  3986. $status = 1;
  3987. }
  3988. if ($status !== 0) {
  3989. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  3990. file_put_contents($jsonFile->getPath(), $composerBackup);
  3991. }
  3992. if ($exception) {
  3993. throw $exception;
  3994. }
  3995. return $status;
  3996. }
  3997. }
  3998. <?php
  3999. namespace Composer\Command;
  4000. use Symfony\Component\Console\Input\InputInterface;
  4001. use Symfony\Component\Console\Input\InputArgument;
  4002. use Symfony\Component\Console\Input\InputOption;
  4003. use Symfony\Component\Console\Output\OutputInterface;
  4004. use Composer\Factory;
  4005. use Composer\Installer;
  4006. use Composer\Json\JsonFile;
  4007. use Composer\Json\JsonManipulator;
  4008. use Composer\Package\Version\VersionParser;
  4009. use Composer\Plugin\CommandEvent;
  4010. use Composer\Plugin\PluginEvents;
  4011. use Composer\Repository\CompositeRepository;
  4012. use Composer\Repository\PlatformRepository;
  4013. class RequireCommand extends InitCommand
  4014. {
  4015. protected function configure()
  4016. {
  4017. $this
  4018. ->setName('require')
  4019. ->setDescription('Adds required packages to your composer.json and installs them.')
  4020. ->setDefinition(array(
  4021. 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"'),
  4022. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4023. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4024. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4025. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4026. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4027. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4028. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4029. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4030. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies.'),
  4031. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4032. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4033. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4034. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4035. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4036. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4037. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4038. ))
  4039. ->setHelp(<<<EOT
  4040. The require command adds required packages to your composer.json and installs them.
  4041. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4042. If you do not want to install the new dependencies immediately you can call it with --no-update
  4043. EOT
  4044. )
  4045. ;
  4046. }
  4047. protected function execute(InputInterface $input, OutputInterface $output)
  4048. {
  4049. $file = Factory::getComposerFile();
  4050. $io = $this->getIO();
  4051. $newlyCreated = !file_exists($file);
  4052. if (!file_exists($file) && !file_put_contents($file, "{\n}\n")) {
  4053. $io->writeError('<error>'.$file.' could not be created.</error>');
  4054. return 1;
  4055. }
  4056. if (!is_readable($file)) {
  4057. $io->writeError('<error>'.$file.' is not readable.</error>');
  4058. return 1;
  4059. }
  4060. if (!is_writable($file)) {
  4061. $io->writeError('<error>'.$file.' is not writable.</error>');
  4062. return 1;
  4063. }
  4064. if (filesize($file) === 0) {
  4065. file_put_contents($file, "{\n}\n");
  4066. }
  4067. $json = new JsonFile($file);
  4068. $composerBackup = file_get_contents($json->getPath());
  4069. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4070. $repos = $composer->getRepositoryManager()->getRepositories();
  4071. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4072. $this->repos = new CompositeRepository(array_merge(
  4073. array(new PlatformRepository(array(), $platformOverrides)),
  4074. $repos
  4075. ));
  4076. if ($composer->getPackage()->getPreferStable()) {
  4077. $preferredStability = 'stable';
  4078. } else {
  4079. $preferredStability = $composer->getPackage()->getMinimumStability();
  4080. }
  4081. $phpVersion = $this->repos->findPackage('php', '*')->getVersion();
  4082. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability);
  4083. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4084. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4085. $requirements = $this->formatRequirements($requirements);
  4086. $versionParser = new VersionParser();
  4087. foreach ($requirements as $constraint) {
  4088. $versionParser->parseConstraints($constraint);
  4089. }
  4090. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4091. if (!$this->updateFileCleanly($json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4092. $composerDefinition = $json->read();
  4093. foreach ($requirements as $package => $version) {
  4094. $composerDefinition[$requireKey][$package] = $version;
  4095. unset($composerDefinition[$removeKey][$package]);
  4096. }
  4097. $json->write($composerDefinition);
  4098. }
  4099. $io->writeError('<info>'.$file.' has been '.($newlyCreated ? 'created' : 'updated').'</info>');
  4100. if ($input->getOption('no-update')) {
  4101. return 0;
  4102. }
  4103. $updateDevMode = !$input->getOption('update-no-dev');
  4104. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4105. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4106. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4107. $this->resetComposer();
  4108. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4109. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4110. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4111. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4112. $install = Installer::create($io, $composer);
  4113. $install
  4114. ->setVerbose($input->getOption('verbose'))
  4115. ->setPreferSource($input->getOption('prefer-source'))
  4116. ->setPreferDist($input->getOption('prefer-dist'))
  4117. ->setDevMode($updateDevMode)
  4118. ->setRunScripts(!$input->getOption('no-scripts'))
  4119. ->setSkipSuggest($input->getOption('no-suggest'))
  4120. ->setOptimizeAutoloader($optimize)
  4121. ->setClassMapAuthoritative($authoritative)
  4122. ->setApcuAutoloader($apcu)
  4123. ->setUpdate(true)
  4124. ->setUpdateWhitelist(array_keys($requirements))
  4125. ->setWhitelistDependencies($input->getOption('update-with-dependencies'))
  4126. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4127. ->setPreferStable($input->getOption('prefer-stable'))
  4128. ->setPreferLowest($input->getOption('prefer-lowest'))
  4129. ;
  4130. $exception = null;
  4131. try {
  4132. $status = $install->run();
  4133. } catch (\Exception $exception) {
  4134. $status = 1;
  4135. }
  4136. if ($status !== 0) {
  4137. if ($newlyCreated) {
  4138. $io->writeError("\n".'<error>Installation failed, deleting '.$file.'.</error>');
  4139. unlink($json->getPath());
  4140. } else {
  4141. $io->writeError("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
  4142. file_put_contents($json->getPath(), $composerBackup);
  4143. }
  4144. }
  4145. if ($exception) {
  4146. throw $exception;
  4147. }
  4148. return $status;
  4149. }
  4150. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4151. {
  4152. $contents = file_get_contents($json->getPath());
  4153. $manipulator = new JsonManipulator($contents);
  4154. foreach ($new as $package => $constraint) {
  4155. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4156. return false;
  4157. }
  4158. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4159. return false;
  4160. }
  4161. }
  4162. file_put_contents($json->getPath(), $manipulator->getContents());
  4163. return true;
  4164. }
  4165. protected function interact(InputInterface $input, OutputInterface $output)
  4166. {
  4167. return;
  4168. }
  4169. }
  4170. <?php
  4171. namespace Composer\Command;
  4172. use Composer\Script\Event as ScriptEvent;
  4173. use Composer\Script\ScriptEvents;
  4174. use Composer\Util\ProcessExecutor;
  4175. use Symfony\Component\Console\Input\InputInterface;
  4176. use Symfony\Component\Console\Input\InputOption;
  4177. use Symfony\Component\Console\Input\InputArgument;
  4178. use Symfony\Component\Console\Output\OutputInterface;
  4179. class RunScriptCommand extends BaseCommand
  4180. {
  4181. protected $scriptEvents = array(
  4182. ScriptEvents::PRE_INSTALL_CMD,
  4183. ScriptEvents::POST_INSTALL_CMD,
  4184. ScriptEvents::PRE_UPDATE_CMD,
  4185. ScriptEvents::POST_UPDATE_CMD,
  4186. ScriptEvents::PRE_STATUS_CMD,
  4187. ScriptEvents::POST_STATUS_CMD,
  4188. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4189. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4190. ScriptEvents::PRE_ARCHIVE_CMD,
  4191. ScriptEvents::POST_ARCHIVE_CMD,
  4192. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4193. ScriptEvents::POST_AUTOLOAD_DUMP,
  4194. );
  4195. protected function configure()
  4196. {
  4197. $this
  4198. ->setName('run-script')
  4199. ->setDescription('Run the scripts defined in composer.json.')
  4200. ->setDefinition(array(
  4201. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4202. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4203. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4204. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4205. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4206. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4207. ))
  4208. ->setHelp(<<<EOT
  4209. The <info>run-script</info> command runs scripts defined in composer.json:
  4210. <info>php composer.phar run-script post-update-cmd</info>
  4211. EOT
  4212. )
  4213. ;
  4214. }
  4215. protected function execute(InputInterface $input, OutputInterface $output)
  4216. {
  4217. if ($input->getOption('list')) {
  4218. return $this->listScripts();
  4219. } elseif (!$input->getArgument('script')) {
  4220. throw new \RuntimeException('Missing required argument "script"');
  4221. }
  4222. $script = $input->getArgument('script');
  4223. if (!in_array($script, $this->scriptEvents)) {
  4224. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4225. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4226. }
  4227. }
  4228. $composer = $this->getComposer();
  4229. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4230. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4231. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4232. if (!$hasListeners) {
  4233. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4234. }
  4235. $args = $input->getArgument('args');
  4236. if (!is_null($timeout = $input->getOption('timeout'))) {
  4237. if (!ctype_digit($timeout)) {
  4238. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4239. }
  4240. ProcessExecutor::setTimeout((int) $timeout);
  4241. }
  4242. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4243. }
  4244. protected function listScripts()
  4245. {
  4246. $scripts = $this->getComposer()->getPackage()->getScripts();
  4247. if (!count($scripts)) {
  4248. return 0;
  4249. }
  4250. $io = $this->getIO();
  4251. $io->writeError('<info>scripts:</info>');
  4252. foreach ($scripts as $name => $script) {
  4253. $io->write(' ' . $name);
  4254. }
  4255. return 0;
  4256. }
  4257. }
  4258. <?php
  4259. namespace Composer\Command;
  4260. use Symfony\Component\Console\Input\InputInterface;
  4261. use Symfony\Component\Console\Input\InputOption;
  4262. use Symfony\Component\Console\Input\InputArgument;
  4263. use Symfony\Component\Console\Output\OutputInterface;
  4264. class ScriptAliasCommand extends BaseCommand
  4265. {
  4266. private $script;
  4267. public function __construct($script)
  4268. {
  4269. $this->script = $script;
  4270. parent::__construct();
  4271. }
  4272. protected function configure()
  4273. {
  4274. $this
  4275. ->setName($this->script)
  4276. ->setDescription('Run the '.$this->script.' script as defined in composer.json.')
  4277. ->setDefinition(array(
  4278. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4279. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4280. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4281. ))
  4282. ->setHelp(<<<EOT
  4283. The <info>run-script</info> command runs scripts defined in composer.json:
  4284. <info>php composer.phar run-script post-update-cmd</info>
  4285. EOT
  4286. )
  4287. ;
  4288. }
  4289. protected function execute(InputInterface $input, OutputInterface $output)
  4290. {
  4291. $composer = $this->getComposer();
  4292. $args = $input->getArguments();
  4293. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4294. }
  4295. }
  4296. <?php
  4297. namespace Composer\Command;
  4298. use Composer\Factory;
  4299. use Symfony\Component\Console\Input\InputInterface;
  4300. use Symfony\Component\Console\Input\InputArgument;
  4301. use Symfony\Component\Console\Input\InputOption;
  4302. use Symfony\Component\Console\Output\OutputInterface;
  4303. use Composer\Repository\CompositeRepository;
  4304. use Composer\Repository\PlatformRepository;
  4305. use Composer\Repository\RepositoryInterface;
  4306. use Composer\Plugin\CommandEvent;
  4307. use Composer\Plugin\PluginEvents;
  4308. class SearchCommand extends BaseCommand
  4309. {
  4310. protected $matches;
  4311. protected $lowMatches = array();
  4312. protected $tokens;
  4313. protected $output;
  4314. protected $onlyName;
  4315. protected function configure()
  4316. {
  4317. $this
  4318. ->setName('search')
  4319. ->setDescription('Search for packages.')
  4320. ->setDefinition(array(
  4321. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4322. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4323. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4324. ))
  4325. ->setHelp(<<<EOT
  4326. The search command searches for packages by its name
  4327. <info>php composer.phar search symfony composer</info>
  4328. EOT
  4329. )
  4330. ;
  4331. }
  4332. protected function execute(InputInterface $input, OutputInterface $output)
  4333. {
  4334. $platformRepo = new PlatformRepository;
  4335. $io = $this->getIO();
  4336. if (!($composer = $this->getComposer(false))) {
  4337. $composer = Factory::create($this->getIO(), array());
  4338. }
  4339. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4340. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4341. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4342. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4343. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4344. $onlyName = $input->getOption('only-name');
  4345. $type = $input->getOption('type') ?: null;
  4346. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4347. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4348. foreach ($results as $result) {
  4349. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4350. }
  4351. }
  4352. }
  4353. <?php
  4354. namespace Composer\Command;
  4355. use Composer\Composer;
  4356. use Composer\Factory;
  4357. use Composer\Config;
  4358. use Composer\Util\Filesystem;
  4359. use Composer\SelfUpdate\Keys;
  4360. use Composer\SelfUpdate\Versions;
  4361. use Composer\IO\IOInterface;
  4362. use Composer\Downloader\FilesystemException;
  4363. use Symfony\Component\Console\Input\InputInterface;
  4364. use Symfony\Component\Console\Input\InputOption;
  4365. use Symfony\Component\Console\Input\InputArgument;
  4366. use Symfony\Component\Console\Output\OutputInterface;
  4367. use Symfony\Component\Finder\Finder;
  4368. class SelfUpdateCommand extends BaseCommand
  4369. {
  4370. const HOMEPAGE = 'getcomposer.org';
  4371. const OLD_INSTALL_EXT = '-old.phar';
  4372. protected function configure()
  4373. {
  4374. $this
  4375. ->setName('self-update')
  4376. ->setAliases(array('selfupdate'))
  4377. ->setDescription('Updates composer.phar to the latest version.')
  4378. ->setDefinition(array(
  4379. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4380. 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'),
  4381. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4382. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4383. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4384. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4385. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4386. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4387. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4388. ))
  4389. ->setHelp(<<<EOT
  4390. The <info>self-update</info> command checks getcomposer.org for newer
  4391. versions of composer and if found, installs the latest.
  4392. <info>php composer.phar self-update</info>
  4393. EOT
  4394. )
  4395. ;
  4396. }
  4397. protected function execute(InputInterface $input, OutputInterface $output)
  4398. {
  4399. $config = Factory::createConfig();
  4400. if ($config->get('disable-tls') === true) {
  4401. $baseUrl = 'http://' . self::HOMEPAGE;
  4402. } else {
  4403. $baseUrl = 'https://' . self::HOMEPAGE;
  4404. }
  4405. $io = $this->getIO();
  4406. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4407. $versionsUtil = new Versions($config, $remoteFilesystem);
  4408. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4409. if ($input->getOption($channel)) {
  4410. $versionsUtil->setChannel($channel);
  4411. }
  4412. }
  4413. if ($input->getOption('set-channel-only')) {
  4414. return 0;
  4415. }
  4416. $cacheDir = $config->get('cache-dir');
  4417. $rollbackDir = $config->get('data-dir');
  4418. $home = $config->get('home');
  4419. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4420. if ($input->getOption('update-keys')) {
  4421. return $this->fetchKeys($io, $config);
  4422. }
  4423. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4424. if (!is_writable($tmpDir)) {
  4425. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4426. }
  4427. if ($input->getOption('rollback')) {
  4428. return $this->rollback($output, $rollbackDir, $localFilename);
  4429. }
  4430. $latest = $versionsUtil->getLatest();
  4431. $latestVersion = $latest['version'];
  4432. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4433. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4434. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4435. return 1;
  4436. }
  4437. if (Composer::VERSION === $updateVersion) {
  4438. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4439. if ($input->getOption('clean-backups')) {
  4440. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4441. }
  4442. return 0;
  4443. }
  4444. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4445. $backupFile = sprintf(
  4446. '%s/%s-%s%s',
  4447. $rollbackDir,
  4448. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4449. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4450. self::OLD_INSTALL_EXT
  4451. );
  4452. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4453. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4454. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4455. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4456. $io->writeError(' ', false);
  4457. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4458. $io->writeError('');
  4459. if (!file_exists($tempFilename) || !$signature) {
  4460. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4461. return 1;
  4462. }
  4463. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4464. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4465. } else {
  4466. if (!extension_loaded('openssl')) {
  4467. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4468. . '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.');
  4469. }
  4470. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4471. if (!file_exists($sigFile)) {
  4472. file_put_contents($home.'/keys.dev.pub', <<<DEVPUBKEY
  4473. -----BEGIN PUBLIC KEY-----
  4474. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4475. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4476. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4477. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4478. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4479. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4480. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4481. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4482. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4483. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4484. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4485. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4486. -----END PUBLIC KEY-----
  4487. DEVPUBKEY
  4488. );
  4489. file_put_contents($home.'/keys.tags.pub', <<<TAGSPUBKEY
  4490. -----BEGIN PUBLIC KEY-----
  4491. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4492. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4493. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4494. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4495. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4496. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4497. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4498. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4499. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4500. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4501. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4502. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4503. -----END PUBLIC KEY-----
  4504. TAGSPUBKEY
  4505. );
  4506. }
  4507. $pubkeyid = openssl_pkey_get_public($sigFile);
  4508. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4509. if (!in_array('SHA384', openssl_get_md_methods())) {
  4510. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  4511. }
  4512. $signature = json_decode($signature, true);
  4513. $signature = base64_decode($signature['sha384']);
  4514. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  4515. openssl_free_key($pubkeyid);
  4516. if (!$verified) {
  4517. 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');
  4518. }
  4519. }
  4520. if ($input->getOption('clean-backups')) {
  4521. $this->cleanBackups($rollbackDir);
  4522. }
  4523. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  4524. @unlink($tempFilename);
  4525. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  4526. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  4527. return 1;
  4528. }
  4529. if (file_exists($backupFile)) {
  4530. $io->writeError('Use <info>composer self-update --rollback</info> to return to version '.Composer::VERSION);
  4531. } else {
  4532. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  4533. }
  4534. }
  4535. protected function fetchKeys(IOInterface $io, Config $config)
  4536. {
  4537. if (!$io->isInteractive()) {
  4538. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  4539. }
  4540. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  4541. $validator = function ($value) {
  4542. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  4543. throw new \UnexpectedValueException('Invalid input');
  4544. }
  4545. return trim($value)."\n";
  4546. };
  4547. $devKey = '';
  4548. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  4549. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  4550. while ($line = $io->ask('')) {
  4551. $devKey .= trim($line)."\n";
  4552. if (trim($line) === '-----END PUBLIC KEY-----') {
  4553. break;
  4554. }
  4555. }
  4556. }
  4557. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  4558. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4559. $tagsKey = '';
  4560. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  4561. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  4562. while ($line = $io->ask('')) {
  4563. $tagsKey .= trim($line)."\n";
  4564. if (trim($line) === '-----END PUBLIC KEY-----') {
  4565. break;
  4566. }
  4567. }
  4568. }
  4569. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  4570. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4571. $io->write('Public keys stored in '.$config->get('home'));
  4572. }
  4573. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  4574. {
  4575. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  4576. if (!$rollbackVersion) {
  4577. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  4578. }
  4579. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  4580. if (!is_file($oldFile)) {
  4581. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  4582. }
  4583. if (!is_readable($oldFile)) {
  4584. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  4585. }
  4586. $io = $this->getIO();
  4587. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  4588. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  4589. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  4590. return 1;
  4591. }
  4592. return 0;
  4593. }
  4594. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  4595. {
  4596. try {
  4597. @chmod($newFilename, fileperms($localFilename));
  4598. if (!ini_get('phar.readonly')) {
  4599. $phar = new \Phar($newFilename);
  4600. unset($phar);
  4601. }
  4602. if ($backupTarget && file_exists($localFilename)) {
  4603. @copy($localFilename, $backupTarget);
  4604. }
  4605. rename($newFilename, $localFilename);
  4606. return null;
  4607. } catch (\Exception $e) {
  4608. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  4609. throw $e;
  4610. }
  4611. return $e;
  4612. }
  4613. }
  4614. protected function cleanBackups($rollbackDir, $except = null)
  4615. {
  4616. $finder = $this->getOldInstallationFinder($rollbackDir);
  4617. $io = $this->getIO();
  4618. $fs = new Filesystem;
  4619. foreach ($finder as $file) {
  4620. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  4621. continue;
  4622. }
  4623. $file = (string) $file;
  4624. $io->writeError('<info>Removing: '.$file.'</info>');
  4625. $fs->remove($file);
  4626. }
  4627. }
  4628. protected function getLastBackupVersion($rollbackDir)
  4629. {
  4630. $finder = $this->getOldInstallationFinder($rollbackDir);
  4631. $finder->sortByName();
  4632. $files = iterator_to_array($finder);
  4633. if (count($files)) {
  4634. return basename(end($files), self::OLD_INSTALL_EXT);
  4635. }
  4636. return false;
  4637. }
  4638. protected function getOldInstallationFinder($rollbackDir)
  4639. {
  4640. $finder = Finder::create()
  4641. ->depth(0)
  4642. ->files()
  4643. ->name('*' . self::OLD_INSTALL_EXT)
  4644. ->in($rollbackDir);
  4645. return $finder;
  4646. }
  4647. }
  4648. <?php
  4649. namespace Composer\Command;
  4650. use Composer\DependencyResolver\Pool;
  4651. use Composer\DependencyResolver\DefaultPolicy;
  4652. use Composer\Json\JsonFile;
  4653. use Composer\Package\CompletePackageInterface;
  4654. use Composer\Package\Version\VersionParser;
  4655. use Composer\Package\BasePackage;
  4656. use Composer\Package\Version\VersionSelector;
  4657. use Composer\Plugin\CommandEvent;
  4658. use Composer\Plugin\PluginEvents;
  4659. use Composer\Package\PackageInterface;
  4660. use Composer\Semver\Constraint\ConstraintInterface;
  4661. use Composer\Util\Platform;
  4662. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  4663. use Symfony\Component\Console\Input\InputInterface;
  4664. use Symfony\Component\Console\Input\InputArgument;
  4665. use Symfony\Component\Console\Input\InputOption;
  4666. use Symfony\Component\Console\Output\OutputInterface;
  4667. use Composer\Repository\ArrayRepository;
  4668. use Composer\Repository\CompositeRepository;
  4669. use Composer\Repository\ComposerRepository;
  4670. use Composer\Repository\PlatformRepository;
  4671. use Composer\Repository\RepositoryInterface;
  4672. use Composer\Repository\RepositoryFactory;
  4673. use Composer\Spdx\SpdxLicenses;
  4674. use Composer\Composer;
  4675. use Composer\Semver\Semver;
  4676. class ShowCommand extends BaseCommand
  4677. {
  4678. protected $versionParser;
  4679. protected $colors;
  4680. private $pool;
  4681. protected function configure()
  4682. {
  4683. $this
  4684. ->setName('show')
  4685. ->setAliases(array('info'))
  4686. ->setDescription('Show information about packages.')
  4687. ->setDefinition(array(
  4688. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4689. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  4690. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  4691. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  4692. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  4693. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  4694. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  4695. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  4696. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  4697. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  4698. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  4699. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  4700. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4701. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4702. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4703. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4704. ))
  4705. ->setHelp(<<<EOT
  4706. The show command displays detailed information about a package, or
  4707. lists all packages available.
  4708. EOT
  4709. )
  4710. ;
  4711. }
  4712. protected function execute(InputInterface $input, OutputInterface $output)
  4713. {
  4714. $this->versionParser = new VersionParser;
  4715. if ($input->getOption('tree')) {
  4716. $this->initStyles($output);
  4717. }
  4718. $composer = $this->getComposer(false);
  4719. $io = $this->getIO();
  4720. if ($input->getOption('installed')) {
  4721. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  4722. }
  4723. if ($input->getOption('outdated')) {
  4724. $input->setOption('latest', true);
  4725. }
  4726. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  4727. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  4728. return 1;
  4729. }
  4730. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  4731. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  4732. return 1;
  4733. }
  4734. $format = $input->getOption('format');
  4735. if (!in_array($format, array('text', 'json'))) {
  4736. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4737. return 1;
  4738. }
  4739. $platformOverrides = array();
  4740. if ($composer) {
  4741. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4742. }
  4743. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  4744. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  4745. if ($input->getOption('self')) {
  4746. $package = $this->getComposer()->getPackage();
  4747. $repos = $installedRepo = new ArrayRepository(array($package));
  4748. } elseif ($input->getOption('platform')) {
  4749. $repos = $installedRepo = $platformRepo;
  4750. } elseif ($input->getOption('available')) {
  4751. $installedRepo = $platformRepo;
  4752. if ($composer) {
  4753. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  4754. } else {
  4755. $defaultRepos = RepositoryFactory::defaultRepos($io);
  4756. $repos = new CompositeRepository($defaultRepos);
  4757. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  4758. }
  4759. } elseif ($input->getOption('all') && $composer) {
  4760. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4761. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4762. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4763. } elseif ($input->getOption('all')) {
  4764. $defaultRepos = RepositoryFactory::defaultRepos($io);
  4765. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  4766. $installedRepo = $platformRepo;
  4767. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  4768. } else {
  4769. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  4770. }
  4771. if ($composer) {
  4772. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  4773. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4774. }
  4775. if ($input->getOption('latest') && null === $composer) {
  4776. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  4777. $input->setOption('latest', false);
  4778. }
  4779. $packageFilter = $input->getArgument('package');
  4780. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  4781. if ('json' === $format) {
  4782. $io->writeError('Format "json" is only supported for package listings, falling back to format "text"');
  4783. }
  4784. if (empty($package)) {
  4785. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  4786. if (empty($package)) {
  4787. $options = $input->getOptions();
  4788. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  4789. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  4790. }
  4791. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  4792. return 1;
  4793. }
  4794. } else {
  4795. $versions = array($package->getPrettyVersion() => $package->getVersion());
  4796. }
  4797. if ($input->getOption('tree')) {
  4798. $this->displayPackageTree($package, $installedRepo, $repos);
  4799. } else {
  4800. $latestPackage = null;
  4801. if ($input->getOption('latest')) {
  4802. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  4803. }
  4804. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  4805. $this->printLinks($package, 'requires');
  4806. $this->printLinks($package, 'devRequires', 'requires (dev)');
  4807. if ($package->getSuggests()) {
  4808. $io->write("\n<info>suggests</info>");
  4809. foreach ($package->getSuggests() as $suggested => $reason) {
  4810. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  4811. }
  4812. }
  4813. $this->printLinks($package, 'provides');
  4814. $this->printLinks($package, 'conflicts');
  4815. $this->printLinks($package, 'replaces');
  4816. }
  4817. return;
  4818. }
  4819. if ($input->getOption('tree')) {
  4820. if ('json' === $format) {
  4821. $io->writeError('Format "json" is only supported for package listings, falling back to format "text"');
  4822. }
  4823. $rootRequires = $this->getRootRequires();
  4824. foreach ($installedRepo->getPackages() as $package) {
  4825. if (in_array($package->getName(), $rootRequires, true)) {
  4826. $this->displayPackageTree($package, $installedRepo, $repos);
  4827. }
  4828. }
  4829. return 0;
  4830. }
  4831. if ($repos instanceof CompositeRepository) {
  4832. $repos = $repos->getRepositories();
  4833. } elseif (!is_array($repos)) {
  4834. $repos = array($repos);
  4835. }
  4836. $packages = array();
  4837. if (null !== $packageFilter) {
  4838. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  4839. }
  4840. $packageListFilter = array();
  4841. if ($input->getOption('direct')) {
  4842. $packageListFilter = $this->getRootRequires();
  4843. }
  4844. list($width) = $this->getApplication()->getTerminalDimensions();
  4845. if (null === $width) {
  4846. $width = PHP_INT_MAX;
  4847. }
  4848. if (Platform::isWindows()) {
  4849. $width--;
  4850. } else {
  4851. $width = max(80, $width);
  4852. }
  4853. if ($input->getOption('path') && null === $composer) {
  4854. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  4855. $input->setOption('path', false);
  4856. }
  4857. foreach ($repos as $repo) {
  4858. if ($repo === $platformRepo) {
  4859. $type = 'platform';
  4860. } elseif (
  4861. $repo === $installedRepo
  4862. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  4863. ) {
  4864. $type = 'installed';
  4865. } else {
  4866. $type = 'available';
  4867. }
  4868. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  4869. foreach ($repo->getProviderNames() as $name) {
  4870. if (!$packageFilter || preg_match($packageFilter, $name)) {
  4871. $packages[$type][$name] = $name;
  4872. }
  4873. }
  4874. } else {
  4875. foreach ($repo->getPackages() as $package) {
  4876. if (!isset($packages[$type][$package->getName()])
  4877. || !is_object($packages[$type][$package->getName()])
  4878. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  4879. ) {
  4880. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  4881. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  4882. $packages[$type][$package->getName()] = $package;
  4883. }
  4884. }
  4885. }
  4886. }
  4887. }
  4888. }
  4889. $showAllTypes = $input->getOption('all');
  4890. $showLatest = $input->getOption('latest');
  4891. $showMinorOnly = $input->getOption('minor-only');
  4892. $indent = $showAllTypes ? ' ' : '';
  4893. $latestPackages = array();
  4894. $exitCode = 0;
  4895. $viewData = array();
  4896. $viewMetaData = array();
  4897. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  4898. if (isset($packages[$type])) {
  4899. ksort($packages[$type]);
  4900. $nameLength = $versionLength = $latestLength = 0;
  4901. foreach ($packages[$type] as $package) {
  4902. if (is_object($package)) {
  4903. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  4904. if ($showVersion) {
  4905. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  4906. if ($showLatest) {
  4907. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  4908. if ($latestPackage === false) {
  4909. continue;
  4910. }
  4911. $latestPackages[$package->getPrettyName()] = $latestPackage;
  4912. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  4913. }
  4914. }
  4915. } else {
  4916. $nameLength = max($nameLength, strlen($package));
  4917. }
  4918. }
  4919. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  4920. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  4921. $writeLatest = $writeVersion && $showLatest;
  4922. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  4923. $hasOutdatedPackages = false;
  4924. $viewData[$type] = array();
  4925. $viewMetaData[$type] = array(
  4926. 'nameLength' => $nameLength,
  4927. 'versionLength' => $versionLength,
  4928. 'latestLength' => $latestLength,
  4929. );
  4930. foreach ($packages[$type] as $package) {
  4931. $packageViewData = array();
  4932. if (is_object($package)) {
  4933. $latestPackage = null;
  4934. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  4935. $latestPackage = $latestPackages[$package->getPrettyName()];
  4936. }
  4937. if ($input->getOption('outdated') && $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  4938. continue;
  4939. } elseif ($input->getOption('outdated')) {
  4940. $hasOutdatedPackages = true;
  4941. }
  4942. $packageViewData['name'] = $package->getPrettyName();
  4943. if ($writeVersion) {
  4944. $packageViewData['version'] = $package->getFullPrettyVersion();
  4945. }
  4946. if ($writeLatest && $latestPackage) {
  4947. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  4948. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  4949. }
  4950. if ($writeDescription) {
  4951. $packageViewData['description'] = $package->getDescription();
  4952. }
  4953. if ($writePath) {
  4954. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  4955. }
  4956. if ($latestPackage && $latestPackage->isAbandoned()) {
  4957. $replacement = (is_string($latestPackage->getReplacementPackage()))
  4958. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  4959. : 'No replacement was suggested';
  4960. $packageWarning = sprintf(
  4961. 'Package %s is abandoned, you should avoid using it. %s.',
  4962. $package->getPrettyName(),
  4963. $replacement
  4964. );
  4965. $packageViewData['warning'] = $packageWarning;
  4966. }
  4967. } else {
  4968. $packageViewData['name'] = $package;
  4969. }
  4970. $viewData[$type][] = $packageViewData;
  4971. }
  4972. if ($input->getOption('strict') && $hasOutdatedPackages) {
  4973. $exitCode = 1;
  4974. break;
  4975. }
  4976. }
  4977. }
  4978. if ('json' === $format) {
  4979. $io->write(JsonFile::encode($viewData));
  4980. } else {
  4981. foreach ($viewData as $type => $packages) {
  4982. $nameLength = $viewMetaData[$type]['nameLength'];
  4983. $versionLength = $viewMetaData[$type]['versionLength'];
  4984. $latestLength = $viewMetaData[$type]['latestLength'];
  4985. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  4986. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  4987. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  4988. if ($writeLatest && !$io->isDecorated()) {
  4989. $latestLength += 2;
  4990. }
  4991. if ($showAllTypes) {
  4992. if ('available' === $type) {
  4993. $io->write('<comment>' . $type . '</comment>:');
  4994. } else {
  4995. $io->write('<info>' . $type . '</info>:');
  4996. }
  4997. }
  4998. foreach ($packages as $package) {
  4999. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5000. if (isset($package['version']) && $writeVersion) {
  5001. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5002. }
  5003. if (isset($package['latest']) && $writeLatest) {
  5004. $latestVersion = $package['latest'];
  5005. $updateStatus = $package['latest-status'];
  5006. $style = $this->updateStatusToVersionStyle($updateStatus);
  5007. if (!$io->isDecorated()) {
  5008. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5009. }
  5010. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5011. }
  5012. if (isset($package['description']) && $writeDescription) {
  5013. $description = strtok($package['description'], "\r\n");
  5014. $remaining = $width - $nameLength - $versionLength - 4;
  5015. if ($writeLatest) {
  5016. $remaining -= $latestLength;
  5017. }
  5018. if (strlen($description) > $remaining) {
  5019. $description = substr($description, 0, $remaining - 3) . '...';
  5020. }
  5021. $io->write(' ' . $description, false);
  5022. }
  5023. if (isset($package['path'])) {
  5024. $io->write(' ' . $package['path'], false);
  5025. }
  5026. $io->write('');
  5027. if (isset($package['warning'])) {
  5028. $io->write('<warning>' . $package['warning'] . '</warning>');
  5029. }
  5030. }
  5031. if ($showAllTypes) {
  5032. $io->write('');
  5033. }
  5034. }
  5035. }
  5036. return $exitCode;
  5037. }
  5038. protected function getRootRequires()
  5039. {
  5040. $rootPackage = $this->getComposer()->getPackage();
  5041. return array_map(
  5042. 'strtolower',
  5043. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5044. );
  5045. }
  5046. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5047. {
  5048. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5049. }
  5050. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5051. {
  5052. $name = strtolower($name);
  5053. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5054. $policy = new DefaultPolicy();
  5055. $pool = new Pool('dev');
  5056. $pool->addRepository($repos);
  5057. $matchedPackage = null;
  5058. $versions = array();
  5059. $matches = $pool->whatProvides($name, $constraint);
  5060. foreach ($matches as $index => $package) {
  5061. if ($package->getName() !== $name) {
  5062. unset($matches[$index]);
  5063. continue;
  5064. }
  5065. if (null === $version && $installedRepo->hasPackage($package)) {
  5066. $matchedPackage = $package;
  5067. }
  5068. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5069. $matches[$index] = $package->getId();
  5070. }
  5071. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5072. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5073. }
  5074. return array($matchedPackage, $versions);
  5075. }
  5076. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5077. {
  5078. $io = $this->getIO();
  5079. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5080. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5081. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5082. $this->printVersions($package, $versions, $installedRepo);
  5083. if ($latestPackage) {
  5084. $style = $this->getVersionStyle($latestPackage, $package);
  5085. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5086. } else {
  5087. $latestPackage = $package;
  5088. }
  5089. $io->write('<info>type</info> : ' . $package->getType());
  5090. $this->printLicenses($package);
  5091. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5092. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5093. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5094. if ($latestPackage->isAbandoned()) {
  5095. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5096. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5097. : null;
  5098. $io->writeError(
  5099. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5100. );
  5101. }
  5102. if ($package->getSupport()) {
  5103. $io->write("\n<info>support</info>");
  5104. foreach ($package->getSupport() as $type => $value) {
  5105. $io->write('<comment>' . $type . '</comment> : '.$value);
  5106. }
  5107. }
  5108. if ($package->getAutoload()) {
  5109. $io->write("\n<info>autoload</info>");
  5110. foreach ($package->getAutoload() as $type => $autoloads) {
  5111. $io->write('<comment>' . $type . '</comment>');
  5112. if ($type === 'psr-0') {
  5113. foreach ($autoloads as $name => $path) {
  5114. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5115. }
  5116. } elseif ($type === 'psr-4') {
  5117. foreach ($autoloads as $name => $path) {
  5118. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5119. }
  5120. } elseif ($type === 'classmap') {
  5121. $io->write(implode(', ', $autoloads));
  5122. }
  5123. }
  5124. if ($package->getIncludePaths()) {
  5125. $io->write('<comment>include-path</comment>');
  5126. $io->write(implode(', ', $package->getIncludePaths()));
  5127. }
  5128. }
  5129. }
  5130. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5131. {
  5132. uasort($versions, 'version_compare');
  5133. $versions = array_keys(array_reverse($versions));
  5134. if ($installedRepo->hasPackage($package)) {
  5135. $installedVersion = $package->getPrettyVersion();
  5136. $key = array_search($installedVersion, $versions);
  5137. if (false !== $key) {
  5138. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5139. }
  5140. }
  5141. $versions = implode(', ', $versions);
  5142. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5143. }
  5144. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5145. {
  5146. $title = $title ?: $linkType;
  5147. $io = $this->getIO();
  5148. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5149. $io->write("\n<info>" . $title . "</info>");
  5150. foreach ($links as $link) {
  5151. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5152. }
  5153. }
  5154. }
  5155. protected function printLicenses(CompletePackageInterface $package)
  5156. {
  5157. $spdxLicenses = new SpdxLicenses();
  5158. $licenses = $package->getLicense();
  5159. $io = $this->getIO();
  5160. foreach ($licenses as $licenseId) {
  5161. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5162. if (!$license) {
  5163. $out = $licenseId;
  5164. } else {
  5165. if ($license[1] === true) {
  5166. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5167. } else {
  5168. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5169. }
  5170. }
  5171. $io->write('<info>license</info> : ' . $out);
  5172. }
  5173. }
  5174. protected function initStyles(OutputInterface $output)
  5175. {
  5176. $this->colors = array(
  5177. 'green',
  5178. 'yellow',
  5179. 'cyan',
  5180. 'magenta',
  5181. 'blue',
  5182. );
  5183. foreach ($this->colors as $color) {
  5184. $style = new OutputFormatterStyle($color);
  5185. $output->getFormatter()->setStyle($color, $style);
  5186. }
  5187. }
  5188. protected function displayPackageTree(PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos)
  5189. {
  5190. $io = $this->getIO();
  5191. $io->write(sprintf('<info>%s</info>', $package->getPrettyName()), false);
  5192. $io->write(' ' . $package->getPrettyVersion(), false);
  5193. $io->write(' ' . strtok($package->getDescription(), "\r\n"));
  5194. if (is_object($package)) {
  5195. $requires = $package->getRequires();
  5196. $treeBar = '├';
  5197. $j = 0;
  5198. $total = count($requires);
  5199. foreach ($requires as $requireName => $require) {
  5200. $j++;
  5201. if ($j == 0) {
  5202. $this->writeTreeLine($treeBar);
  5203. }
  5204. if ($j == $total) {
  5205. $treeBar = 'â””';
  5206. }
  5207. $level = 1;
  5208. $color = $this->colors[$level];
  5209. $info = sprintf('%s──<%s>%s</%s> %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint());
  5210. $this->writeTreeLine($info);
  5211. $treeBar = str_replace('â””', ' ', $treeBar);
  5212. $packagesInTree = array($package->getName(), $requireName);
  5213. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree, $treeBar, $level + 1);
  5214. }
  5215. }
  5216. }
  5217. protected function displayTree($name, $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos, array $packagesInTree, $previousTreeBar = '├', $level = 1)
  5218. {
  5219. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5220. list($package, $versions) = $this->getPackage($installedRepo, $distantRepos, $name, $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint());
  5221. if (is_object($package)) {
  5222. $requires = $package->getRequires();
  5223. $treeBar = $previousTreeBar . ' ├';
  5224. $i = 0;
  5225. $total = count($requires);
  5226. foreach ($requires as $requireName => $require) {
  5227. $currentTree = $packagesInTree;
  5228. $i++;
  5229. if ($i == $total) {
  5230. $treeBar = $previousTreeBar . ' â””';
  5231. }
  5232. $colorIdent = $level % count($this->colors);
  5233. $color = $this->colors[$colorIdent];
  5234. $circularWarn = in_array($requireName, $currentTree) ? '(circular dependency aborted here)' : '';
  5235. $info = rtrim(sprintf('%s──<%s>%s</%s> %s %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint(), $circularWarn));
  5236. $this->writeTreeLine($info);
  5237. $treeBar = str_replace('â””', ' ', $treeBar);
  5238. if (!in_array($requireName, $currentTree)) {
  5239. $currentTree[] = $requireName;
  5240. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $currentTree, $treeBar, $level + 1);
  5241. }
  5242. }
  5243. }
  5244. }
  5245. private function updateStatusToVersionStyle($updateStatus)
  5246. {
  5247. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5248. }
  5249. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5250. {
  5251. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5252. return 'up-to-date';
  5253. }
  5254. $constraint = $package->getVersion();
  5255. if (0 !== strpos($constraint, 'dev-')) {
  5256. $constraint = '^'.$constraint;
  5257. }
  5258. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5259. return 'semver-safe-update';
  5260. }
  5261. return 'update-possible';
  5262. }
  5263. private function writeTreeLine($line)
  5264. {
  5265. $io = $this->getIO();
  5266. if (!$io->isDecorated()) {
  5267. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5268. }
  5269. $io->write($line);
  5270. }
  5271. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5272. {
  5273. $name = $package->getName();
  5274. $versionSelector = new VersionSelector($this->getPool($composer));
  5275. $stability = $composer->getPackage()->getMinimumStability();
  5276. $flags = $composer->getPackage()->getStabilityFlags();
  5277. if (isset($flags[$name])) {
  5278. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5279. }
  5280. $bestStability = $stability;
  5281. if ($composer->getPackage()->getPreferStable()) {
  5282. $bestStability = $package->getStability();
  5283. }
  5284. $targetVersion = null;
  5285. if (0 === strpos($package->getVersion(), 'dev-')) {
  5286. $targetVersion = $package->getVersion();
  5287. }
  5288. if ($targetVersion === null && $minorOnly) {
  5289. $targetVersion = '^' . $package->getVersion();
  5290. }
  5291. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5292. }
  5293. private function getPool(Composer $composer)
  5294. {
  5295. if (!$this->pool) {
  5296. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5297. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5298. }
  5299. return $this->pool;
  5300. }
  5301. }
  5302. <?php
  5303. namespace Composer\Command;
  5304. use Symfony\Component\Console\Input\InputInterface;
  5305. use Symfony\Component\Console\Input\InputOption;
  5306. use Symfony\Component\Console\Output\OutputInterface;
  5307. use Composer\Downloader\ChangeReportInterface;
  5308. use Composer\Downloader\DvcsDownloaderInterface;
  5309. use Composer\Downloader\VcsCapableDownloaderInterface;
  5310. use Composer\Package\Dumper\ArrayDumper;
  5311. use Composer\Package\Version\VersionGuesser;
  5312. use Composer\Package\Version\VersionParser;
  5313. use Composer\Plugin\CommandEvent;
  5314. use Composer\Plugin\PluginEvents;
  5315. use Composer\Script\ScriptEvents;
  5316. use Composer\Util\ProcessExecutor;
  5317. class StatusCommand extends BaseCommand
  5318. {
  5319. const EXIT_CODE_ERRORS = 1;
  5320. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5321. const EXIT_CODE_VERSION_CHANGES = 4;
  5322. protected function configure()
  5323. {
  5324. $this
  5325. ->setName('status')
  5326. ->setDescription('Show a list of locally modified packages.')
  5327. ->setDefinition(array(
  5328. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5329. ))
  5330. ->setHelp(<<<EOT
  5331. The status command displays a list of dependencies that have
  5332. been modified locally.
  5333. EOT
  5334. )
  5335. ;
  5336. }
  5337. protected function execute(InputInterface $input, OutputInterface $output)
  5338. {
  5339. $composer = $this->getComposer();
  5340. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5341. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5342. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5343. $dm = $composer->getDownloadManager();
  5344. $im = $composer->getInstallationManager();
  5345. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  5346. $errors = array();
  5347. $io = $this->getIO();
  5348. $unpushedChanges = array();
  5349. $vcsVersionChanges = array();
  5350. $parser = new VersionParser;
  5351. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  5352. $dumper = new ArrayDumper;
  5353. foreach ($installedRepo->getCanonicalPackages() as $package) {
  5354. $downloader = $dm->getDownloaderForInstalledPackage($package);
  5355. $targetDir = $im->getInstallPath($package);
  5356. if ($downloader instanceof ChangeReportInterface) {
  5357. if (is_link($targetDir)) {
  5358. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  5359. }
  5360. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  5361. $errors[$targetDir] = $changes;
  5362. }
  5363. }
  5364. if ($downloader instanceof VcsCapableDownloaderInterface) {
  5365. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  5366. switch ($package->getInstallationSource()) {
  5367. case 'source':
  5368. $previousRef = $package->getSourceReference();
  5369. break;
  5370. case 'dist':
  5371. $previousRef = $package->getDistReference();
  5372. break;
  5373. default:
  5374. $previousRef = null;
  5375. }
  5376. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  5377. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  5378. $vcsVersionChanges[$targetDir] = array(
  5379. 'previous' => array(
  5380. 'version' => $package->getPrettyVersion(),
  5381. 'ref' => $previousRef,
  5382. ),
  5383. 'current' => array(
  5384. 'version' => $currentVersion['pretty_version'],
  5385. 'ref' => $currentVersion['commit'],
  5386. ),
  5387. );
  5388. }
  5389. }
  5390. }
  5391. if ($downloader instanceof DvcsDownloaderInterface) {
  5392. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  5393. $unpushedChanges[$targetDir] = $unpushed;
  5394. }
  5395. }
  5396. }
  5397. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  5398. $io->writeError('<info>No local changes</info>');
  5399. return 0;
  5400. }
  5401. if ($errors) {
  5402. $io->writeError('<error>You have changes in the following dependencies:</error>');
  5403. foreach ($errors as $path => $changes) {
  5404. if ($input->getOption('verbose')) {
  5405. $indentedChanges = implode("\n", array_map(function ($line) {
  5406. return ' ' . ltrim($line);
  5407. }, explode("\n", $changes)));
  5408. $io->write('<info>'.$path.'</info>:');
  5409. $io->write($indentedChanges);
  5410. } else {
  5411. $io->write($path);
  5412. }
  5413. }
  5414. }
  5415. if ($unpushedChanges) {
  5416. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  5417. foreach ($unpushedChanges as $path => $changes) {
  5418. if ($input->getOption('verbose')) {
  5419. $indentedChanges = implode("\n", array_map(function ($line) {
  5420. return ' ' . ltrim($line);
  5421. }, explode("\n", $changes)));
  5422. $io->write('<info>'.$path.'</info>:');
  5423. $io->write($indentedChanges);
  5424. } else {
  5425. $io->write($path);
  5426. }
  5427. }
  5428. }
  5429. if ($vcsVersionChanges) {
  5430. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  5431. foreach ($vcsVersionChanges as $path => $changes) {
  5432. if ($input->getOption('verbose')) {
  5433. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  5434. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  5435. if ($io->isVeryVerbose()) {
  5436. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  5437. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  5438. }
  5439. $io->write('<info>'.$path.'</info>:');
  5440. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  5441. } else {
  5442. $io->write($path);
  5443. }
  5444. }
  5445. }
  5446. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  5447. $io->writeError('Use --verbose (-v) to see a list of files');
  5448. }
  5449. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  5450. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  5451. }
  5452. }
  5453. <?php
  5454. namespace Composer\Command;
  5455. use Composer\Repository\PlatformRepository;
  5456. use Symfony\Component\Console\Input\InputArgument;
  5457. use Symfony\Component\Console\Input\InputInterface;
  5458. use Symfony\Component\Console\Input\InputOption;
  5459. use Symfony\Component\Console\Output\OutputInterface;
  5460. class SuggestsCommand extends BaseCommand
  5461. {
  5462. protected function configure()
  5463. {
  5464. $this
  5465. ->setName('suggests')
  5466. ->setDescription('Show package suggestions.')
  5467. ->setDefinition(array(
  5468. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  5469. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  5470. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  5471. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  5472. ))
  5473. ->setHelp(<<<EOT
  5474. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  5475. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  5476. EOT
  5477. )
  5478. ;
  5479. }
  5480. protected function execute(InputInterface $input, OutputInterface $output)
  5481. {
  5482. $lock = $this->getComposer()->getLocker()->getLockData();
  5483. if (empty($lock)) {
  5484. throw new \RuntimeException('Lockfile seems to be empty?');
  5485. }
  5486. $packages = $lock['packages'];
  5487. if (!$input->getOption('no-dev')) {
  5488. $packages += $lock['packages-dev'];
  5489. }
  5490. $filter = $input->getArgument('packages');
  5491. $installed = array();
  5492. foreach ($packages as $package) {
  5493. $installed[] = $package['name'];
  5494. if (!empty($package['provide'])) {
  5495. $installed = array_merge($installed, array_keys($package['provide']));
  5496. }
  5497. if (!empty($package['replace'])) {
  5498. $installed = array_merge($installed, array_keys($package['replace']));
  5499. }
  5500. }
  5501. $installed = array_flip($installed);
  5502. ksort($installed);
  5503. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  5504. $suggesters = array();
  5505. $suggested = array();
  5506. foreach ($packages as $package) {
  5507. $packageName = $package['name'];
  5508. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  5509. continue;
  5510. }
  5511. foreach ($package['suggest'] as $suggestion => $reason) {
  5512. if (false === strpos('/', $suggestion) && !is_null($platform->findPackage($suggestion, '*'))) {
  5513. continue;
  5514. }
  5515. if (!isset($installed[$suggestion])) {
  5516. $suggesters[$packageName][$suggestion] = $reason;
  5517. $suggested[$suggestion][$packageName] = $reason;
  5518. }
  5519. }
  5520. }
  5521. ksort($suggesters);
  5522. ksort($suggested);
  5523. $mode = 0;
  5524. $io = $this->getIO();
  5525. if ($input->getOption('by-package') || $io->isVerbose()) {
  5526. $mode |= 1;
  5527. }
  5528. if ($input->getOption('by-suggestion')) {
  5529. $mode |= 2;
  5530. }
  5531. if ($mode === 0) {
  5532. foreach (array_keys($suggested) as $suggestion) {
  5533. $io->write(sprintf('<info>%s</info>', $suggestion));
  5534. }
  5535. return;
  5536. }
  5537. if ($mode & 1) {
  5538. foreach ($suggesters as $suggester => $suggestions) {
  5539. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  5540. foreach ($suggestions as $suggestion => $reason) {
  5541. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  5542. }
  5543. $io->write('');
  5544. }
  5545. }
  5546. if ($mode & 2) {
  5547. if ($mode & 1) {
  5548. $io->write(str_repeat('-', 78));
  5549. }
  5550. foreach ($suggested as $suggestion => $suggesters) {
  5551. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  5552. foreach ($suggesters as $suggester => $reason) {
  5553. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  5554. }
  5555. $io->write('');
  5556. }
  5557. }
  5558. }
  5559. }
  5560. <?php
  5561. namespace Composer\Command;
  5562. use Composer\Composer;
  5563. use Composer\Installer;
  5564. use Composer\IO\IOInterface;
  5565. use Composer\Plugin\CommandEvent;
  5566. use Composer\Plugin\PluginEvents;
  5567. use Symfony\Component\Console\Helper\Table;
  5568. use Symfony\Component\Console\Input\InputInterface;
  5569. use Symfony\Component\Console\Input\InputOption;
  5570. use Symfony\Component\Console\Input\InputArgument;
  5571. use Symfony\Component\Console\Output\OutputInterface;
  5572. use Symfony\Component\Console\Question\Question;
  5573. class UpdateCommand extends BaseCommand
  5574. {
  5575. protected function configure()
  5576. {
  5577. $this
  5578. ->setName('update')
  5579. ->setDescription('Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  5580. ->setDefinition(array(
  5581. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  5582. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5583. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  5584. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5585. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  5586. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  5587. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  5588. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  5589. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  5590. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  5591. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5592. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  5593. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist.'),
  5594. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  5595. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  5596. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5597. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5598. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  5599. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  5600. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  5601. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  5602. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  5603. ))
  5604. ->setHelp(<<<EOT
  5605. The <info>update</info> command reads the composer.json file from the
  5606. current directory, processes it, and updates, removes or installs all the
  5607. dependencies.
  5608. <info>php composer.phar update</info>
  5609. To limit the update operation to a few packages, you can list the package(s)
  5610. you want to update as such:
  5611. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  5612. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  5613. from a specific vendor:
  5614. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  5615. To select packages names interactively with auto-completion use <info>-i</info>.
  5616. EOT
  5617. )
  5618. ;
  5619. }
  5620. protected function execute(InputInterface $input, OutputInterface $output)
  5621. {
  5622. $io = $this->getIO();
  5623. if ($input->getOption('no-custom-installers')) {
  5624. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  5625. $input->setOption('no-plugins', true);
  5626. }
  5627. if ($input->getOption('dev')) {
  5628. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  5629. }
  5630. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  5631. $packages = $input->getArgument('packages');
  5632. if ($input->getOption('interactive')) {
  5633. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  5634. }
  5635. if ($input->getOption('root-reqs')) {
  5636. $require = array_keys($composer->getPackage()->getRequires());
  5637. if (!$input->getOption('no-dev')) {
  5638. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  5639. $require = array_merge($require, $requireDev);
  5640. }
  5641. if (!empty($packages)) {
  5642. $packages = array_intersect($packages, $require);
  5643. } else {
  5644. $packages = $require;
  5645. }
  5646. }
  5647. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  5648. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  5649. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5650. $install = Installer::create($io, $composer);
  5651. $config = $composer->getConfig();
  5652. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  5653. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  5654. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5655. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  5656. $install
  5657. ->setDryRun($input->getOption('dry-run'))
  5658. ->setVerbose($input->getOption('verbose'))
  5659. ->setPreferSource($preferSource)
  5660. ->setPreferDist($preferDist)
  5661. ->setDevMode(!$input->getOption('no-dev'))
  5662. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  5663. ->setRunScripts(!$input->getOption('no-scripts'))
  5664. ->setSkipSuggest($input->getOption('no-suggest'))
  5665. ->setOptimizeAutoloader($optimize)
  5666. ->setClassMapAuthoritative($authoritative)
  5667. ->setApcuAutoloader($apcu)
  5668. ->setUpdate(true)
  5669. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  5670. ->setWhitelistDependencies($input->getOption('with-dependencies'))
  5671. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  5672. ->setPreferStable($input->getOption('prefer-stable'))
  5673. ->setPreferLowest($input->getOption('prefer-lowest'))
  5674. ;
  5675. if ($input->getOption('no-plugins')) {
  5676. $install->disablePlugins();
  5677. }
  5678. return $install->run();
  5679. }
  5680. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  5681. {
  5682. if (!$input->isInteractive()) {
  5683. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  5684. }
  5685. $requires = array_merge(
  5686. $composer->getPackage()->getRequires(),
  5687. $composer->getPackage()->getDevRequires()
  5688. );
  5689. $autocompleterValues = array();
  5690. foreach ($requires as $require) {
  5691. $autocompleterValues[strtolower($require->getTarget())] = $require->getTarget();
  5692. }
  5693. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  5694. foreach ($installedPackages as $package) {
  5695. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  5696. }
  5697. $helper = $this->getHelper('question');
  5698. $question = new Question('<comment>Enter package name: </comment>', null);
  5699. $io->writeError('<info>Press enter without value to end submission</info>');
  5700. do {
  5701. $autocompleterValues = array_diff($autocompleterValues, $packages);
  5702. $question->setAutocompleterValues($autocompleterValues);
  5703. $addedPackage = $helper->ask($input, $output, $question);
  5704. if (!is_string($addedPackage) || empty($addedPackage)) {
  5705. break;
  5706. }
  5707. $addedPackage = strtolower($addedPackage);
  5708. if (!in_array($addedPackage, $packages)) {
  5709. $packages[] = $addedPackage;
  5710. }
  5711. } while (true);
  5712. $packages = array_filter($packages);
  5713. if (!$packages) {
  5714. throw new \InvalidArgumentException('You must enter minimum one package.');
  5715. }
  5716. $table = new Table($output);
  5717. $table->setHeaders(array('Selected packages'));
  5718. foreach ($packages as $package) {
  5719. $table->addRow(array($package));
  5720. }
  5721. $table->render();
  5722. if ($io->askConfirmation(sprintf(
  5723. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  5724. 1 === count($packages) ? '' : 's'
  5725. ), true)) {
  5726. return $packages;
  5727. }
  5728. throw new \RuntimeException('Installation aborted.');
  5729. }
  5730. }
  5731. <?php
  5732. namespace Composer\Command;
  5733. use Composer\Factory;
  5734. use Composer\Package\Loader\ValidatingArrayLoader;
  5735. use Composer\Plugin\CommandEvent;
  5736. use Composer\Plugin\PluginEvents;
  5737. use Composer\Util\ConfigValidator;
  5738. use Symfony\Component\Console\Input\InputArgument;
  5739. use Symfony\Component\Console\Input\InputInterface;
  5740. use Symfony\Component\Console\Input\InputOption;
  5741. use Symfony\Component\Console\Output\OutputInterface;
  5742. class ValidateCommand extends BaseCommand
  5743. {
  5744. protected function configure()
  5745. {
  5746. $this
  5747. ->setName('validate')
  5748. ->setDescription('Validates a composer.json and composer.lock.')
  5749. ->setDefinition(array(
  5750. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'),
  5751. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  5752. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  5753. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  5754. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  5755. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file', './composer.json'),
  5756. ))
  5757. ->setHelp(<<<EOT
  5758. The validate command validates a given composer.json and composer.lock
  5759. Exit codes in case of errors are:
  5760. 1 validation warning(s), only when --strict is given
  5761. 2 validation error(s)
  5762. 3 file unreadable or missing
  5763. EOT
  5764. );
  5765. }
  5766. protected function execute(InputInterface $input, OutputInterface $output)
  5767. {
  5768. $file = $input->getArgument('file');
  5769. $io = $this->getIO();
  5770. if (!file_exists($file)) {
  5771. $io->writeError('<error>' . $file . ' not found.</error>');
  5772. return 3;
  5773. }
  5774. if (!is_readable($file)) {
  5775. $io->writeError('<error>' . $file . ' is not readable.</error>');
  5776. return 3;
  5777. }
  5778. $validator = new ConfigValidator($io);
  5779. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  5780. $checkPublish = !$input->getOption('no-check-publish');
  5781. $checkLock = !$input->getOption('no-check-lock');
  5782. $isStrict = $input->getOption('strict');
  5783. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  5784. $lockErrors = array();
  5785. $composer = Factory::create($io, $file);
  5786. $locker = $composer->getLocker();
  5787. if ($locker->isLocked() && !$locker->isFresh()) {
  5788. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  5789. }
  5790. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  5791. $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0);
  5792. if ($input->getOption('with-dependencies')) {
  5793. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5794. foreach ($localRepo->getPackages() as $package) {
  5795. $path = $composer->getInstallationManager()->getInstallPath($package);
  5796. $file = $path . '/composer.json';
  5797. if (is_dir($path) && file_exists($file)) {
  5798. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  5799. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  5800. $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0);
  5801. $exitCode = max($depCode, $exitCode);
  5802. }
  5803. }
  5804. }
  5805. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  5806. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5807. $exitCode = max($eventCode, $exitCode);
  5808. return $exitCode;
  5809. }
  5810. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  5811. {
  5812. if (!$errors && !$publishErrors && !$warnings) {
  5813. $io->write('<info>' . $name . ' is valid</info>');
  5814. } elseif (!$errors && !$publishErrors) {
  5815. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  5816. if ($printSchemaUrl) {
  5817. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  5818. }
  5819. } elseif (!$errors) {
  5820. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  5821. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  5822. if ($printSchemaUrl) {
  5823. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  5824. }
  5825. } else {
  5826. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  5827. }
  5828. if ($checkPublish) {
  5829. $errors = array_merge($errors, $publishErrors);
  5830. } else {
  5831. $warnings = array_merge($warnings, $publishErrors);
  5832. }
  5833. if ($checkLock) {
  5834. $errors = array_merge($errors, $lockErrors);
  5835. } else {
  5836. $warnings = array_merge($warnings, $lockErrors);
  5837. }
  5838. $messages = array(
  5839. 'error' => $errors,
  5840. 'warning' => $warnings,
  5841. );
  5842. foreach ($messages as $style => $msgs) {
  5843. foreach ($msgs as $msg) {
  5844. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  5845. }
  5846. }
  5847. }
  5848. }
  5849. <?php
  5850. namespace Composer;
  5851. use Composer\Package\RootPackageInterface;
  5852. use Composer\Package\Locker;
  5853. use Composer\Repository\RepositoryManager;
  5854. use Composer\Installer\InstallationManager;
  5855. use Composer\Plugin\PluginManager;
  5856. use Composer\Downloader\DownloadManager;
  5857. use Composer\EventDispatcher\EventDispatcher;
  5858. use Composer\Autoload\AutoloadGenerator;
  5859. class Composer
  5860. {
  5861. const VERSION = '1.4.2';
  5862. const BRANCH_ALIAS_VERSION = '';
  5863. const RELEASE_DATE = '2017-05-17 08:17:52';
  5864. private $package;
  5865. private $locker;
  5866. private $repositoryManager;
  5867. private $downloadManager;
  5868. private $installationManager;
  5869. private $pluginManager;
  5870. private $config;
  5871. private $eventDispatcher;
  5872. private $autoloadGenerator;
  5873. public function setPackage(RootPackageInterface $package)
  5874. {
  5875. $this->package = $package;
  5876. }
  5877. public function getPackage()
  5878. {
  5879. return $this->package;
  5880. }
  5881. public function setConfig(Config $config)
  5882. {
  5883. $this->config = $config;
  5884. }
  5885. public function getConfig()
  5886. {
  5887. return $this->config;
  5888. }
  5889. public function setLocker(Locker $locker)
  5890. {
  5891. $this->locker = $locker;
  5892. }
  5893. public function getLocker()
  5894. {
  5895. return $this->locker;
  5896. }
  5897. public function setRepositoryManager(RepositoryManager $manager)
  5898. {
  5899. $this->repositoryManager = $manager;
  5900. }
  5901. public function getRepositoryManager()
  5902. {
  5903. return $this->repositoryManager;
  5904. }
  5905. public function setDownloadManager(DownloadManager $manager)
  5906. {
  5907. $this->downloadManager = $manager;
  5908. }
  5909. public function getDownloadManager()
  5910. {
  5911. return $this->downloadManager;
  5912. }
  5913. public function setInstallationManager(InstallationManager $manager)
  5914. {
  5915. $this->installationManager = $manager;
  5916. }
  5917. public function getInstallationManager()
  5918. {
  5919. return $this->installationManager;
  5920. }
  5921. public function setPluginManager(PluginManager $manager)
  5922. {
  5923. $this->pluginManager = $manager;
  5924. }
  5925. public function getPluginManager()
  5926. {
  5927. return $this->pluginManager;
  5928. }
  5929. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  5930. {
  5931. $this->eventDispatcher = $eventDispatcher;
  5932. }
  5933. public function getEventDispatcher()
  5934. {
  5935. return $this->eventDispatcher;
  5936. }
  5937. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  5938. {
  5939. $this->autoloadGenerator = $autoloadGenerator;
  5940. }
  5941. public function getAutoloadGenerator()
  5942. {
  5943. return $this->autoloadGenerator;
  5944. }
  5945. }
  5946. <?php
  5947. namespace Composer;
  5948. use Composer\Config\ConfigSourceInterface;
  5949. use Composer\Downloader\TransportException;
  5950. use Composer\IO\IOInterface;
  5951. use Composer\Util\Platform;
  5952. class Config
  5953. {
  5954. const RELATIVE_PATHS = 1;
  5955. public static $defaultConfig = array(
  5956. 'process-timeout' => 300,
  5957. 'use-include-path' => false,
  5958. 'preferred-install' => 'auto',
  5959. 'notify-on-install' => true,
  5960. 'github-protocols' => array('https', 'ssh', 'git'),
  5961. 'vendor-dir' => 'vendor',
  5962. 'bin-dir' => '{$vendor-dir}/bin',
  5963. 'cache-dir' => '{$home}/cache',
  5964. 'data-dir' => '{$home}',
  5965. 'cache-files-dir' => '{$cache-dir}/files',
  5966. 'cache-repo-dir' => '{$cache-dir}/repo',
  5967. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  5968. 'cache-ttl' => 15552000,
  5969. 'cache-files-ttl' => null,
  5970. 'cache-files-maxsize' => '300MiB',
  5971. 'bin-compat' => 'auto',
  5972. 'discard-changes' => false,
  5973. 'autoloader-suffix' => null,
  5974. 'sort-packages' => false,
  5975. 'optimize-autoloader' => false,
  5976. 'classmap-authoritative' => false,
  5977. 'apcu-autoloader' => false,
  5978. 'prepend-autoloader' => true,
  5979. 'github-domains' => array('github.com'),
  5980. 'bitbucket-expose-hostname' => true,
  5981. 'disable-tls' => false,
  5982. 'secure-http' => true,
  5983. 'cafile' => null,
  5984. 'capath' => null,
  5985. 'github-expose-hostname' => true,
  5986. 'gitlab-domains' => array('gitlab.com'),
  5987. 'store-auths' => 'prompt',
  5988. 'platform' => array(),
  5989. 'archive-format' => 'tar',
  5990. 'archive-dir' => '.',
  5991. );
  5992. public static $defaultRepositories = array(
  5993. 'packagist.org' => array(
  5994. 'type' => 'composer',
  5995. 'url' => 'https?://packagist.org',
  5996. 'allow_ssl_downgrade' => true,
  5997. ),
  5998. );
  5999. private $config;
  6000. private $baseDir;
  6001. private $repositories;
  6002. private $configSource;
  6003. private $authConfigSource;
  6004. private $useEnvironment;
  6005. private $warnedHosts = array();
  6006. public function __construct($useEnvironment = true, $baseDir = null)
  6007. {
  6008. $this->config = static::$defaultConfig;
  6009. $this->repositories = static::$defaultRepositories;
  6010. $this->useEnvironment = (bool) $useEnvironment;
  6011. $this->baseDir = $baseDir;
  6012. }
  6013. public function setConfigSource(ConfigSourceInterface $source)
  6014. {
  6015. $this->configSource = $source;
  6016. }
  6017. public function getConfigSource()
  6018. {
  6019. return $this->configSource;
  6020. }
  6021. public function setAuthConfigSource(ConfigSourceInterface $source)
  6022. {
  6023. $this->authConfigSource = $source;
  6024. }
  6025. public function getAuthConfigSource()
  6026. {
  6027. return $this->authConfigSource;
  6028. }
  6029. public function merge($config)
  6030. {
  6031. if (!empty($config['config']) && is_array($config['config'])) {
  6032. foreach ($config['config'] as $key => $val) {
  6033. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6034. $this->config[$key] = array_merge($this->config[$key], $val);
  6035. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6036. if (is_array($val) || is_array($this->config[$key])) {
  6037. if (is_string($val)) {
  6038. $val = array('*' => $val);
  6039. }
  6040. if (is_string($this->config[$key])) {
  6041. $this->config[$key] = array('*' => $this->config[$key]);
  6042. }
  6043. $this->config[$key] = array_merge($this->config[$key], $val);
  6044. if (isset($this->config[$key]['*'])) {
  6045. $wildcard = $this->config[$key]['*'];
  6046. unset($this->config[$key]['*']);
  6047. $this->config[$key]['*'] = $wildcard;
  6048. }
  6049. } else {
  6050. $this->config[$key] = $val;
  6051. }
  6052. } else {
  6053. $this->config[$key] = $val;
  6054. }
  6055. }
  6056. }
  6057. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6058. $this->repositories = array_reverse($this->repositories, true);
  6059. $newRepos = array_reverse($config['repositories'], true);
  6060. foreach ($newRepos as $name => $repository) {
  6061. if (false === $repository) {
  6062. $this->disableRepoByName($name);
  6063. continue;
  6064. }
  6065. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6066. $this->disableRepoByName(key($repository));
  6067. continue;
  6068. }
  6069. if (is_int($name)) {
  6070. $this->repositories[] = $repository;
  6071. } else {
  6072. if ($name === 'packagist') {
  6073. $this->repositories[$name . '.org'] = $repository;
  6074. } else {
  6075. $this->repositories[$name] = $repository;
  6076. }
  6077. }
  6078. }
  6079. $this->repositories = array_reverse($this->repositories, true);
  6080. }
  6081. }
  6082. public function getRepositories()
  6083. {
  6084. return $this->repositories;
  6085. }
  6086. public function get($key, $flags = 0)
  6087. {
  6088. switch ($key) {
  6089. case 'vendor-dir':
  6090. case 'bin-dir':
  6091. case 'process-timeout':
  6092. case 'data-dir':
  6093. case 'cache-dir':
  6094. case 'cache-files-dir':
  6095. case 'cache-repo-dir':
  6096. case 'cache-vcs-dir':
  6097. case 'cafile':
  6098. case 'capath':
  6099. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6100. $val = $this->getComposerEnv($env);
  6101. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6102. $val = Platform::expandPath($val);
  6103. if (substr($key, -4) !== '-dir') {
  6104. return $val;
  6105. }
  6106. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6107. case 'cache-ttl':
  6108. return (int) $this->config[$key];
  6109. case 'cache-files-maxsize':
  6110. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6111. throw new \RuntimeException(
  6112. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6113. );
  6114. }
  6115. $size = $matches[1];
  6116. if (isset($matches[2])) {
  6117. switch (strtolower($matches[2])) {
  6118. case 'g':
  6119. $size *= 1024;
  6120. case 'm':
  6121. $size *= 1024;
  6122. case 'k':
  6123. $size *= 1024;
  6124. break;
  6125. }
  6126. }
  6127. return $size;
  6128. case 'cache-files-ttl':
  6129. if (isset($this->config[$key])) {
  6130. return (int) $this->config[$key];
  6131. }
  6132. return (int) $this->config['cache-ttl'];
  6133. case 'home':
  6134. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6135. return rtrim($this->process($val, $flags), '/\\');
  6136. case 'bin-compat':
  6137. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6138. if (!in_array($value, array('auto', 'full'))) {
  6139. throw new \RuntimeException(
  6140. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6141. );
  6142. }
  6143. return $value;
  6144. case 'discard-changes':
  6145. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6146. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6147. throw new \RuntimeException(
  6148. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6149. );
  6150. }
  6151. if ('stash' === $env) {
  6152. return 'stash';
  6153. }
  6154. return $env !== 'false' && (bool) $env;
  6155. }
  6156. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6157. throw new \RuntimeException(
  6158. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6159. );
  6160. }
  6161. return $this->config[$key];
  6162. case 'github-protocols':
  6163. $protos = $this->config['github-protocols'];
  6164. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6165. unset($protos[$index]);
  6166. }
  6167. if (reset($protos) === 'http') {
  6168. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6169. }
  6170. return $protos;
  6171. case 'disable-tls':
  6172. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6173. case 'secure-http':
  6174. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6175. default:
  6176. if (!isset($this->config[$key])) {
  6177. return null;
  6178. }
  6179. return $this->process($this->config[$key], $flags);
  6180. }
  6181. }
  6182. public function all($flags = 0)
  6183. {
  6184. $all = array(
  6185. 'repositories' => $this->getRepositories(),
  6186. );
  6187. foreach (array_keys($this->config) as $key) {
  6188. $all['config'][$key] = $this->get($key, $flags);
  6189. }
  6190. return $all;
  6191. }
  6192. public function raw()
  6193. {
  6194. return array(
  6195. 'repositories' => $this->getRepositories(),
  6196. 'config' => $this->config,
  6197. );
  6198. }
  6199. public function has($key)
  6200. {
  6201. return array_key_exists($key, $this->config);
  6202. }
  6203. private function process($value, $flags)
  6204. {
  6205. $config = $this;
  6206. if (!is_string($value)) {
  6207. return $value;
  6208. }
  6209. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6210. return $config->get($match[1], $flags);
  6211. }, $value);
  6212. }
  6213. private function realpath($path)
  6214. {
  6215. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6216. return $path;
  6217. }
  6218. return $this->baseDir . '/' . $path;
  6219. }
  6220. private function getComposerEnv($var)
  6221. {
  6222. if ($this->useEnvironment) {
  6223. return getenv($var);
  6224. }
  6225. return false;
  6226. }
  6227. private function disableRepoByName($name)
  6228. {
  6229. if (isset($this->repositories[$name])) {
  6230. unset($this->repositories[$name]);
  6231. } elseif ($name === 'packagist') {
  6232. unset($this->repositories['packagist.org']);
  6233. }
  6234. }
  6235. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6236. {
  6237. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6238. return;
  6239. }
  6240. $scheme = parse_url($url, PHP_URL_SCHEME);
  6241. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6242. if ($this->get('secure-http')) {
  6243. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6244. } elseif ($io) {
  6245. $host = parse_url($url, PHP_URL_HOST);
  6246. if (!isset($this->warnedHosts[$host])) {
  6247. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6248. }
  6249. $this->warnedHosts[$host] = true;
  6250. }
  6251. }
  6252. }
  6253. }
  6254. <?php
  6255. namespace Composer\Config;
  6256. interface ConfigSourceInterface
  6257. {
  6258. public function addRepository($name, $config);
  6259. public function removeRepository($name);
  6260. public function addConfigSetting($name, $value);
  6261. public function removeConfigSetting($name);
  6262. public function addProperty($name, $value);
  6263. public function removeProperty($name);
  6264. public function addLink($type, $name, $value);
  6265. public function removeLink($type, $name);
  6266. public function getName();
  6267. }
  6268. <?php
  6269. namespace Composer\Config;
  6270. use Composer\Json\JsonFile;
  6271. use Composer\Json\JsonManipulator;
  6272. use Composer\Util\Silencer;
  6273. class JsonConfigSource implements ConfigSourceInterface
  6274. {
  6275. private $file;
  6276. private $authConfig;
  6277. public function __construct(JsonFile $file, $authConfig = false)
  6278. {
  6279. $this->file = $file;
  6280. $this->authConfig = $authConfig;
  6281. }
  6282. public function getName()
  6283. {
  6284. return $this->file->getPath();
  6285. }
  6286. public function addRepository($name, $config)
  6287. {
  6288. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6289. if (isset($config['repositories'])) {
  6290. foreach ($config['repositories'] as $index => $val) {
  6291. if ($index === $repo) {
  6292. continue;
  6293. }
  6294. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  6295. unset($config['repositories'][$index]);
  6296. $config['repositories']['packagist.org'] = false;
  6297. break;
  6298. }
  6299. }
  6300. }
  6301. $config['repositories'][$repo] = $repoConfig;
  6302. });
  6303. }
  6304. public function removeRepository($name)
  6305. {
  6306. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  6307. unset($config['repositories'][$repo]);
  6308. });
  6309. }
  6310. public function addConfigSetting($name, $value)
  6311. {
  6312. $authConfig = $this->authConfig;
  6313. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  6314. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6315. list($key, $host) = explode('.', $key, 2);
  6316. if ($authConfig) {
  6317. $config[$key][$host] = $val;
  6318. } else {
  6319. $config['config'][$key][$host] = $val;
  6320. }
  6321. } else {
  6322. $config['config'][$key] = $val;
  6323. }
  6324. });
  6325. }
  6326. public function removeConfigSetting($name)
  6327. {
  6328. $authConfig = $this->authConfig;
  6329. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  6330. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6331. list($key, $host) = explode('.', $key, 2);
  6332. if ($authConfig) {
  6333. unset($config[$key][$host]);
  6334. } else {
  6335. unset($config['config'][$key][$host]);
  6336. }
  6337. } else {
  6338. unset($config['config'][$key]);
  6339. }
  6340. });
  6341. }
  6342. public function addProperty($name, $value)
  6343. {
  6344. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  6345. if (substr($key, 0, 6) === 'extra.') {
  6346. $bits = explode('.', $key);
  6347. $last = array_pop($bits);
  6348. $arr = &$config['extra'];
  6349. foreach ($bits as $bit) {
  6350. if (!isset($arr[$bit])) {
  6351. $arr[$bit] = array();
  6352. }
  6353. $arr = &$arr[$bit];
  6354. }
  6355. $arr[$last] = $val;
  6356. } else {
  6357. $config[$key] = $val;
  6358. }
  6359. });
  6360. }
  6361. public function removeProperty($name)
  6362. {
  6363. $authConfig = $this->authConfig;
  6364. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  6365. if (substr($key, 0, 6) === 'extra.') {
  6366. $bits = explode('.', $key);
  6367. $last = array_pop($bits);
  6368. $arr = &$config['extra'];
  6369. foreach ($bits as $bit) {
  6370. if (!isset($arr[$bit])) {
  6371. return;
  6372. }
  6373. $arr = &$arr[$bit];
  6374. }
  6375. unset($arr[$last]);
  6376. } else {
  6377. unset($config[$key]);
  6378. }
  6379. });
  6380. }
  6381. public function addLink($type, $name, $value)
  6382. {
  6383. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  6384. $config[$type][$name] = $value;
  6385. });
  6386. }
  6387. public function removeLink($type, $name)
  6388. {
  6389. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  6390. unset($config[$type][$name]);
  6391. });
  6392. }
  6393. protected function manipulateJson($method, $args, $fallback)
  6394. {
  6395. $args = func_get_args();
  6396. array_shift($args);
  6397. $fallback = array_pop($args);
  6398. if ($this->file->exists()) {
  6399. if (!is_writable($this->file->getPath())) {
  6400. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  6401. }
  6402. if (!is_readable($this->file->getPath())) {
  6403. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  6404. }
  6405. $contents = file_get_contents($this->file->getPath());
  6406. } elseif ($this->authConfig) {
  6407. $contents = "{\n}\n";
  6408. } else {
  6409. $contents = "{\n \"config\": {\n }\n}\n";
  6410. }
  6411. $manipulator = new JsonManipulator($contents);
  6412. $newFile = !$this->file->exists();
  6413. if ($this->authConfig && $method === 'addConfigSetting') {
  6414. $method = 'addSubNode';
  6415. list($mainNode, $name) = explode('.', $args[0], 2);
  6416. $args = array($mainNode, $name, $args[1]);
  6417. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  6418. $method = 'removeSubNode';
  6419. list($mainNode, $name) = explode('.', $args[0], 2);
  6420. $args = array($mainNode, $name);
  6421. }
  6422. if (call_user_func_array(array($manipulator, $method), $args)) {
  6423. file_put_contents($this->file->getPath(), $manipulator->getContents());
  6424. } else {
  6425. $config = $this->file->read();
  6426. $this->arrayUnshiftRef($args, $config);
  6427. call_user_func_array($fallback, $args);
  6428. $this->file->write($config);
  6429. }
  6430. if ($newFile) {
  6431. Silencer::call('chmod', $this->file->getPath(), 0600);
  6432. }
  6433. }
  6434. private function arrayUnshiftRef(&$array, &$value)
  6435. {
  6436. $return = array_unshift($array, '');
  6437. $array[0] = &$value;
  6438. return $return;
  6439. }
  6440. }
  6441. <?php
  6442. namespace Composer\Console;
  6443. use Composer\Util\Platform;
  6444. use Composer\Util\Silencer;
  6445. use Symfony\Component\Console\Application as BaseApplication;
  6446. use Symfony\Component\Console\Input\InputInterface;
  6447. use Symfony\Component\Console\Input\InputOption;
  6448. use Symfony\Component\Console\Output\OutputInterface;
  6449. use Composer\Command;
  6450. use Composer\Composer;
  6451. use Composer\Factory;
  6452. use Composer\IO\IOInterface;
  6453. use Composer\IO\ConsoleIO;
  6454. use Composer\Json\JsonValidationException;
  6455. use Composer\Util\ErrorHandler;
  6456. use Composer\EventDispatcher\ScriptExecutionException;
  6457. use Composer\Exception\NoSslException;
  6458. class Application extends BaseApplication
  6459. {
  6460. protected $composer;
  6461. protected $io;
  6462. private static $logo = ' ______
  6463. / ____/___ ____ ___ ____ ____ ________ _____
  6464. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  6465. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  6466. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  6467. /_/
  6468. ';
  6469. private $hasPluginCommands = false;
  6470. private $disablePluginsByDefault = false;
  6471. public function __construct()
  6472. {
  6473. static $shutdownRegistered = false;
  6474. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  6475. ini_set('xdebug.show_exception_trace', false);
  6476. ini_set('xdebug.scream', false);
  6477. }
  6478. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  6479. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  6480. }
  6481. if (!$shutdownRegistered) {
  6482. $shutdownRegistered = true;
  6483. register_shutdown_function(function () {
  6484. $lastError = error_get_last();
  6485. if ($lastError && $lastError['message'] &&
  6486. (strpos($lastError['message'], 'Allowed memory') !== false ||
  6487. strpos($lastError['message'], 'exceeded memory') !== false )) {
  6488. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  6489. }
  6490. });
  6491. }
  6492. parent::__construct('Composer', Composer::VERSION);
  6493. }
  6494. public function run(InputInterface $input = null, OutputInterface $output = null)
  6495. {
  6496. if (null === $output) {
  6497. $output = Factory::createOutput();
  6498. }
  6499. return parent::run($input, $output);
  6500. }
  6501. public function doRun(InputInterface $input, OutputInterface $output)
  6502. {
  6503. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  6504. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  6505. ErrorHandler::register($io);
  6506. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  6507. $oldWorkingDir = getcwd();
  6508. chdir($newWorkDir);
  6509. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  6510. }
  6511. $commandName = '';
  6512. if ($name = $this->getCommandName($input)) {
  6513. try {
  6514. $commandName = $this->find($name)->getName();
  6515. } catch (\InvalidArgumentException $e) {
  6516. }
  6517. }
  6518. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  6519. try {
  6520. foreach ($this->getPluginCommands() as $command) {
  6521. if ($this->has($command->getName())) {
  6522. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  6523. } else {
  6524. $this->add($command);
  6525. }
  6526. }
  6527. } catch (NoSslException $e) {
  6528. }
  6529. $this->hasPluginCommands = true;
  6530. }
  6531. $isProxyCommand = false;
  6532. if ($name = $this->getCommandName($input)) {
  6533. try {
  6534. $command = $this->find($name);
  6535. $commandName = $command->getName();
  6536. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  6537. } catch (\InvalidArgumentException $e) {
  6538. }
  6539. }
  6540. if (!$isProxyCommand) {
  6541. $io->writeError(sprintf(
  6542. 'Running %s (%s) with %s on %s',
  6543. Composer::VERSION,
  6544. Composer::RELEASE_DATE,
  6545. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  6546. php_uname('s') . ' / ' . php_uname('r')
  6547. ), true, IOInterface::DEBUG);
  6548. if (PHP_VERSION_ID < 50302) {
  6549. $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>');
  6550. }
  6551. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  6552. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  6553. }
  6554. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  6555. $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']));
  6556. }
  6557. if (getenv('COMPOSER_NO_INTERACTION')) {
  6558. $input->setInteractive(false);
  6559. }
  6560. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  6561. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  6562. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  6563. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  6564. }
  6565. if ($uid = (int) getenv('SUDO_UID')) {
  6566. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  6567. }
  6568. }
  6569. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  6570. }
  6571. Silencer::call(function () use ($io) {
  6572. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  6573. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  6574. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  6575. }
  6576. });
  6577. $file = Factory::getComposerFile();
  6578. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  6579. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  6580. foreach ($composer['scripts'] as $script => $dummy) {
  6581. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  6582. if ($this->has($script)) {
  6583. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  6584. } else {
  6585. $this->add(new Command\ScriptAliasCommand($script));
  6586. }
  6587. }
  6588. }
  6589. }
  6590. }
  6591. }
  6592. try {
  6593. if ($input->hasParameterOption('--profile')) {
  6594. $startTime = microtime(true);
  6595. $this->io->enableDebugging($startTime);
  6596. }
  6597. $result = parent::doRun($input, $output);
  6598. if (isset($oldWorkingDir)) {
  6599. chdir($oldWorkingDir);
  6600. }
  6601. if (isset($startTime)) {
  6602. $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');
  6603. }
  6604. restore_error_handler();
  6605. return $result;
  6606. } catch (ScriptExecutionException $e) {
  6607. return $e->getCode();
  6608. } catch (\Exception $e) {
  6609. $this->hintCommonErrors($e);
  6610. restore_error_handler();
  6611. throw $e;
  6612. }
  6613. }
  6614. private function getNewWorkingDir(InputInterface $input)
  6615. {
  6616. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  6617. if (false !== $workingDir && !is_dir($workingDir)) {
  6618. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  6619. }
  6620. return $workingDir;
  6621. }
  6622. private function hintCommonErrors($exception)
  6623. {
  6624. $io = $this->getIO();
  6625. Silencer::suppress();
  6626. try {
  6627. $composer = $this->getComposer(false, true);
  6628. if ($composer) {
  6629. $config = $composer->getConfig();
  6630. $minSpaceFree = 1024 * 1024;
  6631. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  6632. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  6633. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  6634. ) {
  6635. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  6636. }
  6637. }
  6638. } catch (\Exception $e) {
  6639. }
  6640. Silencer::restore();
  6641. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  6642. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  6643. $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);
  6644. }
  6645. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  6646. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  6647. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  6648. }
  6649. }
  6650. public function getComposer($required = true, $disablePlugins = null)
  6651. {
  6652. if (null === $disablePlugins) {
  6653. $disablePlugins = $this->disablePluginsByDefault;
  6654. }
  6655. if (null === $this->composer) {
  6656. try {
  6657. $this->composer = Factory::create($this->io, null, $disablePlugins);
  6658. } catch (\InvalidArgumentException $e) {
  6659. if ($required) {
  6660. $this->io->writeError($e->getMessage());
  6661. exit(1);
  6662. }
  6663. } catch (JsonValidationException $e) {
  6664. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  6665. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  6666. throw new JsonValidationException($message);
  6667. }
  6668. }
  6669. return $this->composer;
  6670. }
  6671. public function resetComposer()
  6672. {
  6673. $this->composer = null;
  6674. }
  6675. public function getIO()
  6676. {
  6677. return $this->io;
  6678. }
  6679. public function getHelp()
  6680. {
  6681. return self::$logo . parent::getHelp();
  6682. }
  6683. protected function getDefaultCommands()
  6684. {
  6685. $commands = array_merge(parent::getDefaultCommands(), array(
  6686. new Command\AboutCommand(),
  6687. new Command\ConfigCommand(),
  6688. new Command\DependsCommand(),
  6689. new Command\ProhibitsCommand(),
  6690. new Command\InitCommand(),
  6691. new Command\InstallCommand(),
  6692. new Command\CreateProjectCommand(),
  6693. new Command\UpdateCommand(),
  6694. new Command\SearchCommand(),
  6695. new Command\ValidateCommand(),
  6696. new Command\ShowCommand(),
  6697. new Command\SuggestsCommand(),
  6698. new Command\RequireCommand(),
  6699. new Command\DumpAutoloadCommand(),
  6700. new Command\StatusCommand(),
  6701. new Command\ArchiveCommand(),
  6702. new Command\DiagnoseCommand(),
  6703. new Command\RunScriptCommand(),
  6704. new Command\LicensesCommand(),
  6705. new Command\GlobalCommand(),
  6706. new Command\ClearCacheCommand(),
  6707. new Command\RemoveCommand(),
  6708. new Command\HomeCommand(),
  6709. new Command\ExecCommand(),
  6710. new Command\OutdatedCommand(),
  6711. ));
  6712. if ('phar:' === substr(__FILE__, 0, 5)) {
  6713. $commands[] = new Command\SelfUpdateCommand();
  6714. }
  6715. return $commands;
  6716. }
  6717. public function getLongVersion()
  6718. {
  6719. if (Composer::BRANCH_ALIAS_VERSION) {
  6720. return sprintf(
  6721. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  6722. $this->getName(),
  6723. Composer::BRANCH_ALIAS_VERSION,
  6724. $this->getVersion(),
  6725. Composer::RELEASE_DATE
  6726. );
  6727. }
  6728. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  6729. }
  6730. protected function getDefaultInputDefinition()
  6731. {
  6732. $definition = parent::getDefaultInputDefinition();
  6733. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  6734. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  6735. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  6736. return $definition;
  6737. }
  6738. private function getPluginCommands()
  6739. {
  6740. $commands = array();
  6741. $composer = $this->getComposer(false, false);
  6742. if (null === $composer) {
  6743. $composer = Factory::createGlobal($this->io, false);
  6744. }
  6745. if (null !== $composer) {
  6746. $pm = $composer->getPluginManager();
  6747. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  6748. $newCommands = $capability->getCommands();
  6749. if (!is_array($newCommands)) {
  6750. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  6751. }
  6752. foreach ($newCommands as $command) {
  6753. if (!$command instanceof Command\BaseCommand) {
  6754. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  6755. }
  6756. }
  6757. $commands = array_merge($commands, $newCommands);
  6758. }
  6759. }
  6760. return $commands;
  6761. }
  6762. }
  6763. <?php
  6764. namespace Composer\Console;
  6765. use Symfony\Component\Console\Formatter\OutputFormatter;
  6766. class HtmlOutputFormatter extends OutputFormatter
  6767. {
  6768. private static $availableForegroundColors = array(
  6769. 30 => 'black',
  6770. 31 => 'red',
  6771. 32 => 'green',
  6772. 33 => 'yellow',
  6773. 34 => 'blue',
  6774. 35 => 'magenta',
  6775. 36 => 'cyan',
  6776. 37 => 'white',
  6777. );
  6778. private static $availableBackgroundColors = array(
  6779. 40 => 'black',
  6780. 41 => 'red',
  6781. 42 => 'green',
  6782. 43 => 'yellow',
  6783. 44 => 'blue',
  6784. 45 => 'magenta',
  6785. 46 => 'cyan',
  6786. 47 => 'white',
  6787. );
  6788. private static $availableOptions = array(
  6789. 1 => 'bold',
  6790. 4 => 'underscore',
  6791. );
  6792. public function __construct(array $styles = array())
  6793. {
  6794. parent::__construct(true, $styles);
  6795. }
  6796. public function format($message)
  6797. {
  6798. $formatted = parent::format($message);
  6799. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  6800. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  6801. }
  6802. private function formatHtml($matches)
  6803. {
  6804. $out = '<span style="';
  6805. foreach (explode(';', $matches[1]) as $code) {
  6806. if (isset(self::$availableForegroundColors[$code])) {
  6807. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  6808. } elseif (isset(self::$availableBackgroundColors[$code])) {
  6809. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  6810. } elseif (isset(self::$availableOptions[$code])) {
  6811. switch (self::$availableOptions[$code]) {
  6812. case 'bold':
  6813. $out .= 'font-weight:bold;';
  6814. break;
  6815. case 'underscore':
  6816. $out .= 'text-decoration:underline;';
  6817. break;
  6818. }
  6819. }
  6820. }
  6821. return $out.'">'.$matches[2].'</span>';
  6822. }
  6823. }
  6824. <?php
  6825. namespace Composer\DependencyResolver;
  6826. class Decisions implements \Iterator, \Countable
  6827. {
  6828. const DECISION_LITERAL = 0;
  6829. const DECISION_REASON = 1;
  6830. protected $pool;
  6831. protected $decisionMap;
  6832. protected $decisionQueue = array();
  6833. public function __construct($pool)
  6834. {
  6835. $this->pool = $pool;
  6836. $this->decisionMap = array();
  6837. }
  6838. public function decide($literal, $level, $why)
  6839. {
  6840. $this->addDecision($literal, $level);
  6841. $this->decisionQueue[] = array(
  6842. self::DECISION_LITERAL => $literal,
  6843. self::DECISION_REASON => $why,
  6844. );
  6845. }
  6846. public function satisfy($literal)
  6847. {
  6848. $packageId = abs($literal);
  6849. return (
  6850. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  6851. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  6852. );
  6853. }
  6854. public function conflict($literal)
  6855. {
  6856. $packageId = abs($literal);
  6857. return (
  6858. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  6859. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  6860. );
  6861. }
  6862. public function decided($literalOrPackageId)
  6863. {
  6864. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  6865. }
  6866. public function undecided($literalOrPackageId)
  6867. {
  6868. return empty($this->decisionMap[abs($literalOrPackageId)]);
  6869. }
  6870. public function decidedInstall($literalOrPackageId)
  6871. {
  6872. $packageId = abs($literalOrPackageId);
  6873. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  6874. }
  6875. public function decisionLevel($literalOrPackageId)
  6876. {
  6877. $packageId = abs($literalOrPackageId);
  6878. if (isset($this->decisionMap[$packageId])) {
  6879. return abs($this->decisionMap[$packageId]);
  6880. }
  6881. return 0;
  6882. }
  6883. public function decisionRule($literalOrPackageId)
  6884. {
  6885. $packageId = abs($literalOrPackageId);
  6886. foreach ($this->decisionQueue as $i => $decision) {
  6887. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  6888. return $decision[self::DECISION_REASON];
  6889. }
  6890. }
  6891. return null;
  6892. }
  6893. public function atOffset($queueOffset)
  6894. {
  6895. return $this->decisionQueue[$queueOffset];
  6896. }
  6897. public function validOffset($queueOffset)
  6898. {
  6899. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  6900. }
  6901. public function lastReason()
  6902. {
  6903. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  6904. }
  6905. public function lastLiteral()
  6906. {
  6907. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  6908. }
  6909. public function reset()
  6910. {
  6911. while ($decision = array_pop($this->decisionQueue)) {
  6912. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  6913. }
  6914. }
  6915. public function resetToOffset($offset)
  6916. {
  6917. while (count($this->decisionQueue) > $offset + 1) {
  6918. $decision = array_pop($this->decisionQueue);
  6919. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  6920. }
  6921. }
  6922. public function revertLast()
  6923. {
  6924. $this->decisionMap[abs($this->lastLiteral())] = 0;
  6925. array_pop($this->decisionQueue);
  6926. }
  6927. public function count()
  6928. {
  6929. return count($this->decisionQueue);
  6930. }
  6931. public function rewind()
  6932. {
  6933. end($this->decisionQueue);
  6934. }
  6935. public function current()
  6936. {
  6937. return current($this->decisionQueue);
  6938. }
  6939. public function key()
  6940. {
  6941. return key($this->decisionQueue);
  6942. }
  6943. public function next()
  6944. {
  6945. return prev($this->decisionQueue);
  6946. }
  6947. public function valid()
  6948. {
  6949. return false !== current($this->decisionQueue);
  6950. }
  6951. public function isEmpty()
  6952. {
  6953. return count($this->decisionQueue) === 0;
  6954. }
  6955. protected function addDecision($literal, $level)
  6956. {
  6957. $packageId = abs($literal);
  6958. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  6959. if ($previousDecision != 0) {
  6960. $literalString = $this->pool->literalToString($literal);
  6961. $package = $this->pool->literalToPackage($literal);
  6962. throw new SolverBugException(
  6963. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  6964. );
  6965. }
  6966. if ($literal > 0) {
  6967. $this->decisionMap[$packageId] = $level;
  6968. } else {
  6969. $this->decisionMap[$packageId] = -$level;
  6970. }
  6971. }
  6972. }
  6973. <?php
  6974. namespace Composer\DependencyResolver;
  6975. use Composer\Package\PackageInterface;
  6976. use Composer\Package\AliasPackage;
  6977. use Composer\Package\BasePackage;
  6978. use Composer\Semver\Constraint\Constraint;
  6979. class DefaultPolicy implements PolicyInterface
  6980. {
  6981. private $preferStable;
  6982. private $preferLowest;
  6983. public function __construct($preferStable = false, $preferLowest = false)
  6984. {
  6985. $this->preferStable = $preferStable;
  6986. $this->preferLowest = $preferLowest;
  6987. }
  6988. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  6989. {
  6990. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  6991. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  6992. }
  6993. $constraint = new Constraint($operator, $b->getVersion());
  6994. $version = new Constraint('==', $a->getVersion());
  6995. return $constraint->matchSpecific($version, true);
  6996. }
  6997. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  6998. {
  6999. $packages = array();
  7000. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7001. if ($candidate !== $package) {
  7002. $packages[] = $candidate;
  7003. }
  7004. }
  7005. return $packages;
  7006. }
  7007. public function getPriority(Pool $pool, PackageInterface $package)
  7008. {
  7009. return $pool->getPriority($package->getRepository());
  7010. }
  7011. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7012. {
  7013. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7014. foreach ($packages as &$literals) {
  7015. $policy = $this;
  7016. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7017. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7018. });
  7019. }
  7020. foreach ($packages as &$literals) {
  7021. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7022. $literals = $this->pruneToBestVersion($pool, $literals);
  7023. $literals = $this->pruneRemoteAliases($pool, $literals);
  7024. }
  7025. $selected = call_user_func_array('array_merge', $packages);
  7026. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7027. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7028. });
  7029. return $selected;
  7030. }
  7031. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7032. {
  7033. $packages = array();
  7034. foreach ($literals as $literal) {
  7035. $packageName = $pool->literalToPackage($literal)->getName();
  7036. if (!isset($packages[$packageName])) {
  7037. $packages[$packageName] = array();
  7038. }
  7039. if (isset($installedMap[abs($literal)])) {
  7040. array_unshift($packages[$packageName], $literal);
  7041. } else {
  7042. $packages[$packageName][] = $literal;
  7043. }
  7044. }
  7045. return $packages;
  7046. }
  7047. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7048. {
  7049. if ($a->getRepository() === $b->getRepository()) {
  7050. if ($a->getName() === $b->getName()) {
  7051. $aAliased = $a instanceof AliasPackage;
  7052. $bAliased = $b instanceof AliasPackage;
  7053. if ($aAliased && !$bAliased) {
  7054. return -1;
  7055. }
  7056. if (!$aAliased && $bAliased) {
  7057. return 1;
  7058. }
  7059. }
  7060. if (!$ignoreReplace) {
  7061. if ($this->replaces($a, $b)) {
  7062. return 1;
  7063. }
  7064. if ($this->replaces($b, $a)) {
  7065. return -1;
  7066. }
  7067. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7068. $requiredVendor = substr($requiredPackage, 0, $pos);
  7069. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7070. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7071. if ($bIsSameVendor !== $aIsSameVendor) {
  7072. return $aIsSameVendor ? -1 : 1;
  7073. }
  7074. }
  7075. }
  7076. if ($a->id === $b->id) {
  7077. return 0;
  7078. }
  7079. return ($a->id < $b->id) ? -1 : 1;
  7080. }
  7081. if (isset($installedMap[$a->id])) {
  7082. return -1;
  7083. }
  7084. if (isset($installedMap[$b->id])) {
  7085. return 1;
  7086. }
  7087. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7088. }
  7089. protected function replaces(PackageInterface $source, PackageInterface $target)
  7090. {
  7091. foreach ($source->getReplaces() as $link) {
  7092. if ($link->getTarget() === $target->getName()
  7093. ) {
  7094. return true;
  7095. }
  7096. }
  7097. return false;
  7098. }
  7099. protected function pruneToBestVersion(Pool $pool, $literals)
  7100. {
  7101. $operator = $this->preferLowest ? '<' : '>';
  7102. $bestLiterals = array($literals[0]);
  7103. $bestPackage = $pool->literalToPackage($literals[0]);
  7104. foreach ($literals as $i => $literal) {
  7105. if (0 === $i) {
  7106. continue;
  7107. }
  7108. $package = $pool->literalToPackage($literal);
  7109. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7110. $bestPackage = $package;
  7111. $bestLiterals = array($literal);
  7112. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7113. $bestLiterals[] = $literal;
  7114. }
  7115. }
  7116. return $bestLiterals;
  7117. }
  7118. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7119. {
  7120. $selected = array();
  7121. $priority = null;
  7122. foreach ($literals as $literal) {
  7123. $package = $pool->literalToPackage($literal);
  7124. if (isset($installedMap[$package->id])) {
  7125. $selected[] = $literal;
  7126. continue;
  7127. }
  7128. if (null === $priority) {
  7129. $priority = $this->getPriority($pool, $package);
  7130. }
  7131. if ($this->getPriority($pool, $package) != $priority) {
  7132. break;
  7133. }
  7134. $selected[] = $literal;
  7135. }
  7136. return $selected;
  7137. }
  7138. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7139. {
  7140. $hasLocalAlias = false;
  7141. foreach ($literals as $literal) {
  7142. $package = $pool->literalToPackage($literal);
  7143. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7144. $hasLocalAlias = true;
  7145. break;
  7146. }
  7147. }
  7148. if (!$hasLocalAlias) {
  7149. return $literals;
  7150. }
  7151. $selected = array();
  7152. foreach ($literals as $literal) {
  7153. $package = $pool->literalToPackage($literal);
  7154. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7155. $selected[] = $literal;
  7156. }
  7157. }
  7158. return $selected;
  7159. }
  7160. }
  7161. <?php
  7162. namespace Composer\DependencyResolver;
  7163. use Composer\Package\PackageInterface;
  7164. use Composer\Package\Link;
  7165. class GenericRule extends Rule
  7166. {
  7167. protected $literals;
  7168. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7169. {
  7170. parent::__construct($reason, $reasonData, $job);
  7171. sort($literals);
  7172. $this->literals = $literals;
  7173. }
  7174. public function getLiterals()
  7175. {
  7176. return $this->literals;
  7177. }
  7178. public function getHash()
  7179. {
  7180. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7181. return $data['hash'];
  7182. }
  7183. public function equals(Rule $rule)
  7184. {
  7185. return $this->literals === $rule->getLiterals();
  7186. }
  7187. public function isAssertion()
  7188. {
  7189. return 1 === count($this->literals);
  7190. }
  7191. public function __toString()
  7192. {
  7193. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  7194. foreach ($this->literals as $i => $literal) {
  7195. if ($i != 0) {
  7196. $result .= '|';
  7197. }
  7198. $result .= $literal;
  7199. }
  7200. $result .= ')';
  7201. return $result;
  7202. }
  7203. }
  7204. <?php
  7205. namespace Composer\DependencyResolver\Operation;
  7206. use Composer\Package\PackageInterface;
  7207. class InstallOperation extends SolverOperation
  7208. {
  7209. protected $package;
  7210. public function __construct(PackageInterface $package, $reason = null)
  7211. {
  7212. parent::__construct($reason);
  7213. $this->package = $package;
  7214. }
  7215. public function getPackage()
  7216. {
  7217. return $this->package;
  7218. }
  7219. public function getJobType()
  7220. {
  7221. return 'install';
  7222. }
  7223. public function __toString()
  7224. {
  7225. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7226. }
  7227. }
  7228. <?php
  7229. namespace Composer\DependencyResolver\Operation;
  7230. use Composer\Package\AliasPackage;
  7231. use Composer\Package\PackageInterface;
  7232. class MarkAliasInstalledOperation extends SolverOperation
  7233. {
  7234. protected $package;
  7235. public function __construct(AliasPackage $package, $reason = null)
  7236. {
  7237. parent::__construct($reason);
  7238. $this->package = $package;
  7239. }
  7240. public function getPackage()
  7241. {
  7242. return $this->package;
  7243. }
  7244. public function getJobType()
  7245. {
  7246. return 'markAliasInstalled';
  7247. }
  7248. public function __toString()
  7249. {
  7250. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7251. }
  7252. }
  7253. <?php
  7254. namespace Composer\DependencyResolver\Operation;
  7255. use Composer\Package\AliasPackage;
  7256. use Composer\Package\PackageInterface;
  7257. class MarkAliasUninstalledOperation extends SolverOperation
  7258. {
  7259. protected $package;
  7260. public function __construct(AliasPackage $package, $reason = null)
  7261. {
  7262. parent::__construct($reason);
  7263. $this->package = $package;
  7264. }
  7265. public function getPackage()
  7266. {
  7267. return $this->package;
  7268. }
  7269. public function getJobType()
  7270. {
  7271. return 'markAliasUninstalled';
  7272. }
  7273. public function __toString()
  7274. {
  7275. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7276. }
  7277. }
  7278. <?php
  7279. namespace Composer\DependencyResolver\Operation;
  7280. interface OperationInterface
  7281. {
  7282. public function getJobType();
  7283. public function getReason();
  7284. public function __toString();
  7285. }
  7286. <?php
  7287. namespace Composer\DependencyResolver\Operation;
  7288. use Composer\Package\PackageInterface;
  7289. abstract class SolverOperation implements OperationInterface
  7290. {
  7291. protected $reason;
  7292. public function __construct($reason = null)
  7293. {
  7294. $this->reason = $reason;
  7295. }
  7296. public function getReason()
  7297. {
  7298. return $this->reason;
  7299. }
  7300. protected function formatVersion(PackageInterface $package)
  7301. {
  7302. return $package->getFullPrettyVersion();
  7303. }
  7304. }
  7305. <?php
  7306. namespace Composer\DependencyResolver\Operation;
  7307. use Composer\Package\PackageInterface;
  7308. class UninstallOperation extends SolverOperation
  7309. {
  7310. protected $package;
  7311. public function __construct(PackageInterface $package, $reason = null)
  7312. {
  7313. parent::__construct($reason);
  7314. $this->package = $package;
  7315. }
  7316. public function getPackage()
  7317. {
  7318. return $this->package;
  7319. }
  7320. public function getJobType()
  7321. {
  7322. return 'uninstall';
  7323. }
  7324. public function __toString()
  7325. {
  7326. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7327. }
  7328. }
  7329. <?php
  7330. namespace Composer\DependencyResolver\Operation;
  7331. use Composer\Package\PackageInterface;
  7332. class UpdateOperation extends SolverOperation
  7333. {
  7334. protected $initialPackage;
  7335. protected $targetPackage;
  7336. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  7337. {
  7338. parent::__construct($reason);
  7339. $this->initialPackage = $initial;
  7340. $this->targetPackage = $target;
  7341. }
  7342. public function getInitialPackage()
  7343. {
  7344. return $this->initialPackage;
  7345. }
  7346. public function getTargetPackage()
  7347. {
  7348. return $this->targetPackage;
  7349. }
  7350. public function getJobType()
  7351. {
  7352. return 'update';
  7353. }
  7354. public function __toString()
  7355. {
  7356. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  7357. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  7358. }
  7359. }
  7360. <?php
  7361. namespace Composer\DependencyResolver;
  7362. use Composer\Package\PackageInterface;
  7363. interface PolicyInterface
  7364. {
  7365. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  7366. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  7367. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  7368. }
  7369. <?php
  7370. namespace Composer\DependencyResolver;
  7371. use Composer\Package\BasePackage;
  7372. use Composer\Package\AliasPackage;
  7373. use Composer\Package\Version\VersionParser;
  7374. use Composer\Semver\Constraint\ConstraintInterface;
  7375. use Composer\Semver\Constraint\Constraint;
  7376. use Composer\Semver\Constraint\EmptyConstraint;
  7377. use Composer\Repository\RepositoryInterface;
  7378. use Composer\Repository\CompositeRepository;
  7379. use Composer\Repository\ComposerRepository;
  7380. use Composer\Repository\InstalledRepositoryInterface;
  7381. use Composer\Repository\PlatformRepository;
  7382. use Composer\Package\PackageInterface;
  7383. class Pool implements \Countable
  7384. {
  7385. const MATCH_NAME = -1;
  7386. const MATCH_NONE = 0;
  7387. const MATCH = 1;
  7388. const MATCH_PROVIDE = 2;
  7389. const MATCH_REPLACE = 3;
  7390. const MATCH_FILTERED = 4;
  7391. protected $repositories = array();
  7392. protected $providerRepos = array();
  7393. protected $packages = array();
  7394. protected $packageByName = array();
  7395. protected $packageByExactName = array();
  7396. protected $acceptableStabilities;
  7397. protected $stabilityFlags;
  7398. protected $versionParser;
  7399. protected $providerCache = array();
  7400. protected $filterRequires;
  7401. protected $whitelist = null;
  7402. protected $id = 1;
  7403. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  7404. {
  7405. $this->versionParser = new VersionParser;
  7406. $this->acceptableStabilities = array();
  7407. foreach (BasePackage::$stabilities as $stability => $value) {
  7408. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  7409. $this->acceptableStabilities[$stability] = $value;
  7410. }
  7411. }
  7412. $this->stabilityFlags = $stabilityFlags;
  7413. $this->filterRequires = $filterRequires;
  7414. foreach ($filterRequires as $name => $constraint) {
  7415. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  7416. unset($this->filterRequires[$name]);
  7417. }
  7418. }
  7419. }
  7420. public function setWhitelist($whitelist)
  7421. {
  7422. $this->whitelist = $whitelist;
  7423. $this->providerCache = array();
  7424. }
  7425. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  7426. {
  7427. if ($repo instanceof CompositeRepository) {
  7428. $repos = $repo->getRepositories();
  7429. } else {
  7430. $repos = array($repo);
  7431. }
  7432. foreach ($repos as $repo) {
  7433. $this->repositories[] = $repo;
  7434. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  7435. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  7436. $this->providerRepos[] = $repo;
  7437. $repo->setRootAliases($rootAliases);
  7438. $repo->resetPackageIds();
  7439. } else {
  7440. foreach ($repo->getPackages() as $package) {
  7441. $names = $package->getNames();
  7442. $stability = $package->getStability();
  7443. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  7444. $package->setId($this->id++);
  7445. $this->packages[] = $package;
  7446. $this->packageByExactName[$package->getName()][$package->id] = $package;
  7447. foreach ($names as $provided) {
  7448. $this->packageByName[$provided][] = $package;
  7449. }
  7450. $name = $package->getName();
  7451. if (isset($rootAliases[$name][$package->getVersion()])) {
  7452. $alias = $rootAliases[$name][$package->getVersion()];
  7453. if ($package instanceof AliasPackage) {
  7454. $package = $package->getAliasOf();
  7455. }
  7456. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  7457. $aliasPackage->setRootPackageAlias(true);
  7458. $aliasPackage->setId($this->id++);
  7459. $package->getRepository()->addPackage($aliasPackage);
  7460. $this->packages[] = $aliasPackage;
  7461. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  7462. foreach ($aliasPackage->getNames() as $name) {
  7463. $this->packageByName[$name][] = $aliasPackage;
  7464. }
  7465. }
  7466. }
  7467. }
  7468. }
  7469. }
  7470. }
  7471. public function getPriority(RepositoryInterface $repo)
  7472. {
  7473. $priority = array_search($repo, $this->repositories, true);
  7474. if (false === $priority) {
  7475. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  7476. }
  7477. return -$priority;
  7478. }
  7479. public function packageById($id)
  7480. {
  7481. return $this->packages[$id - 1];
  7482. }
  7483. public function count()
  7484. {
  7485. return count($this->packages);
  7486. }
  7487. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  7488. {
  7489. if ($bypassFilters) {
  7490. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  7491. }
  7492. $key = ((int) $mustMatchName).$constraint;
  7493. if (isset($this->providerCache[$name][$key])) {
  7494. return $this->providerCache[$name][$key];
  7495. }
  7496. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  7497. }
  7498. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  7499. {
  7500. $candidates = array();
  7501. foreach ($this->providerRepos as $repo) {
  7502. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  7503. $candidates[] = $candidate;
  7504. if ($candidate->id < 1) {
  7505. $candidate->setId($this->id++);
  7506. $this->packages[$this->id - 2] = $candidate;
  7507. }
  7508. }
  7509. }
  7510. if ($mustMatchName) {
  7511. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  7512. return $candidate->getName() == $name;
  7513. });
  7514. if (isset($this->packageByExactName[$name])) {
  7515. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  7516. }
  7517. } elseif (isset($this->packageByName[$name])) {
  7518. $candidates = array_merge($candidates, $this->packageByName[$name]);
  7519. }
  7520. $matches = $provideMatches = array();
  7521. $nameMatch = false;
  7522. foreach ($candidates as $candidate) {
  7523. $aliasOfCandidate = null;
  7524. if ($candidate instanceof AliasPackage) {
  7525. $aliasOfCandidate = $candidate->getAliasOf();
  7526. }
  7527. if ($this->whitelist !== null && !$bypassFilters && (
  7528. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  7529. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  7530. )) {
  7531. continue;
  7532. }
  7533. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  7534. case self::MATCH_NONE:
  7535. break;
  7536. case self::MATCH_NAME:
  7537. $nameMatch = true;
  7538. break;
  7539. case self::MATCH:
  7540. $nameMatch = true;
  7541. $matches[] = $candidate;
  7542. break;
  7543. case self::MATCH_PROVIDE:
  7544. $provideMatches[] = $candidate;
  7545. break;
  7546. case self::MATCH_REPLACE:
  7547. $matches[] = $candidate;
  7548. break;
  7549. case self::MATCH_FILTERED:
  7550. break;
  7551. default:
  7552. throw new \UnexpectedValueException('Unexpected match type');
  7553. }
  7554. }
  7555. if ($nameMatch) {
  7556. return $matches;
  7557. }
  7558. return array_merge($matches, $provideMatches);
  7559. }
  7560. public function literalToPackage($literal)
  7561. {
  7562. $packageId = abs($literal);
  7563. return $this->packageById($packageId);
  7564. }
  7565. public function literalToPrettyString($literal, $installedMap)
  7566. {
  7567. $package = $this->literalToPackage($literal);
  7568. if (isset($installedMap[$package->id])) {
  7569. $prefix = ($literal > 0 ? 'keep' : 'remove');
  7570. } else {
  7571. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  7572. }
  7573. return $prefix.' '.$package->getPrettyString();
  7574. }
  7575. public function isPackageAcceptable($name, $stability)
  7576. {
  7577. foreach ((array) $name as $n) {
  7578. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  7579. return true;
  7580. }
  7581. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  7582. return true;
  7583. }
  7584. }
  7585. return false;
  7586. }
  7587. private function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  7588. {
  7589. $candidateName = $candidate->getName();
  7590. $candidateVersion = $candidate->getVersion();
  7591. $isDev = $candidate->getStability() === 'dev';
  7592. $isAlias = $candidate instanceof AliasPackage;
  7593. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  7594. $requireFilter = $this->filterRequires[$name];
  7595. } else {
  7596. $requireFilter = new EmptyConstraint;
  7597. }
  7598. if ($candidateName === $name) {
  7599. $pkgConstraint = new Constraint('==', $candidateVersion);
  7600. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  7601. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  7602. }
  7603. return self::MATCH_NAME;
  7604. }
  7605. $provides = $candidate->getProvides();
  7606. $replaces = $candidate->getReplaces();
  7607. if (isset($replaces[0]) || isset($provides[0])) {
  7608. foreach ($provides as $link) {
  7609. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7610. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7611. }
  7612. }
  7613. foreach ($replaces as $link) {
  7614. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7615. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7616. }
  7617. }
  7618. return self::MATCH_NONE;
  7619. }
  7620. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  7621. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7622. }
  7623. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  7624. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7625. }
  7626. return self::MATCH_NONE;
  7627. }
  7628. }
  7629. <?php
  7630. namespace Composer\DependencyResolver;
  7631. class Problem
  7632. {
  7633. protected $reasonSeen;
  7634. protected $reasons = array();
  7635. protected $section = 0;
  7636. protected $pool;
  7637. public function __construct(Pool $pool)
  7638. {
  7639. $this->pool = $pool;
  7640. }
  7641. public function addRule(Rule $rule)
  7642. {
  7643. $this->addReason(spl_object_hash($rule), array(
  7644. 'rule' => $rule,
  7645. 'job' => $rule->getJob(),
  7646. ));
  7647. }
  7648. public function getReasons()
  7649. {
  7650. return $this->reasons;
  7651. }
  7652. public function getPrettyString(array $installedMap = array())
  7653. {
  7654. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  7655. if (count($reasons) === 1) {
  7656. reset($reasons);
  7657. $reason = current($reasons);
  7658. $rule = $reason['rule'];
  7659. $job = $reason['job'];
  7660. if (isset($job['constraint'])) {
  7661. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7662. } else {
  7663. $packages = array();
  7664. }
  7665. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  7666. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  7667. $available = $this->pool->whatProvides($job['packageName']);
  7668. $version = count($available) ? $available[0]->getPrettyVersion() : phpversion();
  7669. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  7670. if (defined('HHVM_VERSION')) {
  7671. return $msg . 'your HHVM version does not satisfy that requirement.';
  7672. }
  7673. if ($job['packageName'] === 'hhvm') {
  7674. return $msg . 'you are running this with PHP and not HHVM.';
  7675. }
  7676. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  7677. }
  7678. if (0 === stripos($job['packageName'], 'ext-')) {
  7679. $ext = substr($job['packageName'], 4);
  7680. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  7681. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  7682. }
  7683. if (0 === stripos($job['packageName'], 'lib-')) {
  7684. if (strtolower($job['packageName']) === 'lib-icu') {
  7685. $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.';
  7686. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  7687. }
  7688. 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.';
  7689. }
  7690. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  7691. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  7692. 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.';
  7693. }
  7694. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  7695. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  7696. }
  7697. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  7698. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  7699. }
  7700. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  7701. }
  7702. }
  7703. $messages = array();
  7704. foreach ($reasons as $reason) {
  7705. $rule = $reason['rule'];
  7706. $job = $reason['job'];
  7707. if ($job) {
  7708. $messages[] = $this->jobToText($job);
  7709. } elseif ($rule) {
  7710. if ($rule instanceof Rule) {
  7711. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  7712. }
  7713. }
  7714. }
  7715. return "\n - ".implode("\n - ", $messages);
  7716. }
  7717. protected function addReason($id, $reason)
  7718. {
  7719. if (!isset($this->reasonSeen[$id])) {
  7720. $this->reasonSeen[$id] = true;
  7721. $this->reasons[$this->section][] = $reason;
  7722. }
  7723. }
  7724. public function nextSection()
  7725. {
  7726. $this->section++;
  7727. }
  7728. protected function jobToText($job)
  7729. {
  7730. switch ($job['cmd']) {
  7731. case 'install':
  7732. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7733. if (!$packages) {
  7734. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  7735. }
  7736. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  7737. case 'update':
  7738. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  7739. case 'remove':
  7740. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  7741. }
  7742. if (isset($job['constraint'])) {
  7743. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7744. } else {
  7745. $packages = array();
  7746. }
  7747. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  7748. }
  7749. protected function getPackageList($packages)
  7750. {
  7751. $prepared = array();
  7752. foreach ($packages as $package) {
  7753. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  7754. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  7755. }
  7756. foreach ($prepared as $name => $package) {
  7757. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  7758. }
  7759. return implode(', ', $prepared);
  7760. }
  7761. protected function constraintToText($constraint)
  7762. {
  7763. return ($constraint) ? ' '.$constraint->getPrettyString() : '';
  7764. }
  7765. }
  7766. <?php
  7767. namespace Composer\DependencyResolver;
  7768. use Composer\Semver\Constraint\ConstraintInterface;
  7769. class Request
  7770. {
  7771. protected $jobs;
  7772. public function __construct()
  7773. {
  7774. $this->jobs = array();
  7775. }
  7776. public function install($packageName, ConstraintInterface $constraint = null)
  7777. {
  7778. $this->addJob($packageName, 'install', $constraint);
  7779. }
  7780. public function update($packageName, ConstraintInterface $constraint = null)
  7781. {
  7782. $this->addJob($packageName, 'update', $constraint);
  7783. }
  7784. public function remove($packageName, ConstraintInterface $constraint = null)
  7785. {
  7786. $this->addJob($packageName, 'remove', $constraint);
  7787. }
  7788. public function fix($packageName, ConstraintInterface $constraint = null)
  7789. {
  7790. $this->addJob($packageName, 'install', $constraint, true);
  7791. }
  7792. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  7793. {
  7794. $packageName = strtolower($packageName);
  7795. $this->jobs[] = array(
  7796. 'cmd' => $cmd,
  7797. 'packageName' => $packageName,
  7798. 'constraint' => $constraint,
  7799. 'fixed' => $fixed,
  7800. );
  7801. }
  7802. public function updateAll()
  7803. {
  7804. $this->jobs[] = array('cmd' => 'update-all');
  7805. }
  7806. public function getJobs()
  7807. {
  7808. return $this->jobs;
  7809. }
  7810. }
  7811. <?php
  7812. namespace Composer\DependencyResolver;
  7813. use Composer\Package\CompletePackage;
  7814. abstract class Rule
  7815. {
  7816. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  7817. const RULE_JOB_INSTALL = 2;
  7818. const RULE_JOB_REMOVE = 3;
  7819. const RULE_PACKAGE_CONFLICT = 6;
  7820. const RULE_PACKAGE_REQUIRES = 7;
  7821. const RULE_PACKAGE_OBSOLETES = 8;
  7822. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  7823. const RULE_PACKAGE_SAME_NAME = 10;
  7824. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  7825. const RULE_LEARNED = 12;
  7826. const RULE_PACKAGE_ALIAS = 13;
  7827. const BITFIELD_TYPE = 0;
  7828. const BITFIELD_REASON = 8;
  7829. const BITFIELD_DISABLED = 16;
  7830. protected $bitfield;
  7831. protected $reasonData;
  7832. public function __construct($reason, $reasonData, $job = null)
  7833. {
  7834. $this->reasonData = $reasonData;
  7835. if ($job) {
  7836. $this->job = $job;
  7837. }
  7838. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  7839. ($reason << self::BITFIELD_REASON) |
  7840. (255 << self::BITFIELD_TYPE);
  7841. }
  7842. abstract public function getLiterals();
  7843. abstract public function getHash();
  7844. public function getJob()
  7845. {
  7846. return isset($this->job) ? $this->job : null;
  7847. }
  7848. abstract public function equals(Rule $rule);
  7849. public function getReason()
  7850. {
  7851. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  7852. }
  7853. public function getReasonData()
  7854. {
  7855. return $this->reasonData;
  7856. }
  7857. public function getRequiredPackage()
  7858. {
  7859. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  7860. return $this->reasonData;
  7861. }
  7862. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  7863. return $this->reasonData->getTarget();
  7864. }
  7865. }
  7866. public function setType($type)
  7867. {
  7868. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  7869. }
  7870. public function getType()
  7871. {
  7872. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  7873. }
  7874. public function disable()
  7875. {
  7876. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  7877. }
  7878. public function enable()
  7879. {
  7880. $this->bitfield = $this->bitfield & ~(255 << self::BITFIELD_DISABLED);
  7881. }
  7882. public function isDisabled()
  7883. {
  7884. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  7885. }
  7886. public function isEnabled()
  7887. {
  7888. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  7889. }
  7890. abstract public function isAssertion();
  7891. public function getPrettyString(Pool $pool, array $installedMap = array())
  7892. {
  7893. $literals = $this->getLiterals();
  7894. $ruleText = '';
  7895. foreach ($literals as $i => $literal) {
  7896. if ($i != 0) {
  7897. $ruleText .= '|';
  7898. }
  7899. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  7900. }
  7901. switch ($this->getReason()) {
  7902. case self::RULE_INTERNAL_ALLOW_UPDATE:
  7903. return $ruleText;
  7904. case self::RULE_JOB_INSTALL:
  7905. return "Install command rule ($ruleText)";
  7906. case self::RULE_JOB_REMOVE:
  7907. return "Remove command rule ($ruleText)";
  7908. case self::RULE_PACKAGE_CONFLICT:
  7909. $package1 = $pool->literalToPackage($literals[0]);
  7910. $package2 = $pool->literalToPackage($literals[1]);
  7911. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  7912. case self::RULE_PACKAGE_REQUIRES:
  7913. $sourceLiteral = array_shift($literals);
  7914. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  7915. $requires = array();
  7916. foreach ($literals as $literal) {
  7917. $requires[] = $pool->literalToPackage($literal);
  7918. }
  7919. $text = $this->reasonData->getPrettyString($sourcePackage);
  7920. if ($requires) {
  7921. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  7922. } else {
  7923. $targetName = $this->reasonData->getTarget();
  7924. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  7925. if (defined('HHVM_VERSION')) {
  7926. return $text . ' -> your HHVM version does not satisfy that requirement.';
  7927. }
  7928. if ($targetName === 'hhvm') {
  7929. return $text . ' -> you are running this with PHP and not HHVM.';
  7930. }
  7931. $packages = $pool->whatProvides($targetName);
  7932. $package = count($packages) ? current($packages) : phpversion();
  7933. if (!($package instanceof CompletePackage)) {
  7934. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  7935. }
  7936. $extra = $package->getExtra();
  7937. if (!empty($extra['config.platform'])) {
  7938. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  7939. } else {
  7940. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  7941. }
  7942. return $text;
  7943. }
  7944. if (0 === strpos($targetName, 'ext-')) {
  7945. $ext = substr($targetName, 4);
  7946. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  7947. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  7948. }
  7949. if (0 === strpos($targetName, 'lib-')) {
  7950. $lib = substr($targetName, 4);
  7951. 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.';
  7952. }
  7953. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  7954. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  7955. }
  7956. return $text . ' -> no matching package found.';
  7957. }
  7958. return $text;
  7959. case self::RULE_PACKAGE_OBSOLETES:
  7960. return $ruleText;
  7961. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  7962. return $ruleText;
  7963. case self::RULE_PACKAGE_SAME_NAME:
  7964. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  7965. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  7966. return $ruleText;
  7967. case self::RULE_LEARNED:
  7968. return 'Conclusion: '.$ruleText;
  7969. case self::RULE_PACKAGE_ALIAS:
  7970. return $ruleText;
  7971. default:
  7972. return '('.$ruleText.')';
  7973. }
  7974. }
  7975. protected function formatPackagesUnique($pool, array $packages)
  7976. {
  7977. $prepared = array();
  7978. foreach ($packages as $package) {
  7979. if (!is_object($package)) {
  7980. $package = $pool->literalToPackage($package);
  7981. }
  7982. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  7983. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  7984. }
  7985. foreach ($prepared as $name => $package) {
  7986. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  7987. }
  7988. return implode(', ', $prepared);
  7989. }
  7990. }
  7991. <?php
  7992. namespace Composer\DependencyResolver;
  7993. use Composer\Package\PackageInterface;
  7994. use Composer\Package\Link;
  7995. class Rule2Literals extends Rule
  7996. {
  7997. protected $literal1;
  7998. protected $literal2;
  7999. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8000. {
  8001. parent::__construct($reason, $reasonData, $job);
  8002. if ($literal1 < $literal2) {
  8003. $this->literal1 = $literal1;
  8004. $this->literal2 = $literal2;
  8005. } else {
  8006. $this->literal1 = $literal2;
  8007. $this->literal2 = $literal1;
  8008. }
  8009. }
  8010. public function getLiterals()
  8011. {
  8012. return array($this->literal1, $this->literal2);
  8013. }
  8014. public function getHash()
  8015. {
  8016. $data = unpack('ihash', md5($this->literal1.','.$this->literal2, true));
  8017. return $data['hash'];
  8018. }
  8019. public function equals(Rule $rule)
  8020. {
  8021. $literals = $rule->getLiterals();
  8022. if (2 != count($literals)) {
  8023. return false;
  8024. }
  8025. if ($this->literal1 !== $literals[0]) {
  8026. return false;
  8027. }
  8028. if ($this->literal2 !== $literals[1]) {
  8029. return false;
  8030. }
  8031. return true;
  8032. }
  8033. public function isAssertion()
  8034. {
  8035. return false;
  8036. }
  8037. public function __toString()
  8038. {
  8039. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  8040. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8041. return $result;
  8042. }
  8043. }
  8044. <?php
  8045. namespace Composer\DependencyResolver;
  8046. class RuleSet implements \IteratorAggregate, \Countable
  8047. {
  8048. const TYPE_PACKAGE = 0;
  8049. const TYPE_JOB = 1;
  8050. const TYPE_LEARNED = 4;
  8051. public $ruleById;
  8052. protected static $types = array(
  8053. 255 => 'UNKNOWN',
  8054. self::TYPE_PACKAGE => 'PACKAGE',
  8055. self::TYPE_JOB => 'JOB',
  8056. self::TYPE_LEARNED => 'LEARNED',
  8057. );
  8058. protected $rules;
  8059. protected $nextRuleId;
  8060. protected $rulesByHash;
  8061. public function __construct()
  8062. {
  8063. $this->nextRuleId = 0;
  8064. foreach ($this->getTypes() as $type) {
  8065. $this->rules[$type] = array();
  8066. }
  8067. $this->rulesByHash = array();
  8068. }
  8069. public function add(Rule $rule, $type)
  8070. {
  8071. if (!isset(self::$types[$type])) {
  8072. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8073. }
  8074. $hash = $rule->getHash();
  8075. if (isset($this->rulesByHash[$hash])) {
  8076. $potentialDuplicates = $this->rulesByHash[$hash];
  8077. if (is_array($potentialDuplicates)) {
  8078. foreach ($potentialDuplicates as $potentialDuplicate) {
  8079. if ($rule->equals($potentialDuplicate)) {
  8080. return;
  8081. }
  8082. }
  8083. } else {
  8084. if ($rule->equals($potentialDuplicates)) {
  8085. return;
  8086. }
  8087. }
  8088. }
  8089. if (!isset($this->rules[$type])) {
  8090. $this->rules[$type] = array();
  8091. }
  8092. $this->rules[$type][] = $rule;
  8093. $this->ruleById[$this->nextRuleId] = $rule;
  8094. $rule->setType($type);
  8095. $this->nextRuleId++;
  8096. if (!isset($this->rulesByHash[$hash])) {
  8097. $this->rulesByHash[$hash] = $rule;
  8098. } elseif (is_array($this->rulesByHash[$hash])) {
  8099. $this->rulesByHash[$hash][] = $rule;
  8100. } else {
  8101. $originalRule = $this->rulesByHash[$hash];
  8102. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8103. }
  8104. }
  8105. public function count()
  8106. {
  8107. return $this->nextRuleId;
  8108. }
  8109. public function ruleById($id)
  8110. {
  8111. return $this->ruleById[$id];
  8112. }
  8113. public function getRules()
  8114. {
  8115. return $this->rules;
  8116. }
  8117. public function getIterator()
  8118. {
  8119. return new RuleSetIterator($this->getRules());
  8120. }
  8121. public function getIteratorFor($types)
  8122. {
  8123. if (!is_array($types)) {
  8124. $types = array($types);
  8125. }
  8126. $allRules = $this->getRules();
  8127. $rules = array();
  8128. foreach ($types as $type) {
  8129. $rules[$type] = $allRules[$type];
  8130. }
  8131. return new RuleSetIterator($rules);
  8132. }
  8133. public function getIteratorWithout($types)
  8134. {
  8135. if (!is_array($types)) {
  8136. $types = array($types);
  8137. }
  8138. $rules = $this->getRules();
  8139. foreach ($types as $type) {
  8140. unset($rules[$type]);
  8141. }
  8142. return new RuleSetIterator($rules);
  8143. }
  8144. public function getTypes()
  8145. {
  8146. $types = self::$types;
  8147. unset($types[255]);
  8148. return array_keys($types);
  8149. }
  8150. public function getPrettyString(Pool $pool = null)
  8151. {
  8152. $string = "\n";
  8153. foreach ($this->rules as $type => $rules) {
  8154. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8155. foreach ($rules as $rule) {
  8156. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8157. }
  8158. $string .= "\n\n";
  8159. }
  8160. return $string;
  8161. }
  8162. public function __toString()
  8163. {
  8164. return $this->getPrettyString(null);
  8165. }
  8166. }
  8167. <?php
  8168. namespace Composer\DependencyResolver;
  8169. use Composer\Package\PackageInterface;
  8170. use Composer\Package\AliasPackage;
  8171. use Composer\Repository\PlatformRepository;
  8172. class RuleSetGenerator
  8173. {
  8174. protected $policy;
  8175. protected $pool;
  8176. protected $rules;
  8177. protected $jobs;
  8178. protected $installedMap;
  8179. protected $whitelistedMap;
  8180. protected $addedMap;
  8181. public function __construct(PolicyInterface $policy, Pool $pool)
  8182. {
  8183. $this->policy = $policy;
  8184. $this->pool = $pool;
  8185. }
  8186. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  8187. {
  8188. $literals = array(-$package->id);
  8189. foreach ($providers as $provider) {
  8190. if ($provider === $package) {
  8191. return null;
  8192. }
  8193. $literals[] = $provider->id;
  8194. }
  8195. return new GenericRule($literals, $reason, $reasonData);
  8196. }
  8197. protected function createInstallOneOfRule(array $packages, $reason, $job)
  8198. {
  8199. $literals = array();
  8200. foreach ($packages as $package) {
  8201. $literals[] = $package->id;
  8202. }
  8203. return new GenericRule($literals, $reason, $job['packageName'], $job);
  8204. }
  8205. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  8206. {
  8207. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  8208. }
  8209. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  8210. {
  8211. if ($issuer === $provider) {
  8212. return null;
  8213. }
  8214. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  8215. }
  8216. private function addRule($type, Rule $newRule = null)
  8217. {
  8218. if (!$newRule) {
  8219. return;
  8220. }
  8221. $this->rules->add($newRule, $type);
  8222. }
  8223. protected function whitelistFromPackage(PackageInterface $package)
  8224. {
  8225. $workQueue = new \SplQueue;
  8226. $workQueue->enqueue($package);
  8227. while (!$workQueue->isEmpty()) {
  8228. $package = $workQueue->dequeue();
  8229. if (isset($this->whitelistedMap[$package->id])) {
  8230. continue;
  8231. }
  8232. $this->whitelistedMap[$package->id] = true;
  8233. foreach ($package->getRequires() as $link) {
  8234. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  8235. foreach ($possibleRequires as $require) {
  8236. $workQueue->enqueue($require);
  8237. }
  8238. }
  8239. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  8240. foreach ($obsoleteProviders as $provider) {
  8241. if ($provider === $package) {
  8242. continue;
  8243. }
  8244. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8245. $workQueue->enqueue($provider);
  8246. }
  8247. }
  8248. }
  8249. }
  8250. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  8251. {
  8252. $workQueue = new \SplQueue;
  8253. $workQueue->enqueue($package);
  8254. while (!$workQueue->isEmpty()) {
  8255. $package = $workQueue->dequeue();
  8256. if (isset($this->addedMap[$package->id])) {
  8257. continue;
  8258. }
  8259. $this->addedMap[$package->id] = true;
  8260. foreach ($package->getRequires() as $link) {
  8261. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  8262. continue;
  8263. }
  8264. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8265. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  8266. foreach ($possibleRequires as $require) {
  8267. $workQueue->enqueue($require);
  8268. }
  8269. }
  8270. foreach ($package->getConflicts() as $link) {
  8271. $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8272. foreach ($possibleConflicts as $conflict) {
  8273. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  8274. }
  8275. }
  8276. $isInstalled = (isset($this->installedMap[$package->id]));
  8277. foreach ($package->getReplaces() as $link) {
  8278. $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8279. foreach ($obsoleteProviders as $provider) {
  8280. if ($provider === $package) {
  8281. continue;
  8282. }
  8283. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8284. $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  8285. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  8286. }
  8287. }
  8288. }
  8289. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
  8290. foreach ($obsoleteProviders as $provider) {
  8291. if ($provider === $package) {
  8292. continue;
  8293. }
  8294. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8295. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  8296. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8297. $reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  8298. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRule2Literals($package, $provider, $reason, $package));
  8299. }
  8300. }
  8301. }
  8302. }
  8303. protected function obsoleteImpossibleForAlias($package, $provider)
  8304. {
  8305. $packageIsAlias = $package instanceof AliasPackage;
  8306. $providerIsAlias = $provider instanceof AliasPackage;
  8307. $impossible = (
  8308. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  8309. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  8310. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  8311. );
  8312. return $impossible;
  8313. }
  8314. protected function whitelistFromJobs()
  8315. {
  8316. foreach ($this->jobs as $job) {
  8317. switch ($job['cmd']) {
  8318. case 'install':
  8319. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  8320. foreach ($packages as $package) {
  8321. $this->whitelistFromPackage($package);
  8322. }
  8323. break;
  8324. }
  8325. }
  8326. }
  8327. protected function addRulesForJobs($ignorePlatformReqs)
  8328. {
  8329. foreach ($this->jobs as $job) {
  8330. switch ($job['cmd']) {
  8331. case 'install':
  8332. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8333. continue;
  8334. }
  8335. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8336. if ($packages) {
  8337. foreach ($packages as $package) {
  8338. if (!isset($this->installedMap[$package->id])) {
  8339. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8340. }
  8341. }
  8342. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  8343. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8344. }
  8345. break;
  8346. case 'remove':
  8347. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8348. foreach ($packages as $package) {
  8349. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  8350. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8351. }
  8352. break;
  8353. }
  8354. }
  8355. }
  8356. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  8357. {
  8358. $this->jobs = $jobs;
  8359. $this->rules = new RuleSet;
  8360. $this->installedMap = $installedMap;
  8361. $this->whitelistedMap = array();
  8362. foreach ($this->installedMap as $package) {
  8363. $this->whitelistFromPackage($package);
  8364. }
  8365. $this->whitelistFromJobs();
  8366. $this->pool->setWhitelist($this->whitelistedMap);
  8367. $this->addedMap = array();
  8368. foreach ($this->installedMap as $package) {
  8369. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8370. }
  8371. $this->addRulesForJobs($ignorePlatformReqs);
  8372. return $this->rules;
  8373. }
  8374. }
  8375. <?php
  8376. namespace Composer\DependencyResolver;
  8377. class RuleSetIterator implements \Iterator
  8378. {
  8379. protected $rules;
  8380. protected $types;
  8381. protected $currentOffset;
  8382. protected $currentType;
  8383. protected $currentTypeOffset;
  8384. public function __construct(array $rules)
  8385. {
  8386. $this->rules = $rules;
  8387. $this->types = array_keys($rules);
  8388. sort($this->types);
  8389. $this->rewind();
  8390. }
  8391. public function current()
  8392. {
  8393. return $this->rules[$this->currentType][$this->currentOffset];
  8394. }
  8395. public function key()
  8396. {
  8397. return $this->currentType;
  8398. }
  8399. public function next()
  8400. {
  8401. $this->currentOffset++;
  8402. if (!isset($this->rules[$this->currentType])) {
  8403. return;
  8404. }
  8405. if ($this->currentOffset >= sizeof($this->rules[$this->currentType])) {
  8406. $this->currentOffset = 0;
  8407. do {
  8408. $this->currentTypeOffset++;
  8409. if (!isset($this->types[$this->currentTypeOffset])) {
  8410. $this->currentType = -1;
  8411. break;
  8412. }
  8413. $this->currentType = $this->types[$this->currentTypeOffset];
  8414. } while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
  8415. }
  8416. }
  8417. public function rewind()
  8418. {
  8419. $this->currentOffset = 0;
  8420. $this->currentTypeOffset = -1;
  8421. $this->currentType = -1;
  8422. do {
  8423. $this->currentTypeOffset++;
  8424. if (!isset($this->types[$this->currentTypeOffset])) {
  8425. $this->currentType = -1;
  8426. break;
  8427. }
  8428. $this->currentType = $this->types[$this->currentTypeOffset];
  8429. } while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
  8430. }
  8431. public function valid()
  8432. {
  8433. return isset($this->rules[$this->currentType])
  8434. && isset($this->rules[$this->currentType][$this->currentOffset]);
  8435. }
  8436. }
  8437. <?php
  8438. namespace Composer\DependencyResolver;
  8439. class RuleWatchChain extends \SplDoublyLinkedList
  8440. {
  8441. protected $offset = 0;
  8442. public function seek($offset)
  8443. {
  8444. $this->rewind();
  8445. for ($i = 0; $i < $offset; $i++, $this->next());
  8446. }
  8447. public function remove()
  8448. {
  8449. $offset = $this->key();
  8450. $this->offsetUnset($offset);
  8451. $this->seek($offset);
  8452. }
  8453. }
  8454. <?php
  8455. namespace Composer\DependencyResolver;
  8456. class RuleWatchGraph
  8457. {
  8458. protected $watchChains = array();
  8459. public function insert(RuleWatchNode $node)
  8460. {
  8461. if ($node->getRule()->isAssertion()) {
  8462. return;
  8463. }
  8464. foreach (array($node->watch1, $node->watch2) as $literal) {
  8465. if (!isset($this->watchChains[$literal])) {
  8466. $this->watchChains[$literal] = new RuleWatchChain;
  8467. }
  8468. $this->watchChains[$literal]->unshift($node);
  8469. }
  8470. }
  8471. public function propagateLiteral($decidedLiteral, $level, $decisions)
  8472. {
  8473. $literal = -$decidedLiteral;
  8474. if (!isset($this->watchChains[$literal])) {
  8475. return null;
  8476. }
  8477. $chain = $this->watchChains[$literal];
  8478. $chain->rewind();
  8479. while ($chain->valid()) {
  8480. $node = $chain->current();
  8481. $otherWatch = $node->getOtherWatch($literal);
  8482. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  8483. $ruleLiterals = $node->getRule()->getLiterals();
  8484. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  8485. return $literal !== $ruleLiteral &&
  8486. $otherWatch !== $ruleLiteral &&
  8487. !$decisions->conflict($ruleLiteral);
  8488. });
  8489. if ($alternativeLiterals) {
  8490. reset($alternativeLiterals);
  8491. $this->moveWatch($literal, current($alternativeLiterals), $node);
  8492. continue;
  8493. }
  8494. if ($decisions->conflict($otherWatch)) {
  8495. return $node->getRule();
  8496. }
  8497. $decisions->decide($otherWatch, $level, $node->getRule());
  8498. }
  8499. $chain->next();
  8500. }
  8501. return null;
  8502. }
  8503. protected function moveWatch($fromLiteral, $toLiteral, $node)
  8504. {
  8505. if (!isset($this->watchChains[$toLiteral])) {
  8506. $this->watchChains[$toLiteral] = new RuleWatchChain;
  8507. }
  8508. $node->moveWatch($fromLiteral, $toLiteral);
  8509. $this->watchChains[$fromLiteral]->remove();
  8510. $this->watchChains[$toLiteral]->unshift($node);
  8511. }
  8512. }
  8513. <?php
  8514. namespace Composer\DependencyResolver;
  8515. class RuleWatchNode
  8516. {
  8517. public $watch1;
  8518. public $watch2;
  8519. protected $rule;
  8520. public function __construct($rule)
  8521. {
  8522. $this->rule = $rule;
  8523. $literals = $rule->getLiterals();
  8524. $this->watch1 = count($literals) > 0 ? $literals[0] : 0;
  8525. $this->watch2 = count($literals) > 1 ? $literals[1] : 0;
  8526. }
  8527. public function watch2OnHighest(Decisions $decisions)
  8528. {
  8529. $literals = $this->rule->getLiterals();
  8530. if (count($literals) < 3) {
  8531. return;
  8532. }
  8533. $watchLevel = 0;
  8534. foreach ($literals as $literal) {
  8535. $level = $decisions->decisionLevel($literal);
  8536. if ($level > $watchLevel) {
  8537. $this->watch2 = $literal;
  8538. $watchLevel = $level;
  8539. }
  8540. }
  8541. }
  8542. public function getRule()
  8543. {
  8544. return $this->rule;
  8545. }
  8546. public function getOtherWatch($literal)
  8547. {
  8548. if ($this->watch1 == $literal) {
  8549. return $this->watch2;
  8550. } else {
  8551. return $this->watch1;
  8552. }
  8553. }
  8554. public function moveWatch($from, $to)
  8555. {
  8556. if ($this->watch1 == $from) {
  8557. $this->watch1 = $to;
  8558. } else {
  8559. $this->watch2 = $to;
  8560. }
  8561. }
  8562. }
  8563. <?php
  8564. namespace Composer\DependencyResolver;
  8565. use Composer\IO\IOInterface;
  8566. use Composer\Repository\RepositoryInterface;
  8567. use Composer\Repository\PlatformRepository;
  8568. class Solver
  8569. {
  8570. const BRANCH_LITERALS = 0;
  8571. const BRANCH_LEVEL = 1;
  8572. protected $policy;
  8573. protected $pool;
  8574. protected $installed;
  8575. protected $rules;
  8576. protected $ruleSetGenerator;
  8577. protected $jobs;
  8578. protected $updateMap = array();
  8579. protected $watchGraph;
  8580. protected $decisions;
  8581. protected $installedMap;
  8582. protected $propagateIndex;
  8583. protected $branches = array();
  8584. protected $problems = array();
  8585. protected $learnedPool = array();
  8586. protected $learnedWhy = array();
  8587. protected $io;
  8588. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  8589. {
  8590. $this->io = $io;
  8591. $this->policy = $policy;
  8592. $this->pool = $pool;
  8593. $this->installed = $installed;
  8594. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  8595. }
  8596. public function getRuleSetSize()
  8597. {
  8598. return count($this->rules);
  8599. }
  8600. private function makeAssertionRuleDecisions()
  8601. {
  8602. $decisionStart = count($this->decisions) - 1;
  8603. $rulesCount = count($this->rules);
  8604. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  8605. $rule = $this->rules->ruleById[$ruleIndex];
  8606. if (!$rule->isAssertion() || $rule->isDisabled()) {
  8607. continue;
  8608. }
  8609. $literals = $rule->getLiterals();
  8610. $literal = $literals[0];
  8611. if (!$this->decisions->decided(abs($literal))) {
  8612. $this->decisions->decide($literal, 1, $rule);
  8613. continue;
  8614. }
  8615. if ($this->decisions->satisfy($literal)) {
  8616. continue;
  8617. }
  8618. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  8619. $rule->disable();
  8620. continue;
  8621. }
  8622. $conflict = $this->decisions->decisionRule($literal);
  8623. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  8624. $problem = new Problem($this->pool);
  8625. $problem->addRule($rule);
  8626. $problem->addRule($conflict);
  8627. $this->disableProblem($rule);
  8628. $this->problems[] = $problem;
  8629. continue;
  8630. }
  8631. $problem = new Problem($this->pool);
  8632. $problem->addRule($rule);
  8633. $problem->addRule($conflict);
  8634. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  8635. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  8636. continue;
  8637. }
  8638. $assertRuleLiterals = $assertRule->getLiterals();
  8639. $assertRuleLiteral = $assertRuleLiterals[0];
  8640. if (abs($literal) !== abs($assertRuleLiteral)) {
  8641. continue;
  8642. }
  8643. $problem->addRule($assertRule);
  8644. $this->disableProblem($assertRule);
  8645. }
  8646. $this->problems[] = $problem;
  8647. $this->decisions->resetToOffset($decisionStart);
  8648. $ruleIndex = -1;
  8649. }
  8650. }
  8651. protected function setupInstalledMap()
  8652. {
  8653. $this->installedMap = array();
  8654. foreach ($this->installed->getPackages() as $package) {
  8655. $this->installedMap[$package->id] = $package;
  8656. }
  8657. }
  8658. protected function checkForRootRequireProblems($ignorePlatformReqs)
  8659. {
  8660. foreach ($this->jobs as $job) {
  8661. switch ($job['cmd']) {
  8662. case 'update':
  8663. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8664. foreach ($packages as $package) {
  8665. if (isset($this->installedMap[$package->id])) {
  8666. $this->updateMap[$package->id] = true;
  8667. }
  8668. }
  8669. break;
  8670. case 'update-all':
  8671. foreach ($this->installedMap as $package) {
  8672. $this->updateMap[$package->id] = true;
  8673. }
  8674. break;
  8675. case 'install':
  8676. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8677. break;
  8678. }
  8679. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  8680. $problem = new Problem($this->pool);
  8681. $problem->addRule(new GenericRule(array(), null, null, $job));
  8682. $this->problems[] = $problem;
  8683. }
  8684. break;
  8685. }
  8686. }
  8687. }
  8688. public function solve(Request $request, $ignorePlatformReqs = false)
  8689. {
  8690. $this->jobs = $request->getJobs();
  8691. $this->setupInstalledMap();
  8692. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  8693. $this->checkForRootRequireProblems($ignorePlatformReqs);
  8694. $this->decisions = new Decisions($this->pool);
  8695. $this->watchGraph = new RuleWatchGraph;
  8696. foreach ($this->rules as $rule) {
  8697. $this->watchGraph->insert(new RuleWatchNode($rule));
  8698. }
  8699. $this->makeAssertionRuleDecisions();
  8700. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  8701. $before = microtime(true);
  8702. $this->runSat(true);
  8703. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  8704. foreach ($this->installedMap as $packageId => $void) {
  8705. if ($this->decisions->undecided($packageId)) {
  8706. $this->decisions->decide(-$packageId, 1, null);
  8707. }
  8708. }
  8709. if ($this->problems) {
  8710. throw new SolverProblemsException($this->problems, $this->installedMap);
  8711. }
  8712. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  8713. return $transaction->getOperations();
  8714. }
  8715. protected function propagate($level)
  8716. {
  8717. while ($this->decisions->validOffset($this->propagateIndex)) {
  8718. $decision = $this->decisions->atOffset($this->propagateIndex);
  8719. $conflict = $this->watchGraph->propagateLiteral(
  8720. $decision[Decisions::DECISION_LITERAL],
  8721. $level,
  8722. $this->decisions
  8723. );
  8724. $this->propagateIndex++;
  8725. if ($conflict) {
  8726. return $conflict;
  8727. }
  8728. }
  8729. return null;
  8730. }
  8731. private function revert($level)
  8732. {
  8733. while (!$this->decisions->isEmpty()) {
  8734. $literal = $this->decisions->lastLiteral();
  8735. if ($this->decisions->undecided($literal)) {
  8736. break;
  8737. }
  8738. $decisionLevel = $this->decisions->decisionLevel($literal);
  8739. if ($decisionLevel <= $level) {
  8740. break;
  8741. }
  8742. $this->decisions->revertLast();
  8743. $this->propagateIndex = count($this->decisions);
  8744. }
  8745. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  8746. array_pop($this->branches);
  8747. }
  8748. }
  8749. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  8750. {
  8751. $level++;
  8752. $this->decisions->decide($literal, $level, $rule);
  8753. while (true) {
  8754. $rule = $this->propagate($level);
  8755. if (!$rule) {
  8756. break;
  8757. }
  8758. if ($level == 1) {
  8759. return $this->analyzeUnsolvable($rule, $disableRules);
  8760. }
  8761. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  8762. if ($newLevel <= 0 || $newLevel >= $level) {
  8763. throw new SolverBugException(
  8764. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  8765. );
  8766. } elseif (!$newRule) {
  8767. throw new SolverBugException(
  8768. "No rule was learned from analyzing $rule at level $level."
  8769. );
  8770. }
  8771. $level = $newLevel;
  8772. $this->revert($level);
  8773. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  8774. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  8775. $ruleNode = new RuleWatchNode($newRule);
  8776. $ruleNode->watch2OnHighest($this->decisions);
  8777. $this->watchGraph->insert($ruleNode);
  8778. $this->decisions->decide($learnLiteral, $level, $newRule);
  8779. }
  8780. return $level;
  8781. }
  8782. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  8783. {
  8784. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  8785. $selectedLiteral = array_shift($literals);
  8786. if (count($literals)) {
  8787. $this->branches[] = array($literals, $level);
  8788. }
  8789. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  8790. }
  8791. protected function analyze($level, Rule $rule)
  8792. {
  8793. $analyzedRule = $rule;
  8794. $ruleLevel = 1;
  8795. $num = 0;
  8796. $l1num = 0;
  8797. $seen = array();
  8798. $learnedLiterals = array(null);
  8799. $decisionId = count($this->decisions);
  8800. $this->learnedPool[] = array();
  8801. while (true) {
  8802. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  8803. foreach ($rule->getLiterals() as $literal) {
  8804. if ($this->decisions->satisfy($literal)) {
  8805. continue;
  8806. }
  8807. if (isset($seen[abs($literal)])) {
  8808. continue;
  8809. }
  8810. $seen[abs($literal)] = true;
  8811. $l = $this->decisions->decisionLevel($literal);
  8812. if (1 === $l) {
  8813. $l1num++;
  8814. } elseif ($level === $l) {
  8815. $num++;
  8816. } else {
  8817. $learnedLiterals[] = $literal;
  8818. if ($l > $ruleLevel) {
  8819. $ruleLevel = $l;
  8820. }
  8821. }
  8822. }
  8823. $l1retry = true;
  8824. while ($l1retry) {
  8825. $l1retry = false;
  8826. if (!$num && !--$l1num) {
  8827. break 2;
  8828. }
  8829. while (true) {
  8830. if ($decisionId <= 0) {
  8831. throw new SolverBugException(
  8832. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  8833. );
  8834. }
  8835. $decisionId--;
  8836. $decision = $this->decisions->atOffset($decisionId);
  8837. $literal = $decision[Decisions::DECISION_LITERAL];
  8838. if (isset($seen[abs($literal)])) {
  8839. break;
  8840. }
  8841. }
  8842. unset($seen[abs($literal)]);
  8843. if ($num && 0 === --$num) {
  8844. $learnedLiterals[0] = -abs($literal);
  8845. if (!$l1num) {
  8846. break 2;
  8847. }
  8848. foreach ($learnedLiterals as $i => $learnedLiteral) {
  8849. if ($i !== 0) {
  8850. unset($seen[abs($learnedLiteral)]);
  8851. }
  8852. }
  8853. $l1num++;
  8854. $l1retry = true;
  8855. }
  8856. }
  8857. $decision = $this->decisions->atOffset($decisionId);
  8858. $rule = $decision[Decisions::DECISION_REASON];
  8859. }
  8860. $why = count($this->learnedPool) - 1;
  8861. if (!$learnedLiterals[0]) {
  8862. throw new SolverBugException(
  8863. "Did not find a learnable literal in analyzed rule $analyzedRule."
  8864. );
  8865. }
  8866. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  8867. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  8868. }
  8869. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  8870. {
  8871. $why = spl_object_hash($conflictRule);
  8872. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  8873. $learnedWhy = $this->learnedWhy[$why];
  8874. $problemRules = $this->learnedPool[$learnedWhy];
  8875. foreach ($problemRules as $problemRule) {
  8876. $this->analyzeUnsolvableRule($problem, $problemRule);
  8877. }
  8878. return;
  8879. }
  8880. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  8881. return;
  8882. }
  8883. $problem->nextSection();
  8884. $problem->addRule($conflictRule);
  8885. }
  8886. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  8887. {
  8888. $problem = new Problem($this->pool);
  8889. $problem->addRule($conflictRule);
  8890. $this->analyzeUnsolvableRule($problem, $conflictRule);
  8891. $this->problems[] = $problem;
  8892. $seen = array();
  8893. $literals = $conflictRule->getLiterals();
  8894. foreach ($literals as $literal) {
  8895. if ($this->decisions->satisfy($literal)) {
  8896. continue;
  8897. }
  8898. $seen[abs($literal)] = true;
  8899. }
  8900. foreach ($this->decisions as $decision) {
  8901. $literal = $decision[Decisions::DECISION_LITERAL];
  8902. if (!isset($seen[abs($literal)])) {
  8903. continue;
  8904. }
  8905. $why = $decision[Decisions::DECISION_REASON];
  8906. $problem->addRule($why);
  8907. $this->analyzeUnsolvableRule($problem, $why);
  8908. $literals = $why->getLiterals();
  8909. foreach ($literals as $literal) {
  8910. if ($this->decisions->satisfy($literal)) {
  8911. continue;
  8912. }
  8913. $seen[abs($literal)] = true;
  8914. }
  8915. }
  8916. if ($disableRules) {
  8917. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  8918. $this->disableProblem($reason['rule']);
  8919. }
  8920. $this->resetSolver();
  8921. return 1;
  8922. }
  8923. return 0;
  8924. }
  8925. private function disableProblem(Rule $why)
  8926. {
  8927. $job = $why->getJob();
  8928. if (!$job) {
  8929. $why->disable();
  8930. return;
  8931. }
  8932. foreach ($this->rules as $rule) {
  8933. if ($job === $rule->getJob()) {
  8934. $rule->disable();
  8935. }
  8936. }
  8937. }
  8938. private function resetSolver()
  8939. {
  8940. $this->decisions->reset();
  8941. $this->propagateIndex = 0;
  8942. $this->branches = array();
  8943. $this->enableDisableLearnedRules();
  8944. $this->makeAssertionRuleDecisions();
  8945. }
  8946. private function enableDisableLearnedRules()
  8947. {
  8948. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  8949. $why = $this->learnedWhy[spl_object_hash($rule)];
  8950. $problemRules = $this->learnedPool[$why];
  8951. $foundDisabled = false;
  8952. foreach ($problemRules as $problemRule) {
  8953. if ($problemRule->isDisabled()) {
  8954. $foundDisabled = true;
  8955. break;
  8956. }
  8957. }
  8958. if ($foundDisabled && $rule->isEnabled()) {
  8959. $rule->disable();
  8960. } elseif (!$foundDisabled && $rule->isDisabled()) {
  8961. $rule->enable();
  8962. }
  8963. }
  8964. }
  8965. private function runSat($disableRules = true)
  8966. {
  8967. $this->propagateIndex = 0;
  8968. $decisionQueue = array();
  8969. $decisionSupplementQueue = array();
  8970. $disableRules = array();
  8971. $level = 1;
  8972. $systemLevel = $level + 1;
  8973. $installedPos = 0;
  8974. while (true) {
  8975. if (1 === $level) {
  8976. $conflictRule = $this->propagate($level);
  8977. if (null !== $conflictRule) {
  8978. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  8979. continue;
  8980. }
  8981. return;
  8982. }
  8983. }
  8984. if ($level < $systemLevel) {
  8985. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  8986. foreach ($iterator as $rule) {
  8987. if ($rule->isEnabled()) {
  8988. $decisionQueue = array();
  8989. $noneSatisfied = true;
  8990. foreach ($rule->getLiterals() as $literal) {
  8991. if ($this->decisions->satisfy($literal)) {
  8992. $noneSatisfied = false;
  8993. break;
  8994. }
  8995. if ($literal > 0 && $this->decisions->undecided($literal)) {
  8996. $decisionQueue[] = $literal;
  8997. }
  8998. }
  8999. if ($noneSatisfied && count($decisionQueue)) {
  9000. if (count($this->installed) != count($this->updateMap)) {
  9001. $prunedQueue = array();
  9002. foreach ($decisionQueue as $literal) {
  9003. if (isset($this->installedMap[abs($literal)])) {
  9004. $prunedQueue[] = $literal;
  9005. if (isset($this->updateMap[abs($literal)])) {
  9006. $prunedQueue = $decisionQueue;
  9007. break;
  9008. }
  9009. }
  9010. }
  9011. $decisionQueue = $prunedQueue;
  9012. }
  9013. }
  9014. if ($noneSatisfied && count($decisionQueue)) {
  9015. $oLevel = $level;
  9016. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9017. if (0 === $level) {
  9018. return;
  9019. }
  9020. if ($level <= $oLevel) {
  9021. break;
  9022. }
  9023. }
  9024. }
  9025. }
  9026. $systemLevel = $level + 1;
  9027. $iterator->next();
  9028. if ($iterator->valid()) {
  9029. continue;
  9030. }
  9031. }
  9032. if ($level < $systemLevel) {
  9033. $systemLevel = $level;
  9034. }
  9035. $rulesCount = count($this->rules);
  9036. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9037. if ($i == $rulesCount) {
  9038. $i = 0;
  9039. }
  9040. $rule = $this->rules->ruleById[$i];
  9041. $literals = $rule->getLiterals();
  9042. if ($rule->isDisabled()) {
  9043. continue;
  9044. }
  9045. $decisionQueue = array();
  9046. foreach ($literals as $literal) {
  9047. if ($literal <= 0) {
  9048. if (!$this->decisions->decidedInstall(abs($literal))) {
  9049. continue 2;
  9050. }
  9051. } else {
  9052. if ($this->decisions->decidedInstall(abs($literal))) {
  9053. continue 2;
  9054. }
  9055. if ($this->decisions->undecided(abs($literal))) {
  9056. $decisionQueue[] = $literal;
  9057. }
  9058. }
  9059. }
  9060. if (count($decisionQueue) < 2) {
  9061. continue;
  9062. }
  9063. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9064. if (0 === $level) {
  9065. return;
  9066. }
  9067. $rulesCount = count($this->rules);
  9068. $n = -1;
  9069. }
  9070. if ($level < $systemLevel) {
  9071. continue;
  9072. }
  9073. if (count($this->branches)) {
  9074. $lastLiteral = null;
  9075. $lastLevel = null;
  9076. $lastBranchIndex = 0;
  9077. $lastBranchOffset = 0;
  9078. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9079. list($literals, $l) = $this->branches[$i];
  9080. foreach ($literals as $offset => $literal) {
  9081. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9082. $lastLiteral = $literal;
  9083. $lastBranchIndex = $i;
  9084. $lastBranchOffset = $offset;
  9085. $lastLevel = $l;
  9086. }
  9087. }
  9088. }
  9089. if ($lastLiteral) {
  9090. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9091. $level = $lastLevel;
  9092. $this->revert($level);
  9093. $why = $this->decisions->lastReason();
  9094. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9095. if ($level == 0) {
  9096. return;
  9097. }
  9098. continue;
  9099. }
  9100. }
  9101. break;
  9102. }
  9103. }
  9104. }
  9105. <?php
  9106. namespace Composer\DependencyResolver;
  9107. class SolverBugException extends \RuntimeException
  9108. {
  9109. public function __construct($message)
  9110. {
  9111. parent::__construct(
  9112. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9113. "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");
  9114. }
  9115. }
  9116. <?php
  9117. namespace Composer\DependencyResolver;
  9118. use Composer\Util\IniHelper;
  9119. class SolverProblemsException extends \RuntimeException
  9120. {
  9121. protected $problems;
  9122. protected $installedMap;
  9123. public function __construct(array $problems, array $installedMap)
  9124. {
  9125. $this->problems = $problems;
  9126. $this->installedMap = $installedMap;
  9127. parent::__construct($this->createMessage(), 2);
  9128. }
  9129. protected function createMessage()
  9130. {
  9131. $text = "\n";
  9132. $hasExtensionProblems = false;
  9133. foreach ($this->problems as $i => $problem) {
  9134. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  9135. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  9136. $hasExtensionProblems = true;
  9137. }
  9138. }
  9139. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  9140. $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.";
  9141. }
  9142. if ($hasExtensionProblems) {
  9143. $text .= $this->createExtensionHint();
  9144. }
  9145. return $text;
  9146. }
  9147. public function getProblems()
  9148. {
  9149. return $this->problems;
  9150. }
  9151. private function createExtensionHint()
  9152. {
  9153. $paths = IniHelper::getAll();
  9154. if (count($paths) === 1 && empty($paths[0])) {
  9155. return '';
  9156. }
  9157. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  9158. $text .= implode("\n - ", $paths);
  9159. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  9160. return $text;
  9161. }
  9162. private function hasExtensionProblems(array $reasonSets)
  9163. {
  9164. foreach ($reasonSets as $reasonSet) {
  9165. foreach ($reasonSet as $reason) {
  9166. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  9167. return true;
  9168. }
  9169. }
  9170. }
  9171. return false;
  9172. }
  9173. }
  9174. <?php
  9175. namespace Composer\DependencyResolver;
  9176. use Composer\Package\AliasPackage;
  9177. class Transaction
  9178. {
  9179. protected $policy;
  9180. protected $pool;
  9181. protected $installedMap;
  9182. protected $decisions;
  9183. protected $transaction;
  9184. public function __construct($policy, $pool, $installedMap, $decisions)
  9185. {
  9186. $this->policy = $policy;
  9187. $this->pool = $pool;
  9188. $this->installedMap = $installedMap;
  9189. $this->decisions = $decisions;
  9190. $this->transaction = array();
  9191. }
  9192. public function getOperations()
  9193. {
  9194. $installMeansUpdateMap = $this->findUpdates();
  9195. $updateMap = array();
  9196. $installMap = array();
  9197. $uninstallMap = array();
  9198. foreach ($this->decisions as $i => $decision) {
  9199. $literal = $decision[Decisions::DECISION_LITERAL];
  9200. $reason = $decision[Decisions::DECISION_REASON];
  9201. $package = $this->pool->literalToPackage($literal);
  9202. if (($literal > 0) == (isset($this->installedMap[$package->id]))) {
  9203. continue;
  9204. }
  9205. if ($literal > 0) {
  9206. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  9207. $source = $installMeansUpdateMap[abs($literal)];
  9208. $updateMap[$package->id] = array(
  9209. 'package' => $package,
  9210. 'source' => $source,
  9211. 'reason' => $reason,
  9212. );
  9213. unset($installMeansUpdateMap[abs($literal)]);
  9214. $ignoreRemove[$source->id] = true;
  9215. } else {
  9216. $installMap[$package->id] = array(
  9217. 'package' => $package,
  9218. 'reason' => $reason,
  9219. );
  9220. }
  9221. }
  9222. }
  9223. foreach ($this->decisions as $i => $decision) {
  9224. $literal = $decision[Decisions::DECISION_LITERAL];
  9225. $reason = $decision[Decisions::DECISION_REASON];
  9226. $package = $this->pool->literalToPackage($literal);
  9227. if ($literal <= 0 &&
  9228. isset($this->installedMap[$package->id]) &&
  9229. !isset($ignoreRemove[$package->id])) {
  9230. $uninstallMap[$package->id] = array(
  9231. 'package' => $package,
  9232. 'reason' => $reason,
  9233. );
  9234. }
  9235. }
  9236. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  9237. return $this->transaction;
  9238. }
  9239. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  9240. {
  9241. $queue = array_map(
  9242. function ($operation) {
  9243. return $operation['package'];
  9244. },
  9245. $this->findRootPackages($installMap, $updateMap)
  9246. );
  9247. $visited = array();
  9248. while (!empty($queue)) {
  9249. $package = array_pop($queue);
  9250. $packageId = $package->id;
  9251. if (!isset($visited[$packageId])) {
  9252. array_push($queue, $package);
  9253. if ($package instanceof AliasPackage) {
  9254. array_push($queue, $package->getAliasOf());
  9255. } else {
  9256. foreach ($package->getRequires() as $link) {
  9257. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9258. foreach ($possibleRequires as $require) {
  9259. array_push($queue, $require);
  9260. }
  9261. }
  9262. }
  9263. $visited[$package->id] = true;
  9264. } else {
  9265. if (isset($installMap[$packageId])) {
  9266. $this->install(
  9267. $installMap[$packageId]['package'],
  9268. $installMap[$packageId]['reason']
  9269. );
  9270. unset($installMap[$packageId]);
  9271. }
  9272. if (isset($updateMap[$packageId])) {
  9273. $this->update(
  9274. $updateMap[$packageId]['source'],
  9275. $updateMap[$packageId]['package'],
  9276. $updateMap[$packageId]['reason']
  9277. );
  9278. unset($updateMap[$packageId]);
  9279. }
  9280. }
  9281. }
  9282. foreach ($uninstallMap as $uninstall) {
  9283. $this->uninstall($uninstall['package'], $uninstall['reason']);
  9284. }
  9285. }
  9286. protected function findRootPackages($installMap, $updateMap)
  9287. {
  9288. $packages = $installMap + $updateMap;
  9289. $roots = $packages;
  9290. foreach ($packages as $packageId => $operation) {
  9291. $package = $operation['package'];
  9292. if (!isset($roots[$packageId])) {
  9293. continue;
  9294. }
  9295. foreach ($package->getRequires() as $link) {
  9296. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9297. foreach ($possibleRequires as $require) {
  9298. if ($require !== $package) {
  9299. unset($roots[$require->id]);
  9300. }
  9301. }
  9302. }
  9303. }
  9304. return $roots;
  9305. }
  9306. protected function findUpdates()
  9307. {
  9308. $installMeansUpdateMap = array();
  9309. foreach ($this->decisions as $i => $decision) {
  9310. $literal = $decision[Decisions::DECISION_LITERAL];
  9311. $package = $this->pool->literalToPackage($literal);
  9312. if ($package instanceof AliasPackage) {
  9313. continue;
  9314. }
  9315. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  9316. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  9317. $literals = array($package->id);
  9318. foreach ($updates as $update) {
  9319. $literals[] = $update->id;
  9320. }
  9321. foreach ($literals as $updateLiteral) {
  9322. if ($updateLiteral !== $literal) {
  9323. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  9324. }
  9325. }
  9326. }
  9327. }
  9328. return $installMeansUpdateMap;
  9329. }
  9330. protected function install($package, $reason)
  9331. {
  9332. if ($package instanceof AliasPackage) {
  9333. return $this->markAliasInstalled($package, $reason);
  9334. }
  9335. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  9336. }
  9337. protected function update($from, $to, $reason)
  9338. {
  9339. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  9340. }
  9341. protected function uninstall($package, $reason)
  9342. {
  9343. if ($package instanceof AliasPackage) {
  9344. return $this->markAliasUninstalled($package, $reason);
  9345. }
  9346. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  9347. }
  9348. protected function markAliasInstalled($package, $reason)
  9349. {
  9350. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  9351. }
  9352. protected function markAliasUninstalled($package, $reason)
  9353. {
  9354. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  9355. }
  9356. }
  9357. <?php
  9358. namespace Composer\Downloader;
  9359. use Composer\Package\PackageInterface;
  9360. use Symfony\Component\Finder\Finder;
  9361. use Composer\IO\IOInterface;
  9362. abstract class ArchiveDownloader extends FileDownloader
  9363. {
  9364. public function download(PackageInterface $package, $path, $output = true)
  9365. {
  9366. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  9367. $retries = 3;
  9368. while ($retries--) {
  9369. $fileName = parent::download($package, $path, $output);
  9370. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  9371. try {
  9372. $this->filesystem->ensureDirectoryExists($temporaryDir);
  9373. try {
  9374. $this->extract($fileName, $temporaryDir);
  9375. } catch (\Exception $e) {
  9376. parent::clearLastCacheWrite($package);
  9377. throw $e;
  9378. }
  9379. $this->filesystem->unlink($fileName);
  9380. $contentDir = $this->getFolderContent($temporaryDir);
  9381. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  9382. $contentDir = $this->getFolderContent((string) reset($contentDir));
  9383. }
  9384. foreach ($contentDir as $file) {
  9385. $file = (string) $file;
  9386. $this->filesystem->rename($file, $path . '/' . basename($file));
  9387. }
  9388. $this->filesystem->removeDirectory($temporaryDir);
  9389. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  9390. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  9391. }
  9392. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  9393. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  9394. }
  9395. } catch (\Exception $e) {
  9396. $this->filesystem->removeDirectory($path);
  9397. $this->filesystem->removeDirectory($temporaryDir);
  9398. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  9399. $this->io->writeError('');
  9400. if ($this->io->isDebug()) {
  9401. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  9402. } else {
  9403. $this->io->writeError(' Invalid zip file, retrying...');
  9404. }
  9405. usleep(500000);
  9406. continue;
  9407. }
  9408. throw $e;
  9409. }
  9410. break;
  9411. }
  9412. }
  9413. protected function getFileName(PackageInterface $package, $path)
  9414. {
  9415. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  9416. }
  9417. protected function processUrl(PackageInterface $package, $url)
  9418. {
  9419. if ($package->getDistReference() && strpos($url, 'github.com')) {
  9420. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  9421. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  9422. } elseif ($package->getDistReference() && preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  9423. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  9424. } elseif ($package->getDistReference() && preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  9425. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
  9426. }
  9427. } elseif ($package->getDistReference() && strpos($url, 'bitbucket.org')) {
  9428. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  9429. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $package->getDistReference() . '.' . $match[4];
  9430. }
  9431. }
  9432. return parent::processUrl($package, $url);
  9433. }
  9434. abstract protected function extract($file, $path);
  9435. private function getFolderContent($dir)
  9436. {
  9437. $finder = Finder::create()
  9438. ->ignoreVCS(false)
  9439. ->ignoreDotFiles(false)
  9440. ->depth(0)
  9441. ->in($dir);
  9442. return iterator_to_array($finder);
  9443. }
  9444. }
  9445. <?php
  9446. namespace Composer\Downloader;
  9447. use Composer\Package\PackageInterface;
  9448. interface ChangeReportInterface
  9449. {
  9450. public function getLocalChanges(PackageInterface $package, $path);
  9451. }
  9452. <?php
  9453. namespace Composer\Downloader;
  9454. use Composer\Package\PackageInterface;
  9455. use Composer\IO\IOInterface;
  9456. use Composer\Util\Filesystem;
  9457. class DownloadManager
  9458. {
  9459. private $io;
  9460. private $preferDist = false;
  9461. private $preferSource = false;
  9462. private $packagePreferences = array();
  9463. private $filesystem;
  9464. private $downloaders = array();
  9465. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  9466. {
  9467. $this->io = $io;
  9468. $this->preferSource = $preferSource;
  9469. $this->filesystem = $filesystem ?: new Filesystem();
  9470. }
  9471. public function setPreferSource($preferSource)
  9472. {
  9473. $this->preferSource = $preferSource;
  9474. return $this;
  9475. }
  9476. public function setPreferDist($preferDist)
  9477. {
  9478. $this->preferDist = $preferDist;
  9479. return $this;
  9480. }
  9481. public function setPreferences(array $preferences)
  9482. {
  9483. $this->packagePreferences = $preferences;
  9484. return $this;
  9485. }
  9486. public function setOutputProgress($outputProgress)
  9487. {
  9488. foreach ($this->downloaders as $downloader) {
  9489. $downloader->setOutputProgress($outputProgress);
  9490. }
  9491. return $this;
  9492. }
  9493. public function setDownloader($type, DownloaderInterface $downloader)
  9494. {
  9495. $type = strtolower($type);
  9496. $this->downloaders[$type] = $downloader;
  9497. return $this;
  9498. }
  9499. public function getDownloader($type)
  9500. {
  9501. $type = strtolower($type);
  9502. if (!isset($this->downloaders[$type])) {
  9503. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  9504. }
  9505. return $this->downloaders[$type];
  9506. }
  9507. public function getDownloaderForInstalledPackage(PackageInterface $package)
  9508. {
  9509. $installationSource = $package->getInstallationSource();
  9510. if ('metapackage' === $package->getType()) {
  9511. return;
  9512. }
  9513. if ('dist' === $installationSource) {
  9514. $downloader = $this->getDownloader($package->getDistType());
  9515. } elseif ('source' === $installationSource) {
  9516. $downloader = $this->getDownloader($package->getSourceType());
  9517. } else {
  9518. throw new \InvalidArgumentException(
  9519. 'Package '.$package.' seems not been installed properly'
  9520. );
  9521. }
  9522. if ($installationSource !== $downloader->getInstallationSource()) {
  9523. throw new \LogicException(sprintf(
  9524. 'Downloader "%s" is a %s type downloader and can not be used to download %s',
  9525. get_class($downloader), $downloader->getInstallationSource(), $installationSource
  9526. ));
  9527. }
  9528. return $downloader;
  9529. }
  9530. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  9531. {
  9532. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  9533. $sourceType = $package->getSourceType();
  9534. $distType = $package->getDistType();
  9535. $sources = array();
  9536. if ($sourceType) {
  9537. $sources[] = 'source';
  9538. }
  9539. if ($distType) {
  9540. $sources[] = 'dist';
  9541. }
  9542. if (empty($sources)) {
  9543. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  9544. }
  9545. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  9546. $sources = array_reverse($sources);
  9547. }
  9548. $this->filesystem->ensureDirectoryExists($targetDir);
  9549. foreach ($sources as $i => $source) {
  9550. if (isset($e)) {
  9551. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  9552. }
  9553. $package->setInstallationSource($source);
  9554. try {
  9555. $downloader = $this->getDownloaderForInstalledPackage($package);
  9556. if ($downloader) {
  9557. $downloader->download($package, $targetDir);
  9558. }
  9559. break;
  9560. } catch (\RuntimeException $e) {
  9561. if ($i === count($sources) - 1) {
  9562. throw $e;
  9563. }
  9564. $this->io->writeError(
  9565. ' <warning>Failed to download '.
  9566. $package->getPrettyName().
  9567. ' from ' . $source . ': '.
  9568. $e->getMessage().'</warning>'
  9569. );
  9570. }
  9571. }
  9572. }
  9573. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  9574. {
  9575. $downloader = $this->getDownloaderForInstalledPackage($initial);
  9576. if (!$downloader) {
  9577. return;
  9578. }
  9579. $installationSource = $initial->getInstallationSource();
  9580. if ('dist' === $installationSource) {
  9581. $initialType = $initial->getDistType();
  9582. $targetType = $target->getDistType();
  9583. } else {
  9584. $initialType = $initial->getSourceType();
  9585. $targetType = $target->getSourceType();
  9586. }
  9587. if ($target->isDev() && 'dist' === $installationSource) {
  9588. $downloader->remove($initial, $targetDir);
  9589. $this->download($target, $targetDir);
  9590. return;
  9591. }
  9592. if ($initialType === $targetType) {
  9593. $target->setInstallationSource($installationSource);
  9594. try {
  9595. $downloader->update($initial, $target, $targetDir);
  9596. return;
  9597. } catch (\RuntimeException $e) {
  9598. if (!$this->io->isInteractive()) {
  9599. throw $e;
  9600. }
  9601. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  9602. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  9603. throw $e;
  9604. }
  9605. }
  9606. }
  9607. $downloader->remove($initial, $targetDir);
  9608. $this->download($target, $targetDir, 'source' === $installationSource);
  9609. }
  9610. public function remove(PackageInterface $package, $targetDir)
  9611. {
  9612. $downloader = $this->getDownloaderForInstalledPackage($package);
  9613. if ($downloader) {
  9614. $downloader->remove($package, $targetDir);
  9615. }
  9616. }
  9617. protected function resolvePackageInstallPreference(PackageInterface $package)
  9618. {
  9619. foreach ($this->packagePreferences as $pattern => $preference) {
  9620. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  9621. if (preg_match($pattern, $package->getName())) {
  9622. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  9623. return 'dist';
  9624. }
  9625. return 'source';
  9626. }
  9627. }
  9628. return $package->isDev() ? 'source' : 'dist';
  9629. }
  9630. }
  9631. <?php
  9632. namespace Composer\Downloader;
  9633. use Composer\Package\PackageInterface;
  9634. interface DownloaderInterface
  9635. {
  9636. public function getInstallationSource();
  9637. public function download(PackageInterface $package, $path);
  9638. public function update(PackageInterface $initial, PackageInterface $target, $path);
  9639. public function remove(PackageInterface $package, $path);
  9640. public function setOutputProgress($outputProgress);
  9641. }
  9642. <?php
  9643. namespace Composer\Downloader;
  9644. use Composer\Package\PackageInterface;
  9645. interface DvcsDownloaderInterface
  9646. {
  9647. public function getUnpushedChanges(PackageInterface $package, $path);
  9648. }
  9649. <?php
  9650. namespace Composer\Downloader;
  9651. use Composer\Config;
  9652. use Composer\Cache;
  9653. use Composer\Factory;
  9654. use Composer\IO\IOInterface;
  9655. use Composer\Package\PackageInterface;
  9656. use Composer\Plugin\PluginEvents;
  9657. use Composer\Plugin\PreFileDownloadEvent;
  9658. use Composer\EventDispatcher\EventDispatcher;
  9659. use Composer\Util\Filesystem;
  9660. use Composer\Util\RemoteFilesystem;
  9661. class FileDownloader implements DownloaderInterface
  9662. {
  9663. protected $io;
  9664. protected $config;
  9665. protected $rfs;
  9666. protected $filesystem;
  9667. protected $cache;
  9668. protected $outputProgress = true;
  9669. private $lastCacheWrites = array();
  9670. private $eventDispatcher;
  9671. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  9672. {
  9673. $this->io = $io;
  9674. $this->config = $config;
  9675. $this->eventDispatcher = $eventDispatcher;
  9676. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  9677. $this->filesystem = $filesystem ?: new Filesystem();
  9678. $this->cache = $cache;
  9679. if ($this->cache && $this->cache->gcIsNecessary()) {
  9680. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  9681. }
  9682. }
  9683. public function getInstallationSource()
  9684. {
  9685. return 'dist';
  9686. }
  9687. public function download(PackageInterface $package, $path, $output = true)
  9688. {
  9689. if (!$package->getDistUrl()) {
  9690. throw new \InvalidArgumentException('The given package is missing url information');
  9691. }
  9692. if ($output) {
  9693. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  9694. }
  9695. $urls = $package->getDistUrls();
  9696. while ($url = array_shift($urls)) {
  9697. try {
  9698. $fileName = $this->doDownload($package, $path, $url);
  9699. break;
  9700. } catch (\Exception $e) {
  9701. if ($this->io->isDebug()) {
  9702. $this->io->writeError('');
  9703. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  9704. } elseif (count($urls)) {
  9705. $this->io->writeError('');
  9706. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  9707. }
  9708. if (!count($urls)) {
  9709. throw $e;
  9710. }
  9711. }
  9712. }
  9713. if ($output) {
  9714. $this->io->writeError('');
  9715. }
  9716. return $fileName;
  9717. }
  9718. protected function doDownload(PackageInterface $package, $path, $url)
  9719. {
  9720. $this->filesystem->emptyDirectory($path);
  9721. $fileName = $this->getFileName($package, $path);
  9722. $processedUrl = $this->processUrl($package, $url);
  9723. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  9724. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  9725. if ($this->eventDispatcher) {
  9726. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  9727. }
  9728. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  9729. try {
  9730. $checksum = $package->getDistSha1Checksum();
  9731. $cacheKey = $this->getCacheKey($package, $processedUrl);
  9732. if (!$this->cache || ($checksum && $checksum !== $this->cache->sha1($cacheKey)) || !$this->cache->copyTo($cacheKey, $fileName)) {
  9733. if (!$this->outputProgress) {
  9734. $this->io->writeError('Downloading', false);
  9735. }
  9736. $retries = 3;
  9737. while ($retries--) {
  9738. try {
  9739. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  9740. break;
  9741. } catch (TransportException $e) {
  9742. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  9743. throw $e;
  9744. }
  9745. $this->io->writeError('');
  9746. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  9747. usleep(500000);
  9748. }
  9749. }
  9750. if (!$this->outputProgress) {
  9751. $this->io->writeError(' (<comment>100%</comment>)', false);
  9752. }
  9753. if ($this->cache) {
  9754. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  9755. $this->cache->copyFrom($cacheKey, $fileName);
  9756. }
  9757. } else {
  9758. $this->io->writeError('Loading from cache', false);
  9759. }
  9760. if (!file_exists($fileName)) {
  9761. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  9762. .' directory is writable and you have internet connectivity');
  9763. }
  9764. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  9765. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  9766. }
  9767. } catch (\Exception $e) {
  9768. $this->filesystem->removeDirectory($path);
  9769. $this->clearLastCacheWrite($package);
  9770. throw $e;
  9771. }
  9772. return $fileName;
  9773. }
  9774. public function setOutputProgress($outputProgress)
  9775. {
  9776. $this->outputProgress = $outputProgress;
  9777. return $this;
  9778. }
  9779. protected function clearLastCacheWrite(PackageInterface $package)
  9780. {
  9781. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  9782. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  9783. unset($this->lastCacheWrites[$package->getName()]);
  9784. }
  9785. }
  9786. public function update(PackageInterface $initial, PackageInterface $target, $path)
  9787. {
  9788. $name = $target->getName();
  9789. $from = $initial->getPrettyVersion();
  9790. $to = $target->getPrettyVersion();
  9791. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  9792. $this->remove($initial, $path, false);
  9793. $this->download($target, $path, false);
  9794. $this->io->writeError('');
  9795. }
  9796. public function remove(PackageInterface $package, $path, $output = true)
  9797. {
  9798. if ($output) {
  9799. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  9800. }
  9801. if (!$this->filesystem->removeDirectory($path)) {
  9802. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  9803. }
  9804. }
  9805. protected function getFileName(PackageInterface $package, $path)
  9806. {
  9807. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  9808. }
  9809. protected function processUrl(PackageInterface $package, $url)
  9810. {
  9811. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  9812. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  9813. }
  9814. return $url;
  9815. }
  9816. private function getCacheKey(PackageInterface $package, $processedUrl)
  9817. {
  9818. $cacheKey = sha1($processedUrl);
  9819. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  9820. }
  9821. }
  9822. <?php
  9823. namespace Composer\Downloader;
  9824. class FilesystemException extends \Exception
  9825. {
  9826. public function __construct($message = '', $code = 0, \Exception $previous = null)
  9827. {
  9828. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  9829. }
  9830. }
  9831. <?php
  9832. namespace Composer\Downloader;
  9833. use Composer\Package\PackageInterface;
  9834. use Composer\Util\ProcessExecutor;
  9835. class FossilDownloader extends VcsDownloader
  9836. {
  9837. public function doDownload(PackageInterface $package, $path, $url)
  9838. {
  9839. $this->config->prohibitUrlByConfig($url, $this->io);
  9840. $url = ProcessExecutor::escape($url);
  9841. $ref = ProcessExecutor::escape($package->getSourceReference());
  9842. $repoFile = $path . '.fossil';
  9843. $this->io->writeError("Cloning ".$package->getSourceReference());
  9844. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  9845. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  9846. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9847. }
  9848. $command = sprintf('fossil open %s', ProcessExecutor::escape($repoFile));
  9849. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9850. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9851. }
  9852. $command = sprintf('fossil update %s', $ref);
  9853. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9854. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9855. }
  9856. }
  9857. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9858. {
  9859. $this->config->prohibitUrlByConfig($url, $this->io);
  9860. $url = ProcessExecutor::escape($url);
  9861. $ref = ProcessExecutor::escape($target->getSourceReference());
  9862. $this->io->writeError(" Updating to ".$target->getSourceReference());
  9863. if (!$this->hasMetadataRepository($path)) {
  9864. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  9865. }
  9866. $command = sprintf('fossil pull && fossil up %s', $ref);
  9867. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  9868. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9869. }
  9870. }
  9871. public function getLocalChanges(PackageInterface $package, $path)
  9872. {
  9873. if (!$this->hasMetadataRepository($path)) {
  9874. return null;
  9875. }
  9876. $this->process->execute('fossil changes', $output, realpath($path));
  9877. return trim($output) ?: null;
  9878. }
  9879. protected function getCommitLogs($fromReference, $toReference, $path)
  9880. {
  9881. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', $toReference);
  9882. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  9883. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  9884. }
  9885. $log = '';
  9886. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  9887. foreach ($this->process->splitLines($output) as $line) {
  9888. if (preg_match($match, $line)) {
  9889. break;
  9890. }
  9891. $log .= $line;
  9892. }
  9893. return $log;
  9894. }
  9895. protected function hasMetadataRepository($path)
  9896. {
  9897. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  9898. }
  9899. }
  9900. <?php
  9901. namespace Composer\Downloader;
  9902. use Composer\Package\PackageInterface;
  9903. use Composer\Util\Git as GitUtil;
  9904. use Composer\Util\Platform;
  9905. use Composer\Util\ProcessExecutor;
  9906. use Composer\IO\IOInterface;
  9907. use Composer\Util\Filesystem;
  9908. use Composer\Config;
  9909. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  9910. {
  9911. private $hasStashedChanges = false;
  9912. private $hasDiscardedChanges = false;
  9913. private $gitUtil;
  9914. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  9915. {
  9916. parent::__construct($io, $config, $process, $fs);
  9917. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  9918. }
  9919. public function doDownload(PackageInterface $package, $path, $url)
  9920. {
  9921. GitUtil::cleanEnv();
  9922. $path = $this->normalizePath($path);
  9923. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  9924. $cacheOptions = '';
  9925. $ref = $package->getSourceReference();
  9926. $flag = Platform::isWindows() ? '/D ' : '';
  9927. $gitVersion = $this->gitUtil->getVersion();
  9928. $msg = "Cloning ".$this->getShortHash($ref);
  9929. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  9930. $this->io->writeError('', true, IOInterface::DEBUG);
  9931. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  9932. try {
  9933. $this->gitUtil->syncMirror($url, $cachePath);
  9934. if (is_dir($cachePath)) {
  9935. $cacheOptions = sprintf('--dissociate --reference %s ', ProcessExecutor::escape($cachePath));
  9936. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  9937. }
  9938. } catch (\RuntimeException $e) {
  9939. }
  9940. }
  9941. $command = 'git clone --no-checkout %s %s '.$cacheOptions.'&& cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer';
  9942. $this->io->writeError($msg);
  9943. $commandCallable = function ($url) use ($ref, $path, $command) {
  9944. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($path), ProcessExecutor::escape($ref));
  9945. };
  9946. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  9947. if ($url !== $package->getSourceUrl()) {
  9948. $this->updateOriginUrl($path, $package->getSourceUrl());
  9949. } else {
  9950. $this->setPushUrl($path, $url);
  9951. }
  9952. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  9953. if ($package->getDistReference() === $package->getSourceReference()) {
  9954. $package->setDistReference($newRef);
  9955. }
  9956. $package->setSourceReference($newRef);
  9957. }
  9958. }
  9959. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  9960. {
  9961. GitUtil::cleanEnv();
  9962. if (!$this->hasMetadataRepository($path)) {
  9963. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  9964. }
  9965. $updateOriginUrl = false;
  9966. if (
  9967. 0 === $this->process->execute('git remote -v', $output, $path)
  9968. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  9969. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  9970. ) {
  9971. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  9972. $updateOriginUrl = true;
  9973. }
  9974. }
  9975. $ref = $target->getSourceReference();
  9976. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  9977. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s^{commit} || (git fetch composer && git fetch --tags composer)';
  9978. $commandCallable = function ($url) use ($command, $ref) {
  9979. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  9980. };
  9981. $this->gitUtil->runCommand($commandCallable, $url, $path);
  9982. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  9983. if ($target->getDistReference() === $target->getSourceReference()) {
  9984. $target->setDistReference($newRef);
  9985. }
  9986. $target->setSourceReference($newRef);
  9987. }
  9988. if ($updateOriginUrl) {
  9989. $this->updateOriginUrl($path, $target->getSourceUrl());
  9990. }
  9991. }
  9992. public function getLocalChanges(PackageInterface $package, $path)
  9993. {
  9994. GitUtil::cleanEnv();
  9995. if (!$this->hasMetadataRepository($path)) {
  9996. return;
  9997. }
  9998. $command = 'git status --porcelain --untracked-files=no';
  9999. if (0 !== $this->process->execute($command, $output, $path)) {
  10000. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10001. }
  10002. return trim($output) ?: null;
  10003. }
  10004. public function getUnpushedChanges(PackageInterface $package, $path)
  10005. {
  10006. GitUtil::cleanEnv();
  10007. $path = $this->normalizePath($path);
  10008. if (!$this->hasMetadataRepository($path)) {
  10009. return;
  10010. }
  10011. $command = 'git show-ref --head -d';
  10012. if (0 !== $this->process->execute($command, $output, $path)) {
  10013. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10014. }
  10015. $refs = trim($output);
  10016. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10017. return;
  10018. }
  10019. $headRef = $match[1];
  10020. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10021. return;
  10022. }
  10023. $branch = $matches[1][0];
  10024. $unpushedChanges = null;
  10025. for ($i = 0; $i <= 1; $i++) {
  10026. foreach ($matches[1] as $candidate) {
  10027. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10028. $branch = $candidate;
  10029. $remoteBranch = $match[1];
  10030. break;
  10031. }
  10032. }
  10033. if (!isset($remoteBranch)) {
  10034. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10035. } else {
  10036. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10037. if (0 !== $this->process->execute($command, $output, $path)) {
  10038. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10039. }
  10040. $unpushedChanges = trim($output) ?: null;
  10041. }
  10042. if ($unpushedChanges && $i === 0) {
  10043. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10044. }
  10045. if (!$unpushedChanges) {
  10046. break;
  10047. }
  10048. }
  10049. return $unpushedChanges;
  10050. }
  10051. protected function cleanChanges(PackageInterface $package, $path, $update)
  10052. {
  10053. GitUtil::cleanEnv();
  10054. $path = $this->normalizePath($path);
  10055. $unpushed = $this->getUnpushedChanges($package, $path);
  10056. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10057. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10058. }
  10059. if (!$changes = $this->getLocalChanges($package, $path)) {
  10060. return;
  10061. }
  10062. if (!$this->io->isInteractive()) {
  10063. $discardChanges = $this->config->get('discard-changes');
  10064. if (true === $discardChanges) {
  10065. return $this->discardChanges($path);
  10066. }
  10067. if ('stash' === $discardChanges) {
  10068. if (!$update) {
  10069. return parent::cleanChanges($package, $path, $update);
  10070. }
  10071. return $this->stashChanges($path);
  10072. }
  10073. return parent::cleanChanges($package, $path, $update);
  10074. }
  10075. $changes = array_map(function ($elem) {
  10076. return ' '.$elem;
  10077. }, preg_split('{\s*\r?\n\s*}', $changes));
  10078. $this->io->writeError(' <error>The package has modified files:</error>');
  10079. $this->io->writeError(array_slice($changes, 0, 10));
  10080. if (count($changes) > 10) {
  10081. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10082. }
  10083. while (true) {
  10084. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10085. case 'y':
  10086. $this->discardChanges($path);
  10087. break 2;
  10088. case 's':
  10089. if (!$update) {
  10090. goto help;
  10091. }
  10092. $this->stashChanges($path);
  10093. break 2;
  10094. case 'n':
  10095. throw new \RuntimeException('Update aborted');
  10096. case 'v':
  10097. $this->io->writeError($changes);
  10098. break;
  10099. case 'd':
  10100. $this->viewDiff($path);
  10101. break;
  10102. case '?':
  10103. default:
  10104. help:
  10105. $this->io->writeError(array(
  10106. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10107. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10108. ' v - view modified files',
  10109. ' d - view local modifications (diff)',
  10110. ));
  10111. if ($update) {
  10112. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  10113. }
  10114. $this->io->writeError(' ? - print help');
  10115. break;
  10116. }
  10117. }
  10118. }
  10119. protected function reapplyChanges($path)
  10120. {
  10121. $path = $this->normalizePath($path);
  10122. if ($this->hasStashedChanges) {
  10123. $this->hasStashedChanges = false;
  10124. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  10125. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  10126. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  10127. }
  10128. }
  10129. $this->hasDiscardedChanges = false;
  10130. }
  10131. protected function updateToCommit($path, $reference, $branch, $date)
  10132. {
  10133. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  10134. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  10135. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  10136. $branches = null;
  10137. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  10138. $branches = $output;
  10139. }
  10140. $gitRef = $reference;
  10141. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  10142. && $branches
  10143. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  10144. ) {
  10145. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  10146. if (0 === $this->process->execute($command, $output, $path)) {
  10147. return;
  10148. }
  10149. }
  10150. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  10151. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  10152. $branch = 'v' . $branch;
  10153. }
  10154. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  10155. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  10156. if (0 === $this->process->execute($command, $output, $path)
  10157. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  10158. ) {
  10159. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  10160. if (0 === $this->process->execute($command, $output, $path)) {
  10161. return;
  10162. }
  10163. }
  10164. }
  10165. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  10166. if (0 === $this->process->execute($command, $output, $path)) {
  10167. return;
  10168. }
  10169. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  10170. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  10171. }
  10172. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  10173. }
  10174. protected function updateOriginUrl($path, $url)
  10175. {
  10176. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  10177. $this->setPushUrl($path, $url);
  10178. }
  10179. protected function setPushUrl($path, $url)
  10180. {
  10181. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  10182. $protocols = $this->config->get('github-protocols');
  10183. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  10184. if (!in_array('ssh', $protocols, true)) {
  10185. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  10186. }
  10187. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  10188. $this->process->execute($cmd, $ignoredOutput, $path);
  10189. }
  10190. }
  10191. protected function getCommitLogs($fromReference, $toReference, $path)
  10192. {
  10193. $path = $this->normalizePath($path);
  10194. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', $fromReference, $toReference);
  10195. if (0 !== $this->process->execute($command, $output, $path)) {
  10196. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10197. }
  10198. return $output;
  10199. }
  10200. protected function discardChanges($path)
  10201. {
  10202. $path = $this->normalizePath($path);
  10203. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  10204. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10205. }
  10206. $this->hasDiscardedChanges = true;
  10207. }
  10208. protected function stashChanges($path)
  10209. {
  10210. $path = $this->normalizePath($path);
  10211. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  10212. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  10213. }
  10214. $this->hasStashedChanges = true;
  10215. }
  10216. protected function viewDiff($path)
  10217. {
  10218. $path = $this->normalizePath($path);
  10219. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  10220. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  10221. }
  10222. $this->io->writeError($output);
  10223. }
  10224. protected function normalizePath($path)
  10225. {
  10226. if (Platform::isWindows() && strlen($path) > 0) {
  10227. $basePath = $path;
  10228. $removed = array();
  10229. while (!is_dir($basePath) && $basePath !== '\\') {
  10230. array_unshift($removed, basename($basePath));
  10231. $basePath = dirname($basePath);
  10232. }
  10233. if ($basePath === '\\') {
  10234. return $path;
  10235. }
  10236. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  10237. }
  10238. return $path;
  10239. }
  10240. protected function hasMetadataRepository($path)
  10241. {
  10242. $path = $this->normalizePath($path);
  10243. return is_dir($path.'/.git');
  10244. }
  10245. protected function getShortHash($reference)
  10246. {
  10247. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  10248. return substr($reference, 0, 10);
  10249. }
  10250. return $reference;
  10251. }
  10252. }
  10253. <?php
  10254. namespace Composer\Downloader;
  10255. use Composer\Config;
  10256. use Composer\Cache;
  10257. use Composer\EventDispatcher\EventDispatcher;
  10258. use Composer\Package\PackageInterface;
  10259. use Composer\Util\Platform;
  10260. use Composer\Util\ProcessExecutor;
  10261. use Composer\Util\RemoteFilesystem;
  10262. use Composer\IO\IOInterface;
  10263. class GzipDownloader extends ArchiveDownloader
  10264. {
  10265. protected $process;
  10266. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10267. {
  10268. $this->process = $process ?: new ProcessExecutor($io);
  10269. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10270. }
  10271. protected function extract($file, $path)
  10272. {
  10273. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  10274. if (!Platform::isWindows()) {
  10275. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  10276. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10277. return;
  10278. }
  10279. if (extension_loaded('zlib')) {
  10280. $this->extractUsingExt($file, $targetFilepath);
  10281. return;
  10282. }
  10283. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10284. throw new \RuntimeException($processError);
  10285. }
  10286. $this->extractUsingExt($file, $targetFilepath);
  10287. }
  10288. protected function getFileName(PackageInterface $package, $path)
  10289. {
  10290. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10291. }
  10292. private function extractUsingExt($file, $targetFilepath)
  10293. {
  10294. $archiveFile = gzopen($file, 'rb');
  10295. $targetFile = fopen($targetFilepath, 'wb');
  10296. while ($string = gzread($archiveFile, 4096)) {
  10297. fwrite($targetFile, $string, Platform::strlen($string));
  10298. }
  10299. gzclose($archiveFile);
  10300. fclose($targetFile);
  10301. }
  10302. }
  10303. <?php
  10304. namespace Composer\Downloader;
  10305. use Composer\Package\PackageInterface;
  10306. use Composer\Util\ProcessExecutor;
  10307. class HgDownloader extends VcsDownloader
  10308. {
  10309. public function doDownload(PackageInterface $package, $path, $url)
  10310. {
  10311. $this->config->prohibitUrlByConfig($url, $this->io);
  10312. $url = ProcessExecutor::escape($url);
  10313. $ref = ProcessExecutor::escape($package->getSourceReference());
  10314. $this->io->writeError("Cloning ".$package->getSourceReference());
  10315. $command = sprintf('hg clone %s %s', $url, ProcessExecutor::escape($path));
  10316. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10317. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10318. }
  10319. $command = sprintf('hg up %s', $ref);
  10320. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10321. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10322. }
  10323. }
  10324. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10325. {
  10326. $this->config->prohibitUrlByConfig($url, $this->io);
  10327. $url = ProcessExecutor::escape($url);
  10328. $ref = ProcessExecutor::escape($target->getSourceReference());
  10329. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10330. if (!$this->hasMetadataRepository($path)) {
  10331. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10332. }
  10333. $command = sprintf('hg pull %s && hg up %s', $url, $ref);
  10334. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10335. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10336. }
  10337. }
  10338. public function getLocalChanges(PackageInterface $package, $path)
  10339. {
  10340. if (!is_dir($path.'/.hg')) {
  10341. return null;
  10342. }
  10343. $this->process->execute('hg st', $output, realpath($path));
  10344. return trim($output) ?: null;
  10345. }
  10346. protected function getCommitLogs($fromReference, $toReference, $path)
  10347. {
  10348. $command = sprintf('hg log -r %s:%s --style compact', $fromReference, $toReference);
  10349. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10350. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10351. }
  10352. return $output;
  10353. }
  10354. protected function hasMetadataRepository($path)
  10355. {
  10356. return is_dir($path . '/.hg');
  10357. }
  10358. }
  10359. <?php
  10360. namespace Composer\Downloader;
  10361. use Composer\Package\Dumper\ArrayDumper;
  10362. use Composer\Package\PackageInterface;
  10363. use Composer\Package\Version\VersionGuesser;
  10364. use Composer\Package\Version\VersionParser;
  10365. use Composer\Util\Platform;
  10366. use Composer\Util\ProcessExecutor;
  10367. use Symfony\Component\Filesystem\Exception\IOException;
  10368. use Symfony\Component\Filesystem\Filesystem;
  10369. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  10370. {
  10371. const STRATEGY_SYMLINK = 10;
  10372. const STRATEGY_MIRROR = 20;
  10373. public function download(PackageInterface $package, $path, $output = true)
  10374. {
  10375. $url = $package->getDistUrl();
  10376. $realUrl = realpath($url);
  10377. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  10378. throw new \RuntimeException(sprintf(
  10379. 'Source path "%s" is not found for package %s', $url, $package->getName()
  10380. ));
  10381. }
  10382. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  10383. throw new \RuntimeException(sprintf(
  10384. 'Package %s cannot install to "%s" inside its source at "%s"',
  10385. $package->getName(), realpath($path), $realUrl
  10386. ));
  10387. }
  10388. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  10389. $currentStrategy = self::STRATEGY_SYMLINK;
  10390. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  10391. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  10392. if ($mirrorPathRepos) {
  10393. $currentStrategy = self::STRATEGY_MIRROR;
  10394. }
  10395. if (true === $transportOptions['symlink']) {
  10396. $currentStrategy = self::STRATEGY_SYMLINK;
  10397. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  10398. } elseif (false === $transportOptions['symlink']) {
  10399. $currentStrategy = self::STRATEGY_MIRROR;
  10400. $allowedStrategies = array(self::STRATEGY_MIRROR);
  10401. }
  10402. $fileSystem = new Filesystem();
  10403. $this->filesystem->removeDirectory($path);
  10404. if ($output) {
  10405. $this->io->writeError(sprintf(
  10406. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  10407. $package->getName(),
  10408. $package->getFullPrettyVersion()
  10409. ), false);
  10410. }
  10411. $isFallback = false;
  10412. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  10413. try {
  10414. if (Platform::isWindows()) {
  10415. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  10416. $this->filesystem->junction($realUrl, $path);
  10417. } else {
  10418. $absolutePath = $path;
  10419. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  10420. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  10421. }
  10422. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  10423. $path = rtrim($path, "/");
  10424. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  10425. $fileSystem->symlink($shortestPath, $path);
  10426. }
  10427. } catch (IOException $e) {
  10428. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  10429. $this->io->writeError('');
  10430. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  10431. $currentStrategy = self::STRATEGY_MIRROR;
  10432. $isFallback = true;
  10433. } else {
  10434. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  10435. }
  10436. }
  10437. }
  10438. if (self::STRATEGY_MIRROR == $currentStrategy) {
  10439. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  10440. $fileSystem->mirror($realUrl, $path);
  10441. }
  10442. $this->io->writeError('');
  10443. }
  10444. public function remove(PackageInterface $package, $path, $output = true)
  10445. {
  10446. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  10447. if ($output) {
  10448. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10449. }
  10450. if (!$this->filesystem->removeJunction($path)) {
  10451. $this->io->writeError(" <warn>Could not remove junction at " . $path . " - is another process locking it?</warn>");
  10452. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  10453. }
  10454. } else {
  10455. parent::remove($package, $path, $output);
  10456. }
  10457. }
  10458. public function getVcsReference(PackageInterface $package, $path)
  10459. {
  10460. $parser = new VersionParser;
  10461. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  10462. $dumper = new ArrayDumper;
  10463. $packageConfig = $dumper->dump($package);
  10464. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  10465. return $packageVersion['commit'];
  10466. }
  10467. }
  10468. }
  10469. <?php
  10470. namespace Composer\Downloader;
  10471. use Composer\Util\Filesystem;
  10472. class PearPackageExtractor
  10473. {
  10474. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  10475. private $filesystem;
  10476. private $file;
  10477. public function __construct($file)
  10478. {
  10479. if (!is_file($file)) {
  10480. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  10481. }
  10482. $this->filesystem = new Filesystem();
  10483. $this->file = $file;
  10484. }
  10485. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  10486. {
  10487. $extractionPath = $target.'/tarball';
  10488. try {
  10489. $archive = new \PharData($this->file);
  10490. $archive->extractTo($extractionPath, null, true);
  10491. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  10492. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  10493. }
  10494. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  10495. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  10496. $this->filesystem->removeDirectory($extractionPath);
  10497. } catch (\Exception $exception) {
  10498. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  10499. }
  10500. }
  10501. private function copyFiles($files, $source, $target, $roles, $vars)
  10502. {
  10503. foreach ($files as $file) {
  10504. $from = $this->combine($source, $file['from']);
  10505. $to = $this->combine($target, $roles[$file['role']]);
  10506. $to = $this->combine($to, $file['to']);
  10507. $tasks = $file['tasks'];
  10508. $this->copyFile($from, $to, $tasks, $vars);
  10509. }
  10510. }
  10511. private function copyFile($from, $to, $tasks, $vars)
  10512. {
  10513. if (!is_file($from)) {
  10514. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  10515. }
  10516. $this->filesystem->ensureDirectoryExists(dirname($to));
  10517. if (0 == count($tasks)) {
  10518. $copied = copy($from, $to);
  10519. } else {
  10520. $content = file_get_contents($from);
  10521. $replacements = array();
  10522. foreach ($tasks as $task) {
  10523. $pattern = $task['from'];
  10524. $varName = $task['to'];
  10525. if (isset($vars[$varName])) {
  10526. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  10527. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  10528. } else {
  10529. $replacements[$pattern] = $vars[$varName];
  10530. }
  10531. }
  10532. }
  10533. $content = strtr($content, $replacements);
  10534. $copied = file_put_contents($to, $content);
  10535. }
  10536. if (false === $copied) {
  10537. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  10538. }
  10539. }
  10540. private function buildCopyActions($source, array $roles, $vars)
  10541. {
  10542. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  10543. if (false === $package) {
  10544. throw new \RuntimeException('Package definition file is not valid.');
  10545. }
  10546. $packageSchemaVersion = $package['version'];
  10547. if ('1.0' == $packageSchemaVersion) {
  10548. $children = $package->release->filelist->children();
  10549. $packageName = (string) $package->name;
  10550. $packageVersion = (string) $package->release->version;
  10551. $sourceDir = $packageName . '-' . $packageVersion;
  10552. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  10553. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  10554. $children = $package->contents->children();
  10555. $packageName = (string) $package->name;
  10556. $packageVersion = (string) $package->version->release;
  10557. $sourceDir = $packageName . '-' . $packageVersion;
  10558. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  10559. $namespaces = $package->getNamespaces();
  10560. $package->registerXPathNamespace('ns', $namespaces['']);
  10561. $releaseNodes = $package->xpath('ns:phprelease');
  10562. $this->applyRelease($result, $releaseNodes, $vars);
  10563. } else {
  10564. throw new \RuntimeException('Unsupported schema version of package definition file.');
  10565. }
  10566. return $result;
  10567. }
  10568. private function applyRelease(&$actions, $releaseNodes, $vars)
  10569. {
  10570. foreach ($releaseNodes as $releaseNode) {
  10571. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  10572. if ($requiredOs && $vars['os'] != $requiredOs) {
  10573. continue;
  10574. }
  10575. if ($releaseNode->filelist) {
  10576. foreach ($releaseNode->filelist->children() as $action) {
  10577. if ('install' == $action->getName()) {
  10578. $name = (string) $action['name'];
  10579. $as = (string) $action['as'];
  10580. if (isset($actions[$name])) {
  10581. $actions[$name]['to'] = $as;
  10582. }
  10583. } elseif ('ignore' == $action->getName()) {
  10584. $name = (string) $action['name'];
  10585. unset($actions[$name]);
  10586. } else {
  10587. }
  10588. }
  10589. }
  10590. break;
  10591. }
  10592. }
  10593. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  10594. {
  10595. $result = array();
  10596. foreach ($children as $child) {
  10597. if ($child->getName() == 'dir') {
  10598. $dirSource = $this->combine($source, (string) $child['name']);
  10599. $dirTarget = $child['baseinstalldir'] ?: $target;
  10600. $dirRole = $child['role'] ?: $role;
  10601. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10602. $result = array_merge($result, $dirFiles);
  10603. } elseif ($child->getName() == 'file') {
  10604. $fileRole = (string) $child['role'] ?: $role;
  10605. if (isset($targetRoles[$fileRole])) {
  10606. $fileName = (string) ($child['name'] ?: $child[0]);
  10607. $fileSource = $this->combine($source, $fileName);
  10608. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  10609. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10610. $fileTarget = $packageName . '/' . $fileTarget;
  10611. }
  10612. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  10613. }
  10614. }
  10615. }
  10616. return $result;
  10617. }
  10618. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  10619. {
  10620. $result = array();
  10621. foreach ($children as $child) {
  10622. if ('dir' == $child->getName()) {
  10623. $dirSource = $this->combine($source, $child['name']);
  10624. $dirTarget = $child['baseinstalldir'] ?: $target;
  10625. $dirRole = $child['role'] ?: $role;
  10626. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10627. $result = array_merge($result, $dirFiles);
  10628. } elseif ('file' == $child->getName()) {
  10629. $fileRole = (string) $child['role'] ?: $role;
  10630. if (isset($targetRoles[$fileRole])) {
  10631. $fileSource = $this->combine($source, (string) $child['name']);
  10632. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  10633. $fileTasks = array();
  10634. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  10635. if ('replace' == $taskNode->getName()) {
  10636. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  10637. }
  10638. }
  10639. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10640. $fileTarget = $packageName . '/' . $fileTarget;
  10641. }
  10642. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  10643. }
  10644. }
  10645. }
  10646. return $result;
  10647. }
  10648. private function combine($left, $right)
  10649. {
  10650. return rtrim($left, '/') . '/' . ltrim($right, '/');
  10651. }
  10652. }
  10653. <?php
  10654. namespace Composer\Downloader;
  10655. use Composer\Package\PackageInterface;
  10656. use Composer\Repository\VcsRepository;
  10657. use Composer\Util\Perforce;
  10658. class PerforceDownloader extends VcsDownloader
  10659. {
  10660. protected $perforce;
  10661. public function doDownload(PackageInterface $package, $path, $url)
  10662. {
  10663. $ref = $package->getSourceReference();
  10664. $label = $this->getLabelFromSourceReference($ref);
  10665. $this->io->writeError('Cloning ' . $ref);
  10666. $this->initPerforce($package, $path, $url);
  10667. $this->perforce->setStream($ref);
  10668. $this->perforce->p4Login();
  10669. $this->perforce->writeP4ClientSpec();
  10670. $this->perforce->connectClient();
  10671. $this->perforce->syncCodeBase($label);
  10672. $this->perforce->cleanupClientSpec();
  10673. }
  10674. private function getLabelFromSourceReference($ref)
  10675. {
  10676. $pos = strpos($ref, '@');
  10677. if (false !== $pos) {
  10678. return substr($ref, $pos + 1);
  10679. }
  10680. return null;
  10681. }
  10682. public function initPerforce(PackageInterface $package, $path, $url)
  10683. {
  10684. if (!empty($this->perforce)) {
  10685. $this->perforce->initializePath($path);
  10686. return;
  10687. }
  10688. $repository = $package->getRepository();
  10689. $repoConfig = null;
  10690. if ($repository instanceof VcsRepository) {
  10691. $repoConfig = $this->getRepoConfig($repository);
  10692. }
  10693. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  10694. }
  10695. private function getRepoConfig(VcsRepository $repository)
  10696. {
  10697. return $repository->getRepoConfig();
  10698. }
  10699. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10700. {
  10701. $this->doDownload($target, $path, $url);
  10702. }
  10703. public function getLocalChanges(PackageInterface $package, $path)
  10704. {
  10705. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  10706. return;
  10707. }
  10708. protected function getCommitLogs($fromReference, $toReference, $path)
  10709. {
  10710. $commitLogs = $this->perforce->getCommitLogs($fromReference, $toReference);
  10711. return $commitLogs;
  10712. }
  10713. public function setPerforce($perforce)
  10714. {
  10715. $this->perforce = $perforce;
  10716. }
  10717. protected function hasMetadataRepository($path)
  10718. {
  10719. return true;
  10720. }
  10721. }
  10722. <?php
  10723. namespace Composer\Downloader;
  10724. class PharDownloader extends ArchiveDownloader
  10725. {
  10726. protected function extract($file, $path)
  10727. {
  10728. $archive = new \Phar($file);
  10729. $archive->extractTo($path, null, true);
  10730. }
  10731. }
  10732. <?php
  10733. namespace Composer\Downloader;
  10734. use Composer\Config;
  10735. use Composer\Cache;
  10736. use Composer\EventDispatcher\EventDispatcher;
  10737. use Composer\Util\IniHelper;
  10738. use Composer\Util\Platform;
  10739. use Composer\Util\ProcessExecutor;
  10740. use Composer\Util\RemoteFilesystem;
  10741. use Composer\IO\IOInterface;
  10742. use RarArchive;
  10743. class RarDownloader extends ArchiveDownloader
  10744. {
  10745. protected $process;
  10746. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10747. {
  10748. $this->process = $process ?: new ProcessExecutor($io);
  10749. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10750. }
  10751. protected function extract($file, $path)
  10752. {
  10753. $processError = null;
  10754. if (!Platform::isWindows()) {
  10755. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  10756. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10757. return;
  10758. }
  10759. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10760. }
  10761. if (!class_exists('RarArchive')) {
  10762. $iniMessage = IniHelper::getMessage();
  10763. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  10764. . $iniMessage . "\n" . $processError;
  10765. if (!Platform::isWindows()) {
  10766. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  10767. }
  10768. throw new \RuntimeException($error);
  10769. }
  10770. $rarArchive = RarArchive::open($file);
  10771. if (false === $rarArchive) {
  10772. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  10773. }
  10774. $entries = $rarArchive->getEntries();
  10775. if (false === $entries) {
  10776. throw new \RuntimeException('Could not retrieve RAR archive entries');
  10777. }
  10778. foreach ($entries as $entry) {
  10779. if (false === $entry->extract($path)) {
  10780. throw new \RuntimeException('Could not extract entry');
  10781. }
  10782. }
  10783. $rarArchive->close();
  10784. }
  10785. }
  10786. <?php
  10787. namespace Composer\Downloader;
  10788. use Composer\Package\PackageInterface;
  10789. use Composer\Util\Svn as SvnUtil;
  10790. use Composer\Repository\VcsRepository;
  10791. class SvnDownloader extends VcsDownloader
  10792. {
  10793. protected $cacheCredentials = true;
  10794. public function doDownload(PackageInterface $package, $path, $url)
  10795. {
  10796. SvnUtil::cleanEnv();
  10797. $ref = $package->getSourceReference();
  10798. $repo = $package->getRepository();
  10799. if ($repo instanceof VcsRepository) {
  10800. $repoConfig = $repo->getRepoConfig();
  10801. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  10802. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  10803. }
  10804. }
  10805. $this->io->writeError(" Checking out ".$package->getSourceReference());
  10806. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  10807. }
  10808. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10809. {
  10810. SvnUtil::cleanEnv();
  10811. $ref = $target->getSourceReference();
  10812. if (!$this->hasMetadataRepository($path)) {
  10813. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10814. }
  10815. $flags = "";
  10816. if (0 === $this->process->execute('svn --version', $output)) {
  10817. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match) && version_compare($match[1], '1.7.0', '>=')) {
  10818. $flags .= ' --ignore-ancestry';
  10819. }
  10820. }
  10821. $this->io->writeError(" Checking out " . $ref);
  10822. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  10823. }
  10824. public function getLocalChanges(PackageInterface $package, $path)
  10825. {
  10826. if (!$this->hasMetadataRepository($path)) {
  10827. return null;
  10828. }
  10829. $this->process->execute('svn status --ignore-externals', $output, $path);
  10830. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  10831. }
  10832. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  10833. {
  10834. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  10835. $util->setCacheCredentials($this->cacheCredentials);
  10836. try {
  10837. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  10838. } catch (\RuntimeException $e) {
  10839. throw new \RuntimeException(
  10840. 'Package could not be downloaded, '.$e->getMessage()
  10841. );
  10842. }
  10843. }
  10844. protected function cleanChanges(PackageInterface $package, $path, $update)
  10845. {
  10846. if (!$changes = $this->getLocalChanges($package, $path)) {
  10847. return;
  10848. }
  10849. if (!$this->io->isInteractive()) {
  10850. if (true === $this->config->get('discard-changes')) {
  10851. return $this->discardChanges($path);
  10852. }
  10853. return parent::cleanChanges($package, $path, $update);
  10854. }
  10855. $changes = array_map(function ($elem) {
  10856. return ' '.$elem;
  10857. }, preg_split('{\s*\r?\n\s*}', $changes));
  10858. $this->io->writeError(' <error>The package has modified files:</error>');
  10859. $this->io->writeError(array_slice($changes, 0, 10));
  10860. if (count($changes) > 10) {
  10861. $this->io->writeError(' <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
  10862. }
  10863. while (true) {
  10864. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  10865. case 'y':
  10866. $this->discardChanges($path);
  10867. break 2;
  10868. case 'n':
  10869. throw new \RuntimeException('Update aborted');
  10870. case 'v':
  10871. $this->io->writeError($changes);
  10872. break;
  10873. case '?':
  10874. default:
  10875. $this->io->writeError(array(
  10876. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10877. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10878. ' v - view modified files',
  10879. ' ? - print help',
  10880. ));
  10881. break;
  10882. }
  10883. }
  10884. }
  10885. protected function getCommitLogs($fromReference, $toReference, $path)
  10886. {
  10887. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  10888. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  10889. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  10890. $command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
  10891. if (0 !== $this->process->execute($command, $output, $path)) {
  10892. throw new \RuntimeException(
  10893. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  10894. );
  10895. }
  10896. } else {
  10897. $output = "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  10898. }
  10899. return $output;
  10900. }
  10901. protected function discardChanges($path)
  10902. {
  10903. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  10904. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10905. }
  10906. }
  10907. protected function hasMetadataRepository($path)
  10908. {
  10909. return is_dir($path.'/.svn');
  10910. }
  10911. }
  10912. <?php
  10913. namespace Composer\Downloader;
  10914. class TarDownloader extends ArchiveDownloader
  10915. {
  10916. protected function extract($file, $path)
  10917. {
  10918. $archive = new \PharData($file);
  10919. $archive->extractTo($path, null, true);
  10920. }
  10921. }
  10922. <?php
  10923. namespace Composer\Downloader;
  10924. class TransportException extends \RuntimeException
  10925. {
  10926. protected $headers;
  10927. protected $response;
  10928. protected $statusCode;
  10929. public function setHeaders($headers)
  10930. {
  10931. $this->headers = $headers;
  10932. }
  10933. public function getHeaders()
  10934. {
  10935. return $this->headers;
  10936. }
  10937. public function setResponse($response)
  10938. {
  10939. $this->response = $response;
  10940. }
  10941. public function getResponse()
  10942. {
  10943. return $this->response;
  10944. }
  10945. public function setStatusCode($statusCode)
  10946. {
  10947. $this->statusCode = $statusCode;
  10948. }
  10949. public function getStatusCode()
  10950. {
  10951. return $this->statusCode;
  10952. }
  10953. }
  10954. <?php
  10955. namespace Composer\Downloader;
  10956. use Composer\Package\PackageInterface;
  10957. interface VcsCapableDownloaderInterface
  10958. {
  10959. public function getVcsReference(PackageInterface $package, $path);
  10960. }
  10961. <?php
  10962. namespace Composer\Downloader;
  10963. use Composer\Config;
  10964. use Composer\Package\Dumper\ArrayDumper;
  10965. use Composer\Package\PackageInterface;
  10966. use Composer\Package\Version\VersionGuesser;
  10967. use Composer\Package\Version\VersionParser;
  10968. use Composer\Util\ProcessExecutor;
  10969. use Composer\IO\IOInterface;
  10970. use Composer\Util\Filesystem;
  10971. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  10972. {
  10973. protected $io;
  10974. protected $config;
  10975. protected $process;
  10976. protected $filesystem;
  10977. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10978. {
  10979. $this->io = $io;
  10980. $this->config = $config;
  10981. $this->process = $process ?: new ProcessExecutor($io);
  10982. $this->filesystem = $fs ?: new Filesystem($this->process);
  10983. }
  10984. public function getInstallationSource()
  10985. {
  10986. return 'source';
  10987. }
  10988. public function download(PackageInterface $package, $path)
  10989. {
  10990. if (!$package->getSourceReference()) {
  10991. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  10992. }
  10993. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  10994. $this->filesystem->emptyDirectory($path);
  10995. $urls = $package->getSourceUrls();
  10996. while ($url = array_shift($urls)) {
  10997. try {
  10998. if (Filesystem::isLocalPath($url)) {
  10999. $needle = 'file://';
  11000. $isFileProtocol = false;
  11001. if (0 === strpos($url, $needle)) {
  11002. $url = substr($url, strlen($needle));
  11003. $isFileProtocol = true;
  11004. }
  11005. if (false !== strpos($url, '%')) {
  11006. $url = rawurldecode($url);
  11007. }
  11008. $url = realpath($url);
  11009. if ($isFileProtocol) {
  11010. $url = $needle . $url;
  11011. }
  11012. }
  11013. $this->doDownload($package, $path, $url);
  11014. break;
  11015. } catch (\Exception $e) {
  11016. if ($e instanceof \PHPUnit_Framework_Exception) {
  11017. throw $e;
  11018. }
  11019. if ($this->io->isDebug()) {
  11020. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11021. } elseif (count($urls)) {
  11022. $this->io->writeError(' Failed, trying the next URL');
  11023. }
  11024. if (!count($urls)) {
  11025. throw $e;
  11026. }
  11027. }
  11028. }
  11029. }
  11030. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11031. {
  11032. if (!$target->getSourceReference()) {
  11033. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11034. }
  11035. $name = $target->getName();
  11036. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  11037. if ($target->getSourceType() === 'svn') {
  11038. $from = $initial->getSourceReference();
  11039. $to = $target->getSourceReference();
  11040. } else {
  11041. $from = substr($initial->getSourceReference(), 0, 7);
  11042. $to = substr($target->getSourceReference(), 0, 7);
  11043. }
  11044. $name .= ' '.$initial->getPrettyVersion();
  11045. } else {
  11046. $from = $initial->getFullPrettyVersion();
  11047. $to = $target->getFullPrettyVersion();
  11048. }
  11049. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11050. $this->cleanChanges($initial, $path, true);
  11051. $urls = $target->getSourceUrls();
  11052. $exception = null;
  11053. while ($url = array_shift($urls)) {
  11054. try {
  11055. if (Filesystem::isLocalPath($url)) {
  11056. $url = realpath($url);
  11057. }
  11058. $this->doUpdate($initial, $target, $path, $url);
  11059. $exception = null;
  11060. break;
  11061. } catch (\Exception $exception) {
  11062. if ($exception instanceof \PHPUnit_Framework_Exception) {
  11063. throw $exception;
  11064. }
  11065. if ($this->io->isDebug()) {
  11066. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  11067. } elseif (count($urls)) {
  11068. $this->io->writeError(' Failed, trying the next URL');
  11069. }
  11070. }
  11071. }
  11072. $this->reapplyChanges($path);
  11073. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  11074. $message = 'Pulling in changes:';
  11075. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  11076. if (!trim($logs)) {
  11077. $message = 'Rolling back changes:';
  11078. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  11079. }
  11080. if (trim($logs)) {
  11081. $logs = implode("\n", array_map(function ($line) {
  11082. return ' ' . $line;
  11083. }, explode("\n", $logs)));
  11084. $logs = str_replace('<', '\<', $logs);
  11085. $this->io->writeError(' '.$message);
  11086. $this->io->writeError($logs);
  11087. }
  11088. }
  11089. if (!$urls && $exception) {
  11090. throw $exception;
  11091. }
  11092. }
  11093. public function remove(PackageInterface $package, $path)
  11094. {
  11095. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  11096. $this->cleanChanges($package, $path, false);
  11097. if (!$this->filesystem->removeDirectory($path)) {
  11098. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11099. }
  11100. }
  11101. public function setOutputProgress($outputProgress)
  11102. {
  11103. return $this;
  11104. }
  11105. public function getVcsReference(PackageInterface $package, $path)
  11106. {
  11107. $parser = new VersionParser;
  11108. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  11109. $dumper = new ArrayDumper;
  11110. $packageConfig = $dumper->dump($package);
  11111. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11112. return $packageVersion['commit'];
  11113. }
  11114. }
  11115. protected function cleanChanges(PackageInterface $package, $path, $update)
  11116. {
  11117. if (null !== $this->getLocalChanges($package, $path)) {
  11118. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  11119. }
  11120. }
  11121. protected function reapplyChanges($path)
  11122. {
  11123. }
  11124. abstract protected function doDownload(PackageInterface $package, $path, $url);
  11125. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  11126. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  11127. abstract protected function hasMetadataRepository($path);
  11128. }
  11129. <?php
  11130. namespace Composer\Downloader;
  11131. use Composer\Config;
  11132. use Composer\Cache;
  11133. use Composer\EventDispatcher\EventDispatcher;
  11134. use Composer\Package\PackageInterface;
  11135. use Composer\Util\ProcessExecutor;
  11136. use Composer\Util\RemoteFilesystem;
  11137. use Composer\IO\IOInterface;
  11138. class XzDownloader extends ArchiveDownloader
  11139. {
  11140. protected $process;
  11141. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11142. {
  11143. $this->process = $process ?: new ProcessExecutor($io);
  11144. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11145. }
  11146. protected function extract($file, $path)
  11147. {
  11148. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  11149. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11150. return;
  11151. }
  11152. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11153. throw new \RuntimeException($processError);
  11154. }
  11155. protected function getFileName(PackageInterface $package, $path)
  11156. {
  11157. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11158. }
  11159. }
  11160. <?php
  11161. namespace Composer\Downloader;
  11162. use Composer\Config;
  11163. use Composer\Cache;
  11164. use Composer\EventDispatcher\EventDispatcher;
  11165. use Composer\Package\PackageInterface;
  11166. use Composer\Util\IniHelper;
  11167. use Composer\Util\Platform;
  11168. use Composer\Util\ProcessExecutor;
  11169. use Composer\Util\RemoteFilesystem;
  11170. use Composer\IO\IOInterface;
  11171. use Symfony\Component\Process\ExecutableFinder;
  11172. use ZipArchive;
  11173. class ZipDownloader extends ArchiveDownloader
  11174. {
  11175. protected $process;
  11176. protected static $hasSystemUnzip;
  11177. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11178. {
  11179. $this->process = $process ?: new ProcessExecutor($io);
  11180. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11181. }
  11182. public function download(PackageInterface $package, $path, $output = true)
  11183. {
  11184. if (null === self::$hasSystemUnzip) {
  11185. $finder = new ExecutableFinder;
  11186. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  11187. }
  11188. if (!class_exists('ZipArchive') && !self::$hasSystemUnzip) {
  11189. $iniMessage = IniHelper::getMessage();
  11190. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  11191. throw new \RuntimeException($error);
  11192. }
  11193. return parent::download($package, $path, $output);
  11194. }
  11195. protected function extract($file, $path)
  11196. {
  11197. $processError = null;
  11198. if (self::$hasSystemUnzip && !(class_exists('ZipArchive') && Platform::isWindows())) {
  11199. $command = 'unzip -qq '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  11200. if (!Platform::isWindows()) {
  11201. $command .= ' && chmod -R u+w ' . ProcessExecutor::escape($path);
  11202. }
  11203. try {
  11204. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11205. return;
  11206. }
  11207. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11208. } catch (\Exception $e) {
  11209. $processError = 'Failed to execute ' . $command . "\n\n" . $e->getMessage();
  11210. }
  11211. if (!class_exists('ZipArchive')) {
  11212. throw new \RuntimeException($processError);
  11213. }
  11214. }
  11215. $zipArchive = new ZipArchive();
  11216. if (true !== ($retval = $zipArchive->open($file))) {
  11217. throw new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n".$processError), $retval);
  11218. }
  11219. if (true !== $zipArchive->extractTo($path)) {
  11220. throw new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n".$processError));
  11221. }
  11222. $zipArchive->close();
  11223. }
  11224. protected function getErrorMessage($retval, $file)
  11225. {
  11226. switch ($retval) {
  11227. case ZipArchive::ER_EXISTS:
  11228. return sprintf("File '%s' already exists.", $file);
  11229. case ZipArchive::ER_INCONS:
  11230. return sprintf("Zip archive '%s' is inconsistent.", $file);
  11231. case ZipArchive::ER_INVAL:
  11232. return sprintf("Invalid argument (%s)", $file);
  11233. case ZipArchive::ER_MEMORY:
  11234. return sprintf("Malloc failure (%s)", $file);
  11235. case ZipArchive::ER_NOENT:
  11236. return sprintf("No such zip file: '%s'", $file);
  11237. case ZipArchive::ER_NOZIP:
  11238. return sprintf("'%s' is not a zip archive.", $file);
  11239. case ZipArchive::ER_OPEN:
  11240. return sprintf("Can't open zip file: %s", $file);
  11241. case ZipArchive::ER_READ:
  11242. return sprintf("Zip read error (%s)", $file);
  11243. case ZipArchive::ER_SEEK:
  11244. return sprintf("Zip seek error (%s)", $file);
  11245. default:
  11246. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  11247. }
  11248. }
  11249. }
  11250. <?php
  11251. namespace Composer\EventDispatcher;
  11252. class Event
  11253. {
  11254. protected $name;
  11255. protected $args;
  11256. protected $flags;
  11257. private $propagationStopped = false;
  11258. public function __construct($name, array $args = array(), array $flags = array())
  11259. {
  11260. $this->name = $name;
  11261. $this->args = $args;
  11262. $this->flags = $flags;
  11263. }
  11264. public function getName()
  11265. {
  11266. return $this->name;
  11267. }
  11268. public function getArguments()
  11269. {
  11270. return $this->args;
  11271. }
  11272. public function getFlags()
  11273. {
  11274. return $this->flags;
  11275. }
  11276. public function isPropagationStopped()
  11277. {
  11278. return $this->propagationStopped;
  11279. }
  11280. public function stopPropagation()
  11281. {
  11282. $this->propagationStopped = true;
  11283. }
  11284. }
  11285. <?php
  11286. namespace Composer\EventDispatcher;
  11287. use Composer\DependencyResolver\PolicyInterface;
  11288. use Composer\DependencyResolver\Pool;
  11289. use Composer\DependencyResolver\Request;
  11290. use Composer\Installer\InstallerEvent;
  11291. use Composer\IO\IOInterface;
  11292. use Composer\Composer;
  11293. use Composer\DependencyResolver\Operation\OperationInterface;
  11294. use Composer\Repository\CompositeRepository;
  11295. use Composer\Script;
  11296. use Composer\Installer\PackageEvent;
  11297. use Composer\Installer\BinaryInstaller;
  11298. use Composer\Util\ProcessExecutor;
  11299. use Composer\Script\Event as ScriptEvent;
  11300. use Symfony\Component\Process\PhpExecutableFinder;
  11301. class EventDispatcher
  11302. {
  11303. protected $composer;
  11304. protected $io;
  11305. protected $loader;
  11306. protected $process;
  11307. protected $listeners;
  11308. private $eventStack;
  11309. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  11310. {
  11311. $this->composer = $composer;
  11312. $this->io = $io;
  11313. $this->process = $process ?: new ProcessExecutor($io);
  11314. $this->eventStack = array();
  11315. }
  11316. public function dispatch($eventName, Event $event = null)
  11317. {
  11318. if (null === $event) {
  11319. $event = new Event($eventName);
  11320. }
  11321. return $this->doDispatch($event);
  11322. }
  11323. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  11324. {
  11325. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  11326. }
  11327. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  11328. {
  11329. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  11330. }
  11331. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  11332. {
  11333. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  11334. }
  11335. protected function doDispatch(Event $event)
  11336. {
  11337. $pathStr = 'PATH';
  11338. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  11339. $pathStr = 'Path';
  11340. }
  11341. $binDir = $this->composer->getConfig()->get('bin-dir');
  11342. if (is_dir($binDir)) {
  11343. $binDir = realpath($binDir);
  11344. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  11345. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  11346. putenv($pathStr.'='.$_SERVER[$pathStr]);
  11347. }
  11348. }
  11349. $listeners = $this->getListeners($event);
  11350. $this->pushEvent($event);
  11351. $return = 0;
  11352. foreach ($listeners as $callable) {
  11353. if (!is_string($callable) && is_callable($callable)) {
  11354. $event = $this->checkListenerExpectedEvent($callable, $event);
  11355. $return = false === call_user_func($callable, $event) ? 1 : 0;
  11356. } elseif ($this->isComposerScript($callable)) {
  11357. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  11358. $scriptName = substr($callable, 1);
  11359. $args = $event->getArguments();
  11360. $flags = $event->getFlags();
  11361. if (substr($callable, 0, 10) === '@composer ') {
  11362. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  11363. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11364. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  11365. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11366. }
  11367. } else {
  11368. if (!$this->getListeners(new Event($scriptName))) {
  11369. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  11370. }
  11371. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  11372. }
  11373. } elseif ($this->isPhpScript($callable)) {
  11374. $className = substr($callable, 0, strpos($callable, '::'));
  11375. $methodName = substr($callable, strpos($callable, '::') + 2);
  11376. if (!class_exists($className)) {
  11377. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  11378. continue;
  11379. }
  11380. if (!is_callable($callable)) {
  11381. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  11382. continue;
  11383. }
  11384. try {
  11385. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  11386. } catch (\Exception $e) {
  11387. $message = "Script %s handling the %s event terminated with an exception";
  11388. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  11389. throw $e;
  11390. }
  11391. } else {
  11392. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  11393. $exec = $callable . ($args === '' ? '' : ' '.$args);
  11394. if ($this->io->isVerbose()) {
  11395. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  11396. } else {
  11397. $this->io->writeError(sprintf('> %s', $exec));
  11398. }
  11399. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  11400. if ($possibleLocalBinaries) {
  11401. foreach ($possibleLocalBinaries as $localExec) {
  11402. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  11403. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  11404. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  11405. break;
  11406. }
  11407. }
  11408. }
  11409. if (substr($exec, 0, 5) === '@php ') {
  11410. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  11411. }
  11412. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11413. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  11414. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11415. }
  11416. }
  11417. if ($event->isPropagationStopped()) {
  11418. break;
  11419. }
  11420. }
  11421. $this->popEvent();
  11422. return $return;
  11423. }
  11424. protected function getPhpExecCommand()
  11425. {
  11426. $finder = new PhpExecutableFinder();
  11427. $phpPath = $finder->find();
  11428. if (!$phpPath) {
  11429. throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName);
  11430. }
  11431. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  11432. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  11433. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  11434. return ProcessExecutor::escape($phpPath) . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  11435. }
  11436. protected function executeEventPhpScript($className, $methodName, Event $event)
  11437. {
  11438. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  11439. if ($this->io->isVerbose()) {
  11440. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  11441. } else {
  11442. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  11443. }
  11444. return $className::$methodName($event);
  11445. }
  11446. protected function checkListenerExpectedEvent($target, Event $event)
  11447. {
  11448. if (in_array($event->getName(), array(
  11449. 'init',
  11450. 'command',
  11451. 'pre-file-download',
  11452. ), true)) {
  11453. return $event;
  11454. }
  11455. try {
  11456. $reflected = new \ReflectionParameter($target, 0);
  11457. } catch (\Exception $e) {
  11458. return $event;
  11459. }
  11460. $typehint = $reflected->getClass();
  11461. if (!$typehint instanceof \ReflectionClass) {
  11462. return $event;
  11463. }
  11464. $expected = $typehint->getName();
  11465. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  11466. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11467. $event = new \Composer\Script\CommandEvent(
  11468. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getArguments()
  11469. );
  11470. }
  11471. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  11472. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11473. $event = new \Composer\Script\PackageEvent(
  11474. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11475. $event->getPolicy(), $event->getPool(), $event->getInstalledRepo(), $event->getRequest(),
  11476. $event->getOperations(), $event->getOperation()
  11477. );
  11478. }
  11479. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  11480. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11481. $event = new \Composer\Script\Event(
  11482. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11483. $event->getArguments(), $event->getFlags()
  11484. );
  11485. }
  11486. return $event;
  11487. }
  11488. private function serializeCallback($cb)
  11489. {
  11490. if (is_array($cb) && count($cb) === 2) {
  11491. if (is_object($cb[0])) {
  11492. $cb[0] = get_class($cb[0]);
  11493. }
  11494. if (is_string($cb[0]) && is_string($cb[1])) {
  11495. $cb = implode('::', $cb);
  11496. }
  11497. }
  11498. if (is_string($cb)) {
  11499. return $cb;
  11500. }
  11501. return var_export($cb, true);
  11502. }
  11503. public function addListener($eventName, $listener, $priority = 0)
  11504. {
  11505. $this->listeners[$eventName][$priority][] = $listener;
  11506. }
  11507. public function addSubscriber(EventSubscriberInterface $subscriber)
  11508. {
  11509. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  11510. if (is_string($params)) {
  11511. $this->addListener($eventName, array($subscriber, $params));
  11512. } elseif (is_string($params[0])) {
  11513. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  11514. } else {
  11515. foreach ($params as $listener) {
  11516. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  11517. }
  11518. }
  11519. }
  11520. }
  11521. protected function getListeners(Event $event)
  11522. {
  11523. $scriptListeners = $this->getScriptListeners($event);
  11524. if (!isset($this->listeners[$event->getName()][0])) {
  11525. $this->listeners[$event->getName()][0] = array();
  11526. }
  11527. krsort($this->listeners[$event->getName()]);
  11528. $listeners = $this->listeners;
  11529. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  11530. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  11531. }
  11532. public function hasEventListeners(Event $event)
  11533. {
  11534. $listeners = $this->getListeners($event);
  11535. return count($listeners) > 0;
  11536. }
  11537. protected function getScriptListeners(Event $event)
  11538. {
  11539. $package = $this->composer->getPackage();
  11540. $scripts = $package->getScripts();
  11541. if (empty($scripts[$event->getName()])) {
  11542. return array();
  11543. }
  11544. if ($this->loader) {
  11545. $this->loader->unregister();
  11546. }
  11547. $generator = $this->composer->getAutoloadGenerator();
  11548. if ($event instanceof ScriptEvent) {
  11549. $generator->setDevMode($event->isDevMode());
  11550. }
  11551. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  11552. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  11553. $map = $generator->parseAutoloads($packageMap, $package);
  11554. $this->loader = $generator->createLoader($map);
  11555. $this->loader->register();
  11556. return $scripts[$event->getName()];
  11557. }
  11558. protected function isPhpScript($callable)
  11559. {
  11560. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  11561. }
  11562. protected function isComposerScript($callable)
  11563. {
  11564. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  11565. }
  11566. protected function pushEvent(Event $event)
  11567. {
  11568. $eventName = $event->getName();
  11569. if (in_array($eventName, $this->eventStack)) {
  11570. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  11571. }
  11572. return array_push($this->eventStack, $eventName);
  11573. }
  11574. protected function popEvent()
  11575. {
  11576. return array_pop($this->eventStack);
  11577. }
  11578. }
  11579. <?php
  11580. namespace Composer\EventDispatcher;
  11581. interface EventSubscriberInterface
  11582. {
  11583. public static function getSubscribedEvents();
  11584. }
  11585. <?php
  11586. namespace Composer\EventDispatcher;
  11587. class ScriptExecutionException extends \RuntimeException
  11588. {
  11589. }
  11590. <?php
  11591. namespace Composer\Exception;
  11592. class NoSslException extends \RuntimeException
  11593. {
  11594. }
  11595. <?php
  11596. namespace Composer;
  11597. use Composer\Config\JsonConfigSource;
  11598. use Composer\Json\JsonFile;
  11599. use Composer\IO\IOInterface;
  11600. use Composer\Package\Archiver;
  11601. use Composer\Package\Version\VersionGuesser;
  11602. use Composer\Repository\RepositoryManager;
  11603. use Composer\Repository\RepositoryFactory;
  11604. use Composer\Repository\WritableRepositoryInterface;
  11605. use Composer\Util\Filesystem;
  11606. use Composer\Util\Platform;
  11607. use Composer\Util\ProcessExecutor;
  11608. use Composer\Util\RemoteFilesystem;
  11609. use Composer\Util\Silencer;
  11610. use Composer\Plugin\PluginEvents;
  11611. use Composer\EventDispatcher\Event;
  11612. use Seld\JsonLint\DuplicateKeyException;
  11613. use Symfony\Component\Console\Formatter\OutputFormatter;
  11614. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  11615. use Symfony\Component\Console\Output\ConsoleOutput;
  11616. use Composer\EventDispatcher\EventDispatcher;
  11617. use Composer\Autoload\AutoloadGenerator;
  11618. use Composer\Package\Version\VersionParser;
  11619. use Composer\Downloader\TransportException;
  11620. use Seld\JsonLint\JsonParser;
  11621. class Factory
  11622. {
  11623. protected static function getHomeDir()
  11624. {
  11625. $home = getenv('COMPOSER_HOME');
  11626. if ($home) {
  11627. return $home;
  11628. }
  11629. if (Platform::isWindows()) {
  11630. if (!getenv('APPDATA')) {
  11631. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  11632. }
  11633. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  11634. }
  11635. $userDir = self::getUserDir();
  11636. if (is_dir($userDir . '/.composer')) {
  11637. return $userDir . '/.composer';
  11638. }
  11639. if (self::useXdg()) {
  11640. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  11641. return $xdgConfig . '/composer';
  11642. }
  11643. return $userDir . '/.composer';
  11644. }
  11645. protected static function getCacheDir($home)
  11646. {
  11647. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  11648. if ($cacheDir) {
  11649. return $cacheDir;
  11650. }
  11651. $homeEnv = getenv('COMPOSER_HOME');
  11652. if ($homeEnv) {
  11653. return $homeEnv . '/cache';
  11654. }
  11655. if (Platform::isWindows()) {
  11656. if ($cacheDir = getenv('LOCALAPPDATA')) {
  11657. $cacheDir .= '/Composer';
  11658. } else {
  11659. $cacheDir = $home . '/cache';
  11660. }
  11661. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  11662. }
  11663. $userDir = self::getUserDir();
  11664. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  11665. return $home . '/cache';
  11666. }
  11667. if (self::useXdg()) {
  11668. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  11669. return $xdgCache . '/composer';
  11670. }
  11671. return $home . '/cache';
  11672. }
  11673. protected static function getDataDir($home)
  11674. {
  11675. $homeEnv = getenv('COMPOSER_HOME');
  11676. if ($homeEnv) {
  11677. return $homeEnv;
  11678. }
  11679. if (Platform::isWindows()) {
  11680. return strtr($home, '\\', '/');
  11681. }
  11682. $userDir = self::getUserDir();
  11683. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  11684. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  11685. return $xdgData . '/composer';
  11686. }
  11687. return $home;
  11688. }
  11689. public static function createConfig(IOInterface $io = null, $cwd = null)
  11690. {
  11691. $cwd = $cwd ?: getcwd();
  11692. $config = new Config(true, $cwd);
  11693. $home = self::getHomeDir();
  11694. $config->merge(array('config' => array(
  11695. 'home' => $home,
  11696. 'cache-dir' => self::getCacheDir($home),
  11697. 'data-dir' => self::getDataDir($home),
  11698. )));
  11699. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  11700. foreach ($dirs as $dir) {
  11701. if (!file_exists($dir . '/.htaccess')) {
  11702. if (!is_dir($dir)) {
  11703. Silencer::call('mkdir', $dir, 0777, true);
  11704. }
  11705. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  11706. }
  11707. }
  11708. $file = new JsonFile($config->get('home').'/config.json');
  11709. if ($file->exists()) {
  11710. if ($io && $io->isDebug()) {
  11711. $io->writeError('Loading config file ' . $file->getPath());
  11712. }
  11713. $config->merge($file->read());
  11714. }
  11715. $config->setConfigSource(new JsonConfigSource($file));
  11716. $file = new JsonFile($config->get('home').'/auth.json');
  11717. if ($file->exists()) {
  11718. if ($io && $io->isDebug()) {
  11719. $io->writeError('Loading config file ' . $file->getPath());
  11720. }
  11721. $config->merge(array('config' => $file->read()));
  11722. }
  11723. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  11724. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  11725. $authData = json_decode($composerAuthEnv, true);
  11726. if (is_null($authData)) {
  11727. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  11728. }
  11729. if ($io && $io->isDebug()) {
  11730. $io->writeError('Loading auth config from COMPOSER_AUTH');
  11731. }
  11732. $config->merge(array('config' => $authData));
  11733. }
  11734. return $config;
  11735. }
  11736. public static function getComposerFile()
  11737. {
  11738. return trim(getenv('COMPOSER')) ?: './composer.json';
  11739. }
  11740. public static function createAdditionalStyles()
  11741. {
  11742. return array(
  11743. 'highlight' => new OutputFormatterStyle('red'),
  11744. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  11745. );
  11746. }
  11747. public static function createOutput()
  11748. {
  11749. $styles = self::createAdditionalStyles();
  11750. $formatter = new OutputFormatter(null, $styles);
  11751. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  11752. }
  11753. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  11754. {
  11755. return RepositoryFactory::defaultRepos($io, $config, $rm);
  11756. }
  11757. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  11758. {
  11759. $cwd = $cwd ?: getcwd();
  11760. if (null === $localConfig) {
  11761. $localConfig = static::getComposerFile();
  11762. }
  11763. if (is_string($localConfig)) {
  11764. $composerFile = $localConfig;
  11765. $file = new JsonFile($localConfig, null, $io);
  11766. if (!$file->exists()) {
  11767. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  11768. $message = 'Composer could not find a composer.json file in '.$cwd;
  11769. } else {
  11770. $message = 'Composer could not find the config file: '.$localConfig;
  11771. }
  11772. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  11773. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  11774. }
  11775. $file->validateSchema(JsonFile::LAX_SCHEMA);
  11776. $jsonParser = new JsonParser;
  11777. try {
  11778. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  11779. } catch (DuplicateKeyException $e) {
  11780. $details = $e->getDetails();
  11781. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  11782. }
  11783. $localConfig = $file->read();
  11784. }
  11785. $config = static::createConfig($io, $cwd);
  11786. $config->merge($localConfig);
  11787. if (isset($composerFile)) {
  11788. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  11789. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  11790. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  11791. if ($localAuthFile->exists()) {
  11792. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  11793. $config->merge(array('config' => $localAuthFile->read()));
  11794. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  11795. }
  11796. }
  11797. $vendorDir = $config->get('vendor-dir');
  11798. $composer = new Composer();
  11799. $composer->setConfig($config);
  11800. if ($fullLoad) {
  11801. $io->loadConfiguration($config);
  11802. }
  11803. $rfs = self::createRemoteFilesystem($io, $config);
  11804. $dispatcher = new EventDispatcher($composer, $io);
  11805. $composer->setEventDispatcher($dispatcher);
  11806. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  11807. $composer->setRepositoryManager($rm);
  11808. $this->addLocalRepository($io, $rm, $vendorDir);
  11809. if (!$fullLoad && !isset($localConfig['version'])) {
  11810. $localConfig['version'] = '1.0.0';
  11811. }
  11812. $parser = new VersionParser;
  11813. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  11814. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser);
  11815. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  11816. $composer->setPackage($package);
  11817. $im = $this->createInstallationManager();
  11818. $composer->setInstallationManager($im);
  11819. if ($fullLoad) {
  11820. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  11821. $composer->setDownloadManager($dm);
  11822. $generator = new AutoloadGenerator($dispatcher, $io);
  11823. $composer->setAutoloadGenerator($generator);
  11824. }
  11825. $this->createDefaultInstallers($im, $composer, $io);
  11826. if ($fullLoad) {
  11827. $globalComposer = null;
  11828. if (realpath($config->get('home')) !== $cwd) {
  11829. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  11830. }
  11831. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  11832. $composer->setPluginManager($pm);
  11833. $pm->loadInstalledPlugins();
  11834. }
  11835. if ($fullLoad && isset($composerFile)) {
  11836. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  11837. ? substr($composerFile, 0, -4).'lock'
  11838. : $composerFile . '.lock';
  11839. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  11840. $composer->setLocker($locker);
  11841. }
  11842. if ($fullLoad) {
  11843. $initEvent = new Event(PluginEvents::INIT);
  11844. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  11845. if ($rm->getLocalRepository()) {
  11846. $this->purgePackages($rm->getLocalRepository(), $im);
  11847. }
  11848. }
  11849. return $composer;
  11850. }
  11851. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  11852. {
  11853. $factory = new static();
  11854. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  11855. }
  11856. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  11857. {
  11858. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  11859. }
  11860. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  11861. {
  11862. $composer = null;
  11863. try {
  11864. $composer = self::createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  11865. } catch (\Exception $e) {
  11866. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  11867. }
  11868. return $composer;
  11869. }
  11870. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  11871. {
  11872. $cache = null;
  11873. if ($config->get('cache-files-ttl') > 0) {
  11874. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  11875. }
  11876. $dm = new Downloader\DownloadManager($io);
  11877. switch ($preferred = $config->get('preferred-install')) {
  11878. case 'dist':
  11879. $dm->setPreferDist(true);
  11880. break;
  11881. case 'source':
  11882. $dm->setPreferSource(true);
  11883. break;
  11884. case 'auto':
  11885. default:
  11886. break;
  11887. }
  11888. if (is_array($preferred)) {
  11889. $dm->setPreferences($preferred);
  11890. }
  11891. $executor = new ProcessExecutor($io);
  11892. $fs = new Filesystem($executor);
  11893. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  11894. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  11895. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  11896. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  11897. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  11898. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11899. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11900. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11901. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11902. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  11903. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11904. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11905. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  11906. return $dm;
  11907. }
  11908. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  11909. {
  11910. if (null === $dm) {
  11911. $io = new IO\NullIO();
  11912. $io->loadConfiguration($config);
  11913. $dm = $this->createDownloadManager($io, $config);
  11914. }
  11915. $am = new Archiver\ArchiveManager($dm);
  11916. $am->addArchiver(new Archiver\ZipArchiver);
  11917. $am->addArchiver(new Archiver\PharArchiver);
  11918. return $am;
  11919. }
  11920. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  11921. {
  11922. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  11923. }
  11924. protected function createInstallationManager()
  11925. {
  11926. return new Installer\InstallationManager();
  11927. }
  11928. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  11929. {
  11930. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  11931. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  11932. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  11933. $im->addInstaller(new Installer\MetapackageInstaller($io));
  11934. }
  11935. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  11936. {
  11937. foreach ($repo->getPackages() as $package) {
  11938. if (!$im->isPackageInstalled($repo, $package)) {
  11939. $repo->removePackage($package);
  11940. }
  11941. }
  11942. }
  11943. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  11944. {
  11945. $factory = new static();
  11946. return $factory->createComposer($io, $config, $disablePlugins);
  11947. }
  11948. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  11949. {
  11950. static $warned = false;
  11951. $disableTls = false;
  11952. if ($config && $config->get('disable-tls') === true) {
  11953. if (!$warned) {
  11954. $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  11955. }
  11956. $warned = true;
  11957. $disableTls = true;
  11958. } elseif (!extension_loaded('openssl')) {
  11959. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  11960. . '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.');
  11961. }
  11962. $remoteFilesystemOptions = array();
  11963. if ($disableTls === false) {
  11964. if ($config && $config->get('cafile')) {
  11965. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  11966. }
  11967. if ($config && $config->get('capath')) {
  11968. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  11969. }
  11970. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  11971. }
  11972. try {
  11973. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  11974. } catch (TransportException $e) {
  11975. if (false !== strpos($e->getMessage(), 'cafile')) {
  11976. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  11977. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  11978. if (PHP_VERSION_ID < 50600) {
  11979. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  11980. }
  11981. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  11982. }
  11983. throw $e;
  11984. }
  11985. return $remoteFilesystem;
  11986. }
  11987. private static function useXdg()
  11988. {
  11989. foreach (array_keys($_SERVER) as $key) {
  11990. if (substr($key, 0, 4) === 'XDG_') {
  11991. return true;
  11992. }
  11993. }
  11994. return false;
  11995. }
  11996. private static function getUserDir()
  11997. {
  11998. $home = getenv('HOME');
  11999. if (!$home) {
  12000. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12001. }
  12002. return rtrim(strtr($home, '\\', '/'), '/');
  12003. }
  12004. }
  12005. <?php
  12006. namespace Composer\IO;
  12007. use Composer\Config;
  12008. use Composer\Util\ProcessExecutor;
  12009. use Psr\Log\LoggerInterface;
  12010. use Psr\Log\LogLevel;
  12011. abstract class BaseIO implements IOInterface, LoggerInterface
  12012. {
  12013. protected $authentications = array();
  12014. public function getAuthentications()
  12015. {
  12016. return $this->authentications;
  12017. }
  12018. public function hasAuthentication($repositoryName)
  12019. {
  12020. return isset($this->authentications[$repositoryName]);
  12021. }
  12022. public function getAuthentication($repositoryName)
  12023. {
  12024. if (isset($this->authentications[$repositoryName])) {
  12025. return $this->authentications[$repositoryName];
  12026. }
  12027. return array('username' => null, 'password' => null);
  12028. }
  12029. public function setAuthentication($repositoryName, $username, $password = null)
  12030. {
  12031. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  12032. }
  12033. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  12034. {
  12035. if ($this->hasAuthentication($repositoryName)) {
  12036. $auth = $this->getAuthentication($repositoryName);
  12037. if ($auth['username'] === $username && $auth['password'] === $password) {
  12038. return;
  12039. }
  12040. $this->writeError(
  12041. sprintf(
  12042. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  12043. $repositoryName
  12044. )
  12045. );
  12046. }
  12047. $this->setAuthentication($repositoryName, $username, $password);
  12048. }
  12049. public function loadConfiguration(Config $config)
  12050. {
  12051. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  12052. $githubOauth = $config->get('github-oauth') ?: array();
  12053. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  12054. $gitlabToken = $config->get('gitlab-token') ?: array();
  12055. $httpBasic = $config->get('http-basic') ?: array();
  12056. foreach ($bitbucketOauth as $domain => $cred) {
  12057. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  12058. }
  12059. foreach ($githubOauth as $domain => $token) {
  12060. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  12061. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  12062. }
  12063. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  12064. }
  12065. foreach ($gitlabOauth as $domain => $token) {
  12066. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  12067. }
  12068. foreach ($gitlabToken as $domain => $token) {
  12069. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  12070. }
  12071. foreach ($httpBasic as $domain => $cred) {
  12072. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  12073. }
  12074. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  12075. }
  12076. public function emergency($message, array $context = array())
  12077. {
  12078. return $this->log(LogLevel::EMERGENCY, $message, $context);
  12079. }
  12080. public function alert($message, array $context = array())
  12081. {
  12082. return $this->log(LogLevel::ALERT, $message, $context);
  12083. }
  12084. public function critical($message, array $context = array())
  12085. {
  12086. return $this->log(LogLevel::CRITICAL, $message, $context);
  12087. }
  12088. public function error($message, array $context = array())
  12089. {
  12090. return $this->log(LogLevel::ERROR, $message, $context);
  12091. }
  12092. public function warning($message, array $context = array())
  12093. {
  12094. return $this->log(LogLevel::WARNING, $message, $context);
  12095. }
  12096. public function notice($message, array $context = array())
  12097. {
  12098. return $this->log(LogLevel::NOTICE, $message, $context);
  12099. }
  12100. public function info($message, array $context = array())
  12101. {
  12102. return $this->log(LogLevel::INFO, $message, $context);
  12103. }
  12104. public function debug($message, array $context = array())
  12105. {
  12106. return $this->log(LogLevel::DEBUG, $message, $context);
  12107. }
  12108. public function log($level, $message, array $context = array())
  12109. {
  12110. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  12111. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  12112. } elseif ($level === LogLevel::WARNING) {
  12113. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  12114. } elseif ($level === LogLevel::NOTICE) {
  12115. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  12116. } elseif ($level === LogLevel::INFO) {
  12117. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  12118. } else {
  12119. $this->writeError($message, true, self::DEBUG);
  12120. }
  12121. }
  12122. }
  12123. <?php
  12124. namespace Composer\IO;
  12125. use Symfony\Component\Console\Output\StreamOutput;
  12126. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  12127. use Symfony\Component\Console\Input\StringInput;
  12128. use Symfony\Component\Console\Helper\HelperSet;
  12129. class BufferIO extends ConsoleIO
  12130. {
  12131. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  12132. {
  12133. $input = new StringInput($input);
  12134. $input->setInteractive(false);
  12135. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  12136. parent::__construct($input, $output, new HelperSet(array()));
  12137. }
  12138. public function getOutput()
  12139. {
  12140. fseek($this->output->getStream(), 0);
  12141. $output = stream_get_contents($this->output->getStream());
  12142. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  12143. $pre = strip_tags($matches[1]);
  12144. if (strlen($pre) === strlen($matches[2])) {
  12145. return '';
  12146. }
  12147. return rtrim($matches[1])."\n";
  12148. }, $output);
  12149. return $output;
  12150. }
  12151. }
  12152. <?php
  12153. namespace Composer\IO;
  12154. use Symfony\Component\Console\Input\InputInterface;
  12155. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  12156. use Symfony\Component\Console\Output\OutputInterface;
  12157. use Symfony\Component\Console\Helper\HelperSet;
  12158. use Composer\Question\StrictConfirmationQuestion;
  12159. use Symfony\Component\Console\Question\Question;
  12160. class ConsoleIO extends BaseIO
  12161. {
  12162. protected $input;
  12163. protected $output;
  12164. protected $helperSet;
  12165. protected $lastMessage;
  12166. protected $lastMessageErr;
  12167. private $startTime;
  12168. private $verbosityMap;
  12169. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  12170. {
  12171. $this->input = $input;
  12172. $this->output = $output;
  12173. $this->helperSet = $helperSet;
  12174. $this->verbosityMap = array(
  12175. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  12176. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  12177. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  12178. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  12179. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  12180. );
  12181. }
  12182. public function enableDebugging($startTime)
  12183. {
  12184. $this->startTime = $startTime;
  12185. }
  12186. public function isInteractive()
  12187. {
  12188. return $this->input->isInteractive();
  12189. }
  12190. public function isDecorated()
  12191. {
  12192. return $this->output->isDecorated();
  12193. }
  12194. public function isVerbose()
  12195. {
  12196. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  12197. }
  12198. public function isVeryVerbose()
  12199. {
  12200. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  12201. }
  12202. public function isDebug()
  12203. {
  12204. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  12205. }
  12206. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12207. {
  12208. $this->doWrite($messages, $newline, false, $verbosity);
  12209. }
  12210. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12211. {
  12212. $this->doWrite($messages, $newline, true, $verbosity);
  12213. }
  12214. private function doWrite($messages, $newline, $stderr, $verbosity)
  12215. {
  12216. $sfVerbosity = $this->verbosityMap[$verbosity];
  12217. if ($sfVerbosity > $this->output->getVerbosity()) {
  12218. return;
  12219. }
  12220. if (OutputInterface::VERBOSITY_QUIET === 0) {
  12221. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  12222. }
  12223. if (null !== $this->startTime) {
  12224. $memoryUsage = memory_get_usage() / 1024 / 1024;
  12225. $timeSpent = microtime(true) - $this->startTime;
  12226. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  12227. return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  12228. }, (array) $messages);
  12229. }
  12230. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  12231. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  12232. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  12233. return;
  12234. }
  12235. $this->output->write($messages, $newline, $sfVerbosity);
  12236. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  12237. }
  12238. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12239. {
  12240. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  12241. }
  12242. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12243. {
  12244. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  12245. }
  12246. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  12247. {
  12248. $messages = implode($newline ? "\n" : '', (array) $messages);
  12249. if (!isset($size)) {
  12250. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  12251. }
  12252. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  12253. $this->doWrite($messages, false, $stderr, $verbosity);
  12254. $fill = $size - strlen(strip_tags($messages));
  12255. if ($fill > 0) {
  12256. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  12257. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  12258. }
  12259. if ($newline) {
  12260. $this->doWrite('', true, $stderr, $verbosity);
  12261. }
  12262. if ($stderr) {
  12263. $this->lastMessageErr = $messages;
  12264. } else {
  12265. $this->lastMessage = $messages;
  12266. }
  12267. }
  12268. public function ask($question, $default = null)
  12269. {
  12270. $helper = $this->helperSet->get('question');
  12271. $question = new Question($question, $default);
  12272. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12273. }
  12274. public function askConfirmation($question, $default = true)
  12275. {
  12276. $helper = $this->helperSet->get('question');
  12277. $question = new StrictConfirmationQuestion($question, $default);
  12278. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12279. }
  12280. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  12281. {
  12282. $helper = $this->helperSet->get('question');
  12283. $question = new Question($question, $default);
  12284. $question->setValidator($validator);
  12285. $question->setMaxAttempts($attempts);
  12286. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12287. }
  12288. public function askAndHideAnswer($question)
  12289. {
  12290. $this->writeError($question, false);
  12291. return \Seld\CliPrompt\CliPrompt::hiddenPrompt(true);
  12292. }
  12293. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12294. {
  12295. if ($this->isInteractive()) {
  12296. return $this->helperSet->get('dialog')->select($this->getErrorOutput(), $question, $choices, $default, $attempts, $errorMessage, $multiselect);
  12297. }
  12298. return $default;
  12299. }
  12300. private function getErrorOutput()
  12301. {
  12302. if ($this->output instanceof ConsoleOutputInterface) {
  12303. return $this->output->getErrorOutput();
  12304. }
  12305. return $this->output;
  12306. }
  12307. }
  12308. <?php
  12309. namespace Composer\IO;
  12310. use Composer\Config;
  12311. interface IOInterface
  12312. {
  12313. const QUIET = 1;
  12314. const NORMAL = 2;
  12315. const VERBOSE = 4;
  12316. const VERY_VERBOSE = 8;
  12317. const DEBUG = 16;
  12318. public function isInteractive();
  12319. public function isVerbose();
  12320. public function isVeryVerbose();
  12321. public function isDebug();
  12322. public function isDecorated();
  12323. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  12324. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  12325. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12326. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12327. public function ask($question, $default = null);
  12328. public function askConfirmation($question, $default = true);
  12329. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  12330. public function askAndHideAnswer($question);
  12331. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  12332. public function getAuthentications();
  12333. public function hasAuthentication($repositoryName);
  12334. public function getAuthentication($repositoryName);
  12335. public function setAuthentication($repositoryName, $username, $password = null);
  12336. public function loadConfiguration(Config $config);
  12337. }
  12338. <?php
  12339. namespace Composer\IO;
  12340. class NullIO extends BaseIO
  12341. {
  12342. public function isInteractive()
  12343. {
  12344. return false;
  12345. }
  12346. public function isVerbose()
  12347. {
  12348. return false;
  12349. }
  12350. public function isVeryVerbose()
  12351. {
  12352. return false;
  12353. }
  12354. public function isDebug()
  12355. {
  12356. return false;
  12357. }
  12358. public function isDecorated()
  12359. {
  12360. return false;
  12361. }
  12362. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12363. {
  12364. }
  12365. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12366. {
  12367. }
  12368. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12369. {
  12370. }
  12371. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12372. {
  12373. }
  12374. public function ask($question, $default = null)
  12375. {
  12376. return $default;
  12377. }
  12378. public function askConfirmation($question, $default = true)
  12379. {
  12380. return $default;
  12381. }
  12382. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  12383. {
  12384. return $default;
  12385. }
  12386. public function askAndHideAnswer($question)
  12387. {
  12388. return null;
  12389. }
  12390. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12391. {
  12392. return $default;
  12393. }
  12394. }
  12395. <?php
  12396. namespace Composer;
  12397. use Composer\Autoload\AutoloadGenerator;
  12398. use Composer\DependencyResolver\DefaultPolicy;
  12399. use Composer\DependencyResolver\Operation\UpdateOperation;
  12400. use Composer\DependencyResolver\Operation\InstallOperation;
  12401. use Composer\DependencyResolver\Operation\UninstallOperation;
  12402. use Composer\DependencyResolver\Operation\OperationInterface;
  12403. use Composer\DependencyResolver\PolicyInterface;
  12404. use Composer\DependencyResolver\Pool;
  12405. use Composer\DependencyResolver\Request;
  12406. use Composer\DependencyResolver\Rule;
  12407. use Composer\DependencyResolver\Solver;
  12408. use Composer\DependencyResolver\SolverProblemsException;
  12409. use Composer\Downloader\DownloadManager;
  12410. use Composer\EventDispatcher\EventDispatcher;
  12411. use Composer\Installer\InstallationManager;
  12412. use Composer\Installer\InstallerEvents;
  12413. use Composer\Installer\NoopInstaller;
  12414. use Composer\Installer\SuggestedPackagesReporter;
  12415. use Composer\IO\IOInterface;
  12416. use Composer\Package\AliasPackage;
  12417. use Composer\Package\CompletePackage;
  12418. use Composer\Package\Link;
  12419. use Composer\Package\Loader\ArrayLoader;
  12420. use Composer\Package\Dumper\ArrayDumper;
  12421. use Composer\Semver\Constraint\Constraint;
  12422. use Composer\Package\Locker;
  12423. use Composer\Package\PackageInterface;
  12424. use Composer\Package\RootPackageInterface;
  12425. use Composer\Repository\CompositeRepository;
  12426. use Composer\Repository\InstalledArrayRepository;
  12427. use Composer\Repository\PlatformRepository;
  12428. use Composer\Repository\RepositoryInterface;
  12429. use Composer\Repository\RepositoryManager;
  12430. use Composer\Repository\WritableRepositoryInterface;
  12431. use Composer\Script\ScriptEvents;
  12432. class Installer
  12433. {
  12434. protected $io;
  12435. protected $config;
  12436. protected $package;
  12437. protected $downloadManager;
  12438. protected $repositoryManager;
  12439. protected $locker;
  12440. protected $installationManager;
  12441. protected $eventDispatcher;
  12442. protected $autoloadGenerator;
  12443. protected $preferSource = false;
  12444. protected $preferDist = false;
  12445. protected $optimizeAutoloader = false;
  12446. protected $classMapAuthoritative = false;
  12447. protected $apcuAutoloader = false;
  12448. protected $devMode = false;
  12449. protected $dryRun = false;
  12450. protected $verbose = false;
  12451. protected $update = false;
  12452. protected $dumpAutoloader = true;
  12453. protected $runScripts = true;
  12454. protected $ignorePlatformReqs = false;
  12455. protected $preferStable = false;
  12456. protected $preferLowest = false;
  12457. protected $skipSuggest = false;
  12458. protected $writeLock = true;
  12459. protected $executeOperations = true;
  12460. protected $updateWhitelist = null;
  12461. protected $whitelistDependencies = false;
  12462. protected $suggestedPackagesReporter;
  12463. protected $additionalInstalledRepository;
  12464. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  12465. {
  12466. $this->io = $io;
  12467. $this->config = $config;
  12468. $this->package = $package;
  12469. $this->downloadManager = $downloadManager;
  12470. $this->repositoryManager = $repositoryManager;
  12471. $this->locker = $locker;
  12472. $this->installationManager = $installationManager;
  12473. $this->eventDispatcher = $eventDispatcher;
  12474. $this->autoloadGenerator = $autoloadGenerator;
  12475. }
  12476. public function run()
  12477. {
  12478. gc_collect_cycles();
  12479. gc_disable();
  12480. if (!$this->update && !$this->locker->isLocked()) {
  12481. $this->update = true;
  12482. }
  12483. if ($this->dryRun) {
  12484. $this->verbose = true;
  12485. $this->runScripts = false;
  12486. $this->executeOperations = false;
  12487. $this->writeLock = false;
  12488. $this->dumpAutoloader = false;
  12489. $this->installationManager->addInstaller(new NoopInstaller);
  12490. $this->mockLocalRepositories($this->repositoryManager);
  12491. }
  12492. if ($this->runScripts) {
  12493. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  12494. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12495. }
  12496. $this->downloadManager->setPreferSource($this->preferSource);
  12497. $this->downloadManager->setPreferDist($this->preferDist);
  12498. $localRepo = $this->repositoryManager->getLocalRepository();
  12499. if ($this->update) {
  12500. $platformOverrides = $this->config->get('platform') ?: array();
  12501. } else {
  12502. $platformOverrides = $this->locker->getPlatformOverrides();
  12503. }
  12504. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  12505. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  12506. $aliases = $this->getRootAliases();
  12507. $this->aliasPlatformPackages($platformRepo, $aliases);
  12508. if (!$this->suggestedPackagesReporter) {
  12509. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  12510. }
  12511. try {
  12512. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  12513. if ($res !== 0) {
  12514. return $res;
  12515. }
  12516. } catch (\Exception $e) {
  12517. if ($this->executeOperations) {
  12518. $this->installationManager->notifyInstalls($this->io);
  12519. }
  12520. throw $e;
  12521. }
  12522. if ($this->executeOperations) {
  12523. $this->installationManager->notifyInstalls($this->io);
  12524. }
  12525. if ($this->devMode && !$this->skipSuggest) {
  12526. $this->suggestedPackagesReporter->output($installedRepo);
  12527. }
  12528. foreach ($localRepo->getPackages() as $package) {
  12529. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  12530. continue;
  12531. }
  12532. $replacement = (is_string($package->getReplacementPackage()))
  12533. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  12534. : 'No replacement was suggested';
  12535. $this->io->writeError(
  12536. sprintf(
  12537. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  12538. $package->getPrettyName(),
  12539. $replacement
  12540. )
  12541. );
  12542. }
  12543. if ($this->update && $this->writeLock) {
  12544. $localRepo->reload();
  12545. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  12546. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  12547. $updatedLock = $this->locker->setLockData(
  12548. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  12549. $devPackages,
  12550. $platformReqs,
  12551. $platformDevReqs,
  12552. $aliases,
  12553. $this->package->getMinimumStability(),
  12554. $this->package->getStabilityFlags(),
  12555. $this->preferStable || $this->package->getPreferStable(),
  12556. $this->preferLowest,
  12557. $this->config->get('platform') ?: array()
  12558. );
  12559. if ($updatedLock) {
  12560. $this->io->writeError('<info>Writing lock file</info>');
  12561. }
  12562. }
  12563. if ($this->dumpAutoloader) {
  12564. if ($this->optimizeAutoloader) {
  12565. $this->io->writeError('<info>Generating optimized autoload files</info>');
  12566. } else {
  12567. $this->io->writeError('<info>Generating autoload files</info>');
  12568. }
  12569. $this->autoloadGenerator->setDevMode($this->devMode);
  12570. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  12571. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  12572. $this->autoloadGenerator->setRunScripts($this->runScripts);
  12573. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  12574. }
  12575. if ($this->runScripts) {
  12576. $devMode = (int) $this->devMode;
  12577. putenv("COMPOSER_DEV_MODE=$devMode");
  12578. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  12579. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12580. }
  12581. if ($this->executeOperations) {
  12582. foreach ($localRepo->getPackages() as $package) {
  12583. $this->installationManager->ensureBinariesPresence($package);
  12584. }
  12585. $vendorDir = $this->config->get('vendor-dir');
  12586. if (is_dir($vendorDir)) {
  12587. @touch($vendorDir);
  12588. }
  12589. }
  12590. if (!defined('HHVM_VERSION')) {
  12591. gc_enable();
  12592. }
  12593. return 0;
  12594. }
  12595. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  12596. {
  12597. $lockedRepository = null;
  12598. $repositories = null;
  12599. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  12600. try {
  12601. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  12602. } catch (\RuntimeException $e) {
  12603. if ($this->package->getDevRequires()) {
  12604. throw $e;
  12605. }
  12606. $lockedRepository = $this->locker->getLockedRepository();
  12607. }
  12608. }
  12609. $this->whitelistUpdateDependencies(
  12610. $lockedRepository ?: $localRepo,
  12611. $this->package->getRequires(),
  12612. $this->package->getDevRequires()
  12613. );
  12614. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  12615. $policy = $this->createPolicy();
  12616. $pool = $this->createPool($this->update ? null : $lockedRepository);
  12617. $pool->addRepository($installedRepo, $aliases);
  12618. if ($this->update) {
  12619. $repositories = $this->repositoryManager->getRepositories();
  12620. foreach ($repositories as $repository) {
  12621. $pool->addRepository($repository, $aliases);
  12622. }
  12623. }
  12624. if ($lockedRepository) {
  12625. $pool->addRepository($lockedRepository, $aliases);
  12626. }
  12627. $request = $this->createRequest($this->package, $platformRepo);
  12628. if ($this->update) {
  12629. $removedUnstablePackages = array();
  12630. foreach ($localRepo->getPackages() as $package) {
  12631. if (
  12632. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  12633. && $this->installationManager->isPackageInstalled($localRepo, $package)
  12634. ) {
  12635. $removedUnstablePackages[$package->getName()] = true;
  12636. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  12637. }
  12638. }
  12639. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  12640. $request->updateAll();
  12641. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  12642. foreach ($links as $link) {
  12643. $request->install($link->getTarget(), $link->getConstraint());
  12644. }
  12645. if ($this->updateWhitelist) {
  12646. $currentPackages = $this->getCurrentPackages($installedRepo);
  12647. $candidates = array();
  12648. foreach ($links as $link) {
  12649. $candidates[$link->getTarget()] = true;
  12650. $rootRequires[$link->getTarget()] = $link;
  12651. }
  12652. foreach ($currentPackages as $package) {
  12653. $candidates[$package->getName()] = true;
  12654. }
  12655. foreach ($candidates as $candidate => $dummy) {
  12656. foreach ($currentPackages as $curPackage) {
  12657. if ($curPackage->getName() === $candidate) {
  12658. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  12659. $constraint = new Constraint('=', $curPackage->getVersion());
  12660. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  12661. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  12662. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  12663. $request->install($curPackage->getName(), $constraint);
  12664. }
  12665. break;
  12666. }
  12667. }
  12668. }
  12669. }
  12670. } else {
  12671. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  12672. if (!$this->locker->isFresh()) {
  12673. $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>', true, IOInterface::QUIET);
  12674. }
  12675. foreach ($lockedRepository->getPackages() as $package) {
  12676. $version = $package->getVersion();
  12677. if (isset($aliases[$package->getName()][$version])) {
  12678. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  12679. }
  12680. $constraint = new Constraint('=', $version);
  12681. $constraint->setPrettyString($package->getPrettyVersion());
  12682. $request->install($package->getName(), $constraint);
  12683. }
  12684. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  12685. $request->install($link->getTarget(), $link->getConstraint());
  12686. }
  12687. }
  12688. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  12689. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  12690. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  12691. try {
  12692. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  12693. } catch (SolverProblemsException $e) {
  12694. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  12695. $this->io->writeError($e->getMessage());
  12696. return array(max(1, $e->getCode()), array());
  12697. }
  12698. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  12699. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  12700. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  12701. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  12702. if (!$operations) {
  12703. $this->io->writeError('Nothing to install or update');
  12704. }
  12705. $operations = $this->movePluginsToFront($operations);
  12706. $operations = $this->moveUninstallsToFront($operations);
  12707. if ($this->update) {
  12708. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  12709. if (!$this->devMode) {
  12710. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  12711. }
  12712. } else {
  12713. $devPackages = null;
  12714. }
  12715. if ($operations) {
  12716. $installs = $updates = $uninstalls = array();
  12717. foreach ($operations as $operation) {
  12718. if ($operation instanceof InstallOperation) {
  12719. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  12720. } elseif ($operation instanceof UpdateOperation) {
  12721. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  12722. } elseif ($operation instanceof UninstallOperation) {
  12723. $uninstalls[] = $operation->getPackage()->getPrettyName();
  12724. }
  12725. }
  12726. $this->io->writeError(
  12727. sprintf("<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  12728. count($installs),
  12729. 1 === count($installs) ? '' : 's',
  12730. count($updates),
  12731. 1 === count($updates) ? '' : 's',
  12732. count($uninstalls),
  12733. 1 === count($uninstalls) ? '' : 's')
  12734. );
  12735. if ($installs) {
  12736. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  12737. }
  12738. if ($updates) {
  12739. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  12740. }
  12741. if ($uninstalls) {
  12742. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  12743. }
  12744. }
  12745. foreach ($operations as $operation) {
  12746. if ('install' === $operation->getJobType()) {
  12747. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  12748. }
  12749. if ($this->update) {
  12750. $package = null;
  12751. if ('update' === $operation->getJobType()) {
  12752. $package = $operation->getTargetPackage();
  12753. } elseif ('install' === $operation->getJobType()) {
  12754. $package = $operation->getPackage();
  12755. }
  12756. if ($package && $package->isDev()) {
  12757. $references = $this->package->getReferences();
  12758. if (isset($references[$package->getName()])) {
  12759. $this->updateInstallReferences($package, $references[$package->getName()]);
  12760. }
  12761. }
  12762. if ('update' === $operation->getJobType()
  12763. && $operation->getTargetPackage()->isDev()
  12764. && $operation->getTargetPackage()->getVersion() === $operation->getInitialPackage()->getVersion()
  12765. && (!$operation->getTargetPackage()->getSourceReference() || $operation->getTargetPackage()->getSourceReference() === $operation->getInitialPackage()->getSourceReference())
  12766. && (!$operation->getTargetPackage()->getDistReference() || $operation->getTargetPackage()->getDistReference() === $operation->getInitialPackage()->getDistReference())
  12767. ) {
  12768. $this->io->writeError(' - Skipping update of '. $operation->getTargetPackage()->getPrettyName().' to the same reference-locked version', true, IOInterface::DEBUG);
  12769. $this->io->writeError('', true, IOInterface::DEBUG);
  12770. continue;
  12771. }
  12772. }
  12773. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($operation->getJobType());
  12774. if (defined($event) && $this->runScripts) {
  12775. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  12776. }
  12777. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  12778. $this->io->writeError(' - ' . $operation);
  12779. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  12780. $this->io->writeError(' - ' . $operation);
  12781. }
  12782. $this->installationManager->execute($localRepo, $operation);
  12783. if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
  12784. $reason = $operation->getReason();
  12785. if ($reason instanceof Rule) {
  12786. switch ($reason->getReason()) {
  12787. case Rule::RULE_JOB_INSTALL:
  12788. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  12789. $this->io->writeError('');
  12790. break;
  12791. case Rule::RULE_PACKAGE_REQUIRES:
  12792. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  12793. $this->io->writeError('');
  12794. break;
  12795. }
  12796. }
  12797. }
  12798. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($operation->getJobType());
  12799. if (defined($event) && $this->runScripts) {
  12800. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  12801. }
  12802. if ($this->executeOperations || $this->writeLock) {
  12803. $localRepo->write();
  12804. }
  12805. }
  12806. if ($this->executeOperations) {
  12807. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  12808. $localRepo->write();
  12809. }
  12810. return array(0, $devPackages);
  12811. }
  12812. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  12813. {
  12814. if (!$this->package->getDevRequires()) {
  12815. return array();
  12816. }
  12817. $tempLocalRepo = clone $localRepo;
  12818. foreach ($operations as $operation) {
  12819. switch ($operation->getJobType()) {
  12820. case 'install':
  12821. case 'markAliasInstalled':
  12822. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  12823. $tempLocalRepo->addPackage(clone $operation->getPackage());
  12824. }
  12825. break;
  12826. case 'uninstall':
  12827. case 'markAliasUninstalled':
  12828. $tempLocalRepo->removePackage($operation->getPackage());
  12829. break;
  12830. case 'update':
  12831. $tempLocalRepo->removePackage($operation->getInitialPackage());
  12832. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  12833. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  12834. }
  12835. break;
  12836. default:
  12837. throw new \LogicException('Unknown type: '.$operation->getJobType());
  12838. }
  12839. }
  12840. $localRepo = new InstalledArrayRepository(array());
  12841. $loader = new ArrayLoader(null, true);
  12842. $dumper = new ArrayDumper();
  12843. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  12844. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  12845. }
  12846. unset($tempLocalRepo, $loader, $dumper);
  12847. $policy = $this->createPolicy();
  12848. $pool = $this->createPool();
  12849. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  12850. $pool->addRepository($installedRepo, $aliases);
  12851. $request = $this->createRequest($this->package, $platformRepo);
  12852. $request->updateAll();
  12853. foreach ($this->package->getRequires() as $link) {
  12854. $request->install($link->getTarget(), $link->getConstraint());
  12855. }
  12856. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  12857. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  12858. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  12859. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  12860. $devPackages = array();
  12861. foreach ($ops as $op) {
  12862. if ($op->getJobType() === 'uninstall') {
  12863. $devPackages[] = $op->getPackage();
  12864. }
  12865. }
  12866. return $devPackages;
  12867. }
  12868. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  12869. {
  12870. $finalOps = array();
  12871. $packagesToSkip = array();
  12872. foreach ($devPackages as $pkg) {
  12873. $packagesToSkip[$pkg->getName()] = true;
  12874. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  12875. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  12876. }
  12877. }
  12878. foreach ($operations as $op) {
  12879. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  12880. if (isset($packagesToSkip[$package->getName()])) {
  12881. continue;
  12882. }
  12883. $finalOps[] = $op;
  12884. }
  12885. return $finalOps;
  12886. }
  12887. private function movePluginsToFront(array $operations)
  12888. {
  12889. $installerOps = array();
  12890. foreach ($operations as $idx => $op) {
  12891. if ($op instanceof InstallOperation) {
  12892. $package = $op->getPackage();
  12893. } elseif ($op instanceof UpdateOperation) {
  12894. $package = $op->getTargetPackage();
  12895. } else {
  12896. continue;
  12897. }
  12898. if ($package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer') {
  12899. $requires = array_keys($package->getRequires());
  12900. foreach ($requires as $index => $req) {
  12901. if ($req === 'composer-plugin-api' || preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  12902. unset($requires[$index]);
  12903. }
  12904. }
  12905. if (!count($requires)) {
  12906. $installerOps[] = $op;
  12907. unset($operations[$idx]);
  12908. }
  12909. }
  12910. }
  12911. return array_merge($installerOps, $operations);
  12912. }
  12913. private function moveUninstallsToFront(array $operations)
  12914. {
  12915. $uninstOps = array();
  12916. foreach ($operations as $idx => $op) {
  12917. if ($op instanceof UninstallOperation) {
  12918. $uninstOps[] = $op;
  12919. unset($operations[$idx]);
  12920. }
  12921. }
  12922. return array_merge($uninstOps, $operations);
  12923. }
  12924. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  12925. {
  12926. $installedRootPackage = clone $this->package;
  12927. $installedRootPackage->setRequires(array());
  12928. $installedRootPackage->setDevRequires(array());
  12929. $repos = array(
  12930. $localRepo,
  12931. new InstalledArrayRepository(array($installedRootPackage)),
  12932. $platformRepo,
  12933. );
  12934. $installedRepo = new CompositeRepository($repos);
  12935. if ($this->additionalInstalledRepository) {
  12936. $installedRepo->addRepository($this->additionalInstalledRepository);
  12937. }
  12938. return $installedRepo;
  12939. }
  12940. private function createPool(RepositoryInterface $lockedRepository = null)
  12941. {
  12942. if ($this->update) {
  12943. $minimumStability = $this->package->getMinimumStability();
  12944. $stabilityFlags = $this->package->getStabilityFlags();
  12945. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  12946. } else {
  12947. $minimumStability = $this->locker->getMinimumStability();
  12948. $stabilityFlags = $this->locker->getStabilityFlags();
  12949. $requires = array();
  12950. foreach ($lockedRepository->getPackages() as $package) {
  12951. $constraint = new Constraint('=', $package->getVersion());
  12952. $constraint->setPrettyString($package->getPrettyVersion());
  12953. $requires[$package->getName()] = $constraint;
  12954. }
  12955. }
  12956. $rootConstraints = array();
  12957. foreach ($requires as $req => $constraint) {
  12958. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  12959. continue;
  12960. }
  12961. if ($constraint instanceof Link) {
  12962. $rootConstraints[$req] = $constraint->getConstraint();
  12963. } else {
  12964. $rootConstraints[$req] = $constraint;
  12965. }
  12966. }
  12967. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  12968. }
  12969. private function createPolicy()
  12970. {
  12971. $preferStable = null;
  12972. $preferLowest = null;
  12973. if (!$this->update) {
  12974. $preferStable = $this->locker->getPreferStable();
  12975. $preferLowest = $this->locker->getPreferLowest();
  12976. }
  12977. if (null === $preferStable) {
  12978. $preferStable = $this->preferStable || $this->package->getPreferStable();
  12979. }
  12980. if (null === $preferLowest) {
  12981. $preferLowest = $this->preferLowest;
  12982. }
  12983. return new DefaultPolicy($preferStable, $preferLowest);
  12984. }
  12985. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  12986. {
  12987. $request = new Request();
  12988. $constraint = new Constraint('=', $rootPackage->getVersion());
  12989. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  12990. $request->install($rootPackage->getName(), $constraint);
  12991. $fixedPackages = $platformRepo->getPackages();
  12992. if ($this->additionalInstalledRepository) {
  12993. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  12994. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  12995. }
  12996. $provided = $rootPackage->getProvides();
  12997. foreach ($fixedPackages as $package) {
  12998. $constraint = new Constraint('=', $package->getVersion());
  12999. $constraint->setPrettyString($package->getPrettyVersion());
  13000. if ($package->getRepository() !== $platformRepo
  13001. || !isset($provided[$package->getName()])
  13002. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  13003. ) {
  13004. $request->fix($package->getName(), $constraint);
  13005. }
  13006. }
  13007. return $request;
  13008. }
  13009. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  13010. {
  13011. if ($task === 'force-updates' && null === $operations) {
  13012. throw new \InvalidArgumentException('Missing operations argument');
  13013. }
  13014. if ($task === 'force-links') {
  13015. $operations = array();
  13016. }
  13017. if ($this->update && $this->updateWhitelist) {
  13018. $currentPackages = $this->getCurrentPackages($installedRepo);
  13019. }
  13020. foreach ($localRepo->getCanonicalPackages() as $package) {
  13021. if (!$package->isDev()) {
  13022. continue;
  13023. }
  13024. foreach ($operations as $operation) {
  13025. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  13026. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  13027. ) {
  13028. continue 2;
  13029. }
  13030. }
  13031. if ($this->update) {
  13032. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13033. foreach ($currentPackages as $curPackage) {
  13034. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  13035. if ($task === 'force-links') {
  13036. $package->setRequires($curPackage->getRequires());
  13037. $package->setConflicts($curPackage->getConflicts());
  13038. $package->setProvides($curPackage->getProvides());
  13039. $package->setReplaces($curPackage->getReplaces());
  13040. } elseif ($task === 'force-updates') {
  13041. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  13042. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  13043. ) {
  13044. $operations[] = new UpdateOperation($package, $curPackage);
  13045. }
  13046. }
  13047. break;
  13048. }
  13049. }
  13050. continue;
  13051. }
  13052. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13053. foreach ($matches as $index => $match) {
  13054. if (!in_array($match->getRepository(), $repositories, true)) {
  13055. unset($matches[$index]);
  13056. continue;
  13057. }
  13058. if ($match->getName() !== $package->getName()) {
  13059. unset($matches[$index]);
  13060. continue;
  13061. }
  13062. $matches[$index] = $match->getId();
  13063. }
  13064. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13065. $newPackage = $pool->literalToPackage($matches[0]);
  13066. if ($task === 'force-links' && $newPackage) {
  13067. $package->setRequires($newPackage->getRequires());
  13068. $package->setConflicts($newPackage->getConflicts());
  13069. $package->setProvides($newPackage->getProvides());
  13070. $package->setReplaces($newPackage->getReplaces());
  13071. }
  13072. if ($task === 'force-updates' && $newPackage && (
  13073. (($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  13074. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  13075. )
  13076. )) {
  13077. $operations[] = new UpdateOperation($package, $newPackage);
  13078. continue;
  13079. }
  13080. }
  13081. if ($task === 'force-updates') {
  13082. $references = $this->package->getReferences();
  13083. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  13084. $operations[] = new UpdateOperation($package, clone $package);
  13085. }
  13086. }
  13087. } else {
  13088. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  13089. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  13090. if ($task === 'force-links') {
  13091. $package->setRequires($lockedPackage->getRequires());
  13092. $package->setConflicts($lockedPackage->getConflicts());
  13093. $package->setProvides($lockedPackage->getProvides());
  13094. $package->setReplaces($lockedPackage->getReplaces());
  13095. } elseif ($task === 'force-updates') {
  13096. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  13097. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  13098. ) {
  13099. $operations[] = new UpdateOperation($package, $lockedPackage);
  13100. }
  13101. }
  13102. break;
  13103. }
  13104. }
  13105. }
  13106. }
  13107. return $operations;
  13108. }
  13109. private function getCurrentPackages($installedRepo)
  13110. {
  13111. if ($this->locker->isLocked()) {
  13112. try {
  13113. return $this->locker->getLockedRepository(true)->getPackages();
  13114. } catch (\RuntimeException $e) {
  13115. return $this->locker->getLockedRepository()->getPackages();
  13116. }
  13117. }
  13118. return $installedRepo->getPackages();
  13119. }
  13120. private function getRootAliases()
  13121. {
  13122. if ($this->update) {
  13123. $aliases = $this->package->getAliases();
  13124. } else {
  13125. $aliases = $this->locker->getAliases();
  13126. }
  13127. $normalizedAliases = array();
  13128. foreach ($aliases as $alias) {
  13129. $normalizedAliases[$alias['package']][$alias['version']] = array(
  13130. 'alias' => $alias['alias'],
  13131. 'alias_normalized' => $alias['alias_normalized'],
  13132. );
  13133. }
  13134. return $normalizedAliases;
  13135. }
  13136. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  13137. {
  13138. if (!$this->update) {
  13139. return;
  13140. }
  13141. $rootRefs = $this->package->getReferences();
  13142. foreach ($localRepo->getCanonicalPackages() as $package) {
  13143. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13144. foreach ($matches as $index => $match) {
  13145. if (!in_array($match->getRepository(), $repositories, true)) {
  13146. unset($matches[$index]);
  13147. continue;
  13148. }
  13149. if ($match->getName() !== $package->getName()) {
  13150. unset($matches[$index]);
  13151. continue;
  13152. }
  13153. $matches[$index] = $match->getId();
  13154. }
  13155. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13156. $newPackage = $pool->literalToPackage($matches[0]);
  13157. $sourceUrl = $package->getSourceUrl();
  13158. $newSourceUrl = $newPackage->getSourceUrl();
  13159. $newReference = $newPackage->getSourceReference();
  13160. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  13161. $newReference = $rootRefs[$package->getName()];
  13162. }
  13163. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  13164. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  13165. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  13166. }
  13167. $package->setDistMirrors($newPackage->getDistMirrors());
  13168. $package->setSourceMirrors($newPackage->getSourceMirrors());
  13169. }
  13170. }
  13171. }
  13172. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  13173. {
  13174. $oldSourceRef = $package->getSourceReference();
  13175. if ($package->getSourceUrl() !== $sourceUrl) {
  13176. $package->setSourceType($sourceType);
  13177. $package->setSourceUrl($sourceUrl);
  13178. $package->setSourceReference($sourceReference);
  13179. }
  13180. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $distUrl)) {
  13181. $package->setDistUrl($distUrl);
  13182. $this->updateInstallReferences($package, $sourceReference);
  13183. }
  13184. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13185. $this->updateInstallReferences($package, $oldSourceRef);
  13186. }
  13187. }
  13188. private function updateInstallReferences(PackageInterface $package, $reference)
  13189. {
  13190. if (!$reference) {
  13191. return;
  13192. }
  13193. $package->setSourceReference($reference);
  13194. $package->setDistReference($reference);
  13195. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) {
  13196. $package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  13197. }
  13198. }
  13199. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  13200. {
  13201. foreach ($aliases as $package => $versions) {
  13202. foreach ($versions as $version => $alias) {
  13203. $packages = $platformRepo->findPackages($package, $version);
  13204. foreach ($packages as $package) {
  13205. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  13206. $aliasPackage->setRootPackageAlias(true);
  13207. $platformRepo->addPackage($aliasPackage);
  13208. }
  13209. }
  13210. }
  13211. }
  13212. private function isUpdateable(PackageInterface $package)
  13213. {
  13214. if (!$this->updateWhitelist) {
  13215. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  13216. }
  13217. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  13218. $patternRegexp = $this->packageNameToRegexp($whiteListedPattern);
  13219. if (preg_match($patternRegexp, $package->getName())) {
  13220. return true;
  13221. }
  13222. }
  13223. return false;
  13224. }
  13225. private function packageNameToRegexp($whiteListedPattern)
  13226. {
  13227. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  13228. return "{^" . $cleanedWhiteListedPattern . "$}i";
  13229. }
  13230. private function extractPlatformRequirements($links)
  13231. {
  13232. $platformReqs = array();
  13233. foreach ($links as $link) {
  13234. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  13235. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  13236. }
  13237. }
  13238. return $platformReqs;
  13239. }
  13240. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  13241. {
  13242. if (!$this->updateWhitelist) {
  13243. return;
  13244. }
  13245. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  13246. $requiredPackageNames = array();
  13247. foreach ($rootRequires as $require) {
  13248. $requiredPackageNames[] = $require->getTarget();
  13249. }
  13250. $skipPackages = array();
  13251. foreach ($rootRequires as $require) {
  13252. $skipPackages[$require->getTarget()] = true;
  13253. }
  13254. $pool = new Pool;
  13255. $pool->addRepository($localOrLockRepo);
  13256. $seen = array();
  13257. $rootRequiredPackageNames = array_keys($rootRequires);
  13258. foreach ($this->updateWhitelist as $packageName => $void) {
  13259. $packageQueue = new \SplQueue;
  13260. $depPackages = $pool->whatProvides($packageName);
  13261. $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true);
  13262. if (!$nameMatchesRequiredPackage) {
  13263. $whitelistPatternRegexp = $this->packageNameToRegexp($packageName);
  13264. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  13265. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  13266. $nameMatchesRequiredPackage = true;
  13267. break;
  13268. }
  13269. }
  13270. }
  13271. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  13272. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  13273. }
  13274. foreach ($depPackages as $depPackage) {
  13275. $packageQueue->enqueue($depPackage);
  13276. }
  13277. while (!$packageQueue->isEmpty()) {
  13278. $package = $packageQueue->dequeue();
  13279. if (isset($seen[$package->getId()])) {
  13280. continue;
  13281. }
  13282. $seen[$package->getId()] = true;
  13283. $this->updateWhitelist[$package->getName()] = true;
  13284. if (!$this->whitelistDependencies) {
  13285. continue;
  13286. }
  13287. $requires = $package->getRequires();
  13288. foreach ($requires as $require) {
  13289. $requirePackages = $pool->whatProvides($require->getTarget());
  13290. foreach ($requirePackages as $requirePackage) {
  13291. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  13292. continue;
  13293. }
  13294. if (isset($skipPackages[$requirePackage->getName()])) {
  13295. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  13296. continue;
  13297. }
  13298. $packageQueue->enqueue($requirePackage);
  13299. }
  13300. }
  13301. }
  13302. }
  13303. }
  13304. private function mockLocalRepositories(RepositoryManager $rm)
  13305. {
  13306. $packages = array();
  13307. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  13308. $packages[(string) $package] = clone $package;
  13309. }
  13310. foreach ($packages as $key => $package) {
  13311. if ($package instanceof AliasPackage) {
  13312. $alias = (string) $package->getAliasOf();
  13313. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  13314. }
  13315. }
  13316. $rm->setLocalRepository(
  13317. new InstalledArrayRepository($packages)
  13318. );
  13319. }
  13320. public static function create(IOInterface $io, Composer $composer)
  13321. {
  13322. return new static(
  13323. $io,
  13324. $composer->getConfig(),
  13325. $composer->getPackage(),
  13326. $composer->getDownloadManager(),
  13327. $composer->getRepositoryManager(),
  13328. $composer->getLocker(),
  13329. $composer->getInstallationManager(),
  13330. $composer->getEventDispatcher(),
  13331. $composer->getAutoloadGenerator()
  13332. );
  13333. }
  13334. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  13335. {
  13336. $this->additionalInstalledRepository = $additionalInstalledRepository;
  13337. return $this;
  13338. }
  13339. public function setDryRun($dryRun = true)
  13340. {
  13341. $this->dryRun = (bool) $dryRun;
  13342. return $this;
  13343. }
  13344. public function isDryRun()
  13345. {
  13346. return $this->dryRun;
  13347. }
  13348. public function setPreferSource($preferSource = true)
  13349. {
  13350. $this->preferSource = (bool) $preferSource;
  13351. return $this;
  13352. }
  13353. public function setPreferDist($preferDist = true)
  13354. {
  13355. $this->preferDist = (bool) $preferDist;
  13356. return $this;
  13357. }
  13358. public function setOptimizeAutoloader($optimizeAutoloader = false)
  13359. {
  13360. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  13361. if (!$this->optimizeAutoloader) {
  13362. $this->setClassMapAuthoritative(false);
  13363. }
  13364. return $this;
  13365. }
  13366. public function setClassMapAuthoritative($classMapAuthoritative = false)
  13367. {
  13368. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  13369. if ($this->classMapAuthoritative) {
  13370. $this->setOptimizeAutoloader(true);
  13371. }
  13372. return $this;
  13373. }
  13374. public function setApcuAutoloader($apcuAutoloader = false)
  13375. {
  13376. $this->apcuAutoloader = (bool) $apcuAutoloader;
  13377. return $this;
  13378. }
  13379. public function setUpdate($update = true)
  13380. {
  13381. $this->update = (bool) $update;
  13382. return $this;
  13383. }
  13384. public function setDevMode($devMode = true)
  13385. {
  13386. $this->devMode = (bool) $devMode;
  13387. return $this;
  13388. }
  13389. public function setDumpAutoloader($dumpAutoloader = true)
  13390. {
  13391. $this->dumpAutoloader = (bool) $dumpAutoloader;
  13392. return $this;
  13393. }
  13394. public function setRunScripts($runScripts = true)
  13395. {
  13396. $this->runScripts = (bool) $runScripts;
  13397. return $this;
  13398. }
  13399. public function setConfig(Config $config)
  13400. {
  13401. $this->config = $config;
  13402. return $this;
  13403. }
  13404. public function setVerbose($verbose = true)
  13405. {
  13406. $this->verbose = (bool) $verbose;
  13407. return $this;
  13408. }
  13409. public function isVerbose()
  13410. {
  13411. return $this->verbose;
  13412. }
  13413. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  13414. {
  13415. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  13416. return $this;
  13417. }
  13418. public function setUpdateWhitelist(array $packages)
  13419. {
  13420. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  13421. return $this;
  13422. }
  13423. public function setWhitelistDependencies($updateDependencies = true)
  13424. {
  13425. $this->whitelistDependencies = (bool) $updateDependencies;
  13426. return $this;
  13427. }
  13428. public function setPreferStable($preferStable = true)
  13429. {
  13430. $this->preferStable = (bool) $preferStable;
  13431. return $this;
  13432. }
  13433. public function setPreferLowest($preferLowest = true)
  13434. {
  13435. $this->preferLowest = (bool) $preferLowest;
  13436. return $this;
  13437. }
  13438. public function setWriteLock($writeLock = true)
  13439. {
  13440. $this->writeLock = (bool) $writeLock;
  13441. return $this;
  13442. }
  13443. public function setExecuteOperations($executeOperations = true)
  13444. {
  13445. $this->executeOperations = (bool) $executeOperations;
  13446. return $this;
  13447. }
  13448. public function setSkipSuggest($skipSuggest = true)
  13449. {
  13450. $this->skipSuggest = (bool) $skipSuggest;
  13451. return $this;
  13452. }
  13453. public function disablePlugins()
  13454. {
  13455. $this->installationManager->disablePlugins();
  13456. return $this;
  13457. }
  13458. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  13459. {
  13460. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  13461. return $this;
  13462. }
  13463. }
  13464. <?php
  13465. namespace Composer\Installer;
  13466. use Composer\IO\IOInterface;
  13467. use Composer\Package\PackageInterface;
  13468. use Composer\Util\Filesystem;
  13469. use Composer\Util\Platform;
  13470. use Composer\Util\ProcessExecutor;
  13471. use Composer\Util\Silencer;
  13472. class BinaryInstaller
  13473. {
  13474. protected $binDir;
  13475. protected $binCompat;
  13476. protected $io;
  13477. protected $filesystem;
  13478. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  13479. {
  13480. $this->binDir = $binDir;
  13481. $this->binCompat = $binCompat;
  13482. $this->io = $io;
  13483. $this->filesystem = $filesystem ?: new Filesystem();
  13484. }
  13485. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  13486. {
  13487. $binaries = $this->getBinaries($package);
  13488. if (!$binaries) {
  13489. return;
  13490. }
  13491. foreach ($binaries as $bin) {
  13492. $binPath = $installPath.'/'.$bin;
  13493. if (!file_exists($binPath)) {
  13494. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  13495. continue;
  13496. }
  13497. $binPath = realpath($binPath);
  13498. $this->initializeBinDir();
  13499. $link = $this->binDir.'/'.basename($bin);
  13500. if (file_exists($link)) {
  13501. if (is_link($link)) {
  13502. Silencer::call('chmod', $link, 0777 & ~umask());
  13503. }
  13504. if ($warnOnOverwrite) {
  13505. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  13506. }
  13507. continue;
  13508. }
  13509. if ($this->binCompat === "auto") {
  13510. if (Platform::isWindows()) {
  13511. $this->installFullBinaries($binPath, $link, $bin, $package);
  13512. } else {
  13513. $this->installSymlinkBinaries($binPath, $link);
  13514. }
  13515. } elseif ($this->binCompat === "full") {
  13516. $this->installFullBinaries($binPath, $link, $bin, $package);
  13517. }
  13518. Silencer::call('chmod', $link, 0777 & ~umask());
  13519. }
  13520. }
  13521. public function removeBinaries(PackageInterface $package)
  13522. {
  13523. $this->initializeBinDir();
  13524. $binaries = $this->getBinaries($package);
  13525. if (!$binaries) {
  13526. return;
  13527. }
  13528. foreach ($binaries as $bin) {
  13529. $link = $this->binDir.'/'.basename($bin);
  13530. if (is_link($link) || file_exists($link)) {
  13531. $this->filesystem->unlink($link);
  13532. }
  13533. if (file_exists($link.'.bat')) {
  13534. $this->filesystem->unlink($link.'.bat');
  13535. }
  13536. }
  13537. if ((is_dir($this->binDir)) && ($this->filesystem->isDirEmpty($this->binDir))) {
  13538. Silencer::call('rmdir', $this->binDir);
  13539. }
  13540. }
  13541. public static function determineBinaryCaller($bin)
  13542. {
  13543. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  13544. return 'call';
  13545. }
  13546. $handle = fopen($bin, 'r');
  13547. $line = fgets($handle);
  13548. fclose($handle);
  13549. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  13550. return trim($match[1]);
  13551. }
  13552. return 'php';
  13553. }
  13554. protected function getBinaries(PackageInterface $package)
  13555. {
  13556. return $package->getBinaries();
  13557. }
  13558. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  13559. {
  13560. if ('.bat' !== substr($binPath, -4)) {
  13561. $this->installUnixyProxyBinaries($binPath, $link);
  13562. @chmod($link, 0777 & ~umask());
  13563. $link .= '.bat';
  13564. if (file_exists($link)) {
  13565. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  13566. }
  13567. }
  13568. if (!file_exists($link)) {
  13569. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  13570. }
  13571. }
  13572. protected function installSymlinkBinaries($binPath, $link)
  13573. {
  13574. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  13575. $this->installUnixyProxyBinaries($binPath, $link);
  13576. }
  13577. }
  13578. protected function installUnixyProxyBinaries($binPath, $link)
  13579. {
  13580. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  13581. }
  13582. protected function initializeBinDir()
  13583. {
  13584. $this->filesystem->ensureDirectoryExists($this->binDir);
  13585. $this->binDir = realpath($this->binDir);
  13586. }
  13587. protected function generateWindowsProxyCode($bin, $link)
  13588. {
  13589. $binPath = $this->filesystem->findShortestPath($link, $bin);
  13590. $caller = self::determineBinaryCaller($bin);
  13591. return "@ECHO OFF\r\n".
  13592. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  13593. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  13594. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  13595. }
  13596. protected function generateUnixyProxyCode($bin, $link)
  13597. {
  13598. $binPath = $this->filesystem->findShortestPath($link, $bin);
  13599. $binDir = ProcessExecutor::escape(dirname($binPath));
  13600. $binFile = basename($binPath);
  13601. $proxyCode = <<<PROXY
  13602. #!/usr/bin/env sh
  13603. dir=$(d=\${0%[/\\\\]*}; cd "\$d"; cd $binDir && pwd)
  13604. # See if we are running in Cygwin by checking for cygpath program
  13605. if command -v 'cygpath' >/dev/null 2>&1; then
  13606. # Cygwin paths start with /cygdrive/ which will break windows PHP,
  13607. # so we need to translate the dir path to windows format. However
  13608. # we could be using cygwin PHP which does not require this, so we
  13609. # test if the path to PHP starts with /cygdrive/ rather than /usr/bin
  13610. if [[ $(which php) == /cygdrive/* ]]; then
  13611. dir=$(cygpath -m "\$dir");
  13612. fi
  13613. fi
  13614. dir=$(echo \$dir | sed 's/ /\ /g')
  13615. "\${dir}/$binFile" "$@"
  13616. PROXY;
  13617. return $proxyCode;
  13618. }
  13619. }
  13620. <?php
  13621. namespace Composer\Installer;
  13622. use Composer\Package\PackageInterface;
  13623. interface BinaryPresenceInterface
  13624. {
  13625. public function ensureBinariesPresence(PackageInterface $package);
  13626. }
  13627. <?php
  13628. namespace Composer\Installer;
  13629. use Composer\IO\IOInterface;
  13630. use Composer\Package\PackageInterface;
  13631. use Composer\Package\AliasPackage;
  13632. use Composer\Repository\RepositoryInterface;
  13633. use Composer\Repository\InstalledRepositoryInterface;
  13634. use Composer\DependencyResolver\Operation\OperationInterface;
  13635. use Composer\DependencyResolver\Operation\InstallOperation;
  13636. use Composer\DependencyResolver\Operation\UpdateOperation;
  13637. use Composer\DependencyResolver\Operation\UninstallOperation;
  13638. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  13639. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13640. use Composer\Util\StreamContextFactory;
  13641. class InstallationManager
  13642. {
  13643. private $installers = array();
  13644. private $cache = array();
  13645. private $notifiablePackages = array();
  13646. public function reset()
  13647. {
  13648. $this->notifiablePackages = array();
  13649. }
  13650. public function addInstaller(InstallerInterface $installer)
  13651. {
  13652. array_unshift($this->installers, $installer);
  13653. $this->cache = array();
  13654. }
  13655. public function removeInstaller(InstallerInterface $installer)
  13656. {
  13657. if (false !== ($key = array_search($installer, $this->installers, true))) {
  13658. array_splice($this->installers, $key, 1);
  13659. $this->cache = array();
  13660. }
  13661. }
  13662. public function disablePlugins()
  13663. {
  13664. foreach ($this->installers as $i => $installer) {
  13665. if (!$installer instanceof PluginInstaller) {
  13666. continue;
  13667. }
  13668. unset($this->installers[$i]);
  13669. }
  13670. }
  13671. public function getInstaller($type)
  13672. {
  13673. $type = strtolower($type);
  13674. if (isset($this->cache[$type])) {
  13675. return $this->cache[$type];
  13676. }
  13677. foreach ($this->installers as $installer) {
  13678. if ($installer->supports($type)) {
  13679. return $this->cache[$type] = $installer;
  13680. }
  13681. }
  13682. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  13683. }
  13684. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13685. {
  13686. if ($package instanceof AliasPackage) {
  13687. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  13688. }
  13689. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  13690. }
  13691. public function ensureBinariesPresence(PackageInterface $package)
  13692. {
  13693. try {
  13694. $installer = $this->getInstaller($package->getType());
  13695. } catch (\InvalidArgumentException $e) {
  13696. return;
  13697. }
  13698. if ($installer instanceof BinaryPresenceInterface) {
  13699. $installer->ensureBinariesPresence($package);
  13700. }
  13701. }
  13702. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  13703. {
  13704. $method = $operation->getJobType();
  13705. $this->$method($repo, $operation);
  13706. }
  13707. public function install(RepositoryInterface $repo, InstallOperation $operation)
  13708. {
  13709. $package = $operation->getPackage();
  13710. $installer = $this->getInstaller($package->getType());
  13711. $installer->install($repo, $package);
  13712. $this->markForNotification($package);
  13713. }
  13714. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  13715. {
  13716. $initial = $operation->getInitialPackage();
  13717. $target = $operation->getTargetPackage();
  13718. $initialType = $initial->getType();
  13719. $targetType = $target->getType();
  13720. if ($initialType === $targetType) {
  13721. $installer = $this->getInstaller($initialType);
  13722. $installer->update($repo, $initial, $target);
  13723. $this->markForNotification($target);
  13724. } else {
  13725. $this->getInstaller($initialType)->uninstall($repo, $initial);
  13726. $this->getInstaller($targetType)->install($repo, $target);
  13727. }
  13728. }
  13729. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  13730. {
  13731. $package = $operation->getPackage();
  13732. $installer = $this->getInstaller($package->getType());
  13733. $installer->uninstall($repo, $package);
  13734. }
  13735. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  13736. {
  13737. $package = $operation->getPackage();
  13738. if (!$repo->hasPackage($package)) {
  13739. $repo->addPackage(clone $package);
  13740. }
  13741. }
  13742. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  13743. {
  13744. $package = $operation->getPackage();
  13745. $repo->removePackage($package);
  13746. }
  13747. public function getInstallPath(PackageInterface $package)
  13748. {
  13749. $installer = $this->getInstaller($package->getType());
  13750. return $installer->getInstallPath($package);
  13751. }
  13752. public function notifyInstalls(IOInterface $io)
  13753. {
  13754. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  13755. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  13756. if ($io->hasAuthentication($repositoryName)) {
  13757. $auth = $io->getAuthentication($repositoryName);
  13758. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  13759. $authHeader = 'Authorization: Basic '.$authStr;
  13760. }
  13761. if (strpos($repoUrl, '%package%')) {
  13762. foreach ($packages as $package) {
  13763. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  13764. $params = array(
  13765. 'version' => $package->getPrettyVersion(),
  13766. 'version_normalized' => $package->getVersion(),
  13767. );
  13768. $opts = array('http' =>
  13769. array(
  13770. 'method' => 'POST',
  13771. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  13772. 'content' => http_build_query($params, '', '&'),
  13773. 'timeout' => 3,
  13774. ),
  13775. );
  13776. if (isset($authHeader)) {
  13777. $opts['http']['header'][] = $authHeader;
  13778. }
  13779. $context = StreamContextFactory::getContext($url, $opts);
  13780. @file_get_contents($url, false, $context);
  13781. }
  13782. continue;
  13783. }
  13784. $postData = array('downloads' => array());
  13785. foreach ($packages as $package) {
  13786. $postData['downloads'][] = array(
  13787. 'name' => $package->getPrettyName(),
  13788. 'version' => $package->getVersion(),
  13789. );
  13790. }
  13791. $opts = array('http' =>
  13792. array(
  13793. 'method' => 'POST',
  13794. 'header' => array('Content-Type: application/json'),
  13795. 'content' => json_encode($postData),
  13796. 'timeout' => 6,
  13797. ),
  13798. );
  13799. if (isset($authHeader)) {
  13800. $opts['http']['header'][] = $authHeader;
  13801. }
  13802. $context = StreamContextFactory::getContext($repoUrl, $opts);
  13803. @file_get_contents($repoUrl, false, $context);
  13804. }
  13805. $this->reset();
  13806. }
  13807. private function markForNotification(PackageInterface $package)
  13808. {
  13809. if ($package->getNotificationUrl()) {
  13810. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  13811. }
  13812. }
  13813. }
  13814. <?php
  13815. namespace Composer\Installer;
  13816. use Composer\Composer;
  13817. use Composer\DependencyResolver\PolicyInterface;
  13818. use Composer\DependencyResolver\Operation\OperationInterface;
  13819. use Composer\DependencyResolver\Pool;
  13820. use Composer\DependencyResolver\Request;
  13821. use Composer\EventDispatcher\Event;
  13822. use Composer\IO\IOInterface;
  13823. use Composer\Repository\CompositeRepository;
  13824. class InstallerEvent extends Event
  13825. {
  13826. private $composer;
  13827. private $io;
  13828. private $devMode;
  13829. private $policy;
  13830. private $pool;
  13831. private $installedRepo;
  13832. private $request;
  13833. private $operations;
  13834. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  13835. {
  13836. parent::__construct($eventName);
  13837. $this->composer = $composer;
  13838. $this->io = $io;
  13839. $this->devMode = $devMode;
  13840. $this->policy = $policy;
  13841. $this->pool = $pool;
  13842. $this->installedRepo = $installedRepo;
  13843. $this->request = $request;
  13844. $this->operations = $operations;
  13845. }
  13846. public function getComposer()
  13847. {
  13848. return $this->composer;
  13849. }
  13850. public function getIO()
  13851. {
  13852. return $this->io;
  13853. }
  13854. public function isDevMode()
  13855. {
  13856. return $this->devMode;
  13857. }
  13858. public function getPolicy()
  13859. {
  13860. return $this->policy;
  13861. }
  13862. public function getPool()
  13863. {
  13864. return $this->pool;
  13865. }
  13866. public function getInstalledRepo()
  13867. {
  13868. return $this->installedRepo;
  13869. }
  13870. public function getRequest()
  13871. {
  13872. return $this->request;
  13873. }
  13874. public function getOperations()
  13875. {
  13876. return $this->operations;
  13877. }
  13878. }
  13879. <?php
  13880. namespace Composer\Installer;
  13881. class InstallerEvents
  13882. {
  13883. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  13884. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  13885. }
  13886. <?php
  13887. namespace Composer\Installer;
  13888. use Composer\Package\PackageInterface;
  13889. use Composer\Repository\InstalledRepositoryInterface;
  13890. use InvalidArgumentException;
  13891. interface InstallerInterface
  13892. {
  13893. public function supports($packageType);
  13894. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  13895. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  13896. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  13897. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  13898. public function getInstallPath(PackageInterface $package);
  13899. }
  13900. <?php
  13901. namespace Composer\Installer;
  13902. use Composer\Composer;
  13903. use Composer\IO\IOInterface;
  13904. use Composer\Repository\InstalledRepositoryInterface;
  13905. use Composer\Package\PackageInterface;
  13906. use Composer\Util\Filesystem;
  13907. use Composer\Util\Silencer;
  13908. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  13909. {
  13910. protected $composer;
  13911. protected $vendorDir;
  13912. protected $binDir;
  13913. protected $downloadManager;
  13914. protected $io;
  13915. protected $type;
  13916. protected $filesystem;
  13917. protected $binCompat;
  13918. protected $binaryInstaller;
  13919. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  13920. {
  13921. $this->composer = $composer;
  13922. $this->downloadManager = $composer->getDownloadManager();
  13923. $this->io = $io;
  13924. $this->type = $type;
  13925. $this->filesystem = $filesystem ?: new Filesystem();
  13926. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  13927. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  13928. }
  13929. public function supports($packageType)
  13930. {
  13931. return $packageType === $this->type || null === $this->type;
  13932. }
  13933. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  13934. {
  13935. return $repo->hasPackage($package) && is_readable($this->getInstallPath($package));
  13936. }
  13937. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  13938. {
  13939. $this->initializeVendorDir();
  13940. $downloadPath = $this->getInstallPath($package);
  13941. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  13942. $this->binaryInstaller->removeBinaries($package);
  13943. }
  13944. $this->installCode($package);
  13945. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  13946. if (!$repo->hasPackage($package)) {
  13947. $repo->addPackage(clone $package);
  13948. }
  13949. }
  13950. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  13951. {
  13952. if (!$repo->hasPackage($initial)) {
  13953. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  13954. }
  13955. $this->initializeVendorDir();
  13956. $this->binaryInstaller->removeBinaries($initial);
  13957. $this->updateCode($initial, $target);
  13958. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  13959. $repo->removePackage($initial);
  13960. if (!$repo->hasPackage($target)) {
  13961. $repo->addPackage(clone $target);
  13962. }
  13963. }
  13964. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  13965. {
  13966. if (!$repo->hasPackage($package)) {
  13967. throw new \InvalidArgumentException('Package is not installed: '.$package);
  13968. }
  13969. $this->removeCode($package);
  13970. $this->binaryInstaller->removeBinaries($package);
  13971. $repo->removePackage($package);
  13972. $downloadPath = $this->getPackageBasePath($package);
  13973. if (strpos($package->getName(), '/')) {
  13974. $packageVendorDir = dirname($downloadPath);
  13975. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  13976. Silencer::call('rmdir', $packageVendorDir);
  13977. }
  13978. }
  13979. }
  13980. public function getInstallPath(PackageInterface $package)
  13981. {
  13982. $this->initializeVendorDir();
  13983. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  13984. $targetDir = $package->getTargetDir();
  13985. return $basePath . ($targetDir ? '/'.$targetDir : '');
  13986. }
  13987. public function ensureBinariesPresence(PackageInterface $package)
  13988. {
  13989. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  13990. }
  13991. protected function getPackageBasePath(PackageInterface $package)
  13992. {
  13993. $installPath = $this->getInstallPath($package);
  13994. $targetDir = $package->getTargetDir();
  13995. if ($targetDir) {
  13996. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  13997. }
  13998. return $installPath;
  13999. }
  14000. protected function installCode(PackageInterface $package)
  14001. {
  14002. $downloadPath = $this->getInstallPath($package);
  14003. $this->downloadManager->download($package, $downloadPath);
  14004. }
  14005. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  14006. {
  14007. $initialDownloadPath = $this->getInstallPath($initial);
  14008. $targetDownloadPath = $this->getInstallPath($target);
  14009. if ($targetDownloadPath !== $initialDownloadPath) {
  14010. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  14011. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  14012. ) {
  14013. $this->removeCode($initial);
  14014. $this->installCode($target);
  14015. return;
  14016. }
  14017. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  14018. }
  14019. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  14020. }
  14021. protected function removeCode(PackageInterface $package)
  14022. {
  14023. $downloadPath = $this->getPackageBasePath($package);
  14024. $this->downloadManager->remove($package, $downloadPath);
  14025. }
  14026. protected function initializeVendorDir()
  14027. {
  14028. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  14029. $this->vendorDir = realpath($this->vendorDir);
  14030. }
  14031. }
  14032. <?php
  14033. namespace Composer\Installer;
  14034. use Composer\Repository\InstalledRepositoryInterface;
  14035. use Composer\Package\PackageInterface;
  14036. class MetapackageInstaller implements InstallerInterface
  14037. {
  14038. public function supports($packageType)
  14039. {
  14040. return $packageType === 'metapackage';
  14041. }
  14042. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14043. {
  14044. return $repo->hasPackage($package);
  14045. }
  14046. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14047. {
  14048. $repo->addPackage(clone $package);
  14049. }
  14050. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14051. {
  14052. if (!$repo->hasPackage($initial)) {
  14053. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14054. }
  14055. $repo->removePackage($initial);
  14056. $repo->addPackage(clone $target);
  14057. }
  14058. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14059. {
  14060. if (!$repo->hasPackage($package)) {
  14061. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14062. }
  14063. $repo->removePackage($package);
  14064. }
  14065. public function getInstallPath(PackageInterface $package)
  14066. {
  14067. return '';
  14068. }
  14069. }
  14070. <?php
  14071. namespace Composer\Installer;
  14072. use Composer\Repository\InstalledRepositoryInterface;
  14073. use Composer\Package\PackageInterface;
  14074. class NoopInstaller implements InstallerInterface
  14075. {
  14076. public function supports($packageType)
  14077. {
  14078. return true;
  14079. }
  14080. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14081. {
  14082. return $repo->hasPackage($package);
  14083. }
  14084. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14085. {
  14086. if (!$repo->hasPackage($package)) {
  14087. $repo->addPackage(clone $package);
  14088. }
  14089. }
  14090. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14091. {
  14092. if (!$repo->hasPackage($initial)) {
  14093. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14094. }
  14095. $repo->removePackage($initial);
  14096. if (!$repo->hasPackage($target)) {
  14097. $repo->addPackage(clone $target);
  14098. }
  14099. }
  14100. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14101. {
  14102. if (!$repo->hasPackage($package)) {
  14103. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14104. }
  14105. $repo->removePackage($package);
  14106. }
  14107. public function getInstallPath(PackageInterface $package)
  14108. {
  14109. $targetDir = $package->getTargetDir();
  14110. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  14111. }
  14112. }
  14113. <?php
  14114. namespace Composer\Installer;
  14115. use Composer\Composer;
  14116. use Composer\IO\IOInterface;
  14117. use Composer\DependencyResolver\Operation\OperationInterface;
  14118. use Composer\DependencyResolver\PolicyInterface;
  14119. use Composer\DependencyResolver\Pool;
  14120. use Composer\DependencyResolver\Request;
  14121. use Composer\Repository\CompositeRepository;
  14122. class PackageEvent extends InstallerEvent
  14123. {
  14124. private $operation;
  14125. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  14126. {
  14127. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  14128. $this->operation = $operation;
  14129. }
  14130. public function getOperation()
  14131. {
  14132. return $this->operation;
  14133. }
  14134. }
  14135. <?php
  14136. namespace Composer\Installer;
  14137. class PackageEvents
  14138. {
  14139. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  14140. const POST_PACKAGE_INSTALL = 'post-package-install';
  14141. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  14142. const POST_PACKAGE_UPDATE = 'post-package-update';
  14143. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  14144. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  14145. }
  14146. <?php
  14147. namespace Composer\Installer;
  14148. use Composer\IO\IOInterface;
  14149. use Composer\Package\PackageInterface;
  14150. use Composer\Util\Filesystem;
  14151. use Composer\Util\ProcessExecutor;
  14152. class PearBinaryInstaller extends BinaryInstaller
  14153. {
  14154. private $installer;
  14155. private $vendorDir;
  14156. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  14157. {
  14158. parent::__construct($io, $binDir, $binCompat, $filesystem);
  14159. $this->installer = $installer;
  14160. $this->vendorDir = $vendorDir;
  14161. }
  14162. protected function getBinaries(PackageInterface $package)
  14163. {
  14164. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  14165. $binaries = array();
  14166. if (file_exists($binariesPath)) {
  14167. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  14168. if (!$value->isDir()) {
  14169. $binaries[] = 'bin/'.$fileName;
  14170. }
  14171. }
  14172. }
  14173. return $binaries;
  14174. }
  14175. protected function initializeBinDir()
  14176. {
  14177. parent::initializeBinDir();
  14178. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  14179. @chmod($this->binDir.'/composer-php', 0777);
  14180. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  14181. @chmod($this->binDir.'/composer-php.bat', 0777);
  14182. }
  14183. protected function generateWindowsProxyCode($bin, $link)
  14184. {
  14185. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14186. if ('.bat' === substr($bin, -4)) {
  14187. $caller = 'call';
  14188. } else {
  14189. $handle = fopen($bin, 'r');
  14190. $line = fgets($handle);
  14191. fclose($handle);
  14192. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14193. $caller = trim($match[1]);
  14194. } else {
  14195. $caller = 'php';
  14196. }
  14197. if ($caller === 'php') {
  14198. return "@echo off\r\n".
  14199. "pushd .\r\n".
  14200. "cd %~dp0\r\n".
  14201. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  14202. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14203. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14204. "popd\r\n".
  14205. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  14206. }
  14207. }
  14208. return "@echo off\r\n".
  14209. "pushd .\r\n".
  14210. "cd %~dp0\r\n".
  14211. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14212. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14213. "popd\r\n".
  14214. $caller." \"%BIN_TARGET%\" %*\r\n";
  14215. }
  14216. private function generateWindowsPhpProxyCode()
  14217. {
  14218. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14219. return
  14220. "@echo off\r\n" .
  14221. "setlocal enabledelayedexpansion\r\n" .
  14222. "set BIN_DIR=%~dp0\r\n" .
  14223. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  14224. "set DIRS=.\r\n" .
  14225. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  14226. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  14227. " set DIRS=!DIRS!;%%~fP\r\n" .
  14228. " )\r\n" .
  14229. ")\r\n" .
  14230. "php.exe -d include_path=!DIRS! %*\r\n";
  14231. }
  14232. private function generateUnixyPhpProxyCode()
  14233. {
  14234. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14235. return
  14236. "#!/usr/bin/env sh\n".
  14237. "SRC_DIR=`pwd`\n".
  14238. "BIN_DIR=`dirname $0`\n".
  14239. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  14240. "DIRS=\"\"\n".
  14241. "for vendor in \$VENDOR_DIR/*; do\n".
  14242. " if [ -d \"\$vendor\" ]; then\n".
  14243. " for package in \$vendor/*; do\n".
  14244. " if [ -d \"\$package\" ]; then\n".
  14245. " DIRS=\"\${DIRS}:\${package}\"\n".
  14246. " fi\n".
  14247. " done\n".
  14248. " fi\n".
  14249. "done\n".
  14250. "php -d include_path=\".\$DIRS\" $@\n";
  14251. }
  14252. }
  14253. <?php
  14254. namespace Composer\Installer;
  14255. use Composer\IO\IOInterface;
  14256. use Composer\Composer;
  14257. use Composer\Downloader\PearPackageExtractor;
  14258. use Composer\Repository\InstalledRepositoryInterface;
  14259. use Composer\Package\PackageInterface;
  14260. use Composer\Util\Platform;
  14261. use Composer\Util\Filesystem;
  14262. class PearInstaller extends LibraryInstaller
  14263. {
  14264. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  14265. {
  14266. $filesystem = new Filesystem();
  14267. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  14268. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  14269. }
  14270. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14271. {
  14272. $this->uninstall($repo, $initial);
  14273. $this->install($repo, $target);
  14274. }
  14275. protected function installCode(PackageInterface $package)
  14276. {
  14277. parent::installCode($package);
  14278. $isWindows = Platform::isWindows();
  14279. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  14280. if (!$isWindows) {
  14281. $php_bin = '/usr/bin/env ' . $php_bin;
  14282. }
  14283. $installPath = $this->getInstallPath($package);
  14284. $vars = array(
  14285. 'os' => $isWindows ? 'windows' : 'linux',
  14286. 'php_bin' => $php_bin,
  14287. 'pear_php' => $installPath,
  14288. 'php_dir' => $installPath,
  14289. 'bin_dir' => $installPath . '/bin',
  14290. 'data_dir' => $installPath . '/data',
  14291. 'version' => $package->getPrettyVersion(),
  14292. );
  14293. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  14294. $pearExtractor = new PearPackageExtractor($packageArchive);
  14295. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  14296. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  14297. $this->filesystem->unlink($packageArchive);
  14298. }
  14299. }
  14300. <?php
  14301. namespace Composer\Installer;
  14302. use Composer\Composer;
  14303. use Composer\IO\IOInterface;
  14304. use Composer\Repository\InstalledRepositoryInterface;
  14305. use Composer\Package\PackageInterface;
  14306. class PluginInstaller extends LibraryInstaller
  14307. {
  14308. private $installationManager;
  14309. public function __construct(IOInterface $io, Composer $composer, $type = 'library')
  14310. {
  14311. parent::__construct($io, $composer, 'composer-plugin');
  14312. $this->installationManager = $composer->getInstallationManager();
  14313. }
  14314. public function supports($packageType)
  14315. {
  14316. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  14317. }
  14318. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14319. {
  14320. $extra = $package->getExtra();
  14321. if (empty($extra['class'])) {
  14322. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14323. }
  14324. parent::install($repo, $package);
  14325. try {
  14326. $this->composer->getPluginManager()->registerPackage($package, true);
  14327. } catch (\Exception $e) {
  14328. $this->io->writeError('Plugin installation failed, rolling back');
  14329. parent::uninstall($repo, $package);
  14330. throw $e;
  14331. }
  14332. }
  14333. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14334. {
  14335. $extra = $target->getExtra();
  14336. if (empty($extra['class'])) {
  14337. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14338. }
  14339. parent::update($repo, $initial, $target);
  14340. $this->composer->getPluginManager()->registerPackage($target, true);
  14341. }
  14342. }
  14343. <?php
  14344. namespace Composer\Installer;
  14345. use Composer\Package\PackageInterface;
  14346. use Composer\Downloader\DownloadManager;
  14347. use Composer\Repository\InstalledRepositoryInterface;
  14348. use Composer\Util\Filesystem;
  14349. class ProjectInstaller implements InstallerInterface
  14350. {
  14351. private $installPath;
  14352. private $downloadManager;
  14353. private $filesystem;
  14354. public function __construct($installPath, DownloadManager $dm)
  14355. {
  14356. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  14357. $this->downloadManager = $dm;
  14358. $this->filesystem = new Filesystem;
  14359. }
  14360. public function supports($packageType)
  14361. {
  14362. return true;
  14363. }
  14364. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14365. {
  14366. return false;
  14367. }
  14368. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14369. {
  14370. $installPath = $this->installPath;
  14371. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  14372. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  14373. }
  14374. if (!is_dir($installPath)) {
  14375. mkdir($installPath, 0777, true);
  14376. }
  14377. $this->downloadManager->download($package, $installPath);
  14378. }
  14379. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14380. {
  14381. throw new \InvalidArgumentException("not supported");
  14382. }
  14383. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14384. {
  14385. throw new \InvalidArgumentException("not supported");
  14386. }
  14387. public function getInstallPath(PackageInterface $package)
  14388. {
  14389. return $this->installPath;
  14390. }
  14391. }
  14392. <?php
  14393. namespace Composer\Installer;
  14394. use Composer\IO\IOInterface;
  14395. use Composer\Package\PackageInterface;
  14396. use Composer\Repository\RepositoryInterface;
  14397. use Symfony\Component\Console\Formatter\OutputFormatter;
  14398. class SuggestedPackagesReporter
  14399. {
  14400. protected $suggestedPackages = array();
  14401. private $io;
  14402. public function __construct(IOInterface $io)
  14403. {
  14404. $this->io = $io;
  14405. }
  14406. public function getPackages()
  14407. {
  14408. return $this->suggestedPackages;
  14409. }
  14410. public function addPackage($source, $target, $reason)
  14411. {
  14412. $this->suggestedPackages[] = array(
  14413. 'source' => $source,
  14414. 'target' => $target,
  14415. 'reason' => $reason,
  14416. );
  14417. return $this;
  14418. }
  14419. public function addSuggestionsFromPackage(PackageInterface $package)
  14420. {
  14421. $source = $package->getPrettyName();
  14422. foreach ($package->getSuggests() as $target => $reason) {
  14423. $this->addPackage(
  14424. $source,
  14425. $target,
  14426. $reason
  14427. );
  14428. }
  14429. return $this;
  14430. }
  14431. public function output(RepositoryInterface $installedRepo = null)
  14432. {
  14433. $suggestedPackages = $this->getPackages();
  14434. $installedPackages = array();
  14435. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  14436. foreach ($installedRepo->getPackages() as $package) {
  14437. $installedPackages = array_merge(
  14438. $installedPackages,
  14439. $package->getNames()
  14440. );
  14441. }
  14442. }
  14443. foreach ($suggestedPackages as $suggestion) {
  14444. if (in_array($suggestion['target'], $installedPackages)) {
  14445. continue;
  14446. }
  14447. $this->io->writeError(sprintf(
  14448. '%s suggests installing %s (%s)',
  14449. $suggestion['source'],
  14450. $this->escapeOutput($suggestion['target']),
  14451. $this->escapeOutput($suggestion['reason'])
  14452. ));
  14453. }
  14454. return $this;
  14455. }
  14456. private function escapeOutput($string)
  14457. {
  14458. return OutputFormatter::escape(
  14459. $this->removeControlCharacters($string)
  14460. );
  14461. }
  14462. private function removeControlCharacters($string)
  14463. {
  14464. return preg_replace(
  14465. '/[[:cntrl:]]/',
  14466. '',
  14467. str_replace("\n", ' ', $string)
  14468. );
  14469. }
  14470. }
  14471. <?php
  14472. namespace Composer\Json;
  14473. use JsonSchema\Validator;
  14474. use Seld\JsonLint\JsonParser;
  14475. use Seld\JsonLint\ParsingException;
  14476. use Composer\Util\RemoteFilesystem;
  14477. use Composer\IO\IOInterface;
  14478. use Composer\Downloader\TransportException;
  14479. class JsonFile
  14480. {
  14481. const LAX_SCHEMA = 1;
  14482. const STRICT_SCHEMA = 2;
  14483. const JSON_UNESCAPED_SLASHES = 64;
  14484. const JSON_PRETTY_PRINT = 128;
  14485. const JSON_UNESCAPED_UNICODE = 256;
  14486. private $path;
  14487. private $rfs;
  14488. private $io;
  14489. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  14490. {
  14491. $this->path = $path;
  14492. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  14493. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  14494. }
  14495. $this->rfs = $rfs;
  14496. $this->io = $io;
  14497. }
  14498. public function getPath()
  14499. {
  14500. return $this->path;
  14501. }
  14502. public function exists()
  14503. {
  14504. return is_file($this->path);
  14505. }
  14506. public function read()
  14507. {
  14508. try {
  14509. if ($this->rfs) {
  14510. $json = $this->rfs->getContents($this->path, $this->path, false);
  14511. } else {
  14512. if ($this->io && $this->io->isDebug()) {
  14513. $this->io->writeError('Reading ' . $this->path);
  14514. }
  14515. $json = file_get_contents($this->path);
  14516. }
  14517. } catch (TransportException $e) {
  14518. throw new \RuntimeException($e->getMessage(), 0, $e);
  14519. } catch (\Exception $e) {
  14520. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  14521. }
  14522. return static::parseJson($json, $this->path);
  14523. }
  14524. public function write(array $hash, $options = 448)
  14525. {
  14526. $dir = dirname($this->path);
  14527. if (!is_dir($dir)) {
  14528. if (file_exists($dir)) {
  14529. throw new \UnexpectedValueException(
  14530. $dir.' exists and is not a directory.'
  14531. );
  14532. }
  14533. if (!@mkdir($dir, 0777, true)) {
  14534. throw new \UnexpectedValueException(
  14535. $dir.' does not exist and could not be created.'
  14536. );
  14537. }
  14538. }
  14539. $retries = 3;
  14540. while ($retries--) {
  14541. try {
  14542. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  14543. break;
  14544. } catch (\Exception $e) {
  14545. if ($retries) {
  14546. usleep(500000);
  14547. continue;
  14548. }
  14549. throw $e;
  14550. }
  14551. }
  14552. }
  14553. public function validateSchema($schema = self::STRICT_SCHEMA)
  14554. {
  14555. $content = file_get_contents($this->path);
  14556. $data = json_decode($content);
  14557. if (null === $data && 'null' !== $content) {
  14558. self::validateSyntax($content, $this->path);
  14559. }
  14560. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  14561. if (false === strpos($schemaFile, '://')) {
  14562. $schemaFile = 'file://' . $schemaFile;
  14563. }
  14564. $schemaData = (object) array('$ref' => $schemaFile);
  14565. if ($schema === self::LAX_SCHEMA) {
  14566. $schemaData->additionalProperties = true;
  14567. $schemaData->required = array();
  14568. }
  14569. $validator = new Validator();
  14570. $validator->check($data, $schemaData);
  14571. if (!$validator->isValid()) {
  14572. $errors = array();
  14573. foreach ((array) $validator->getErrors() as $error) {
  14574. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  14575. }
  14576. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  14577. }
  14578. return true;
  14579. }
  14580. public static function encode($data, $options = 448)
  14581. {
  14582. if (PHP_VERSION_ID >= 50400) {
  14583. $json = json_encode($data, $options);
  14584. if (false === $json) {
  14585. self::throwEncodeError(json_last_error());
  14586. }
  14587. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  14588. $json = preg_replace('/\[\s+\]/', '[]', $json);
  14589. $json = preg_replace('/\{\s+\}/', '{}', $json);
  14590. }
  14591. return $json;
  14592. }
  14593. $json = json_encode($data);
  14594. if (false === $json) {
  14595. self::throwEncodeError(json_last_error());
  14596. }
  14597. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  14598. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  14599. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  14600. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  14601. return $json;
  14602. }
  14603. $result = JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  14604. return $result;
  14605. }
  14606. private static function throwEncodeError($code)
  14607. {
  14608. switch ($code) {
  14609. case JSON_ERROR_DEPTH:
  14610. $msg = 'Maximum stack depth exceeded';
  14611. break;
  14612. case JSON_ERROR_STATE_MISMATCH:
  14613. $msg = 'Underflow or the modes mismatch';
  14614. break;
  14615. case JSON_ERROR_CTRL_CHAR:
  14616. $msg = 'Unexpected control character found';
  14617. break;
  14618. case JSON_ERROR_UTF8:
  14619. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  14620. break;
  14621. default:
  14622. $msg = 'Unknown error';
  14623. }
  14624. throw new \RuntimeException('JSON encoding failed: '.$msg);
  14625. }
  14626. public static function parseJson($json, $file = null)
  14627. {
  14628. if (null === $json) {
  14629. return;
  14630. }
  14631. $data = json_decode($json, true);
  14632. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  14633. self::validateSyntax($json, $file);
  14634. }
  14635. return $data;
  14636. }
  14637. protected static function validateSyntax($json, $file = null)
  14638. {
  14639. $parser = new JsonParser();
  14640. $result = $parser->lint($json);
  14641. if (null === $result) {
  14642. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  14643. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  14644. }
  14645. return true;
  14646. }
  14647. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  14648. }
  14649. }
  14650. <?php
  14651. namespace Composer\Json;
  14652. class JsonFormatter
  14653. {
  14654. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  14655. {
  14656. $result = '';
  14657. $pos = 0;
  14658. $strLen = strlen($json);
  14659. $indentStr = ' ';
  14660. $newLine = "\n";
  14661. $outOfQuotes = true;
  14662. $buffer = '';
  14663. $noescape = true;
  14664. for ($i = 0; $i < $strLen; $i++) {
  14665. $char = substr($json, $i, 1);
  14666. if ('"' === $char && $noescape) {
  14667. $outOfQuotes = !$outOfQuotes;
  14668. }
  14669. if (!$outOfQuotes) {
  14670. $buffer .= $char;
  14671. $noescape = '\\' === $char ? !$noescape : true;
  14672. continue;
  14673. } elseif ('' !== $buffer) {
  14674. if ($unescapeSlashes) {
  14675. $buffer = str_replace('\\/', '/', $buffer);
  14676. }
  14677. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  14678. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  14679. $l = strlen($match[1]);
  14680. if ($l % 2) {
  14681. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  14682. pack('H*', $match[2]),
  14683. 'UTF-8',
  14684. 'UCS-2BE'
  14685. );
  14686. }
  14687. return $match[0];
  14688. }, $buffer);
  14689. }
  14690. $result .= $buffer.$char;
  14691. $buffer = '';
  14692. continue;
  14693. }
  14694. if (':' === $char) {
  14695. $char .= ' ';
  14696. } elseif (('}' === $char || ']' === $char)) {
  14697. $pos--;
  14698. $prevChar = substr($json, $i - 1, 1);
  14699. if ('{' !== $prevChar && '[' !== $prevChar) {
  14700. $result .= $newLine;
  14701. for ($j = 0; $j < $pos; $j++) {
  14702. $result .= $indentStr;
  14703. }
  14704. } else {
  14705. $result = rtrim($result);
  14706. }
  14707. }
  14708. $result .= $char;
  14709. if (',' === $char || '{' === $char || '[' === $char) {
  14710. $result .= $newLine;
  14711. if ('{' === $char || '[' === $char) {
  14712. $pos++;
  14713. }
  14714. for ($j = 0; $j < $pos; $j++) {
  14715. $result .= $indentStr;
  14716. }
  14717. }
  14718. }
  14719. return $result;
  14720. }
  14721. }
  14722. <?php
  14723. namespace Composer\Json;
  14724. use Composer\Repository\PlatformRepository;
  14725. class JsonManipulator
  14726. {
  14727. private static $DEFINES = '(?(DEFINE)
  14728. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  14729. (?<boolean> true | false | null )
  14730. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
  14731. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  14732. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  14733. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  14734. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  14735. )';
  14736. private $contents;
  14737. private $newline;
  14738. private $indent;
  14739. public function __construct($contents)
  14740. {
  14741. $contents = trim($contents);
  14742. if ($contents === '') {
  14743. $contents = '{}';
  14744. }
  14745. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  14746. throw new \InvalidArgumentException('The json file must be an object ({})');
  14747. }
  14748. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  14749. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  14750. $this->detectIndenting();
  14751. }
  14752. public function getContents()
  14753. {
  14754. return $this->contents . $this->newline;
  14755. }
  14756. public function addLink($type, $package, $constraint, $sortPackages = false)
  14757. {
  14758. $decoded = JsonFile::parseJson($this->contents);
  14759. if (!isset($decoded[$type])) {
  14760. return $this->addMainKey($type, array($package => $constraint));
  14761. }
  14762. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  14763. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  14764. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  14765. return false;
  14766. }
  14767. $links = $matches['value'];
  14768. if (isset($decoded[$type][$package])) {
  14769. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  14770. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($package, $constraint) {
  14771. return JsonFile::encode($package) . $m['separator'] . '"' . $constraint . '"';
  14772. }, $links);
  14773. } else {
  14774. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  14775. $links = preg_replace(
  14776. '{'.preg_quote($match[1]).'$}',
  14777. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  14778. $links
  14779. );
  14780. } else {
  14781. $links = '{' . $this->newline .
  14782. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  14783. $this->indent . '}';
  14784. }
  14785. }
  14786. if (true === $sortPackages) {
  14787. $requirements = json_decode($links, true);
  14788. $this->sortPackages($requirements);
  14789. $links = $this->format($requirements);
  14790. }
  14791. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  14792. return true;
  14793. }
  14794. private function sortPackages(array &$packages = array())
  14795. {
  14796. $prefix = function ($requirement) {
  14797. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  14798. return preg_replace(
  14799. array(
  14800. '/^php/',
  14801. '/^hhvm/',
  14802. '/^ext/',
  14803. '/^lib/',
  14804. '/^\D/',
  14805. ),
  14806. array(
  14807. '0-$0',
  14808. '1-$0',
  14809. '2-$0',
  14810. '3-$0',
  14811. '4-$0',
  14812. ),
  14813. $requirement
  14814. );
  14815. }
  14816. return '5-'.$requirement;
  14817. };
  14818. uksort($packages, function ($a, $b) use ($prefix) {
  14819. return strnatcmp($prefix($a), $prefix($b));
  14820. });
  14821. }
  14822. public function addRepository($name, $config)
  14823. {
  14824. return $this->addSubNode('repositories', $name, $config);
  14825. }
  14826. public function removeRepository($name)
  14827. {
  14828. return $this->removeSubNode('repositories', $name);
  14829. }
  14830. public function addConfigSetting($name, $value)
  14831. {
  14832. return $this->addSubNode('config', $name, $value);
  14833. }
  14834. public function removeConfigSetting($name)
  14835. {
  14836. return $this->removeSubNode('config', $name);
  14837. }
  14838. public function addProperty($name, $value)
  14839. {
  14840. if (substr($name, 0, 6) === 'extra.') {
  14841. return $this->addSubNode('extra', substr($name, 6), $value);
  14842. }
  14843. return $this->addMainKey($name, $value);
  14844. }
  14845. public function removeProperty($name)
  14846. {
  14847. if (substr($name, 0, 6) === 'extra.') {
  14848. return $this->removeSubNode('extra', substr($name, 6));
  14849. }
  14850. return $this->removeMainKey($name);
  14851. }
  14852. public function addSubNode($mainNode, $name, $value)
  14853. {
  14854. $decoded = JsonFile::parseJson($this->contents);
  14855. $subName = null;
  14856. if (in_array($mainNode, array('config', 'repositories', 'extra')) && false !== strpos($name, '.')) {
  14857. list($name, $subName) = explode('.', $name, 2);
  14858. }
  14859. if (!isset($decoded[$mainNode])) {
  14860. if ($subName !== null) {
  14861. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  14862. } else {
  14863. $this->addMainKey($mainNode, array($name => $value));
  14864. }
  14865. return true;
  14866. }
  14867. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  14868. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  14869. try {
  14870. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  14871. return false;
  14872. }
  14873. } catch (\RuntimeException $e) {
  14874. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  14875. return false;
  14876. }
  14877. throw $e;
  14878. }
  14879. $children = $match['content'];
  14880. if (!@json_decode($children)) {
  14881. return false;
  14882. }
  14883. $that = $this;
  14884. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  14885. if ($this->pregMatch($childRegex, $children, $matches)) {
  14886. $children = preg_replace_callback($childRegex, function ($matches) use ($name, $subName, $value, $that) {
  14887. if ($subName !== null) {
  14888. $curVal = json_decode($matches['content'], true);
  14889. if (!is_array($curVal)) {
  14890. $curVal = array();
  14891. }
  14892. $curVal[$subName] = $value;
  14893. $value = $curVal;
  14894. }
  14895. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  14896. }, $children);
  14897. } else {
  14898. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  14899. $whitespace = '';
  14900. if (!empty($match['trailingspace'])) {
  14901. $whitespace = $match['trailingspace'];
  14902. }
  14903. if (!empty($match['content'])) {
  14904. if ($subName !== null) {
  14905. $value = array($subName => $value);
  14906. }
  14907. $children = preg_replace(
  14908. '#'.$whitespace.'}$#',
  14909. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  14910. $children
  14911. );
  14912. } else {
  14913. if ($subName !== null) {
  14914. $value = array($subName => $value);
  14915. }
  14916. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  14917. }
  14918. }
  14919. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  14920. return $m['start'] . $children . $m['end'];
  14921. }, $this->contents);
  14922. return true;
  14923. }
  14924. public function removeSubNode($mainNode, $name)
  14925. {
  14926. $decoded = JsonFile::parseJson($this->contents);
  14927. if (empty($decoded[$mainNode])) {
  14928. return true;
  14929. }
  14930. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  14931. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  14932. try {
  14933. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  14934. return false;
  14935. }
  14936. } catch (\RuntimeException $e) {
  14937. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  14938. return false;
  14939. }
  14940. throw $e;
  14941. }
  14942. $children = $match['content'];
  14943. if (!@json_decode($children, true)) {
  14944. return false;
  14945. }
  14946. $subName = null;
  14947. if (in_array($mainNode, array('config', 'repositories', 'extra')) && false !== strpos($name, '.')) {
  14948. list($name, $subName) = explode('.', $name, 2);
  14949. }
  14950. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  14951. return true;
  14952. }
  14953. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  14954. if (preg_match_all('{'.self::$DEFINES.'"'.preg_quote($name).'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  14955. $bestMatch = '';
  14956. foreach ($matches[0] as $match) {
  14957. if (strlen($bestMatch) < strlen($match)) {
  14958. $bestMatch = $match;
  14959. }
  14960. }
  14961. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  14962. if (1 !== $count) {
  14963. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  14964. if (1 !== $count) {
  14965. return false;
  14966. }
  14967. }
  14968. }
  14969. } else {
  14970. $childrenClean = $children;
  14971. }
  14972. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  14973. if (empty($match['content'])) {
  14974. $newline = $this->newline;
  14975. $indent = $this->indent;
  14976. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  14977. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  14978. }, $this->contents);
  14979. if ($subName !== null) {
  14980. $curVal = json_decode($children, true);
  14981. unset($curVal[$name][$subName]);
  14982. $this->addSubNode($mainNode, $name, $curVal[$name]);
  14983. }
  14984. return true;
  14985. }
  14986. $that = $this;
  14987. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  14988. if ($subName !== null) {
  14989. $curVal = json_decode($matches['content'], true);
  14990. unset($curVal[$name][$subName]);
  14991. $childrenClean = $that->format($curVal, 0);
  14992. }
  14993. return $matches['start'] . $childrenClean . $matches['end'];
  14994. }, $this->contents);
  14995. return true;
  14996. }
  14997. public function addMainKey($key, $content)
  14998. {
  14999. $decoded = JsonFile::parseJson($this->contents);
  15000. $content = $this->format($content);
  15001. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15002. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  15003. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  15004. if (!@json_decode('{'.$matches['key'].'}')) {
  15005. return false;
  15006. }
  15007. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  15008. return true;
  15009. }
  15010. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  15011. $this->contents = preg_replace(
  15012. '#'.$match[1].'\}$#',
  15013. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  15014. $this->contents
  15015. );
  15016. return true;
  15017. }
  15018. $this->contents = preg_replace(
  15019. '#\}$#',
  15020. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  15021. $this->contents
  15022. );
  15023. return true;
  15024. }
  15025. public function removeMainKey($key)
  15026. {
  15027. $decoded = JsonFile::parseJson($this->contents);
  15028. if (!isset($decoded[$key])) {
  15029. return true;
  15030. }
  15031. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15032. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  15033. if ($this->pregMatch($regex, $this->contents, $matches)) {
  15034. if (!@json_decode('{'.$matches['removal'].'}')) {
  15035. return false;
  15036. }
  15037. $this->contents = $matches['start'] . $matches['end'];
  15038. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  15039. $this->contents = "{\n}";
  15040. }
  15041. return true;
  15042. }
  15043. return false;
  15044. }
  15045. public function format($data, $depth = 0)
  15046. {
  15047. if (is_array($data)) {
  15048. reset($data);
  15049. if (is_numeric(key($data))) {
  15050. foreach ($data as $key => $val) {
  15051. $data[$key] = $this->format($val, $depth + 1);
  15052. }
  15053. return '['.implode(', ', $data).']';
  15054. }
  15055. $out = '{' . $this->newline;
  15056. $elems = array();
  15057. foreach ($data as $key => $val) {
  15058. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  15059. }
  15060. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  15061. }
  15062. return JsonFile::encode($data);
  15063. }
  15064. protected function detectIndenting()
  15065. {
  15066. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  15067. $this->indent = $match[1];
  15068. } else {
  15069. $this->indent = ' ';
  15070. }
  15071. }
  15072. protected function pregMatch($re, $str, &$matches = array())
  15073. {
  15074. $count = preg_match($re, $str, $matches);
  15075. if ($count === false) {
  15076. switch (preg_last_error()) {
  15077. case PREG_NO_ERROR:
  15078. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  15079. case PREG_INTERNAL_ERROR:
  15080. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  15081. case PREG_BACKTRACK_LIMIT_ERROR:
  15082. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  15083. case PREG_RECURSION_LIMIT_ERROR:
  15084. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  15085. case PREG_BAD_UTF8_ERROR:
  15086. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  15087. case PREG_BAD_UTF8_OFFSET_ERROR:
  15088. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  15089. case 6:
  15090. if (PHP_VERSION_ID > 70000) {
  15091. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  15092. }
  15093. default:
  15094. throw new \RuntimeException('Failed to execute regex: Unknown error');
  15095. }
  15096. }
  15097. return $count;
  15098. }
  15099. }
  15100. <?php
  15101. namespace Composer\Json;
  15102. use Exception;
  15103. class JsonValidationException extends Exception
  15104. {
  15105. protected $errors;
  15106. public function __construct($message, $errors = array(), Exception $previous = null)
  15107. {
  15108. $this->errors = $errors;
  15109. parent::__construct($message, 0, $previous);
  15110. }
  15111. public function getErrors()
  15112. {
  15113. return $this->errors;
  15114. }
  15115. }
  15116. <?php
  15117. namespace Composer\Package;
  15118. use Composer\Semver\Constraint\Constraint;
  15119. use Composer\Package\Version\VersionParser;
  15120. class AliasPackage extends BasePackage implements CompletePackageInterface
  15121. {
  15122. protected $version;
  15123. protected $prettyVersion;
  15124. protected $dev;
  15125. protected $rootPackageAlias = false;
  15126. protected $stability;
  15127. protected $aliasOf;
  15128. protected $requires;
  15129. protected $devRequires;
  15130. protected $conflicts;
  15131. protected $provides;
  15132. protected $replaces;
  15133. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  15134. {
  15135. parent::__construct($aliasOf->getName());
  15136. $this->version = $version;
  15137. $this->prettyVersion = $prettyVersion;
  15138. $this->aliasOf = $aliasOf;
  15139. $this->stability = VersionParser::parseStability($version);
  15140. $this->dev = $this->stability === 'dev';
  15141. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  15142. $links = $aliasOf->{'get' . ucfirst($type)}();
  15143. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  15144. }
  15145. }
  15146. public function getAliasOf()
  15147. {
  15148. return $this->aliasOf;
  15149. }
  15150. public function getVersion()
  15151. {
  15152. return $this->version;
  15153. }
  15154. public function getStability()
  15155. {
  15156. return $this->stability;
  15157. }
  15158. public function getPrettyVersion()
  15159. {
  15160. return $this->prettyVersion;
  15161. }
  15162. public function isDev()
  15163. {
  15164. return $this->dev;
  15165. }
  15166. public function getRequires()
  15167. {
  15168. return $this->requires;
  15169. }
  15170. public function getConflicts()
  15171. {
  15172. return $this->conflicts;
  15173. }
  15174. public function getProvides()
  15175. {
  15176. return $this->provides;
  15177. }
  15178. public function getReplaces()
  15179. {
  15180. return $this->replaces;
  15181. }
  15182. public function getDevRequires()
  15183. {
  15184. return $this->devRequires;
  15185. }
  15186. public function setRootPackageAlias($value)
  15187. {
  15188. return $this->rootPackageAlias = $value;
  15189. }
  15190. public function isRootPackageAlias()
  15191. {
  15192. return $this->rootPackageAlias;
  15193. }
  15194. protected function replaceSelfVersionDependencies(array $links, $linkType)
  15195. {
  15196. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  15197. $newLinks = array();
  15198. foreach ($links as $link) {
  15199. if ('self.version' === $link->getPrettyConstraint()) {
  15200. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15201. }
  15202. }
  15203. $links = array_merge($links, $newLinks);
  15204. } else {
  15205. foreach ($links as $index => $link) {
  15206. if ('self.version' === $link->getPrettyConstraint()) {
  15207. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15208. }
  15209. }
  15210. }
  15211. return $links;
  15212. }
  15213. public function getType()
  15214. {
  15215. return $this->aliasOf->getType();
  15216. }
  15217. public function getTargetDir()
  15218. {
  15219. return $this->aliasOf->getTargetDir();
  15220. }
  15221. public function getExtra()
  15222. {
  15223. return $this->aliasOf->getExtra();
  15224. }
  15225. public function setInstallationSource($type)
  15226. {
  15227. $this->aliasOf->setInstallationSource($type);
  15228. }
  15229. public function getInstallationSource()
  15230. {
  15231. return $this->aliasOf->getInstallationSource();
  15232. }
  15233. public function getSourceType()
  15234. {
  15235. return $this->aliasOf->getSourceType();
  15236. }
  15237. public function getSourceUrl()
  15238. {
  15239. return $this->aliasOf->getSourceUrl();
  15240. }
  15241. public function getSourceUrls()
  15242. {
  15243. return $this->aliasOf->getSourceUrls();
  15244. }
  15245. public function getSourceReference()
  15246. {
  15247. return $this->aliasOf->getSourceReference();
  15248. }
  15249. public function setSourceReference($reference)
  15250. {
  15251. return $this->aliasOf->setSourceReference($reference);
  15252. }
  15253. public function setSourceMirrors($mirrors)
  15254. {
  15255. return $this->aliasOf->setSourceMirrors($mirrors);
  15256. }
  15257. public function getSourceMirrors()
  15258. {
  15259. return $this->aliasOf->getSourceMirrors();
  15260. }
  15261. public function getDistType()
  15262. {
  15263. return $this->aliasOf->getDistType();
  15264. }
  15265. public function getDistUrl()
  15266. {
  15267. return $this->aliasOf->getDistUrl();
  15268. }
  15269. public function getDistUrls()
  15270. {
  15271. return $this->aliasOf->getDistUrls();
  15272. }
  15273. public function getDistReference()
  15274. {
  15275. return $this->aliasOf->getDistReference();
  15276. }
  15277. public function setDistReference($reference)
  15278. {
  15279. return $this->aliasOf->setDistReference($reference);
  15280. }
  15281. public function getDistSha1Checksum()
  15282. {
  15283. return $this->aliasOf->getDistSha1Checksum();
  15284. }
  15285. public function setTransportOptions(array $options)
  15286. {
  15287. return $this->aliasOf->setTransportOptions($options);
  15288. }
  15289. public function getTransportOptions()
  15290. {
  15291. return $this->aliasOf->getTransportOptions();
  15292. }
  15293. public function setDistMirrors($mirrors)
  15294. {
  15295. return $this->aliasOf->setDistMirrors($mirrors);
  15296. }
  15297. public function getDistMirrors()
  15298. {
  15299. return $this->aliasOf->getDistMirrors();
  15300. }
  15301. public function getScripts()
  15302. {
  15303. return $this->aliasOf->getScripts();
  15304. }
  15305. public function getLicense()
  15306. {
  15307. return $this->aliasOf->getLicense();
  15308. }
  15309. public function getAutoload()
  15310. {
  15311. return $this->aliasOf->getAutoload();
  15312. }
  15313. public function getDevAutoload()
  15314. {
  15315. return $this->aliasOf->getDevAutoload();
  15316. }
  15317. public function getIncludePaths()
  15318. {
  15319. return $this->aliasOf->getIncludePaths();
  15320. }
  15321. public function getRepositories()
  15322. {
  15323. return $this->aliasOf->getRepositories();
  15324. }
  15325. public function getReleaseDate()
  15326. {
  15327. return $this->aliasOf->getReleaseDate();
  15328. }
  15329. public function getBinaries()
  15330. {
  15331. return $this->aliasOf->getBinaries();
  15332. }
  15333. public function getKeywords()
  15334. {
  15335. return $this->aliasOf->getKeywords();
  15336. }
  15337. public function getDescription()
  15338. {
  15339. return $this->aliasOf->getDescription();
  15340. }
  15341. public function getHomepage()
  15342. {
  15343. return $this->aliasOf->getHomepage();
  15344. }
  15345. public function getSuggests()
  15346. {
  15347. return $this->aliasOf->getSuggests();
  15348. }
  15349. public function getAuthors()
  15350. {
  15351. return $this->aliasOf->getAuthors();
  15352. }
  15353. public function getSupport()
  15354. {
  15355. return $this->aliasOf->getSupport();
  15356. }
  15357. public function getNotificationUrl()
  15358. {
  15359. return $this->aliasOf->getNotificationUrl();
  15360. }
  15361. public function getArchiveExcludes()
  15362. {
  15363. return $this->aliasOf->getArchiveExcludes();
  15364. }
  15365. public function isAbandoned()
  15366. {
  15367. return $this->aliasOf->isAbandoned();
  15368. }
  15369. public function getReplacementPackage()
  15370. {
  15371. return $this->aliasOf->getReplacementPackage();
  15372. }
  15373. public function __toString()
  15374. {
  15375. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  15376. }
  15377. }
  15378. <?php
  15379. namespace Composer\Package\Archiver;
  15380. use FilterIterator;
  15381. use PharData;
  15382. class ArchivableFilesFilter extends FilterIterator
  15383. {
  15384. private $dirs = array();
  15385. public function accept()
  15386. {
  15387. $file = $this->getInnerIterator()->current();
  15388. if ($file->isDir()) {
  15389. $this->dirs[] = (string) $file;
  15390. return false;
  15391. }
  15392. return true;
  15393. }
  15394. public function addEmptyDir(PharData $phar, $sources)
  15395. {
  15396. foreach ($this->dirs as $filepath) {
  15397. $localname = str_replace($sources . "/", '', $filepath);
  15398. $phar->addEmptyDir($localname);
  15399. }
  15400. }
  15401. }
  15402. <?php
  15403. namespace Composer\Package\Archiver;
  15404. use Composer\Util\Filesystem;
  15405. use FilesystemIterator;
  15406. use Symfony\Component\Finder\Finder;
  15407. use Symfony\Component\Finder\SplFileInfo;
  15408. class ArchivableFilesFinder extends \FilterIterator
  15409. {
  15410. protected $finder;
  15411. public function __construct($sources, array $excludes, $ignoreFilters = false)
  15412. {
  15413. $fs = new Filesystem();
  15414. $sources = $fs->normalizePath($sources);
  15415. if ($ignoreFilters) {
  15416. $filters = array();
  15417. } else {
  15418. $filters = array(
  15419. new HgExcludeFilter($sources),
  15420. new GitExcludeFilter($sources),
  15421. new ComposerExcludeFilter($sources, $excludes),
  15422. );
  15423. }
  15424. $this->finder = new Finder();
  15425. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  15426. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  15427. return false;
  15428. }
  15429. $relativePath = preg_replace(
  15430. '#^'.preg_quote($sources, '#').'#',
  15431. '',
  15432. $fs->normalizePath($file->getRealPath())
  15433. );
  15434. $exclude = false;
  15435. foreach ($filters as $filter) {
  15436. $exclude = $filter->filter($relativePath, $exclude);
  15437. }
  15438. return !$exclude;
  15439. };
  15440. if (method_exists($filter, 'bindTo')) {
  15441. $filter = $filter->bindTo(null);
  15442. }
  15443. $this->finder
  15444. ->in($sources)
  15445. ->filter($filter)
  15446. ->ignoreVCS(true)
  15447. ->ignoreDotFiles(false);
  15448. parent::__construct($this->finder->getIterator());
  15449. }
  15450. public function accept()
  15451. {
  15452. $current = $this->getInnerIterator()->current();
  15453. if (!$current->isDir()) {
  15454. return true;
  15455. }
  15456. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  15457. return !$iterator->valid();
  15458. }
  15459. }
  15460. <?php
  15461. namespace Composer\Package\Archiver;
  15462. use Composer\Downloader\DownloadManager;
  15463. use Composer\Package\PackageInterface;
  15464. use Composer\Package\RootPackageInterface;
  15465. use Composer\Util\Filesystem;
  15466. use Composer\Json\JsonFile;
  15467. class ArchiveManager
  15468. {
  15469. protected $downloadManager;
  15470. protected $archivers = array();
  15471. protected $overwriteFiles = true;
  15472. public function __construct(DownloadManager $downloadManager)
  15473. {
  15474. $this->downloadManager = $downloadManager;
  15475. }
  15476. public function addArchiver(ArchiverInterface $archiver)
  15477. {
  15478. $this->archivers[] = $archiver;
  15479. }
  15480. public function setOverwriteFiles($overwriteFiles)
  15481. {
  15482. $this->overwriteFiles = $overwriteFiles;
  15483. return $this;
  15484. }
  15485. public function getPackageFilename(PackageInterface $package)
  15486. {
  15487. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  15488. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  15489. $nameParts = array_merge($nameParts, array($package->getDistReference(), $package->getDistType()));
  15490. } else {
  15491. $nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference()));
  15492. }
  15493. if ($package->getSourceReference()) {
  15494. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  15495. }
  15496. $name = implode('-', array_filter($nameParts, function ($p) {
  15497. return !empty($p);
  15498. }));
  15499. return str_replace('/', '-', $name);
  15500. }
  15501. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  15502. {
  15503. if (empty($format)) {
  15504. throw new \InvalidArgumentException('Format must be specified');
  15505. }
  15506. $usableArchiver = null;
  15507. foreach ($this->archivers as $archiver) {
  15508. if ($archiver->supports($format, $package->getSourceType())) {
  15509. $usableArchiver = $archiver;
  15510. break;
  15511. }
  15512. }
  15513. if (null === $usableArchiver) {
  15514. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  15515. }
  15516. $filesystem = new Filesystem();
  15517. if (null === $fileName) {
  15518. $packageName = $this->getPackageFilename($package);
  15519. } else {
  15520. $packageName = $fileName;
  15521. }
  15522. $filesystem->ensureDirectoryExists($targetDir);
  15523. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  15524. $filesystem->ensureDirectoryExists(dirname($target));
  15525. if (!$this->overwriteFiles && file_exists($target)) {
  15526. return $target;
  15527. }
  15528. if ($package instanceof RootPackageInterface) {
  15529. $sourcePath = realpath('.');
  15530. } else {
  15531. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  15532. $filesystem->ensureDirectoryExists($sourcePath);
  15533. $this->downloadManager->download($package, $sourcePath);
  15534. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  15535. $jsonFile = new JsonFile($composerJsonPath);
  15536. $jsonData = $jsonFile->read();
  15537. if (!empty($jsonData['archive']['exclude'])) {
  15538. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  15539. }
  15540. }
  15541. }
  15542. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  15543. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  15544. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  15545. $filesystem->rename($archivePath, $target);
  15546. if (!$package instanceof RootPackageInterface) {
  15547. $filesystem->removeDirectory($sourcePath);
  15548. }
  15549. $filesystem->remove($tempTarget);
  15550. return $target;
  15551. }
  15552. }
  15553. <?php
  15554. namespace Composer\Package\Archiver;
  15555. interface ArchiverInterface
  15556. {
  15557. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  15558. public function supports($format, $sourceType);
  15559. }
  15560. <?php
  15561. namespace Composer\Package\Archiver;
  15562. use Symfony\Component\Finder;
  15563. abstract class BaseExcludeFilter
  15564. {
  15565. protected $sourcePath;
  15566. protected $excludePatterns;
  15567. public function __construct($sourcePath)
  15568. {
  15569. $this->sourcePath = $sourcePath;
  15570. $this->excludePatterns = array();
  15571. }
  15572. public function filter($relativePath, $exclude)
  15573. {
  15574. foreach ($this->excludePatterns as $patternData) {
  15575. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  15576. if ($stripLeadingSlash) {
  15577. $path = substr($relativePath, 1);
  15578. } else {
  15579. $path = $relativePath;
  15580. }
  15581. if (preg_match($pattern, $path)) {
  15582. $exclude = !$negate;
  15583. }
  15584. }
  15585. return $exclude;
  15586. }
  15587. protected function parseLines(array $lines, $lineParser)
  15588. {
  15589. return array_filter(
  15590. array_map(
  15591. function ($line) use ($lineParser) {
  15592. $line = trim($line);
  15593. if (!$line || 0 === strpos($line, '#')) {
  15594. return null;
  15595. }
  15596. return call_user_func($lineParser, $line);
  15597. },
  15598. $lines
  15599. ),
  15600. function ($pattern) {
  15601. return $pattern !== null;
  15602. }
  15603. );
  15604. }
  15605. protected function generatePatterns($rules)
  15606. {
  15607. $patterns = array();
  15608. foreach ($rules as $rule) {
  15609. $patterns[] = $this->generatePattern($rule);
  15610. }
  15611. return $patterns;
  15612. }
  15613. protected function generatePattern($rule)
  15614. {
  15615. $negate = false;
  15616. $pattern = '{';
  15617. if (strlen($rule) && $rule[0] === '!') {
  15618. $negate = true;
  15619. $rule = substr($rule, 1);
  15620. }
  15621. if (strlen($rule) && $rule[0] === '/') {
  15622. $pattern .= '^/';
  15623. $rule = substr($rule, 1);
  15624. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  15625. $pattern .= '/';
  15626. $rule = substr($rule, 0, -1);
  15627. } elseif (false === strpos($rule, '/')) {
  15628. $pattern .= '/';
  15629. }
  15630. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  15631. return array($pattern . '}', $negate, false);
  15632. }
  15633. }
  15634. <?php
  15635. namespace Composer\Package\Archiver;
  15636. class ComposerExcludeFilter extends BaseExcludeFilter
  15637. {
  15638. public function __construct($sourcePath, array $excludeRules)
  15639. {
  15640. parent::__construct($sourcePath);
  15641. $this->excludePatterns = $this->generatePatterns($excludeRules);
  15642. }
  15643. }
  15644. <?php
  15645. namespace Composer\Package\Archiver;
  15646. class GitExcludeFilter extends BaseExcludeFilter
  15647. {
  15648. public function __construct($sourcePath)
  15649. {
  15650. parent::__construct($sourcePath);
  15651. if (file_exists($sourcePath.'/.gitignore')) {
  15652. $this->excludePatterns = $this->parseLines(
  15653. file($sourcePath.'/.gitignore'),
  15654. array($this, 'parseGitIgnoreLine')
  15655. );
  15656. }
  15657. if (file_exists($sourcePath.'/.gitattributes')) {
  15658. $this->excludePatterns = array_merge(
  15659. $this->excludePatterns,
  15660. $this->parseLines(
  15661. file($sourcePath.'/.gitattributes'),
  15662. array($this, 'parseGitAttributesLine')
  15663. ));
  15664. }
  15665. }
  15666. public function parseGitIgnoreLine($line)
  15667. {
  15668. return $this->generatePattern($line);
  15669. }
  15670. public function parseGitAttributesLine($line)
  15671. {
  15672. $parts = preg_split('#\s+#', $line);
  15673. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  15674. return $this->generatePattern($parts[0]);
  15675. }
  15676. return null;
  15677. }
  15678. }
  15679. <?php
  15680. namespace Composer\Package\Archiver;
  15681. use Symfony\Component\Finder;
  15682. class HgExcludeFilter extends BaseExcludeFilter
  15683. {
  15684. const HG_IGNORE_REGEX = 1;
  15685. const HG_IGNORE_GLOB = 2;
  15686. protected $patternMode;
  15687. public function __construct($sourcePath)
  15688. {
  15689. parent::__construct($sourcePath);
  15690. $this->patternMode = self::HG_IGNORE_REGEX;
  15691. if (file_exists($sourcePath.'/.hgignore')) {
  15692. $this->excludePatterns = $this->parseLines(
  15693. file($sourcePath.'/.hgignore'),
  15694. array($this, 'parseHgIgnoreLine')
  15695. );
  15696. }
  15697. }
  15698. public function parseHgIgnoreLine($line)
  15699. {
  15700. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  15701. if ($matches[1] === 'glob') {
  15702. $this->patternMode = self::HG_IGNORE_GLOB;
  15703. } else {
  15704. $this->patternMode = self::HG_IGNORE_REGEX;
  15705. }
  15706. return null;
  15707. }
  15708. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  15709. return $this->patternFromGlob($line);
  15710. } else {
  15711. return $this->patternFromRegex($line);
  15712. }
  15713. }
  15714. protected function patternFromGlob($line)
  15715. {
  15716. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  15717. $pattern = str_replace('[^/]*', '.*', $pattern);
  15718. return array($pattern, false, true);
  15719. }
  15720. public function patternFromRegex($line)
  15721. {
  15722. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  15723. return array($pattern, false, true);
  15724. }
  15725. }
  15726. <?php
  15727. namespace Composer\Package\Archiver;
  15728. class PharArchiver implements ArchiverInterface
  15729. {
  15730. protected static $formats = array(
  15731. 'zip' => \Phar::ZIP,
  15732. 'tar' => \Phar::TAR,
  15733. 'tar.gz' => \Phar::TAR,
  15734. 'tar.bz2' => \Phar::TAR,
  15735. );
  15736. protected static $compressFormats = array(
  15737. 'tar.gz' => \Phar::GZ,
  15738. 'tar.bz2' => \Phar::BZ2,
  15739. );
  15740. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  15741. {
  15742. $sources = realpath($sources);
  15743. if (file_exists($target)) {
  15744. unlink($target);
  15745. }
  15746. try {
  15747. $filename = substr($target, 0, strrpos($target, $format) - 1);
  15748. if (isset(static::$compressFormats[$format])) {
  15749. $target = $filename . '.tar';
  15750. }
  15751. $phar = new \PharData($target, null, null, static::$formats[$format]);
  15752. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  15753. $filesOnly = new ArchivableFilesFilter($files);
  15754. $phar->buildFromIterator($filesOnly, $sources);
  15755. $filesOnly->addEmptyDir($phar, $sources);
  15756. if (isset(static::$compressFormats[$format])) {
  15757. if (!$phar->canCompress(static::$compressFormats[$format])) {
  15758. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  15759. }
  15760. unlink($target);
  15761. $phar->compress(static::$compressFormats[$format]);
  15762. $target = $filename . '.' . $format;
  15763. }
  15764. return $target;
  15765. } catch (\UnexpectedValueException $e) {
  15766. $message = sprintf("Could not create archive '%s' from '%s': %s",
  15767. $target,
  15768. $sources,
  15769. $e->getMessage()
  15770. );
  15771. throw new \RuntimeException($message, $e->getCode(), $e);
  15772. }
  15773. }
  15774. public function supports($format, $sourceType)
  15775. {
  15776. return isset(static::$formats[$format]);
  15777. }
  15778. }
  15779. <?php
  15780. namespace Composer\Package\Archiver;
  15781. use ZipArchive;
  15782. use Composer\Util\Filesystem;
  15783. class ZipArchiver implements ArchiverInterface
  15784. {
  15785. protected static $formats = array(
  15786. 'zip' => 1,
  15787. );
  15788. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  15789. {
  15790. $fs = new Filesystem();
  15791. $sources = $fs->normalizePath($sources);
  15792. $zip = new ZipArchive();
  15793. $res = $zip->open($target, ZipArchive::CREATE);
  15794. if ($res === true) {
  15795. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  15796. foreach ($files as $file) {
  15797. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  15798. $localname = str_replace($sources.'/', '', $filepath);
  15799. if ($file->isDir()) {
  15800. $zip->addEmptyDir($localname);
  15801. } else {
  15802. $zip->addFile($filepath, $localname);
  15803. }
  15804. }
  15805. if ($zip->close()) {
  15806. return $target;
  15807. }
  15808. }
  15809. $message = sprintf("Could not create archive '%s' from '%s': %s",
  15810. $target,
  15811. $sources,
  15812. $zip->getStatusString()
  15813. );
  15814. throw new \RuntimeException($message);
  15815. }
  15816. public function supports($format, $sourceType)
  15817. {
  15818. return isset(static::$formats[$format]) && $this->compressionAvailable();
  15819. }
  15820. private function compressionAvailable()
  15821. {
  15822. return class_exists('ZipArchive');
  15823. }
  15824. }
  15825. <?php
  15826. namespace Composer\Package;
  15827. use Composer\Repository\RepositoryInterface;
  15828. use Composer\Repository\PlatformRepository;
  15829. abstract class BasePackage implements PackageInterface
  15830. {
  15831. public static $supportedLinkTypes = array(
  15832. 'require' => array('description' => 'requires', 'method' => 'requires'),
  15833. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  15834. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  15835. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  15836. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  15837. );
  15838. const STABILITY_STABLE = 0;
  15839. const STABILITY_RC = 5;
  15840. const STABILITY_BETA = 10;
  15841. const STABILITY_ALPHA = 15;
  15842. const STABILITY_DEV = 20;
  15843. public static $stabilities = array(
  15844. 'stable' => self::STABILITY_STABLE,
  15845. 'RC' => self::STABILITY_RC,
  15846. 'beta' => self::STABILITY_BETA,
  15847. 'alpha' => self::STABILITY_ALPHA,
  15848. 'dev' => self::STABILITY_DEV,
  15849. );
  15850. public $id;
  15851. protected $name;
  15852. protected $prettyName;
  15853. protected $repository;
  15854. protected $transportOptions = array();
  15855. public function __construct($name)
  15856. {
  15857. $this->prettyName = $name;
  15858. $this->name = strtolower($name);
  15859. $this->id = -1;
  15860. }
  15861. public function getName()
  15862. {
  15863. return $this->name;
  15864. }
  15865. public function getPrettyName()
  15866. {
  15867. return $this->prettyName;
  15868. }
  15869. public function getNames()
  15870. {
  15871. $names = array(
  15872. $this->getName() => true,
  15873. );
  15874. foreach ($this->getProvides() as $link) {
  15875. $names[$link->getTarget()] = true;
  15876. }
  15877. foreach ($this->getReplaces() as $link) {
  15878. $names[$link->getTarget()] = true;
  15879. }
  15880. return array_keys($names);
  15881. }
  15882. public function setId($id)
  15883. {
  15884. $this->id = $id;
  15885. }
  15886. public function getId()
  15887. {
  15888. return $this->id;
  15889. }
  15890. public function setRepository(RepositoryInterface $repository)
  15891. {
  15892. if ($this->repository && $repository !== $this->repository) {
  15893. throw new \LogicException('A package can only be added to one repository');
  15894. }
  15895. $this->repository = $repository;
  15896. }
  15897. public function getRepository()
  15898. {
  15899. return $this->repository;
  15900. }
  15901. public function getTransportOptions()
  15902. {
  15903. return $this->transportOptions;
  15904. }
  15905. public function setTransportOptions(array $options)
  15906. {
  15907. $this->transportOptions = $options;
  15908. }
  15909. public function isPlatform()
  15910. {
  15911. return $this->getRepository() instanceof PlatformRepository;
  15912. }
  15913. public function getUniqueName()
  15914. {
  15915. return $this->getName().'-'.$this->getVersion();
  15916. }
  15917. public function equals(PackageInterface $package)
  15918. {
  15919. $self = $this;
  15920. if ($this instanceof AliasPackage) {
  15921. $self = $this->getAliasOf();
  15922. }
  15923. if ($package instanceof AliasPackage) {
  15924. $package = $package->getAliasOf();
  15925. }
  15926. return $package === $self;
  15927. }
  15928. public function __toString()
  15929. {
  15930. return $this->getUniqueName();
  15931. }
  15932. public function getPrettyString()
  15933. {
  15934. return $this->getPrettyName().' '.$this->getPrettyVersion();
  15935. }
  15936. public function getFullPrettyVersion($truncate = true)
  15937. {
  15938. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  15939. return $this->getPrettyVersion();
  15940. }
  15941. if ($truncate && strlen($this->getSourceReference()) === 40) {
  15942. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  15943. }
  15944. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  15945. }
  15946. public function getStabilityPriority()
  15947. {
  15948. return self::$stabilities[$this->getStability()];
  15949. }
  15950. public function __clone()
  15951. {
  15952. $this->repository = null;
  15953. $this->id = -1;
  15954. }
  15955. }
  15956. <?php
  15957. namespace Composer\Package;
  15958. class CompletePackage extends Package implements CompletePackageInterface
  15959. {
  15960. protected $repositories;
  15961. protected $license = array();
  15962. protected $keywords;
  15963. protected $authors;
  15964. protected $description;
  15965. protected $homepage;
  15966. protected $scripts = array();
  15967. protected $support = array();
  15968. protected $abandoned = false;
  15969. public function setScripts(array $scripts)
  15970. {
  15971. $this->scripts = $scripts;
  15972. }
  15973. public function getScripts()
  15974. {
  15975. return $this->scripts;
  15976. }
  15977. public function setRepositories($repositories)
  15978. {
  15979. $this->repositories = $repositories;
  15980. }
  15981. public function getRepositories()
  15982. {
  15983. return $this->repositories;
  15984. }
  15985. public function setLicense(array $license)
  15986. {
  15987. $this->license = $license;
  15988. }
  15989. public function getLicense()
  15990. {
  15991. return $this->license;
  15992. }
  15993. public function setKeywords(array $keywords)
  15994. {
  15995. $this->keywords = $keywords;
  15996. }
  15997. public function getKeywords()
  15998. {
  15999. return $this->keywords;
  16000. }
  16001. public function setAuthors(array $authors)
  16002. {
  16003. $this->authors = $authors;
  16004. }
  16005. public function getAuthors()
  16006. {
  16007. return $this->authors;
  16008. }
  16009. public function setDescription($description)
  16010. {
  16011. $this->description = $description;
  16012. }
  16013. public function getDescription()
  16014. {
  16015. return $this->description;
  16016. }
  16017. public function setHomepage($homepage)
  16018. {
  16019. $this->homepage = $homepage;
  16020. }
  16021. public function getHomepage()
  16022. {
  16023. return $this->homepage;
  16024. }
  16025. public function setSupport(array $support)
  16026. {
  16027. $this->support = $support;
  16028. }
  16029. public function getSupport()
  16030. {
  16031. return $this->support;
  16032. }
  16033. public function isAbandoned()
  16034. {
  16035. return (bool) $this->abandoned;
  16036. }
  16037. public function setAbandoned($abandoned)
  16038. {
  16039. $this->abandoned = $abandoned;
  16040. }
  16041. public function getReplacementPackage()
  16042. {
  16043. return is_string($this->abandoned) ? $this->abandoned : null;
  16044. }
  16045. }
  16046. <?php
  16047. namespace Composer\Package;
  16048. interface CompletePackageInterface extends PackageInterface
  16049. {
  16050. public function getScripts();
  16051. public function getRepositories();
  16052. public function getLicense();
  16053. public function getKeywords();
  16054. public function getDescription();
  16055. public function getHomepage();
  16056. public function getAuthors();
  16057. public function getSupport();
  16058. public function isAbandoned();
  16059. public function getReplacementPackage();
  16060. }
  16061. <?php
  16062. namespace Composer\Package\Dumper;
  16063. use Composer\Package\BasePackage;
  16064. use Composer\Package\PackageInterface;
  16065. use Composer\Package\CompletePackageInterface;
  16066. use Composer\Package\RootPackageInterface;
  16067. class ArrayDumper
  16068. {
  16069. public function dump(PackageInterface $package)
  16070. {
  16071. $keys = array(
  16072. 'binaries' => 'bin',
  16073. 'type',
  16074. 'extra',
  16075. 'installationSource' => 'installation-source',
  16076. 'autoload',
  16077. 'devAutoload' => 'autoload-dev',
  16078. 'notificationUrl' => 'notification-url',
  16079. 'includePaths' => 'include-path',
  16080. );
  16081. $data = array();
  16082. $data['name'] = $package->getPrettyName();
  16083. $data['version'] = $package->getPrettyVersion();
  16084. $data['version_normalized'] = $package->getVersion();
  16085. if ($package->getTargetDir()) {
  16086. $data['target-dir'] = $package->getTargetDir();
  16087. }
  16088. if ($package->getSourceType()) {
  16089. $data['source']['type'] = $package->getSourceType();
  16090. $data['source']['url'] = $package->getSourceUrl();
  16091. $data['source']['reference'] = $package->getSourceReference();
  16092. if ($mirrors = $package->getSourceMirrors()) {
  16093. $data['source']['mirrors'] = $mirrors;
  16094. }
  16095. }
  16096. if ($package->getDistType()) {
  16097. $data['dist']['type'] = $package->getDistType();
  16098. $data['dist']['url'] = $package->getDistUrl();
  16099. $data['dist']['reference'] = $package->getDistReference();
  16100. $data['dist']['shasum'] = $package->getDistSha1Checksum();
  16101. if ($mirrors = $package->getDistMirrors()) {
  16102. $data['dist']['mirrors'] = $mirrors;
  16103. }
  16104. }
  16105. if ($package->getArchiveExcludes()) {
  16106. $data['archive']['exclude'] = $package->getArchiveExcludes();
  16107. }
  16108. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  16109. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  16110. foreach ($links as $link) {
  16111. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  16112. }
  16113. ksort($data[$type]);
  16114. }
  16115. }
  16116. if ($packages = $package->getSuggests()) {
  16117. ksort($packages);
  16118. $data['suggest'] = $packages;
  16119. }
  16120. if ($package->getReleaseDate()) {
  16121. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  16122. }
  16123. $data = $this->dumpValues($package, $keys, $data);
  16124. if ($package instanceof CompletePackageInterface) {
  16125. $keys = array(
  16126. 'scripts',
  16127. 'license',
  16128. 'authors',
  16129. 'description',
  16130. 'homepage',
  16131. 'keywords',
  16132. 'repositories',
  16133. 'support',
  16134. );
  16135. $data = $this->dumpValues($package, $keys, $data);
  16136. if (isset($data['keywords']) && is_array($data['keywords'])) {
  16137. sort($data['keywords']);
  16138. }
  16139. if ($package->isAbandoned()) {
  16140. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  16141. }
  16142. }
  16143. if ($package instanceof RootPackageInterface) {
  16144. $minimumStability = $package->getMinimumStability();
  16145. if ($minimumStability) {
  16146. $data['minimum-stability'] = $minimumStability;
  16147. }
  16148. }
  16149. if (count($package->getTransportOptions()) > 0) {
  16150. $data['transport-options'] = $package->getTransportOptions();
  16151. }
  16152. return $data;
  16153. }
  16154. private function dumpValues(PackageInterface $package, array $keys, array $data)
  16155. {
  16156. foreach ($keys as $method => $key) {
  16157. if (is_numeric($method)) {
  16158. $method = $key;
  16159. }
  16160. $getter = 'get'.ucfirst($method);
  16161. $value = $package->$getter();
  16162. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  16163. $data[$key] = $value;
  16164. }
  16165. }
  16166. return $data;
  16167. }
  16168. }
  16169. <?php
  16170. namespace Composer\Package;
  16171. use Composer\Semver\Constraint\ConstraintInterface;
  16172. class Link
  16173. {
  16174. protected $source;
  16175. protected $target;
  16176. protected $constraint;
  16177. protected $description;
  16178. protected $prettyConstraint;
  16179. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  16180. {
  16181. $this->source = strtolower($source);
  16182. $this->target = strtolower($target);
  16183. $this->constraint = $constraint;
  16184. $this->description = $description;
  16185. $this->prettyConstraint = $prettyConstraint;
  16186. }
  16187. public function getDescription()
  16188. {
  16189. return $this->description;
  16190. }
  16191. public function getSource()
  16192. {
  16193. return $this->source;
  16194. }
  16195. public function getTarget()
  16196. {
  16197. return $this->target;
  16198. }
  16199. public function getConstraint()
  16200. {
  16201. return $this->constraint;
  16202. }
  16203. public function getPrettyConstraint()
  16204. {
  16205. if (null === $this->prettyConstraint) {
  16206. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  16207. }
  16208. return $this->prettyConstraint;
  16209. }
  16210. public function __toString()
  16211. {
  16212. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  16213. }
  16214. public function getPrettyString(PackageInterface $sourcePackage)
  16215. {
  16216. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  16217. }
  16218. }
  16219. <?php
  16220. namespace Composer\Package\LinkConstraint;
  16221. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  16222. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  16223. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  16224. {
  16225. }
  16226. <?php
  16227. namespace Composer\Package\LinkConstraint;
  16228. use Composer\Semver\Constraint\ConstraintInterface;
  16229. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  16230. interface LinkConstraintInterface extends ConstraintInterface
  16231. {
  16232. }
  16233. <?php
  16234. namespace Composer\Package\LinkConstraint;
  16235. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  16236. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  16237. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  16238. {
  16239. }
  16240. <?php
  16241. namespace Composer\Package\LinkConstraint;
  16242. use Composer\Semver\Constraint\AbstractConstraint;
  16243. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  16244. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  16245. {
  16246. }
  16247. <?php
  16248. namespace Composer\Package\LinkConstraint;
  16249. use Composer\Semver\Constraint\Constraint;
  16250. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  16251. class VersionConstraint extends Constraint implements LinkConstraintInterface
  16252. {
  16253. }
  16254. <?php
  16255. namespace Composer\Package\Loader;
  16256. use Composer\Package;
  16257. use Composer\Package\AliasPackage;
  16258. use Composer\Package\Link;
  16259. use Composer\Package\RootAliasPackage;
  16260. use Composer\Package\RootPackageInterface;
  16261. use Composer\Package\Version\VersionParser;
  16262. use Composer\Semver\VersionParser as SemverVersionParser;
  16263. class ArrayLoader implements LoaderInterface
  16264. {
  16265. protected $versionParser;
  16266. protected $loadOptions;
  16267. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  16268. {
  16269. if (!$parser) {
  16270. $parser = new VersionParser;
  16271. }
  16272. $this->versionParser = $parser;
  16273. $this->loadOptions = $loadOptions;
  16274. }
  16275. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  16276. {
  16277. if (!isset($config['name'])) {
  16278. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  16279. }
  16280. if (!isset($config['version'])) {
  16281. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  16282. }
  16283. if (isset($config['version_normalized'])) {
  16284. $version = $config['version_normalized'];
  16285. } else {
  16286. $version = $this->versionParser->normalize($config['version']);
  16287. }
  16288. $package = new $class($config['name'], $version, $config['version']);
  16289. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  16290. if (isset($config['target-dir'])) {
  16291. $package->setTargetDir($config['target-dir']);
  16292. }
  16293. if (isset($config['extra']) && is_array($config['extra'])) {
  16294. $package->setExtra($config['extra']);
  16295. }
  16296. if (isset($config['bin'])) {
  16297. if (!is_array($config['bin'])) {
  16298. throw new \UnexpectedValueException('Package '.$config['name'].'\'s bin key should be an array, '.gettype($config['bin']).' given.');
  16299. }
  16300. foreach ($config['bin'] as $key => $bin) {
  16301. $config['bin'][$key] = ltrim($bin, '/');
  16302. }
  16303. $package->setBinaries($config['bin']);
  16304. }
  16305. if (isset($config['installation-source'])) {
  16306. $package->setInstallationSource($config['installation-source']);
  16307. }
  16308. if (isset($config['source'])) {
  16309. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  16310. throw new \UnexpectedValueException(sprintf(
  16311. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  16312. $config['name'],
  16313. json_encode($config['source'])
  16314. ));
  16315. }
  16316. $package->setSourceType($config['source']['type']);
  16317. $package->setSourceUrl($config['source']['url']);
  16318. $package->setSourceReference($config['source']['reference']);
  16319. if (isset($config['source']['mirrors'])) {
  16320. $package->setSourceMirrors($config['source']['mirrors']);
  16321. }
  16322. }
  16323. if (isset($config['dist'])) {
  16324. if (!isset($config['dist']['type'])
  16325. || !isset($config['dist']['url'])) {
  16326. throw new \UnexpectedValueException(sprintf(
  16327. "Package %s's dist key should be specified as ".
  16328. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  16329. $config['name'],
  16330. json_encode($config['dist'])
  16331. ));
  16332. }
  16333. $package->setDistType($config['dist']['type']);
  16334. $package->setDistUrl($config['dist']['url']);
  16335. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  16336. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  16337. if (isset($config['dist']['mirrors'])) {
  16338. $package->setDistMirrors($config['dist']['mirrors']);
  16339. }
  16340. }
  16341. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  16342. if (isset($config[$type])) {
  16343. $method = 'set'.ucfirst($opts['method']);
  16344. $package->{$method}(
  16345. $this->parseLinks(
  16346. $package->getName(),
  16347. $package->getPrettyVersion(),
  16348. $opts['description'],
  16349. $config[$type]
  16350. )
  16351. );
  16352. }
  16353. }
  16354. if (isset($config['suggest']) && is_array($config['suggest'])) {
  16355. foreach ($config['suggest'] as $target => $reason) {
  16356. if ('self.version' === trim($reason)) {
  16357. $config['suggest'][$target] = $package->getPrettyVersion();
  16358. }
  16359. }
  16360. $package->setSuggests($config['suggest']);
  16361. }
  16362. if (isset($config['autoload'])) {
  16363. $package->setAutoload($config['autoload']);
  16364. }
  16365. if (isset($config['autoload-dev'])) {
  16366. $package->setDevAutoload($config['autoload-dev']);
  16367. }
  16368. if (isset($config['include-path'])) {
  16369. $package->setIncludePaths($config['include-path']);
  16370. }
  16371. if (!empty($config['time'])) {
  16372. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  16373. try {
  16374. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  16375. $package->setReleaseDate($date);
  16376. } catch (\Exception $e) {
  16377. }
  16378. }
  16379. if (!empty($config['notification-url'])) {
  16380. $package->setNotificationUrl($config['notification-url']);
  16381. }
  16382. if (!empty($config['archive']['exclude'])) {
  16383. $package->setArchiveExcludes($config['archive']['exclude']);
  16384. }
  16385. if ($package instanceof Package\CompletePackageInterface) {
  16386. if (isset($config['scripts']) && is_array($config['scripts'])) {
  16387. foreach ($config['scripts'] as $event => $listeners) {
  16388. $config['scripts'][$event] = (array) $listeners;
  16389. }
  16390. if (isset($config['scripts']['composer'])) {
  16391. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  16392. }
  16393. $package->setScripts($config['scripts']);
  16394. }
  16395. if (!empty($config['description']) && is_string($config['description'])) {
  16396. $package->setDescription($config['description']);
  16397. }
  16398. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  16399. $package->setHomepage($config['homepage']);
  16400. }
  16401. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  16402. $package->setKeywords($config['keywords']);
  16403. }
  16404. if (!empty($config['license'])) {
  16405. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  16406. }
  16407. if (!empty($config['authors']) && is_array($config['authors'])) {
  16408. $package->setAuthors($config['authors']);
  16409. }
  16410. if (isset($config['support'])) {
  16411. $package->setSupport($config['support']);
  16412. }
  16413. if (isset($config['abandoned'])) {
  16414. $package->setAbandoned($config['abandoned']);
  16415. }
  16416. }
  16417. if ($aliasNormalized = $this->getBranchAlias($config)) {
  16418. if ($package instanceof RootPackageInterface) {
  16419. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16420. } else {
  16421. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16422. }
  16423. }
  16424. if ($this->loadOptions && isset($config['transport-options'])) {
  16425. $package->setTransportOptions($config['transport-options']);
  16426. }
  16427. return $package;
  16428. }
  16429. public function parseLinks($source, $sourceVersion, $description, $links)
  16430. {
  16431. $res = array();
  16432. foreach ($links as $target => $constraint) {
  16433. if (!is_string($constraint)) {
  16434. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  16435. }
  16436. if ('self.version' === $constraint) {
  16437. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  16438. } else {
  16439. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  16440. }
  16441. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  16442. }
  16443. return $res;
  16444. }
  16445. public function getBranchAlias(array $config)
  16446. {
  16447. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  16448. || !isset($config['extra']['branch-alias'])
  16449. || !is_array($config['extra']['branch-alias'])
  16450. ) {
  16451. return;
  16452. }
  16453. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  16454. if ('-dev' !== substr($targetBranch, -4)) {
  16455. continue;
  16456. }
  16457. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  16458. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  16459. continue;
  16460. }
  16461. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  16462. continue;
  16463. }
  16464. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  16465. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  16466. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  16467. ) {
  16468. continue;
  16469. }
  16470. return $validatedTargetBranch;
  16471. }
  16472. }
  16473. }
  16474. <?php
  16475. namespace Composer\Package\Loader;
  16476. class InvalidPackageException extends \Exception
  16477. {
  16478. private $errors;
  16479. private $warnings;
  16480. private $data;
  16481. public function __construct(array $errors, array $warnings, array $data)
  16482. {
  16483. $this->errors = $errors;
  16484. $this->warnings = $warnings;
  16485. $this->data = $data;
  16486. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  16487. }
  16488. public function getData()
  16489. {
  16490. return $this->data;
  16491. }
  16492. public function getErrors()
  16493. {
  16494. return $this->errors;
  16495. }
  16496. public function getWarnings()
  16497. {
  16498. return $this->warnings;
  16499. }
  16500. }
  16501. <?php
  16502. namespace Composer\Package\Loader;
  16503. use Composer\Json\JsonFile;
  16504. class JsonLoader
  16505. {
  16506. private $loader;
  16507. public function __construct(LoaderInterface $loader)
  16508. {
  16509. $this->loader = $loader;
  16510. }
  16511. public function load($json)
  16512. {
  16513. if ($json instanceof JsonFile) {
  16514. $config = $json->read();
  16515. } elseif (file_exists($json)) {
  16516. $config = JsonFile::parseJson(file_get_contents($json), $json);
  16517. } elseif (is_string($json)) {
  16518. $config = JsonFile::parseJson($json);
  16519. }
  16520. return $this->loader->load($config);
  16521. }
  16522. }
  16523. <?php
  16524. namespace Composer\Package\Loader;
  16525. interface LoaderInterface
  16526. {
  16527. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  16528. }
  16529. <?php
  16530. namespace Composer\Package\Loader;
  16531. use Composer\Package\BasePackage;
  16532. use Composer\Package\AliasPackage;
  16533. use Composer\Config;
  16534. use Composer\Package\RootPackageInterface;
  16535. use Composer\Repository\RepositoryFactory;
  16536. use Composer\Package\Version\VersionGuesser;
  16537. use Composer\Package\Version\VersionParser;
  16538. use Composer\Repository\RepositoryManager;
  16539. use Composer\Util\ProcessExecutor;
  16540. class RootPackageLoader extends ArrayLoader
  16541. {
  16542. private $manager;
  16543. private $config;
  16544. private $versionGuesser;
  16545. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null)
  16546. {
  16547. parent::__construct($parser);
  16548. $this->manager = $manager;
  16549. $this->config = $config;
  16550. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  16551. }
  16552. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  16553. {
  16554. if (!isset($config['name'])) {
  16555. $config['name'] = '__root__';
  16556. }
  16557. $autoVersioned = false;
  16558. if (!isset($config['version'])) {
  16559. if (getenv('COMPOSER_ROOT_VERSION')) {
  16560. $version = getenv('COMPOSER_ROOT_VERSION');
  16561. $commit = null;
  16562. } else {
  16563. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  16564. $version = $versionData['version'];
  16565. $commit = $versionData['commit'];
  16566. }
  16567. if (!$version) {
  16568. $version = '1.0.0';
  16569. $autoVersioned = true;
  16570. }
  16571. $config['version'] = $version;
  16572. if ($commit) {
  16573. $config['source'] = array(
  16574. 'type' => '',
  16575. 'url' => '',
  16576. 'reference' => $commit,
  16577. );
  16578. $config['dist'] = array(
  16579. 'type' => '',
  16580. 'url' => '',
  16581. 'reference' => $commit,
  16582. );
  16583. }
  16584. }
  16585. $realPackage = $package = parent::load($config, $class);
  16586. if ($realPackage instanceof AliasPackage) {
  16587. $realPackage = $package->getAliasOf();
  16588. }
  16589. if ($autoVersioned) {
  16590. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  16591. }
  16592. if (isset($config['minimum-stability'])) {
  16593. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  16594. }
  16595. $aliases = array();
  16596. $stabilityFlags = array();
  16597. $references = array();
  16598. foreach (array('require', 'require-dev') as $linkType) {
  16599. if (isset($config[$linkType])) {
  16600. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  16601. $method = 'get'.ucfirst($linkInfo['method']);
  16602. $links = array();
  16603. foreach ($realPackage->$method() as $link) {
  16604. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  16605. }
  16606. $aliases = $this->extractAliases($links, $aliases);
  16607. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  16608. $references = $this->extractReferences($links, $references);
  16609. }
  16610. }
  16611. if (isset($links[$config['name']])) {
  16612. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  16613. 'Did you accidentally name your root package after an external package?', $config['name']));
  16614. }
  16615. $realPackage->setAliases($aliases);
  16616. $realPackage->setStabilityFlags($stabilityFlags);
  16617. $realPackage->setReferences($references);
  16618. if (isset($config['prefer-stable'])) {
  16619. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  16620. }
  16621. if (isset($config['config'])) {
  16622. $realPackage->setConfig($config['config']);
  16623. }
  16624. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  16625. foreach ($repos as $repo) {
  16626. $this->manager->addRepository($repo);
  16627. }
  16628. $realPackage->setRepositories($this->config->getRepositories());
  16629. return $package;
  16630. }
  16631. private function extractAliases(array $requires, array $aliases)
  16632. {
  16633. foreach ($requires as $reqName => $reqVersion) {
  16634. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  16635. $aliases[] = array(
  16636. 'package' => strtolower($reqName),
  16637. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  16638. 'alias' => $match[2],
  16639. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  16640. );
  16641. }
  16642. }
  16643. return $aliases;
  16644. }
  16645. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  16646. {
  16647. $stabilities = BasePackage::$stabilities;
  16648. $minimumStability = $stabilities[$minimumStability];
  16649. foreach ($requires as $reqName => $reqVersion) {
  16650. $constraints = array();
  16651. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  16652. foreach ($orSplit as $orConstraint) {
  16653. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  16654. foreach ($andSplit as $andConstraint) {
  16655. $constraints[] = $andConstraint;
  16656. }
  16657. }
  16658. $match = false;
  16659. foreach ($constraints as $constraint) {
  16660. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  16661. $name = strtolower($reqName);
  16662. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  16663. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  16664. continue;
  16665. }
  16666. $stabilityFlags[$name] = $stability;
  16667. $match = true;
  16668. }
  16669. }
  16670. if ($match) {
  16671. continue;
  16672. }
  16673. foreach ($constraints as $constraint) {
  16674. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  16675. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  16676. $name = strtolower($reqName);
  16677. $stability = $stabilities[$stabilityName];
  16678. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  16679. continue;
  16680. }
  16681. $stabilityFlags[$name] = $stability;
  16682. }
  16683. }
  16684. }
  16685. return $stabilityFlags;
  16686. }
  16687. private function extractReferences(array $requires, array $references)
  16688. {
  16689. foreach ($requires as $reqName => $reqVersion) {
  16690. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  16691. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === ($stabilityName = VersionParser::parseStability($reqVersion))) {
  16692. $name = strtolower($reqName);
  16693. $references[$name] = $match[1];
  16694. }
  16695. }
  16696. return $references;
  16697. }
  16698. }
  16699. <?php
  16700. namespace Composer\Package\Loader;
  16701. use Composer\Package;
  16702. use Composer\Package\BasePackage;
  16703. use Composer\Semver\Constraint\Constraint;
  16704. use Composer\Package\Version\VersionParser;
  16705. use Composer\Repository\PlatformRepository;
  16706. class ValidatingArrayLoader implements LoaderInterface
  16707. {
  16708. const CHECK_ALL = 3;
  16709. const CHECK_UNBOUND_CONSTRAINTS = 1;
  16710. const CHECK_STRICT_CONSTRAINTS = 2;
  16711. private $loader;
  16712. private $versionParser;
  16713. private $errors;
  16714. private $warnings;
  16715. private $config;
  16716. private $strictName;
  16717. private $flags;
  16718. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  16719. {
  16720. $this->loader = $loader;
  16721. $this->versionParser = $parser ?: new VersionParser();
  16722. $this->strictName = $strictName;
  16723. $this->flags = $flags;
  16724. }
  16725. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  16726. {
  16727. $this->errors = array();
  16728. $this->warnings = array();
  16729. $this->config = $config;
  16730. if ($this->strictName) {
  16731. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  16732. } else {
  16733. $this->validateString('name', true);
  16734. }
  16735. if (!empty($this->config['version'])) {
  16736. try {
  16737. $this->versionParser->normalize($this->config['version']);
  16738. } catch (\Exception $e) {
  16739. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  16740. unset($this->config['version']);
  16741. }
  16742. }
  16743. $this->validateRegex('type', '[A-Za-z0-9-]+');
  16744. $this->validateString('target-dir');
  16745. $this->validateArray('extra');
  16746. $this->validateFlatArray('bin');
  16747. $this->validateArray('scripts');
  16748. $this->validateString('description');
  16749. $this->validateUrl('homepage');
  16750. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  16751. if (isset($this->config['license'])) {
  16752. if (is_string($this->config['license'])) {
  16753. $this->validateRegex('license', '[A-Za-z0-9+. ()-]+');
  16754. } else {
  16755. $this->validateFlatArray('license', '[A-Za-z0-9+. ()-]+');
  16756. }
  16757. }
  16758. $this->validateString('time');
  16759. if (!empty($this->config['time'])) {
  16760. try {
  16761. $date = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  16762. } catch (\Exception $e) {
  16763. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  16764. unset($this->config['time']);
  16765. }
  16766. }
  16767. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  16768. foreach ($this->config['authors'] as $key => $author) {
  16769. if (!is_array($author)) {
  16770. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  16771. unset($this->config['authors'][$key]);
  16772. continue;
  16773. }
  16774. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  16775. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  16776. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  16777. unset($this->config['authors'][$key][$authorData]);
  16778. }
  16779. }
  16780. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  16781. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  16782. unset($this->config['authors'][$key]['homepage']);
  16783. }
  16784. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  16785. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  16786. unset($this->config['authors'][$key]['email']);
  16787. }
  16788. if (empty($this->config['authors'][$key])) {
  16789. unset($this->config['authors'][$key]);
  16790. }
  16791. }
  16792. if (empty($this->config['authors'])) {
  16793. unset($this->config['authors']);
  16794. }
  16795. }
  16796. if ($this->validateArray('support') && !empty($this->config['support'])) {
  16797. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss') as $key) {
  16798. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  16799. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  16800. unset($this->config['support'][$key]);
  16801. }
  16802. }
  16803. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  16804. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  16805. unset($this->config['support']['email']);
  16806. }
  16807. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  16808. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  16809. unset($this->config['support']['irc']);
  16810. }
  16811. foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) {
  16812. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  16813. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  16814. unset($this->config['support'][$key]);
  16815. }
  16816. }
  16817. if (empty($this->config['support'])) {
  16818. unset($this->config['support']);
  16819. }
  16820. }
  16821. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  16822. $stableConstraint = new Constraint('=', '1.0.0');
  16823. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  16824. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  16825. foreach ($this->config[$linkType] as $package => $constraint) {
  16826. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  16827. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  16828. }
  16829. if (!is_string($constraint)) {
  16830. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  16831. unset($this->config[$linkType][$package]);
  16832. } elseif ('self.version' !== $constraint) {
  16833. try {
  16834. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  16835. } catch (\Exception $e) {
  16836. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  16837. unset($this->config[$linkType][$package]);
  16838. continue;
  16839. }
  16840. if (
  16841. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  16842. && 'require' === $linkType
  16843. && $linkConstraint->matches($unboundConstraint)
  16844. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  16845. ) {
  16846. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  16847. } elseif (
  16848. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  16849. && 'require' === $linkType
  16850. && substr($linkConstraint, 0, 1) === '='
  16851. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  16852. ) {
  16853. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  16854. }
  16855. }
  16856. }
  16857. }
  16858. }
  16859. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  16860. foreach ($this->config['suggest'] as $package => $description) {
  16861. if (!is_string($description)) {
  16862. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  16863. unset($this->config['suggest'][$package]);
  16864. }
  16865. }
  16866. }
  16867. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  16868. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  16869. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  16870. unset($this->config['minimum-stability']);
  16871. }
  16872. }
  16873. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  16874. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  16875. foreach ($this->config['autoload'] as $type => $typeConfig) {
  16876. if (!in_array($type, $types)) {
  16877. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  16878. unset($this->config['autoload'][$type]);
  16879. }
  16880. if ($type === 'psr-4') {
  16881. foreach ($typeConfig as $namespace => $dirs) {
  16882. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  16883. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  16884. }
  16885. }
  16886. }
  16887. }
  16888. }
  16889. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  16890. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  16891. unset($this->config['autoload']['psr-4']);
  16892. }
  16893. $this->validateFlatArray('include-path');
  16894. $this->validateArray('transport-options');
  16895. if (isset($this->config['extra']['branch-alias'])) {
  16896. if (!is_array($this->config['extra']['branch-alias'])) {
  16897. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  16898. } else {
  16899. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  16900. if ('-dev' !== substr($targetBranch, -4)) {
  16901. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  16902. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  16903. continue;
  16904. }
  16905. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  16906. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  16907. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  16908. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  16909. continue;
  16910. }
  16911. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  16912. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  16913. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  16914. ) {
  16915. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  16916. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  16917. }
  16918. }
  16919. }
  16920. }
  16921. if ($this->errors) {
  16922. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  16923. }
  16924. $package = $this->loader->load($this->config, $class);
  16925. $this->config = null;
  16926. return $package;
  16927. }
  16928. public function getWarnings()
  16929. {
  16930. return $this->warnings;
  16931. }
  16932. public function getErrors()
  16933. {
  16934. return $this->errors;
  16935. }
  16936. private function validateRegex($property, $regex, $mandatory = false)
  16937. {
  16938. if (!$this->validateString($property, $mandatory)) {
  16939. return false;
  16940. }
  16941. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  16942. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  16943. if ($mandatory) {
  16944. $this->errors[] = $message;
  16945. } else {
  16946. $this->warnings[] = $message;
  16947. }
  16948. unset($this->config[$property]);
  16949. return false;
  16950. }
  16951. return true;
  16952. }
  16953. private function validateString($property, $mandatory = false)
  16954. {
  16955. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  16956. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  16957. unset($this->config[$property]);
  16958. return false;
  16959. }
  16960. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  16961. if ($mandatory) {
  16962. $this->errors[] = $property.' : must be present';
  16963. }
  16964. unset($this->config[$property]);
  16965. return false;
  16966. }
  16967. return true;
  16968. }
  16969. private function validateArray($property, $mandatory = false)
  16970. {
  16971. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  16972. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  16973. unset($this->config[$property]);
  16974. return false;
  16975. }
  16976. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  16977. if ($mandatory) {
  16978. $this->errors[] = $property.' : must be present and contain at least one element';
  16979. }
  16980. unset($this->config[$property]);
  16981. return false;
  16982. }
  16983. return true;
  16984. }
  16985. private function validateFlatArray($property, $regex = null, $mandatory = false)
  16986. {
  16987. if (!$this->validateArray($property, $mandatory)) {
  16988. return false;
  16989. }
  16990. $pass = true;
  16991. foreach ($this->config[$property] as $key => $value) {
  16992. if (!is_string($value) && !is_numeric($value)) {
  16993. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  16994. unset($this->config[$property][$key]);
  16995. $pass = false;
  16996. continue;
  16997. }
  16998. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  16999. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  17000. unset($this->config[$property][$key]);
  17001. $pass = false;
  17002. }
  17003. }
  17004. return $pass;
  17005. }
  17006. private function validateUrl($property, $mandatory = false)
  17007. {
  17008. if (!$this->validateString($property, $mandatory)) {
  17009. return false;
  17010. }
  17011. if (!$this->filterUrl($this->config[$property])) {
  17012. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  17013. unset($this->config[$property]);
  17014. return false;
  17015. }
  17016. return true;
  17017. }
  17018. private function filterUrl($value, array $schemes = array('http', 'https'))
  17019. {
  17020. if ($value === '') {
  17021. return true;
  17022. }
  17023. $bits = parse_url($value);
  17024. if (empty($bits['scheme']) || empty($bits['host'])) {
  17025. return false;
  17026. }
  17027. if (!in_array($bits['scheme'], $schemes, true)) {
  17028. return false;
  17029. }
  17030. return true;
  17031. }
  17032. }
  17033. <?php
  17034. namespace Composer\Package;
  17035. use Composer\Json\JsonFile;
  17036. use Composer\Installer\InstallationManager;
  17037. use Composer\Repository\RepositoryManager;
  17038. use Composer\Util\ProcessExecutor;
  17039. use Composer\Repository\ArrayRepository;
  17040. use Composer\Package\Dumper\ArrayDumper;
  17041. use Composer\Package\Loader\ArrayLoader;
  17042. use Composer\Util\Git as GitUtil;
  17043. use Composer\IO\IOInterface;
  17044. use Seld\JsonLint\ParsingException;
  17045. class Locker
  17046. {
  17047. private $lockFile;
  17048. private $repositoryManager;
  17049. private $installationManager;
  17050. private $hash;
  17051. private $contentHash;
  17052. private $loader;
  17053. private $dumper;
  17054. private $process;
  17055. private $lockDataCache;
  17056. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  17057. {
  17058. $this->lockFile = $lockFile;
  17059. $this->repositoryManager = $repositoryManager;
  17060. $this->installationManager = $installationManager;
  17061. $this->hash = md5($composerFileContents);
  17062. $this->contentHash = self::getContentHash($composerFileContents);
  17063. $this->loader = new ArrayLoader(null, true);
  17064. $this->dumper = new ArrayDumper();
  17065. $this->process = new ProcessExecutor($io);
  17066. }
  17067. public static function getContentHash($composerFileContents)
  17068. {
  17069. $content = json_decode($composerFileContents, true);
  17070. $relevantKeys = array(
  17071. 'name',
  17072. 'version',
  17073. 'require',
  17074. 'require-dev',
  17075. 'conflict',
  17076. 'replace',
  17077. 'provide',
  17078. 'minimum-stability',
  17079. 'prefer-stable',
  17080. 'repositories',
  17081. 'extra',
  17082. );
  17083. $relevantContent = array();
  17084. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  17085. $relevantContent[$key] = $content[$key];
  17086. }
  17087. if (isset($content['config']['platform'])) {
  17088. $relevantContent['config']['platform'] = $content['config']['platform'];
  17089. }
  17090. ksort($relevantContent);
  17091. return md5(json_encode($relevantContent));
  17092. }
  17093. public function isLocked()
  17094. {
  17095. if (!$this->lockFile->exists()) {
  17096. return false;
  17097. }
  17098. $data = $this->getLockData();
  17099. return isset($data['packages']);
  17100. }
  17101. public function isFresh()
  17102. {
  17103. $lock = $this->lockFile->read();
  17104. if (!empty($lock['content-hash'])) {
  17105. return $this->contentHash === $lock['content-hash'];
  17106. }
  17107. if (!empty($lock['hash'])) {
  17108. return $this->hash === $lock['hash'];
  17109. }
  17110. return false;
  17111. }
  17112. public function getLockedRepository($withDevReqs = false)
  17113. {
  17114. $lockData = $this->getLockData();
  17115. $packages = new ArrayRepository();
  17116. $lockedPackages = $lockData['packages'];
  17117. if ($withDevReqs) {
  17118. if (isset($lockData['packages-dev'])) {
  17119. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  17120. } else {
  17121. 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.');
  17122. }
  17123. }
  17124. if (empty($lockedPackages)) {
  17125. return $packages;
  17126. }
  17127. if (isset($lockedPackages[0]['name'])) {
  17128. foreach ($lockedPackages as $info) {
  17129. $packages->addPackage($this->loader->load($info));
  17130. }
  17131. return $packages;
  17132. }
  17133. 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.');
  17134. }
  17135. public function getPlatformRequirements($withDevReqs = false)
  17136. {
  17137. $lockData = $this->getLockData();
  17138. $requirements = array();
  17139. if (!empty($lockData['platform'])) {
  17140. $requirements = $this->loader->parseLinks(
  17141. '__ROOT__',
  17142. '1.0.0',
  17143. 'requires',
  17144. isset($lockData['platform']) ? $lockData['platform'] : array()
  17145. );
  17146. }
  17147. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  17148. $devRequirements = $this->loader->parseLinks(
  17149. '__ROOT__',
  17150. '1.0.0',
  17151. 'requires',
  17152. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  17153. );
  17154. $requirements = array_merge($requirements, $devRequirements);
  17155. }
  17156. return $requirements;
  17157. }
  17158. public function getMinimumStability()
  17159. {
  17160. $lockData = $this->getLockData();
  17161. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  17162. }
  17163. public function getStabilityFlags()
  17164. {
  17165. $lockData = $this->getLockData();
  17166. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  17167. }
  17168. public function getPreferStable()
  17169. {
  17170. $lockData = $this->getLockData();
  17171. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  17172. }
  17173. public function getPreferLowest()
  17174. {
  17175. $lockData = $this->getLockData();
  17176. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  17177. }
  17178. public function getPlatformOverrides()
  17179. {
  17180. $lockData = $this->getLockData();
  17181. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  17182. }
  17183. public function getAliases()
  17184. {
  17185. $lockData = $this->getLockData();
  17186. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  17187. }
  17188. public function getLockData()
  17189. {
  17190. if (null !== $this->lockDataCache) {
  17191. return $this->lockDataCache;
  17192. }
  17193. if (!$this->lockFile->exists()) {
  17194. throw new \LogicException('No lockfile found. Unable to read locked packages');
  17195. }
  17196. return $this->lockDataCache = $this->lockFile->read();
  17197. }
  17198. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  17199. {
  17200. $lock = array(
  17201. '_readme' => array('This file locks the dependencies of your project to a known state',
  17202. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
  17203. 'This file is @gener'.'ated automatically', ),
  17204. 'content-hash' => $this->contentHash,
  17205. 'packages' => null,
  17206. 'packages-dev' => null,
  17207. 'aliases' => array(),
  17208. 'minimum-stability' => $minimumStability,
  17209. 'stability-flags' => $stabilityFlags,
  17210. 'prefer-stable' => $preferStable,
  17211. 'prefer-lowest' => $preferLowest,
  17212. );
  17213. foreach ($aliases as $package => $versions) {
  17214. foreach ($versions as $version => $alias) {
  17215. $lock['aliases'][] = array(
  17216. 'alias' => $alias['alias'],
  17217. 'alias_normalized' => $alias['alias_normalized'],
  17218. 'version' => $version,
  17219. 'package' => $package,
  17220. );
  17221. }
  17222. }
  17223. $lock['packages'] = $this->lockPackages($packages);
  17224. if (null !== $devPackages) {
  17225. $lock['packages-dev'] = $this->lockPackages($devPackages);
  17226. }
  17227. $lock['platform'] = $platformReqs;
  17228. $lock['platform-dev'] = $platformDevReqs;
  17229. if ($platformOverrides) {
  17230. $lock['platform-overrides'] = $platformOverrides;
  17231. }
  17232. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  17233. if ($this->lockFile->exists()) {
  17234. unlink($this->lockFile->getPath());
  17235. }
  17236. return false;
  17237. }
  17238. try {
  17239. $isLocked = $this->isLocked();
  17240. } catch (ParsingException $e) {
  17241. $isLocked = false;
  17242. }
  17243. if (!$isLocked || $lock !== $this->getLockData()) {
  17244. $this->lockFile->write($lock);
  17245. $this->lockDataCache = null;
  17246. return true;
  17247. }
  17248. return false;
  17249. }
  17250. private function lockPackages(array $packages)
  17251. {
  17252. $locked = array();
  17253. foreach ($packages as $package) {
  17254. if ($package instanceof AliasPackage) {
  17255. continue;
  17256. }
  17257. $name = $package->getPrettyName();
  17258. $version = $package->getPrettyVersion();
  17259. if (!$name || !$version) {
  17260. throw new \LogicException(sprintf(
  17261. 'Package "%s" has no version or name and can not be locked', $package
  17262. ));
  17263. }
  17264. $spec = $this->dumper->dump($package);
  17265. unset($spec['version_normalized']);
  17266. $time = isset($spec['time']) ? $spec['time'] : null;
  17267. unset($spec['time']);
  17268. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  17269. $time = $this->getPackageTime($package) ?: $time;
  17270. }
  17271. if (null !== $time) {
  17272. $spec['time'] = $time;
  17273. }
  17274. unset($spec['installation-source']);
  17275. $locked[] = $spec;
  17276. }
  17277. usort($locked, function ($a, $b) {
  17278. $comparison = strcmp($a['name'], $b['name']);
  17279. if (0 !== $comparison) {
  17280. return $comparison;
  17281. }
  17282. return strcmp($a['version'], $b['version']);
  17283. });
  17284. return $locked;
  17285. }
  17286. private function getPackageTime(PackageInterface $package)
  17287. {
  17288. if (!function_exists('proc_open')) {
  17289. return null;
  17290. }
  17291. $path = realpath($this->installationManager->getInstallPath($package));
  17292. $sourceType = $package->getSourceType();
  17293. $datetime = null;
  17294. if ($path && in_array($sourceType, array('git', 'hg'))) {
  17295. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  17296. switch ($sourceType) {
  17297. case 'git':
  17298. GitUtil::cleanEnv();
  17299. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  17300. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  17301. }
  17302. break;
  17303. case 'hg':
  17304. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  17305. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  17306. }
  17307. break;
  17308. }
  17309. }
  17310. return $datetime ? $datetime->format('Y-m-d H:i:s') : null;
  17311. }
  17312. }
  17313. <?php
  17314. namespace Composer\Package;
  17315. use Composer\Package\Version\VersionParser;
  17316. use Composer\Util\ComposerMirror;
  17317. class Package extends BasePackage
  17318. {
  17319. protected $type;
  17320. protected $targetDir;
  17321. protected $installationSource;
  17322. protected $sourceType;
  17323. protected $sourceUrl;
  17324. protected $sourceReference;
  17325. protected $sourceMirrors;
  17326. protected $distType;
  17327. protected $distUrl;
  17328. protected $distReference;
  17329. protected $distSha1Checksum;
  17330. protected $distMirrors;
  17331. protected $version;
  17332. protected $prettyVersion;
  17333. protected $releaseDate;
  17334. protected $extra = array();
  17335. protected $binaries = array();
  17336. protected $dev;
  17337. protected $stability;
  17338. protected $notificationUrl;
  17339. protected $requires = array();
  17340. protected $conflicts = array();
  17341. protected $provides = array();
  17342. protected $replaces = array();
  17343. protected $devRequires = array();
  17344. protected $suggests = array();
  17345. protected $autoload = array();
  17346. protected $devAutoload = array();
  17347. protected $includePaths = array();
  17348. protected $archiveExcludes = array();
  17349. public function __construct($name, $version, $prettyVersion)
  17350. {
  17351. parent::__construct($name);
  17352. $this->version = $version;
  17353. $this->prettyVersion = $prettyVersion;
  17354. $this->stability = VersionParser::parseStability($version);
  17355. $this->dev = $this->stability === 'dev';
  17356. }
  17357. public function isDev()
  17358. {
  17359. return $this->dev;
  17360. }
  17361. public function setType($type)
  17362. {
  17363. $this->type = $type;
  17364. }
  17365. public function getType()
  17366. {
  17367. return $this->type ?: 'library';
  17368. }
  17369. public function getStability()
  17370. {
  17371. return $this->stability;
  17372. }
  17373. public function setTargetDir($targetDir)
  17374. {
  17375. $this->targetDir = $targetDir;
  17376. }
  17377. public function getTargetDir()
  17378. {
  17379. if (null === $this->targetDir) {
  17380. return;
  17381. }
  17382. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  17383. }
  17384. public function setExtra(array $extra)
  17385. {
  17386. $this->extra = $extra;
  17387. }
  17388. public function getExtra()
  17389. {
  17390. return $this->extra;
  17391. }
  17392. public function setBinaries(array $binaries)
  17393. {
  17394. $this->binaries = $binaries;
  17395. }
  17396. public function getBinaries()
  17397. {
  17398. return $this->binaries;
  17399. }
  17400. public function setInstallationSource($type)
  17401. {
  17402. $this->installationSource = $type;
  17403. }
  17404. public function getInstallationSource()
  17405. {
  17406. return $this->installationSource;
  17407. }
  17408. public function setSourceType($type)
  17409. {
  17410. $this->sourceType = $type;
  17411. }
  17412. public function getSourceType()
  17413. {
  17414. return $this->sourceType;
  17415. }
  17416. public function setSourceUrl($url)
  17417. {
  17418. $this->sourceUrl = $url;
  17419. }
  17420. public function getSourceUrl()
  17421. {
  17422. return $this->sourceUrl;
  17423. }
  17424. public function setSourceReference($reference)
  17425. {
  17426. $this->sourceReference = $reference;
  17427. }
  17428. public function getSourceReference()
  17429. {
  17430. return $this->sourceReference;
  17431. }
  17432. public function setSourceMirrors($mirrors)
  17433. {
  17434. $this->sourceMirrors = $mirrors;
  17435. }
  17436. public function getSourceMirrors()
  17437. {
  17438. return $this->sourceMirrors;
  17439. }
  17440. public function getSourceUrls()
  17441. {
  17442. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  17443. }
  17444. public function setDistType($type)
  17445. {
  17446. $this->distType = $type;
  17447. }
  17448. public function getDistType()
  17449. {
  17450. return $this->distType;
  17451. }
  17452. public function setDistUrl($url)
  17453. {
  17454. $this->distUrl = $url;
  17455. }
  17456. public function getDistUrl()
  17457. {
  17458. return $this->distUrl;
  17459. }
  17460. public function setDistReference($reference)
  17461. {
  17462. $this->distReference = $reference;
  17463. }
  17464. public function getDistReference()
  17465. {
  17466. return $this->distReference;
  17467. }
  17468. public function setDistSha1Checksum($sha1checksum)
  17469. {
  17470. $this->distSha1Checksum = $sha1checksum;
  17471. }
  17472. public function getDistSha1Checksum()
  17473. {
  17474. return $this->distSha1Checksum;
  17475. }
  17476. public function setDistMirrors($mirrors)
  17477. {
  17478. $this->distMirrors = $mirrors;
  17479. }
  17480. public function getDistMirrors()
  17481. {
  17482. return $this->distMirrors;
  17483. }
  17484. public function getDistUrls()
  17485. {
  17486. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  17487. }
  17488. public function getVersion()
  17489. {
  17490. return $this->version;
  17491. }
  17492. public function getPrettyVersion()
  17493. {
  17494. return $this->prettyVersion;
  17495. }
  17496. public function setReleaseDate(\DateTime $releaseDate)
  17497. {
  17498. $this->releaseDate = $releaseDate;
  17499. }
  17500. public function getReleaseDate()
  17501. {
  17502. return $this->releaseDate;
  17503. }
  17504. public function setRequires(array $requires)
  17505. {
  17506. $this->requires = $requires;
  17507. }
  17508. public function getRequires()
  17509. {
  17510. return $this->requires;
  17511. }
  17512. public function setConflicts(array $conflicts)
  17513. {
  17514. $this->conflicts = $conflicts;
  17515. }
  17516. public function getConflicts()
  17517. {
  17518. return $this->conflicts;
  17519. }
  17520. public function setProvides(array $provides)
  17521. {
  17522. $this->provides = $provides;
  17523. }
  17524. public function getProvides()
  17525. {
  17526. return $this->provides;
  17527. }
  17528. public function setReplaces(array $replaces)
  17529. {
  17530. $this->replaces = $replaces;
  17531. }
  17532. public function getReplaces()
  17533. {
  17534. return $this->replaces;
  17535. }
  17536. public function setDevRequires(array $devRequires)
  17537. {
  17538. $this->devRequires = $devRequires;
  17539. }
  17540. public function getDevRequires()
  17541. {
  17542. return $this->devRequires;
  17543. }
  17544. public function setSuggests(array $suggests)
  17545. {
  17546. $this->suggests = $suggests;
  17547. }
  17548. public function getSuggests()
  17549. {
  17550. return $this->suggests;
  17551. }
  17552. public function setAutoload(array $autoload)
  17553. {
  17554. $this->autoload = $autoload;
  17555. }
  17556. public function getAutoload()
  17557. {
  17558. return $this->autoload;
  17559. }
  17560. public function setDevAutoload(array $devAutoload)
  17561. {
  17562. $this->devAutoload = $devAutoload;
  17563. }
  17564. public function getDevAutoload()
  17565. {
  17566. return $this->devAutoload;
  17567. }
  17568. public function setIncludePaths(array $includePaths)
  17569. {
  17570. $this->includePaths = $includePaths;
  17571. }
  17572. public function getIncludePaths()
  17573. {
  17574. return $this->includePaths;
  17575. }
  17576. public function setNotificationUrl($notificationUrl)
  17577. {
  17578. $this->notificationUrl = $notificationUrl;
  17579. }
  17580. public function getNotificationUrl()
  17581. {
  17582. return $this->notificationUrl;
  17583. }
  17584. public function setArchiveExcludes(array $excludes)
  17585. {
  17586. $this->archiveExcludes = $excludes;
  17587. }
  17588. public function getArchiveExcludes()
  17589. {
  17590. return $this->archiveExcludes;
  17591. }
  17592. public function replaceVersion($version, $prettyVersion)
  17593. {
  17594. $this->version = $version;
  17595. $this->prettyVersion = $prettyVersion;
  17596. $this->stability = VersionParser::parseStability($version);
  17597. $this->dev = $this->stability === 'dev';
  17598. }
  17599. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  17600. {
  17601. if (!$url) {
  17602. return array();
  17603. }
  17604. $urls = array($url);
  17605. if ($mirrors) {
  17606. foreach ($mirrors as $mirror) {
  17607. if ($urlType === 'dist') {
  17608. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  17609. } elseif ($urlType === 'source' && $type === 'git') {
  17610. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  17611. } elseif ($urlType === 'source' && $type === 'hg') {
  17612. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  17613. }
  17614. if (!in_array($mirrorUrl, $urls)) {
  17615. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  17616. $func($urls, $mirrorUrl);
  17617. }
  17618. }
  17619. }
  17620. return $urls;
  17621. }
  17622. }
  17623. <?php
  17624. namespace Composer\Package;
  17625. use Composer\Repository\RepositoryInterface;
  17626. interface PackageInterface
  17627. {
  17628. public function getName();
  17629. public function getPrettyName();
  17630. public function getNames();
  17631. public function setId($id);
  17632. public function getId();
  17633. public function isDev();
  17634. public function getType();
  17635. public function getTargetDir();
  17636. public function getExtra();
  17637. public function setInstallationSource($type);
  17638. public function getInstallationSource();
  17639. public function getSourceType();
  17640. public function getSourceUrl();
  17641. public function getSourceUrls();
  17642. public function getSourceReference();
  17643. public function getSourceMirrors();
  17644. public function getDistType();
  17645. public function getDistUrl();
  17646. public function getDistUrls();
  17647. public function getDistReference();
  17648. public function getDistSha1Checksum();
  17649. public function getDistMirrors();
  17650. public function getVersion();
  17651. public function getPrettyVersion();
  17652. public function getFullPrettyVersion($truncate = true);
  17653. public function getReleaseDate();
  17654. public function getStability();
  17655. public function getRequires();
  17656. public function getConflicts();
  17657. public function getProvides();
  17658. public function getReplaces();
  17659. public function getDevRequires();
  17660. public function getSuggests();
  17661. public function getAutoload();
  17662. public function getDevAutoload();
  17663. public function getIncludePaths();
  17664. public function setRepository(RepositoryInterface $repository);
  17665. public function getRepository();
  17666. public function getBinaries();
  17667. public function getUniqueName();
  17668. public function getNotificationUrl();
  17669. public function __toString();
  17670. public function getPrettyString();
  17671. public function getArchiveExcludes();
  17672. public function getTransportOptions();
  17673. }
  17674. <?php
  17675. namespace Composer\Package;
  17676. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  17677. {
  17678. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  17679. {
  17680. parent::__construct($aliasOf, $version, $prettyVersion);
  17681. }
  17682. public function getAliases()
  17683. {
  17684. return $this->aliasOf->getAliases();
  17685. }
  17686. public function getMinimumStability()
  17687. {
  17688. return $this->aliasOf->getMinimumStability();
  17689. }
  17690. public function getStabilityFlags()
  17691. {
  17692. return $this->aliasOf->getStabilityFlags();
  17693. }
  17694. public function getReferences()
  17695. {
  17696. return $this->aliasOf->getReferences();
  17697. }
  17698. public function getPreferStable()
  17699. {
  17700. return $this->aliasOf->getPreferStable();
  17701. }
  17702. public function getConfig()
  17703. {
  17704. return $this->aliasOf->getConfig();
  17705. }
  17706. public function setRequires(array $require)
  17707. {
  17708. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  17709. $this->aliasOf->setRequires($require);
  17710. }
  17711. public function setDevRequires(array $devRequire)
  17712. {
  17713. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  17714. $this->aliasOf->setDevRequires($devRequire);
  17715. }
  17716. public function setConflicts(array $conflicts)
  17717. {
  17718. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  17719. $this->aliasOf->setConflicts($conflicts);
  17720. }
  17721. public function setProvides(array $provides)
  17722. {
  17723. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  17724. $this->aliasOf->setProvides($provides);
  17725. }
  17726. public function setReplaces(array $replaces)
  17727. {
  17728. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  17729. $this->aliasOf->setReplaces($replaces);
  17730. }
  17731. public function setRepositories($repositories)
  17732. {
  17733. $this->aliasOf->setRepositories($repositories);
  17734. }
  17735. public function setAutoload(array $autoload)
  17736. {
  17737. $this->aliasOf->setAutoload($autoload);
  17738. }
  17739. public function setDevAutoload(array $devAutoload)
  17740. {
  17741. $this->aliasOf->setDevAutoload($devAutoload);
  17742. }
  17743. public function setStabilityFlags(array $stabilityFlags)
  17744. {
  17745. $this->aliasOf->setStabilityFlags($stabilityFlags);
  17746. }
  17747. public function setSuggests(array $suggests)
  17748. {
  17749. $this->aliasOf->setSuggests($suggests);
  17750. }
  17751. public function setExtra(array $extra)
  17752. {
  17753. $this->aliasOf->setExtra($extra);
  17754. }
  17755. public function __clone()
  17756. {
  17757. parent::__clone();
  17758. $this->aliasOf = clone $this->aliasOf;
  17759. }
  17760. }
  17761. <?php
  17762. namespace Composer\Package;
  17763. class RootPackage extends CompletePackage implements RootPackageInterface
  17764. {
  17765. protected $minimumStability = 'stable';
  17766. protected $preferStable = false;
  17767. protected $stabilityFlags = array();
  17768. protected $config = array();
  17769. protected $references = array();
  17770. protected $aliases = array();
  17771. public function setMinimumStability($minimumStability)
  17772. {
  17773. $this->minimumStability = $minimumStability;
  17774. }
  17775. public function getMinimumStability()
  17776. {
  17777. return $this->minimumStability;
  17778. }
  17779. public function setStabilityFlags(array $stabilityFlags)
  17780. {
  17781. $this->stabilityFlags = $stabilityFlags;
  17782. }
  17783. public function getStabilityFlags()
  17784. {
  17785. return $this->stabilityFlags;
  17786. }
  17787. public function setPreferStable($preferStable)
  17788. {
  17789. $this->preferStable = $preferStable;
  17790. }
  17791. public function getPreferStable()
  17792. {
  17793. return $this->preferStable;
  17794. }
  17795. public function setConfig(array $config)
  17796. {
  17797. $this->config = $config;
  17798. }
  17799. public function getConfig()
  17800. {
  17801. return $this->config;
  17802. }
  17803. public function setReferences(array $references)
  17804. {
  17805. $this->references = $references;
  17806. }
  17807. public function getReferences()
  17808. {
  17809. return $this->references;
  17810. }
  17811. public function setAliases(array $aliases)
  17812. {
  17813. $this->aliases = $aliases;
  17814. }
  17815. public function getAliases()
  17816. {
  17817. return $this->aliases;
  17818. }
  17819. }
  17820. <?php
  17821. namespace Composer\Package;
  17822. interface RootPackageInterface extends CompletePackageInterface
  17823. {
  17824. public function getAliases();
  17825. public function getMinimumStability();
  17826. public function getStabilityFlags();
  17827. public function getReferences();
  17828. public function getPreferStable();
  17829. public function getConfig();
  17830. public function setRequires(array $requires);
  17831. public function setDevRequires(array $devRequires);
  17832. public function setConflicts(array $conflicts);
  17833. public function setProvides(array $provides);
  17834. public function setReplaces(array $replaces);
  17835. public function setRepositories($repositories);
  17836. public function setAutoload(array $autoload);
  17837. public function setDevAutoload(array $devAutoload);
  17838. public function setStabilityFlags(array $stabilityFlags);
  17839. public function setSuggests(array $suggests);
  17840. public function setExtra(array $extra);
  17841. }
  17842. <?php
  17843. namespace Composer\Package\Version;
  17844. use Composer\Config;
  17845. use Composer\Repository\Vcs\HgDriver;
  17846. use Composer\IO\NullIO;
  17847. use Composer\Semver\VersionParser as SemverVersionParser;
  17848. use Composer\Util\Git as GitUtil;
  17849. use Composer\Util\ProcessExecutor;
  17850. use Composer\Util\Svn as SvnUtil;
  17851. class VersionGuesser
  17852. {
  17853. private $config;
  17854. private $process;
  17855. private $versionParser;
  17856. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  17857. {
  17858. $this->config = $config;
  17859. $this->process = $process;
  17860. $this->versionParser = $versionParser;
  17861. }
  17862. public function guessVersion(array $packageConfig, $path)
  17863. {
  17864. if (function_exists('proc_open')) {
  17865. $versionData = $this->guessGitVersion($packageConfig, $path);
  17866. if (null !== $versionData && null !== $versionData['version']) {
  17867. return $versionData;
  17868. }
  17869. $versionData = $this->guessHgVersion($packageConfig, $path);
  17870. if (null !== $versionData && null !== $versionData['version']) {
  17871. return $versionData;
  17872. }
  17873. $versionData = $this->guessFossilVersion($packageConfig, $path);
  17874. if (null !== $versionData && null !== $versionData['version']) {
  17875. return $versionData;
  17876. }
  17877. return $this->guessSvnVersion($packageConfig, $path);
  17878. }
  17879. }
  17880. private function guessGitVersion(array $packageConfig, $path)
  17881. {
  17882. GitUtil::cleanEnv();
  17883. $commit = null;
  17884. $version = null;
  17885. $prettyVersion = null;
  17886. $isDetached = false;
  17887. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  17888. $branches = array();
  17889. $isFeatureBranch = false;
  17890. foreach ($this->process->splitLines($output) as $branch) {
  17891. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at FETCH_HEAD\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  17892. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  17893. $version = 'dev-' . $match[2];
  17894. $prettyVersion = $version;
  17895. $isFeatureBranch = true;
  17896. $isDetached = true;
  17897. } else {
  17898. $version = $this->versionParser->normalizeBranch($match[1]);
  17899. $prettyVersion = 'dev-' . $match[1];
  17900. $isFeatureBranch = 0 === strpos($version, 'dev-');
  17901. if ('9999999-dev' === $version) {
  17902. $version = $prettyVersion;
  17903. }
  17904. }
  17905. if ($match[2]) {
  17906. $commit = $match[2];
  17907. }
  17908. }
  17909. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  17910. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  17911. $branches[] = $match[1];
  17912. }
  17913. }
  17914. }
  17915. if ($isFeatureBranch) {
  17916. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  17917. $version = $result['version'];
  17918. $prettyVersion = $result['pretty_version'];
  17919. }
  17920. }
  17921. if (!$version || $isDetached) {
  17922. $result = $this->versionFromGitTags($path);
  17923. if ($result) {
  17924. $version = $result['version'];
  17925. $prettyVersion = $result['pretty_version'];
  17926. }
  17927. }
  17928. if (!$commit) {
  17929. $command = 'git log --pretty="%H" -n1 HEAD';
  17930. if (0 === $this->process->execute($command, $output, $path)) {
  17931. $commit = trim($output) ?: null;
  17932. }
  17933. }
  17934. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  17935. }
  17936. private function versionFromGitTags($path)
  17937. {
  17938. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  17939. try {
  17940. $version = $this->versionParser->normalize(trim($output));
  17941. return array('version' => $version, 'pretty_version' => trim($output));
  17942. } catch (\Exception $e) {
  17943. }
  17944. }
  17945. return null;
  17946. }
  17947. private function guessHgVersion(array $packageConfig, $path)
  17948. {
  17949. if (0 === $this->process->execute('hg branch', $output, $path)) {
  17950. $branch = trim($output);
  17951. $version = $this->versionParser->normalizeBranch($branch);
  17952. $isFeatureBranch = 0 === strpos($version, 'dev-');
  17953. if ('9999999-dev' === $version) {
  17954. $version = 'dev-' . $branch;
  17955. }
  17956. if (!$isFeatureBranch) {
  17957. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  17958. }
  17959. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  17960. $branches = array_keys($driver->getBranches());
  17961. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  17962. $result['commit'] = '';
  17963. return $result;
  17964. }
  17965. }
  17966. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  17967. {
  17968. $prettyVersion = $version;
  17969. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  17970. || strpos(json_encode($packageConfig), '"self.version"')
  17971. ) {
  17972. $branch = preg_replace('{^dev-}', '', $version);
  17973. $length = PHP_INT_MAX;
  17974. $nonFeatureBranches = '';
  17975. if (!empty($packageConfig['non-feature-branches'])) {
  17976. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  17977. }
  17978. foreach ($branches as $candidate) {
  17979. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  17980. break;
  17981. }
  17982. if ($candidate === $branch || !preg_match('{^(master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  17983. continue;
  17984. }
  17985. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  17986. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  17987. continue;
  17988. }
  17989. if (strlen($output) < $length) {
  17990. $length = strlen($output);
  17991. $version = $this->versionParser->normalizeBranch($candidate);
  17992. $prettyVersion = 'dev-' . $match[1];
  17993. if ('9999999-dev' === $version) {
  17994. $version = $prettyVersion;
  17995. }
  17996. }
  17997. }
  17998. }
  17999. return array('version' => $version, 'pretty_version' => $prettyVersion);
  18000. }
  18001. private function guessFossilVersion(array $packageConfig, $path)
  18002. {
  18003. $version = null;
  18004. $prettyVersion = null;
  18005. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  18006. $branch = trim($output);
  18007. $version = $this->versionParser->normalizeBranch($branch);
  18008. $prettyVersion = 'dev-' . $branch;
  18009. if ('9999999-dev' === $version) {
  18010. $version = $prettyVersion;
  18011. }
  18012. }
  18013. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  18014. try {
  18015. $version = $this->versionParser->normalize(trim($output));
  18016. $prettyVersion = trim($output);
  18017. } catch (\Exception $e) {
  18018. }
  18019. }
  18020. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18021. }
  18022. private function guessSvnVersion(array $packageConfig, $path)
  18023. {
  18024. SvnUtil::cleanEnv();
  18025. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  18026. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  18027. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  18028. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  18029. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  18030. if (preg_match($urlPattern, $output, $matches)) {
  18031. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  18032. $version = $this->versionParser->normalizeBranch($matches[3]);
  18033. $prettyVersion = 'dev-' . $matches[3];
  18034. if ('9999999-dev' === $version) {
  18035. $version = $prettyVersion;
  18036. }
  18037. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18038. }
  18039. $prettyVersion = trim($matches[1]);
  18040. $version = $this->versionParser->normalize($prettyVersion);
  18041. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18042. }
  18043. }
  18044. }
  18045. }
  18046. <?php
  18047. namespace Composer\Package\Version;
  18048. use Composer\Semver\VersionParser as SemverVersionParser;
  18049. class VersionParser extends SemverVersionParser
  18050. {
  18051. private static $constraints = array();
  18052. public function parseConstraints($constraints)
  18053. {
  18054. if (!isset(self::$constraints[$constraints])) {
  18055. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  18056. }
  18057. return self::$constraints[$constraints];
  18058. }
  18059. public function parseNameVersionPairs(array $pairs)
  18060. {
  18061. $pairs = array_values($pairs);
  18062. $result = array();
  18063. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  18064. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  18065. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/')) {
  18066. $pair .= ' '.$pairs[$i + 1];
  18067. $i++;
  18068. }
  18069. if (strpos($pair, ' ')) {
  18070. list($name, $version) = explode(" ", $pair, 2);
  18071. $result[] = array('name' => $name, 'version' => $version);
  18072. } else {
  18073. $result[] = array('name' => $pair);
  18074. }
  18075. }
  18076. return $result;
  18077. }
  18078. }
  18079. <?php
  18080. namespace Composer\Package\Version;
  18081. use Composer\DependencyResolver\Pool;
  18082. use Composer\Package\BasePackage;
  18083. use Composer\Package\PackageInterface;
  18084. use Composer\Package\Loader\ArrayLoader;
  18085. use Composer\Package\Dumper\ArrayDumper;
  18086. use Composer\Semver\Constraint\Constraint;
  18087. class VersionSelector
  18088. {
  18089. private $pool;
  18090. private $parser;
  18091. public function __construct(Pool $pool)
  18092. {
  18093. $this->pool = $pool;
  18094. }
  18095. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  18096. {
  18097. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  18098. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  18099. if ($targetPhpVersion) {
  18100. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  18101. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  18102. $reqs = $pkg->getRequires();
  18103. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  18104. });
  18105. }
  18106. if (!$candidates) {
  18107. return false;
  18108. }
  18109. $package = reset($candidates);
  18110. $minPriority = BasePackage::$stabilities[$preferredStability];
  18111. foreach ($candidates as $candidate) {
  18112. $candidatePriority = $candidate->getStabilityPriority();
  18113. $currentPriority = $package->getStabilityPriority();
  18114. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  18115. continue;
  18116. }
  18117. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  18118. $package = $candidate;
  18119. continue;
  18120. }
  18121. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  18122. $package = $candidate;
  18123. continue;
  18124. }
  18125. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  18126. $package = $candidate;
  18127. }
  18128. }
  18129. return $package;
  18130. }
  18131. public function findRecommendedRequireVersion(PackageInterface $package)
  18132. {
  18133. $version = $package->getVersion();
  18134. if (!$package->isDev()) {
  18135. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  18136. }
  18137. $loader = new ArrayLoader($this->getParser());
  18138. $dumper = new ArrayDumper();
  18139. $extra = $loader->getBranchAlias($dumper->dump($package));
  18140. if ($extra) {
  18141. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  18142. if ($count) {
  18143. $extra = str_replace('.9999999', '.0', $extra);
  18144. return $this->transformVersion($extra, $extra, 'dev');
  18145. }
  18146. }
  18147. return $package->getPrettyVersion();
  18148. }
  18149. private function transformVersion($version, $prettyVersion, $stability)
  18150. {
  18151. $semanticVersionParts = explode('.', $version);
  18152. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  18153. if ($semanticVersionParts[0] === '0') {
  18154. unset($semanticVersionParts[3]);
  18155. } else {
  18156. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  18157. }
  18158. $version = implode('.', $semanticVersionParts);
  18159. } else {
  18160. return $prettyVersion;
  18161. }
  18162. if ($stability != 'stable') {
  18163. $version .= '@'.$stability;
  18164. }
  18165. return '^' . $version;
  18166. }
  18167. private function getParser()
  18168. {
  18169. if ($this->parser === null) {
  18170. $this->parser = new VersionParser();
  18171. }
  18172. return $this->parser;
  18173. }
  18174. }
  18175. <?php
  18176. namespace Composer\Plugin\Capability;
  18177. interface Capability
  18178. {
  18179. }
  18180. <?php
  18181. namespace Composer\Plugin\Capability;
  18182. interface CommandProvider extends Capability
  18183. {
  18184. public function getCommands();
  18185. }
  18186. <?php
  18187. namespace Composer\Plugin;
  18188. interface Capable
  18189. {
  18190. public function getCapabilities();
  18191. }
  18192. <?php
  18193. namespace Composer\Plugin;
  18194. use Composer\EventDispatcher\Event;
  18195. use Symfony\Component\Console\Input\InputInterface;
  18196. use Symfony\Component\Console\Output\OutputInterface;
  18197. class CommandEvent extends Event
  18198. {
  18199. private $commandName;
  18200. private $input;
  18201. private $output;
  18202. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  18203. {
  18204. parent::__construct($name, $args, $flags);
  18205. $this->commandName = $commandName;
  18206. $this->input = $input;
  18207. $this->output = $output;
  18208. }
  18209. public function getInput()
  18210. {
  18211. return $this->input;
  18212. }
  18213. public function getOutput()
  18214. {
  18215. return $this->output;
  18216. }
  18217. public function getCommandName()
  18218. {
  18219. return $this->commandName;
  18220. }
  18221. }
  18222. <?php
  18223. namespace Composer\Plugin;
  18224. class PluginEvents
  18225. {
  18226. const INIT = 'init';
  18227. const COMMAND = 'command';
  18228. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  18229. }
  18230. <?php
  18231. namespace Composer\Plugin;
  18232. use Composer\Composer;
  18233. use Composer\IO\IOInterface;
  18234. interface PluginInterface
  18235. {
  18236. const PLUGIN_API_VERSION = '1.1.0';
  18237. public function activate(Composer $composer, IOInterface $io);
  18238. }
  18239. <?php
  18240. namespace Composer\Plugin;
  18241. use Composer\Composer;
  18242. use Composer\EventDispatcher\EventSubscriberInterface;
  18243. use Composer\IO\IOInterface;
  18244. use Composer\Package\Package;
  18245. use Composer\Package\Version\VersionParser;
  18246. use Composer\Repository\RepositoryInterface;
  18247. use Composer\Package\AliasPackage;
  18248. use Composer\Package\PackageInterface;
  18249. use Composer\Package\Link;
  18250. use Composer\Semver\Constraint\Constraint;
  18251. use Composer\DependencyResolver\Pool;
  18252. use Composer\Plugin\Capability\Capability;
  18253. class PluginManager
  18254. {
  18255. protected $composer;
  18256. protected $io;
  18257. protected $globalComposer;
  18258. protected $versionParser;
  18259. protected $disablePlugins = false;
  18260. protected $plugins = array();
  18261. protected $registeredPlugins = array();
  18262. private static $classCounter = 0;
  18263. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  18264. {
  18265. $this->io = $io;
  18266. $this->composer = $composer;
  18267. $this->globalComposer = $globalComposer;
  18268. $this->versionParser = new VersionParser();
  18269. $this->disablePlugins = $disablePlugins;
  18270. }
  18271. public function loadInstalledPlugins()
  18272. {
  18273. if ($this->disablePlugins) {
  18274. return;
  18275. }
  18276. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  18277. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18278. if ($repo) {
  18279. $this->loadRepository($repo);
  18280. }
  18281. if ($globalRepo) {
  18282. $this->loadRepository($globalRepo);
  18283. }
  18284. }
  18285. public function getPlugins()
  18286. {
  18287. return $this->plugins;
  18288. }
  18289. public function getGlobalComposer()
  18290. {
  18291. return $this->globalComposer;
  18292. }
  18293. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  18294. {
  18295. if ($this->disablePlugins) {
  18296. return;
  18297. }
  18298. if ($package->getType() === 'composer-plugin') {
  18299. $requiresComposer = null;
  18300. foreach ($package->getRequires() as $link) {
  18301. if ('composer-plugin-api' === $link->getTarget()) {
  18302. $requiresComposer = $link->getConstraint();
  18303. break;
  18304. }
  18305. }
  18306. if (!$requiresComposer) {
  18307. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  18308. }
  18309. $currentPluginApiVersion = $this->getPluginApiVersion();
  18310. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  18311. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  18312. $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>');
  18313. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  18314. $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>');
  18315. return;
  18316. }
  18317. }
  18318. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  18319. if (in_array($package->getName(), $this->registeredPlugins)) {
  18320. return;
  18321. }
  18322. $extra = $package->getExtra();
  18323. if (empty($extra['class'])) {
  18324. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  18325. }
  18326. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  18327. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  18328. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18329. $pool = new Pool('dev');
  18330. $pool->addRepository($localRepo);
  18331. if ($globalRepo) {
  18332. $pool->addRepository($globalRepo);
  18333. }
  18334. $autoloadPackages = array($package->getName() => $package);
  18335. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  18336. $generator = $this->composer->getAutoloadGenerator();
  18337. $autoloads = array();
  18338. foreach ($autoloadPackages as $autoloadPackage) {
  18339. $downloadPath = $this->getInstallPath($autoloadPackage, ($globalRepo && $globalRepo->hasPackage($autoloadPackage)));
  18340. $autoloads[] = array($autoloadPackage, $downloadPath);
  18341. }
  18342. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  18343. $classLoader = $generator->createLoader($map);
  18344. $classLoader->register();
  18345. foreach ($classes as $class) {
  18346. if (class_exists($class, false)) {
  18347. $class = trim($class, '\\');
  18348. $path = $classLoader->findFile($class);
  18349. $code = file_get_contents($path);
  18350. $separatorPos = strrpos($class, '\\');
  18351. $className = $class;
  18352. if ($separatorPos) {
  18353. $className = substr($class, $separatorPos + 1);
  18354. }
  18355. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  18356. $code = str_replace('__FILE__', var_export($path, true), $code);
  18357. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  18358. $code = str_replace('__CLASS__', var_export($class, true), $code);
  18359. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  18360. eval($code);
  18361. $class .= '_composer_tmp'.self::$classCounter;
  18362. self::$classCounter++;
  18363. }
  18364. if ($oldInstallerPlugin) {
  18365. $installer = new $class($this->io, $this->composer);
  18366. $this->composer->getInstallationManager()->addInstaller($installer);
  18367. } elseif (class_exists($class)) {
  18368. $plugin = new $class();
  18369. $this->addPlugin($plugin);
  18370. $this->registeredPlugins[] = $package->getName();
  18371. } elseif ($failOnMissingClasses) {
  18372. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  18373. }
  18374. }
  18375. }
  18376. protected function getPluginApiVersion()
  18377. {
  18378. return PluginInterface::PLUGIN_API_VERSION;
  18379. }
  18380. public function addPlugin(PluginInterface $plugin)
  18381. {
  18382. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  18383. $this->plugins[] = $plugin;
  18384. $plugin->activate($this->composer, $this->io);
  18385. if ($plugin instanceof EventSubscriberInterface) {
  18386. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  18387. }
  18388. }
  18389. private function loadRepository(RepositoryInterface $repo)
  18390. {
  18391. foreach ($repo->getPackages() as $package) {
  18392. if ($package instanceof AliasPackage) {
  18393. continue;
  18394. }
  18395. if ('composer-plugin' === $package->getType()) {
  18396. $this->registerPackage($package);
  18397. } elseif ('composer-installer' === $package->getType()) {
  18398. $this->registerPackage($package);
  18399. }
  18400. }
  18401. }
  18402. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  18403. {
  18404. $requires = array_merge(
  18405. $package->getRequires(),
  18406. $package->getDevRequires()
  18407. );
  18408. foreach ($requires as $requireLink) {
  18409. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  18410. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  18411. $collected[$requiredPackage->getName()] = $requiredPackage;
  18412. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  18413. }
  18414. }
  18415. return $collected;
  18416. }
  18417. private function lookupInstalledPackage(Pool $pool, Link $link)
  18418. {
  18419. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  18420. return (!empty($packages)) ? $packages[0] : null;
  18421. }
  18422. private function getInstallPath(PackageInterface $package, $global = false)
  18423. {
  18424. if (!$global) {
  18425. return $this->composer->getInstallationManager()->getInstallPath($package);
  18426. }
  18427. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  18428. }
  18429. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  18430. {
  18431. if (!($plugin instanceof Capable)) {
  18432. return null;
  18433. }
  18434. $capabilities = (array) $plugin->getCapabilities();
  18435. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  18436. return trim($capabilities[$capability]);
  18437. }
  18438. if (
  18439. array_key_exists($capability, $capabilities)
  18440. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  18441. ) {
  18442. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  18443. }
  18444. }
  18445. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  18446. {
  18447. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  18448. if (!class_exists($capabilityClass)) {
  18449. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  18450. }
  18451. $ctorArgs['plugin'] = $plugin;
  18452. $capabilityObj = new $capabilityClass($ctorArgs);
  18453. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  18454. throw new \RuntimeException(
  18455. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  18456. );
  18457. }
  18458. return $capabilityObj;
  18459. }
  18460. }
  18461. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  18462. {
  18463. $capabilities = array();
  18464. foreach ($this->getPlugins() as $plugin) {
  18465. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  18466. $capabilities[] = $capability;
  18467. }
  18468. }
  18469. return $capabilities;
  18470. }
  18471. }
  18472. <?php
  18473. namespace Composer\Plugin;
  18474. use Composer\EventDispatcher\Event;
  18475. use Composer\Util\RemoteFilesystem;
  18476. class PreFileDownloadEvent extends Event
  18477. {
  18478. private $rfs;
  18479. private $processedUrl;
  18480. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  18481. {
  18482. parent::__construct($name);
  18483. $this->rfs = $rfs;
  18484. $this->processedUrl = $processedUrl;
  18485. }
  18486. public function getRemoteFilesystem()
  18487. {
  18488. return $this->rfs;
  18489. }
  18490. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  18491. {
  18492. $this->rfs = $rfs;
  18493. }
  18494. public function getProcessedUrl()
  18495. {
  18496. return $this->processedUrl;
  18497. }
  18498. }
  18499. <?php
  18500. namespace Composer\Question;
  18501. use Symfony\Component\Console\Exception\InvalidArgumentException;
  18502. use Symfony\Component\Console\Question\Question;
  18503. class StrictConfirmationQuestion extends Question
  18504. {
  18505. private $trueAnswerRegex;
  18506. private $falseAnswerRegex;
  18507. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  18508. {
  18509. parent::__construct($question, (bool) $default);
  18510. $this->trueAnswerRegex = $trueAnswerRegex;
  18511. $this->falseAnswerRegex = $falseAnswerRegex;
  18512. $this->setNormalizer($this->getDefaultNormalizer());
  18513. $this->setValidator($this->getDefaultValidator());
  18514. }
  18515. private function getDefaultNormalizer()
  18516. {
  18517. $default = $this->getDefault();
  18518. $trueRegex = $this->trueAnswerRegex;
  18519. $falseRegex = $this->falseAnswerRegex;
  18520. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  18521. if (is_bool($answer)) {
  18522. return $answer;
  18523. }
  18524. if (empty($answer) && !empty($default)) {
  18525. return $default;
  18526. }
  18527. if (preg_match($trueRegex, $answer)) {
  18528. return true;
  18529. }
  18530. if (preg_match($falseRegex, $answer)) {
  18531. return false;
  18532. }
  18533. return null;
  18534. };
  18535. }
  18536. private function getDefaultValidator()
  18537. {
  18538. return function ($answer) {
  18539. if (!is_bool($answer)) {
  18540. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  18541. }
  18542. return $answer;
  18543. };
  18544. }
  18545. }
  18546. <?php
  18547. namespace Composer\Repository;
  18548. use Composer\Package\AliasPackage;
  18549. use Composer\Package\PackageInterface;
  18550. use Composer\Package\CompletePackageInterface;
  18551. use Composer\Package\Version\VersionParser;
  18552. use Composer\Semver\Constraint\ConstraintInterface;
  18553. use Composer\Semver\Constraint\Constraint;
  18554. class ArrayRepository extends BaseRepository
  18555. {
  18556. protected $packages;
  18557. public function __construct(array $packages = array())
  18558. {
  18559. foreach ($packages as $package) {
  18560. $this->addPackage($package);
  18561. }
  18562. }
  18563. public function findPackage($name, $constraint)
  18564. {
  18565. $name = strtolower($name);
  18566. if (!$constraint instanceof ConstraintInterface) {
  18567. $versionParser = new VersionParser();
  18568. $constraint = $versionParser->parseConstraints($constraint);
  18569. }
  18570. foreach ($this->getPackages() as $package) {
  18571. if ($name === $package->getName()) {
  18572. $pkgConstraint = new Constraint('==', $package->getVersion());
  18573. if ($constraint->matches($pkgConstraint)) {
  18574. return $package;
  18575. }
  18576. }
  18577. }
  18578. return null;
  18579. }
  18580. public function findPackages($name, $constraint = null)
  18581. {
  18582. $name = strtolower($name);
  18583. $packages = array();
  18584. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  18585. $versionParser = new VersionParser();
  18586. $constraint = $versionParser->parseConstraints($constraint);
  18587. }
  18588. foreach ($this->getPackages() as $package) {
  18589. if ($name === $package->getName()) {
  18590. $pkgConstraint = new Constraint('==', $package->getVersion());
  18591. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  18592. $packages[] = $package;
  18593. }
  18594. }
  18595. }
  18596. return $packages;
  18597. }
  18598. public function search($query, $mode = 0, $type = null)
  18599. {
  18600. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  18601. $matches = array();
  18602. foreach ($this->getPackages() as $package) {
  18603. $name = $package->getName();
  18604. if (isset($matches[$name])) {
  18605. continue;
  18606. }
  18607. if (preg_match($regex, $name)
  18608. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  18609. ) {
  18610. if (null !== $type && $package->getType() !== $type) {
  18611. continue;
  18612. }
  18613. $matches[$name] = array(
  18614. 'name' => $package->getPrettyName(),
  18615. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  18616. );
  18617. }
  18618. }
  18619. return array_values($matches);
  18620. }
  18621. public function hasPackage(PackageInterface $package)
  18622. {
  18623. $packageId = $package->getUniqueName();
  18624. foreach ($this->getPackages() as $repoPackage) {
  18625. if ($packageId === $repoPackage->getUniqueName()) {
  18626. return true;
  18627. }
  18628. }
  18629. return false;
  18630. }
  18631. public function addPackage(PackageInterface $package)
  18632. {
  18633. if (null === $this->packages) {
  18634. $this->initialize();
  18635. }
  18636. $package->setRepository($this);
  18637. $this->packages[] = $package;
  18638. if ($package instanceof AliasPackage) {
  18639. $aliasedPackage = $package->getAliasOf();
  18640. if (null === $aliasedPackage->getRepository()) {
  18641. $this->addPackage($aliasedPackage);
  18642. }
  18643. }
  18644. }
  18645. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  18646. {
  18647. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  18648. }
  18649. public function removePackage(PackageInterface $package)
  18650. {
  18651. $packageId = $package->getUniqueName();
  18652. foreach ($this->getPackages() as $key => $repoPackage) {
  18653. if ($packageId === $repoPackage->getUniqueName()) {
  18654. array_splice($this->packages, $key, 1);
  18655. return;
  18656. }
  18657. }
  18658. }
  18659. public function getPackages()
  18660. {
  18661. if (null === $this->packages) {
  18662. $this->initialize();
  18663. }
  18664. return $this->packages;
  18665. }
  18666. public function count()
  18667. {
  18668. return count($this->packages);
  18669. }
  18670. protected function initialize()
  18671. {
  18672. $this->packages = array();
  18673. }
  18674. }
  18675. <?php
  18676. namespace Composer\Repository;
  18677. use Composer\IO\IOInterface;
  18678. use Composer\Json\JsonFile;
  18679. use Composer\Package\Loader\ArrayLoader;
  18680. use Composer\Package\Loader\LoaderInterface;
  18681. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  18682. {
  18683. protected $loader;
  18684. protected $lookup;
  18685. protected $repoConfig;
  18686. private $io;
  18687. public function __construct(array $repoConfig, IOInterface $io)
  18688. {
  18689. parent::__construct();
  18690. if (!extension_loaded('zip')) {
  18691. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  18692. }
  18693. $this->loader = new ArrayLoader();
  18694. $this->lookup = $repoConfig['url'];
  18695. $this->io = $io;
  18696. $this->repoConfig = $repoConfig;
  18697. }
  18698. public function getRepoConfig()
  18699. {
  18700. return $this->repoConfig;
  18701. }
  18702. protected function initialize()
  18703. {
  18704. parent::initialize();
  18705. $this->scanDirectory($this->lookup);
  18706. }
  18707. private function scanDirectory($path)
  18708. {
  18709. $io = $this->io;
  18710. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  18711. $iterator = new \RecursiveIteratorIterator($directory);
  18712. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  18713. foreach ($regex as $file) {
  18714. if (!$file->isFile()) {
  18715. continue;
  18716. }
  18717. $package = $this->getComposerInformation($file);
  18718. if (!$package) {
  18719. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  18720. continue;
  18721. }
  18722. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  18723. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  18724. $this->addPackage($package);
  18725. }
  18726. }
  18727. private function locateFile(\ZipArchive $zip, $filename)
  18728. {
  18729. $indexOfShortestMatch = false;
  18730. $lengthOfShortestMatch = -1;
  18731. for ($i = 0; $i < $zip->numFiles; $i++) {
  18732. $stat = $zip->statIndex($i);
  18733. if (strcmp(basename($stat['name']), $filename) === 0) {
  18734. $directoryName = dirname($stat['name']);
  18735. if ($directoryName == '.') {
  18736. return $i;
  18737. }
  18738. if (strpos($directoryName, '\\') !== false ||
  18739. strpos($directoryName, '/') !== false) {
  18740. continue;
  18741. }
  18742. $length = strlen($stat['name']);
  18743. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  18744. $contents = $zip->getFromIndex($i);
  18745. if ($contents !== false) {
  18746. $indexOfShortestMatch = $i;
  18747. $lengthOfShortestMatch = $length;
  18748. }
  18749. }
  18750. }
  18751. }
  18752. return $indexOfShortestMatch;
  18753. }
  18754. private function getComposerInformation(\SplFileInfo $file)
  18755. {
  18756. $zip = new \ZipArchive();
  18757. $zip->open($file->getPathname());
  18758. if (0 == $zip->numFiles) {
  18759. return false;
  18760. }
  18761. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  18762. if (false === $foundFileIndex) {
  18763. return false;
  18764. }
  18765. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  18766. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  18767. $json = file_get_contents($composerFile);
  18768. $package = JsonFile::parseJson($json, $composerFile);
  18769. $package['dist'] = array(
  18770. 'type' => 'zip',
  18771. 'url' => strtr($file->getPathname(), '\\', '/'),
  18772. 'shasum' => sha1_file($file->getRealPath()),
  18773. );
  18774. try {
  18775. $package = $this->loader->load($package);
  18776. } catch (\UnexpectedValueException $e) {
  18777. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  18778. }
  18779. return $package;
  18780. }
  18781. }
  18782. <?php
  18783. namespace Composer\Repository;
  18784. use Composer\Package\RootPackageInterface;
  18785. use Composer\Semver\Constraint\ConstraintInterface;
  18786. use Composer\Semver\Constraint\Constraint;
  18787. use Composer\Package\Link;
  18788. abstract class BaseRepository implements RepositoryInterface
  18789. {
  18790. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  18791. {
  18792. $needles = (array) $needle;
  18793. $results = array();
  18794. if (null === $packagesFound) {
  18795. $packagesFound = $needles;
  18796. }
  18797. $rootPackage = null;
  18798. foreach ($this->getPackages() as $package) {
  18799. if ($package instanceof RootPackageInterface) {
  18800. $rootPackage = $package;
  18801. break;
  18802. }
  18803. }
  18804. foreach ($this->getPackages() as $package) {
  18805. $links = $package->getRequires();
  18806. $packagesInTree = $packagesFound;
  18807. if (!$invert) {
  18808. $links += $package->getReplaces();
  18809. }
  18810. if ($package instanceof RootPackageInterface) {
  18811. $links += $package->getDevRequires();
  18812. }
  18813. foreach ($links as $link) {
  18814. foreach ($needles as $needle) {
  18815. if ($link->getTarget() === $needle) {
  18816. if (is_null($constraint) || (($link->getConstraint()->matches($constraint) === !$invert))) {
  18817. if (in_array($link->getSource(), $packagesInTree)) {
  18818. $results[$link->getSource()] = array($package, $link, false);
  18819. continue;
  18820. }
  18821. $packagesInTree[] = $link->getSource();
  18822. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  18823. $results[$link->getSource()] = array($package, $link, $dependents);
  18824. }
  18825. }
  18826. }
  18827. }
  18828. if ($invert && in_array($package->getName(), $needles)) {
  18829. foreach ($package->getConflicts() as $link) {
  18830. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  18831. $version = new Constraint('=', $pkg->getVersion());
  18832. if ($link->getConstraint()->matches($version) === $invert) {
  18833. $results[] = array($package, $link, false);
  18834. }
  18835. }
  18836. }
  18837. }
  18838. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  18839. foreach ($package->getRequires() as $link) {
  18840. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  18841. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  18842. continue;
  18843. }
  18844. $platformPkg = $this->findPackage($link->getTarget(), '*');
  18845. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  18846. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  18847. continue;
  18848. }
  18849. foreach ($this->getPackages() as $pkg) {
  18850. if (!in_array($link->getTarget(), $pkg->getNames())) {
  18851. continue;
  18852. }
  18853. $version = new Constraint('=', $pkg->getVersion());
  18854. if (!$link->getConstraint()->matches($version)) {
  18855. if ($rootPackage) {
  18856. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  18857. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  18858. $results[] = array($package, $link, false);
  18859. $results[] = array($rootPackage, $rootReq, false);
  18860. continue 3;
  18861. }
  18862. }
  18863. $results[] = array($package, $link, false);
  18864. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  18865. } else {
  18866. $results[] = array($package, $link, false);
  18867. }
  18868. }
  18869. continue 2;
  18870. }
  18871. }
  18872. }
  18873. }
  18874. ksort($results);
  18875. return $results;
  18876. }
  18877. }
  18878. <?php
  18879. namespace Composer\Repository;
  18880. use Composer\Package\Loader\ArrayLoader;
  18881. use Composer\Package\PackageInterface;
  18882. use Composer\Package\AliasPackage;
  18883. use Composer\Package\Version\VersionParser;
  18884. use Composer\DependencyResolver\Pool;
  18885. use Composer\Json\JsonFile;
  18886. use Composer\Cache;
  18887. use Composer\Config;
  18888. use Composer\Factory;
  18889. use Composer\IO\IOInterface;
  18890. use Composer\Util\RemoteFilesystem;
  18891. use Composer\Plugin\PluginEvents;
  18892. use Composer\Plugin\PreFileDownloadEvent;
  18893. use Composer\EventDispatcher\EventDispatcher;
  18894. use Composer\Downloader\TransportException;
  18895. use Composer\Semver\Constraint\ConstraintInterface;
  18896. use Composer\Semver\Constraint\Constraint;
  18897. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  18898. {
  18899. protected $config;
  18900. protected $repoConfig;
  18901. protected $options;
  18902. protected $url;
  18903. protected $baseUrl;
  18904. protected $io;
  18905. protected $rfs;
  18906. protected $cache;
  18907. protected $notifyUrl;
  18908. protected $searchUrl;
  18909. protected $hasProviders = false;
  18910. protected $providersUrl;
  18911. protected $lazyProvidersUrl;
  18912. protected $providerListing;
  18913. protected $providers = array();
  18914. protected $providersByUid = array();
  18915. protected $loader;
  18916. protected $rootAliases;
  18917. protected $allowSslDowngrade = false;
  18918. protected $eventDispatcher;
  18919. protected $sourceMirrors;
  18920. protected $distMirrors;
  18921. private $degradedMode = false;
  18922. private $rootData;
  18923. private $hasPartialPackages;
  18924. private $partialPackagesByName;
  18925. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  18926. {
  18927. parent::__construct();
  18928. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  18929. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  18930. }
  18931. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  18932. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  18933. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  18934. }
  18935. $urlBits = parse_url($repoConfig['url']);
  18936. if ($urlBits === false || empty($urlBits['scheme'])) {
  18937. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  18938. }
  18939. if (!isset($repoConfig['options'])) {
  18940. $repoConfig['options'] = array();
  18941. }
  18942. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  18943. $this->allowSslDowngrade = true;
  18944. }
  18945. $this->config = $config;
  18946. $this->options = $repoConfig['options'];
  18947. $this->url = $repoConfig['url'];
  18948. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  18949. $this->io = $io;
  18950. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  18951. $this->loader = new ArrayLoader();
  18952. if ($rfs && $this->options) {
  18953. $rfs = clone $rfs;
  18954. $rfs->setOptions($this->options);
  18955. }
  18956. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  18957. $this->eventDispatcher = $eventDispatcher;
  18958. $this->repoConfig = $repoConfig;
  18959. }
  18960. public function getRepoConfig()
  18961. {
  18962. return $this->repoConfig;
  18963. }
  18964. public function setRootAliases(array $rootAliases)
  18965. {
  18966. $this->rootAliases = $rootAliases;
  18967. }
  18968. public function findPackage($name, $constraint)
  18969. {
  18970. if (!$this->hasProviders()) {
  18971. return parent::findPackage($name, $constraint);
  18972. }
  18973. $name = strtolower($name);
  18974. if (!$constraint instanceof ConstraintInterface) {
  18975. $versionParser = new VersionParser();
  18976. $constraint = $versionParser->parseConstraints($constraint);
  18977. }
  18978. foreach ($this->getProviderNames() as $providerName) {
  18979. if ($name === $providerName) {
  18980. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  18981. foreach ($packages as $package) {
  18982. if ($name === $package->getName()) {
  18983. $pkgConstraint = new Constraint('==', $package->getVersion());
  18984. if ($constraint->matches($pkgConstraint)) {
  18985. return $package;
  18986. }
  18987. }
  18988. }
  18989. break;
  18990. }
  18991. }
  18992. }
  18993. public function findPackages($name, $constraint = null)
  18994. {
  18995. if (!$this->hasProviders()) {
  18996. return parent::findPackages($name, $constraint);
  18997. }
  18998. $name = strtolower($name);
  18999. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19000. $versionParser = new VersionParser();
  19001. $constraint = $versionParser->parseConstraints($constraint);
  19002. }
  19003. $packages = array();
  19004. foreach ($this->getProviderNames() as $providerName) {
  19005. if ($name === $providerName) {
  19006. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  19007. foreach ($candidates as $package) {
  19008. if ($name === $package->getName()) {
  19009. $pkgConstraint = new Constraint('==', $package->getVersion());
  19010. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19011. $packages[] = $package;
  19012. }
  19013. }
  19014. }
  19015. break;
  19016. }
  19017. }
  19018. return $packages;
  19019. }
  19020. public function getPackages()
  19021. {
  19022. if ($this->hasProviders()) {
  19023. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  19024. }
  19025. return parent::getPackages();
  19026. }
  19027. public function search($query, $mode = 0, $type = null)
  19028. {
  19029. $this->loadRootServerFile();
  19030. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  19031. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  19032. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  19033. $json = $this->rfs->getContents($hostname, $url, false);
  19034. $results = JsonFile::parseJson($json, $url);
  19035. return $results['results'];
  19036. }
  19037. if ($this->hasProviders()) {
  19038. $results = array();
  19039. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19040. foreach ($this->getProviderNames() as $name) {
  19041. if (preg_match($regex, $name)) {
  19042. $results[] = array('name' => $name);
  19043. }
  19044. }
  19045. return $results;
  19046. }
  19047. return parent::search($query, $mode);
  19048. }
  19049. public function getProviderNames()
  19050. {
  19051. $this->loadRootServerFile();
  19052. if (null === $this->providerListing) {
  19053. $this->loadProviderListings($this->loadRootServerFile());
  19054. }
  19055. if ($this->lazyProvidersUrl) {
  19056. return array();
  19057. }
  19058. if ($this->providersUrl) {
  19059. return array_keys($this->providerListing);
  19060. }
  19061. return array();
  19062. }
  19063. protected function configurePackageTransportOptions(PackageInterface $package)
  19064. {
  19065. foreach ($package->getDistUrls() as $url) {
  19066. if (strpos($url, $this->baseUrl) === 0) {
  19067. $package->setTransportOptions($this->options);
  19068. return;
  19069. }
  19070. }
  19071. }
  19072. public function hasProviders()
  19073. {
  19074. $this->loadRootServerFile();
  19075. return $this->hasProviders;
  19076. }
  19077. public function resetPackageIds()
  19078. {
  19079. foreach ($this->providersByUid as $package) {
  19080. if ($package instanceof AliasPackage) {
  19081. $package->getAliasOf()->setId(-1);
  19082. }
  19083. $package->setId(-1);
  19084. }
  19085. }
  19086. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  19087. {
  19088. if (isset($this->providers[$name]) && !$bypassFilters) {
  19089. return $this->providers[$name];
  19090. }
  19091. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  19092. $this->initializePartialPackages();
  19093. }
  19094. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  19095. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  19096. return array();
  19097. }
  19098. if (null === $this->providerListing) {
  19099. $this->loadProviderListings($this->loadRootServerFile());
  19100. }
  19101. $useLastModifiedCheck = false;
  19102. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  19103. $hash = null;
  19104. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  19105. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  19106. $useLastModifiedCheck = true;
  19107. } elseif ($this->providersUrl) {
  19108. if (!isset($this->providerListing[$name])) {
  19109. return array();
  19110. }
  19111. $hash = $this->providerListing[$name]['sha256'];
  19112. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  19113. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  19114. } else {
  19115. return array();
  19116. }
  19117. $packages = null;
  19118. if ($cacheKey) {
  19119. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  19120. $packages = json_decode($this->cache->read($cacheKey), true);
  19121. } elseif ($useLastModifiedCheck) {
  19122. if ($contents = $this->cache->read($cacheKey)) {
  19123. $contents = json_decode($contents, true);
  19124. if (isset($contents['last-modified'])) {
  19125. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  19126. if (true === $response) {
  19127. $packages = $contents;
  19128. } elseif ($response) {
  19129. $packages = $response;
  19130. }
  19131. }
  19132. }
  19133. }
  19134. }
  19135. if (!$packages) {
  19136. try {
  19137. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  19138. } catch (TransportException $e) {
  19139. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  19140. $packages = array('packages' => array());
  19141. } else {
  19142. throw $e;
  19143. }
  19144. }
  19145. }
  19146. $loadingPartialPackage = false;
  19147. } else {
  19148. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  19149. $loadingPartialPackage = true;
  19150. }
  19151. $this->providers[$name] = array();
  19152. foreach ($packages['packages'] as $versions) {
  19153. foreach ($versions as $version) {
  19154. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  19155. continue;
  19156. }
  19157. if (isset($this->providersByUid[$version['uid']])) {
  19158. if (!isset($this->providers[$name][$version['uid']])) {
  19159. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  19160. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  19161. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  19162. } else {
  19163. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  19164. }
  19165. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  19166. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  19167. }
  19168. }
  19169. } else {
  19170. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  19171. continue;
  19172. }
  19173. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  19174. $package->setRepository($this);
  19175. if ($package instanceof AliasPackage) {
  19176. $aliased = $package->getAliasOf();
  19177. $aliased->setRepository($this);
  19178. $this->providers[$name][$version['uid']] = $aliased;
  19179. $this->providers[$name][$version['uid'].'-alias'] = $package;
  19180. $this->providersByUid[$version['uid']] = $package;
  19181. } else {
  19182. $this->providers[$name][$version['uid']] = $package;
  19183. $this->providersByUid[$version['uid']] = $package;
  19184. }
  19185. unset($rootAliasData);
  19186. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  19187. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  19188. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  19189. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  19190. }
  19191. if (isset($rootAliasData)) {
  19192. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  19193. $alias->setRepository($this);
  19194. $this->providers[$name][$version['uid'].'-root'] = $alias;
  19195. $this->providersByUid[$version['uid'].'-root'] = $alias;
  19196. }
  19197. }
  19198. }
  19199. }
  19200. $result = $this->providers[$name];
  19201. if ($bypassFilters) {
  19202. foreach ($this->providers[$name] as $uid => $provider) {
  19203. unset($this->providersByUid[$uid]);
  19204. }
  19205. unset($this->providers[$name]);
  19206. }
  19207. return $result;
  19208. }
  19209. protected function initialize()
  19210. {
  19211. parent::initialize();
  19212. $repoData = $this->loadDataFromServer();
  19213. foreach ($repoData as $package) {
  19214. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  19215. }
  19216. }
  19217. public function addPackage(PackageInterface $package)
  19218. {
  19219. parent::addPackage($package);
  19220. $this->configurePackageTransportOptions($package);
  19221. }
  19222. protected function loadRootServerFile()
  19223. {
  19224. if (null !== $this->rootData) {
  19225. return $this->rootData;
  19226. }
  19227. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  19228. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  19229. }
  19230. $jsonUrlParts = parse_url($this->url);
  19231. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  19232. $jsonUrl = $this->url;
  19233. } else {
  19234. $jsonUrl = $this->url . '/packages.json';
  19235. }
  19236. $data = $this->fetchFile($jsonUrl, 'packages.json');
  19237. if (!empty($data['notify-batch'])) {
  19238. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  19239. } elseif (!empty($data['notify'])) {
  19240. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  19241. }
  19242. if (!empty($data['search'])) {
  19243. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  19244. }
  19245. if (!empty($data['mirrors'])) {
  19246. foreach ($data['mirrors'] as $mirror) {
  19247. if (!empty($mirror['git-url'])) {
  19248. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  19249. }
  19250. if (!empty($mirror['hg-url'])) {
  19251. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  19252. }
  19253. if (!empty($mirror['dist-url'])) {
  19254. $this->distMirrors[] = array(
  19255. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  19256. 'preferred' => !empty($mirror['preferred'])
  19257. );
  19258. }
  19259. }
  19260. }
  19261. if (!empty($data['providers-lazy-url'])) {
  19262. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  19263. $this->hasProviders = true;
  19264. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  19265. }
  19266. if ($this->allowSslDowngrade) {
  19267. $this->url = str_replace('https://', 'http://', $this->url);
  19268. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  19269. }
  19270. if (!empty($data['providers-url'])) {
  19271. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  19272. $this->hasProviders = true;
  19273. }
  19274. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  19275. $this->hasProviders = true;
  19276. }
  19277. if (preg_match('{^https?://packagist.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  19278. $this->url = 'https://packagist.org';
  19279. $this->baseUrl = 'https://packagist.org';
  19280. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://packagist.org/p/%package%.json');
  19281. $this->providersUrl = null;
  19282. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  19283. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  19284. $this->providersUrl = null;
  19285. }
  19286. return $this->rootData = $data;
  19287. }
  19288. protected function canonicalizeUrl($url)
  19289. {
  19290. if ('/' === $url[0]) {
  19291. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  19292. }
  19293. return $url;
  19294. }
  19295. protected function loadDataFromServer()
  19296. {
  19297. $data = $this->loadRootServerFile();
  19298. return $this->loadIncludes($data);
  19299. }
  19300. protected function loadProviderListings($data)
  19301. {
  19302. if (isset($data['providers'])) {
  19303. if (!is_array($this->providerListing)) {
  19304. $this->providerListing = array();
  19305. }
  19306. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  19307. }
  19308. if ($this->providersUrl && isset($data['provider-includes'])) {
  19309. $includes = $data['provider-includes'];
  19310. foreach ($includes as $include => $metadata) {
  19311. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  19312. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  19313. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  19314. $includedData = json_decode($this->cache->read($cacheKey), true);
  19315. } else {
  19316. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  19317. }
  19318. $this->loadProviderListings($includedData);
  19319. }
  19320. }
  19321. }
  19322. protected function loadIncludes($data)
  19323. {
  19324. $packages = array();
  19325. if (!isset($data['packages']) && !isset($data['includes'])) {
  19326. foreach ($data as $pkg) {
  19327. foreach ($pkg['versions'] as $metadata) {
  19328. $packages[] = $metadata;
  19329. }
  19330. }
  19331. return $packages;
  19332. }
  19333. if (isset($data['packages'])) {
  19334. foreach ($data['packages'] as $package => $versions) {
  19335. foreach ($versions as $version => $metadata) {
  19336. $packages[] = $metadata;
  19337. }
  19338. }
  19339. }
  19340. if (isset($data['includes'])) {
  19341. foreach ($data['includes'] as $include => $metadata) {
  19342. if ($this->cache->sha1($include) === $metadata['sha1']) {
  19343. $includedData = json_decode($this->cache->read($include), true);
  19344. } else {
  19345. $includedData = $this->fetchFile($include);
  19346. }
  19347. $packages = array_merge($packages, $this->loadIncludes($includedData));
  19348. }
  19349. }
  19350. return $packages;
  19351. }
  19352. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  19353. {
  19354. try {
  19355. if (!isset($data['notification-url'])) {
  19356. $data['notification-url'] = $this->notifyUrl;
  19357. }
  19358. $package = $this->loader->load($data, $class);
  19359. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  19360. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  19361. }
  19362. $package->setDistMirrors($this->distMirrors);
  19363. $this->configurePackageTransportOptions($package);
  19364. return $package;
  19365. } catch (\Exception $e) {
  19366. 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);
  19367. }
  19368. }
  19369. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  19370. {
  19371. if (null === $cacheKey) {
  19372. $cacheKey = $filename;
  19373. $filename = $this->baseUrl.'/'.$filename;
  19374. }
  19375. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  19376. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  19377. }
  19378. $retries = 3;
  19379. while ($retries--) {
  19380. try {
  19381. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19382. if ($this->eventDispatcher) {
  19383. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19384. }
  19385. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19386. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19387. $json = $rfs->getContents($hostname, $filename, false);
  19388. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  19389. if ($this->allowSslDowngrade) {
  19390. $this->url = str_replace('http://', 'https://', $this->url);
  19391. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  19392. $filename = str_replace('http://', 'https://', $filename);
  19393. }
  19394. if ($retries) {
  19395. usleep(100000);
  19396. continue;
  19397. }
  19398. 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.');
  19399. }
  19400. $data = JsonFile::parseJson($json, $filename);
  19401. if (!empty($data['warning'])) {
  19402. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  19403. }
  19404. if (!empty($data['info'])) {
  19405. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  19406. }
  19407. if ($cacheKey) {
  19408. if ($storeLastModifiedTime) {
  19409. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19410. if ($lastModifiedDate) {
  19411. $data['last-modified'] = $lastModifiedDate;
  19412. $json = json_encode($data);
  19413. }
  19414. }
  19415. $this->cache->write($cacheKey, $json);
  19416. }
  19417. break;
  19418. } catch (\Exception $e) {
  19419. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19420. throw $e;
  19421. }
  19422. if ($retries) {
  19423. usleep(100000);
  19424. continue;
  19425. }
  19426. if ($e instanceof RepositorySecurityException) {
  19427. throw $e;
  19428. }
  19429. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  19430. if (!$this->degradedMode) {
  19431. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19432. $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>');
  19433. }
  19434. $this->degradedMode = true;
  19435. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  19436. break;
  19437. }
  19438. throw $e;
  19439. }
  19440. }
  19441. return $data;
  19442. }
  19443. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  19444. {
  19445. $retries = 3;
  19446. while ($retries--) {
  19447. try {
  19448. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19449. if ($this->eventDispatcher) {
  19450. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19451. }
  19452. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19453. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19454. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  19455. $json = $rfs->getContents($hostname, $filename, false, $options);
  19456. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  19457. return true;
  19458. }
  19459. $data = JsonFile::parseJson($json, $filename);
  19460. if (!empty($data['warning'])) {
  19461. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  19462. }
  19463. if (!empty($data['info'])) {
  19464. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  19465. }
  19466. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19467. if ($lastModifiedDate) {
  19468. $data['last-modified'] = $lastModifiedDate;
  19469. $json = json_encode($data);
  19470. }
  19471. $this->cache->write($cacheKey, $json);
  19472. return $data;
  19473. } catch (\Exception $e) {
  19474. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19475. throw $e;
  19476. }
  19477. if ($retries) {
  19478. usleep(100000);
  19479. continue;
  19480. }
  19481. if (!$this->degradedMode) {
  19482. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19483. $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>');
  19484. }
  19485. $this->degradedMode = true;
  19486. return true;
  19487. }
  19488. }
  19489. }
  19490. private function initializePartialPackages()
  19491. {
  19492. $rootData = $this->loadRootServerFile();
  19493. $this->partialPackagesByName = array();
  19494. foreach ($rootData['packages'] as $package => $versions) {
  19495. $package = strtolower($package);
  19496. foreach ($versions as $version) {
  19497. $this->partialPackagesByName[$package][] = $version;
  19498. if (!empty($version['provide']) && is_array($version['provide'])) {
  19499. foreach ($version['provide'] as $provided => $providedVersion) {
  19500. $this->partialPackagesByName[strtolower($provided)][] = $version;
  19501. }
  19502. }
  19503. if (!empty($version['replace']) && is_array($version['replace'])) {
  19504. foreach ($version['replace'] as $provided => $providedVersion) {
  19505. $this->partialPackagesByName[strtolower($provided)][] = $version;
  19506. }
  19507. }
  19508. }
  19509. }
  19510. $this->rootData = true;
  19511. }
  19512. }
  19513. <?php
  19514. namespace Composer\Repository;
  19515. use Composer\Package\PackageInterface;
  19516. class CompositeRepository extends BaseRepository
  19517. {
  19518. private $repositories;
  19519. public function __construct(array $repositories)
  19520. {
  19521. $this->repositories = array();
  19522. foreach ($repositories as $repo) {
  19523. $this->addRepository($repo);
  19524. }
  19525. }
  19526. public function getRepositories()
  19527. {
  19528. return $this->repositories;
  19529. }
  19530. public function hasPackage(PackageInterface $package)
  19531. {
  19532. foreach ($this->repositories as $repository) {
  19533. if ($repository->hasPackage($package)) {
  19534. return true;
  19535. }
  19536. }
  19537. return false;
  19538. }
  19539. public function findPackage($name, $constraint)
  19540. {
  19541. foreach ($this->repositories as $repository) {
  19542. $package = $repository->findPackage($name, $constraint);
  19543. if (null !== $package) {
  19544. return $package;
  19545. }
  19546. }
  19547. return null;
  19548. }
  19549. public function findPackages($name, $constraint = null)
  19550. {
  19551. $packages = array();
  19552. foreach ($this->repositories as $repository) {
  19553. $packages[] = $repository->findPackages($name, $constraint);
  19554. }
  19555. return $packages ? call_user_func_array('array_merge', $packages) : array();
  19556. }
  19557. public function search($query, $mode = 0, $type = null)
  19558. {
  19559. $matches = array();
  19560. foreach ($this->repositories as $repository) {
  19561. $matches[] = $repository->search($query, $mode, $type);
  19562. }
  19563. return $matches ? call_user_func_array('array_merge', $matches) : array();
  19564. }
  19565. public function getPackages()
  19566. {
  19567. $packages = array();
  19568. foreach ($this->repositories as $repository) {
  19569. $packages[] = $repository->getPackages();
  19570. }
  19571. return $packages ? call_user_func_array('array_merge', $packages) : array();
  19572. }
  19573. public function removePackage(PackageInterface $package)
  19574. {
  19575. foreach ($this->repositories as $repository) {
  19576. $repository->removePackage($package);
  19577. }
  19578. }
  19579. public function count()
  19580. {
  19581. $total = 0;
  19582. foreach ($this->repositories as $repository) {
  19583. $total += $repository->count();
  19584. }
  19585. return $total;
  19586. }
  19587. public function addRepository(RepositoryInterface $repository)
  19588. {
  19589. if ($repository instanceof self) {
  19590. foreach ($repository->getRepositories() as $repo) {
  19591. $this->addRepository($repo);
  19592. }
  19593. } else {
  19594. $this->repositories[] = $repository;
  19595. }
  19596. }
  19597. }
  19598. <?php
  19599. namespace Composer\Repository;
  19600. interface ConfigurableRepositoryInterface
  19601. {
  19602. public function getRepoConfig();
  19603. }
  19604. <?php
  19605. namespace Composer\Repository;
  19606. use Composer\Json\JsonFile;
  19607. use Composer\Package\Loader\ArrayLoader;
  19608. use Composer\Package\Dumper\ArrayDumper;
  19609. class FilesystemRepository extends WritableArrayRepository
  19610. {
  19611. private $file;
  19612. public function __construct(JsonFile $repositoryFile)
  19613. {
  19614. parent::__construct();
  19615. $this->file = $repositoryFile;
  19616. }
  19617. protected function initialize()
  19618. {
  19619. parent::initialize();
  19620. if (!$this->file->exists()) {
  19621. return;
  19622. }
  19623. try {
  19624. $packages = $this->file->read();
  19625. if (!is_array($packages)) {
  19626. throw new \UnexpectedValueException('Could not parse package list from the repository');
  19627. }
  19628. } catch (\Exception $e) {
  19629. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  19630. }
  19631. $loader = new ArrayLoader(null, true);
  19632. foreach ($packages as $packageData) {
  19633. $package = $loader->load($packageData);
  19634. $this->addPackage($package);
  19635. }
  19636. }
  19637. public function reload()
  19638. {
  19639. $this->packages = null;
  19640. $this->initialize();
  19641. }
  19642. public function write()
  19643. {
  19644. $data = array();
  19645. $dumper = new ArrayDumper();
  19646. foreach ($this->getCanonicalPackages() as $package) {
  19647. $data[] = $dumper->dump($package);
  19648. }
  19649. $this->file->write($data);
  19650. }
  19651. }
  19652. <?php
  19653. namespace Composer\Repository;
  19654. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  19655. {
  19656. }
  19657. <?php
  19658. namespace Composer\Repository;
  19659. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  19660. {
  19661. }
  19662. <?php
  19663. namespace Composer\Repository;
  19664. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  19665. {
  19666. }
  19667. <?php
  19668. namespace Composer\Repository;
  19669. class InvalidRepositoryException extends \Exception
  19670. {
  19671. }
  19672. <?php
  19673. namespace Composer\Repository;
  19674. use Composer\Package\Loader\ArrayLoader;
  19675. use Composer\Package\Loader\ValidatingArrayLoader;
  19676. class PackageRepository extends ArrayRepository
  19677. {
  19678. private $config;
  19679. public function __construct(array $config)
  19680. {
  19681. parent::__construct();
  19682. $this->config = $config['package'];
  19683. if (!is_numeric(key($this->config))) {
  19684. $this->config = array($this->config);
  19685. }
  19686. }
  19687. protected function initialize()
  19688. {
  19689. parent::initialize();
  19690. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  19691. foreach ($this->config as $package) {
  19692. try {
  19693. $package = $loader->load($package);
  19694. } catch (\Exception $e) {
  19695. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  19696. }
  19697. $this->addPackage($package);
  19698. }
  19699. }
  19700. }
  19701. <?php
  19702. namespace Composer\Repository;
  19703. use Composer\Config;
  19704. use Composer\IO\IOInterface;
  19705. use Composer\Json\JsonFile;
  19706. use Composer\Package\Loader\ArrayLoader;
  19707. use Composer\Package\Version\VersionGuesser;
  19708. use Composer\Package\Version\VersionParser;
  19709. use Composer\Util\Platform;
  19710. use Composer\Util\ProcessExecutor;
  19711. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19712. {
  19713. private $loader;
  19714. private $versionGuesser;
  19715. private $url;
  19716. private $repoConfig;
  19717. private $process;
  19718. private $options;
  19719. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  19720. {
  19721. if (!isset($repoConfig['url'])) {
  19722. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  19723. }
  19724. $this->loader = new ArrayLoader(null, true);
  19725. $this->url = Platform::expandPath($repoConfig['url']);
  19726. $this->process = new ProcessExecutor($io);
  19727. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  19728. $this->repoConfig = $repoConfig;
  19729. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  19730. parent::__construct();
  19731. }
  19732. public function getRepoConfig()
  19733. {
  19734. return $this->repoConfig;
  19735. }
  19736. protected function initialize()
  19737. {
  19738. parent::initialize();
  19739. foreach ($this->getUrlMatches() as $url) {
  19740. $path = realpath($url) . DIRECTORY_SEPARATOR;
  19741. $composerFilePath = $path.'composer.json';
  19742. if (!file_exists($composerFilePath)) {
  19743. continue;
  19744. }
  19745. $json = file_get_contents($composerFilePath);
  19746. $package = JsonFile::parseJson($json, $composerFilePath);
  19747. $package['dist'] = array(
  19748. 'type' => 'path',
  19749. 'url' => $url,
  19750. 'reference' => sha1($json . serialize($this->options)),
  19751. );
  19752. $package['transport-options'] = $this->options;
  19753. if (!isset($package['version'])) {
  19754. $versionData = $this->versionGuesser->guessVersion($package, $path);
  19755. $package['version'] = $versionData['version'] ?: 'dev-master';
  19756. }
  19757. $output = '';
  19758. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  19759. $package['dist']['reference'] = trim($output);
  19760. }
  19761. $package = $this->loader->load($package);
  19762. $this->addPackage($package);
  19763. }
  19764. }
  19765. private function getUrlMatches()
  19766. {
  19767. return array_map(function ($val) {
  19768. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  19769. }, glob($this->url, GLOB_MARK | GLOB_ONLYDIR));
  19770. }
  19771. }
  19772. <?php
  19773. namespace Composer\Repository\Pear;
  19774. use Composer\Util\RemoteFilesystem;
  19775. abstract class BaseChannelReader
  19776. {
  19777. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  19778. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  19779. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  19780. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  19781. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  19782. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  19783. private $rfs;
  19784. protected function __construct(RemoteFilesystem $rfs)
  19785. {
  19786. $this->rfs = $rfs;
  19787. }
  19788. protected function requestContent($origin, $path)
  19789. {
  19790. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  19791. $content = $this->rfs->getContents($origin, $url, false);
  19792. if (!$content) {
  19793. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  19794. }
  19795. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  19796. }
  19797. protected function requestXml($origin, $path)
  19798. {
  19799. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  19800. if (false === $xml) {
  19801. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  19802. }
  19803. return $xml;
  19804. }
  19805. }
  19806. <?php
  19807. namespace Composer\Repository\Pear;
  19808. class ChannelInfo
  19809. {
  19810. private $name;
  19811. private $alias;
  19812. private $packages;
  19813. public function __construct($name, $alias, array $packages)
  19814. {
  19815. $this->name = $name;
  19816. $this->alias = $alias;
  19817. $this->packages = $packages;
  19818. }
  19819. public function getName()
  19820. {
  19821. return $this->name;
  19822. }
  19823. public function getAlias()
  19824. {
  19825. return $this->alias;
  19826. }
  19827. public function getPackages()
  19828. {
  19829. return $this->packages;
  19830. }
  19831. }
  19832. <?php
  19833. namespace Composer\Repository\Pear;
  19834. use Composer\Util\RemoteFilesystem;
  19835. class ChannelReader extends BaseChannelReader
  19836. {
  19837. private $readerMap;
  19838. public function __construct(RemoteFilesystem $rfs)
  19839. {
  19840. parent::__construct($rfs);
  19841. $rest10reader = new ChannelRest10Reader($rfs);
  19842. $rest11reader = new ChannelRest11Reader($rfs);
  19843. $this->readerMap = array(
  19844. 'REST1.3' => $rest11reader,
  19845. 'REST1.2' => $rest11reader,
  19846. 'REST1.1' => $rest11reader,
  19847. 'REST1.0' => $rest10reader,
  19848. );
  19849. }
  19850. public function read($url)
  19851. {
  19852. $xml = $this->requestXml($url, "/channel.xml");
  19853. $channelName = (string) $xml->name;
  19854. $channelAlias = (string) $xml->suggestedalias;
  19855. $supportedVersions = array_keys($this->readerMap);
  19856. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  19857. if (!$selectedRestVersion) {
  19858. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  19859. }
  19860. $reader = $this->readerMap[$selectedRestVersion['version']];
  19861. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  19862. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  19863. }
  19864. private function selectRestVersion($channelXml, $supportedVersions)
  19865. {
  19866. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  19867. foreach ($supportedVersions as $version) {
  19868. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  19869. $testResult = $channelXml->xpath($xpathTest);
  19870. foreach ($testResult as $result) {
  19871. $result = (string) $result;
  19872. if (preg_match('{^https://}i', $result)) {
  19873. return array('version' => $version, 'baseUrl' => $result);
  19874. }
  19875. }
  19876. if (count($testResult) > 0) {
  19877. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  19878. }
  19879. }
  19880. return null;
  19881. }
  19882. }
  19883. <?php
  19884. namespace Composer\Repository\Pear;
  19885. use Composer\Downloader\TransportException;
  19886. class ChannelRest10Reader extends BaseChannelReader
  19887. {
  19888. private $dependencyReader;
  19889. public function __construct($rfs)
  19890. {
  19891. parent::__construct($rfs);
  19892. $this->dependencyReader = new PackageDependencyParser();
  19893. }
  19894. public function read($baseUrl)
  19895. {
  19896. return $this->readPackages($baseUrl);
  19897. }
  19898. private function readPackages($baseUrl)
  19899. {
  19900. $result = array();
  19901. $xmlPath = '/p/packages.xml';
  19902. $xml = $this->requestXml($baseUrl, $xmlPath);
  19903. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  19904. foreach ($xml->xpath('ns:p') as $node) {
  19905. $packageName = (string) $node;
  19906. $packageInfo = $this->readPackage($baseUrl, $packageName);
  19907. $result[] = $packageInfo;
  19908. }
  19909. return $result;
  19910. }
  19911. private function readPackage($baseUrl, $packageName)
  19912. {
  19913. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  19914. $xml = $this->requestXml($baseUrl, $xmlPath);
  19915. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  19916. $channelName = (string) $xml->c;
  19917. $packageName = (string) $xml->n;
  19918. $license = (string) $xml->l;
  19919. $shortDescription = (string) $xml->s;
  19920. $description = (string) $xml->d;
  19921. return new PackageInfo(
  19922. $channelName,
  19923. $packageName,
  19924. $license,
  19925. $shortDescription,
  19926. $description,
  19927. $this->readPackageReleases($baseUrl, $packageName)
  19928. );
  19929. }
  19930. private function readPackageReleases($baseUrl, $packageName)
  19931. {
  19932. $result = array();
  19933. try {
  19934. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  19935. $xml = $this->requestXml($baseUrl, $xmlPath);
  19936. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  19937. foreach ($xml->xpath('ns:r') as $node) {
  19938. $releaseVersion = (string) $node->v;
  19939. $releaseStability = (string) $node->s;
  19940. try {
  19941. $result[$releaseVersion] = new ReleaseInfo(
  19942. $releaseStability,
  19943. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  19944. );
  19945. } catch (TransportException $exception) {
  19946. if ($exception->getCode() != 404) {
  19947. throw $exception;
  19948. }
  19949. }
  19950. }
  19951. } catch (TransportException $exception) {
  19952. if ($exception->getCode() != 404) {
  19953. throw $exception;
  19954. }
  19955. }
  19956. return $result;
  19957. }
  19958. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  19959. {
  19960. $dependencyReader = new PackageDependencyParser();
  19961. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  19962. $content = $this->requestContent($baseUrl, $depthPath);
  19963. $dependencyArray = unserialize($content);
  19964. $result = $dependencyReader->buildDependencyInfo($dependencyArray);
  19965. return $result;
  19966. }
  19967. }
  19968. <?php
  19969. namespace Composer\Repository\Pear;
  19970. class ChannelRest11Reader extends BaseChannelReader
  19971. {
  19972. private $dependencyReader;
  19973. public function __construct($rfs)
  19974. {
  19975. parent::__construct($rfs);
  19976. $this->dependencyReader = new PackageDependencyParser();
  19977. }
  19978. public function read($baseUrl)
  19979. {
  19980. return $this->readChannelPackages($baseUrl);
  19981. }
  19982. private function readChannelPackages($baseUrl)
  19983. {
  19984. $result = array();
  19985. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  19986. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  19987. foreach ($xml->xpath('ns:c') as $node) {
  19988. $categoryName = (string) $node;
  19989. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  19990. $result = array_merge($result, $categoryPackages);
  19991. }
  19992. return $result;
  19993. }
  19994. private function readCategoryPackages($baseUrl, $categoryName)
  19995. {
  19996. $result = array();
  19997. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  19998. $xml = $this->requestXml($baseUrl, $categoryPath);
  19999. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20000. foreach ($xml->xpath('ns:pi') as $node) {
  20001. $packageInfo = $this->parsePackage($node);
  20002. $result[] = $packageInfo;
  20003. }
  20004. return $result;
  20005. }
  20006. private function parsePackage($packageInfo)
  20007. {
  20008. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20009. $channelName = (string) $packageInfo->p->c;
  20010. $packageName = (string) $packageInfo->p->n;
  20011. $license = (string) $packageInfo->p->l;
  20012. $shortDescription = (string) $packageInfo->p->s;
  20013. $description = (string) $packageInfo->p->d;
  20014. $dependencies = array();
  20015. foreach ($packageInfo->xpath('ns:deps') as $node) {
  20016. $dependencyVersion = (string) $node->v;
  20017. $dependencyArray = unserialize((string) $node->d);
  20018. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  20019. $dependencies[$dependencyVersion] = $dependencyInfo;
  20020. }
  20021. $releases = array();
  20022. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  20023. if ($releasesInfo) {
  20024. foreach ($releasesInfo as $node) {
  20025. $releaseVersion = (string) $node->v;
  20026. $releaseStability = (string) $node->s;
  20027. $releases[$releaseVersion] = new ReleaseInfo(
  20028. $releaseStability,
  20029. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  20030. );
  20031. }
  20032. }
  20033. return new PackageInfo(
  20034. $channelName,
  20035. $packageName,
  20036. $license,
  20037. $shortDescription,
  20038. $description,
  20039. $releases
  20040. );
  20041. }
  20042. }
  20043. <?php
  20044. namespace Composer\Repository\Pear;
  20045. class DependencyConstraint
  20046. {
  20047. private $type;
  20048. private $constraint;
  20049. private $channelName;
  20050. private $packageName;
  20051. public function __construct($type, $constraint, $channelName, $packageName)
  20052. {
  20053. $this->type = $type;
  20054. $this->constraint = $constraint;
  20055. $this->channelName = $channelName;
  20056. $this->packageName = $packageName;
  20057. }
  20058. public function getChannelName()
  20059. {
  20060. return $this->channelName;
  20061. }
  20062. public function getConstraint()
  20063. {
  20064. return $this->constraint;
  20065. }
  20066. public function getPackageName()
  20067. {
  20068. return $this->packageName;
  20069. }
  20070. public function getType()
  20071. {
  20072. return $this->type;
  20073. }
  20074. }
  20075. <?php
  20076. namespace Composer\Repository\Pear;
  20077. class DependencyInfo
  20078. {
  20079. private $requires;
  20080. private $optionals;
  20081. public function __construct($requires, $optionals)
  20082. {
  20083. $this->requires = $requires;
  20084. $this->optionals = $optionals;
  20085. }
  20086. public function getRequires()
  20087. {
  20088. return $this->requires;
  20089. }
  20090. public function getOptionals()
  20091. {
  20092. return $this->optionals;
  20093. }
  20094. }
  20095. <?php
  20096. namespace Composer\Repository\Pear;
  20097. class PackageDependencyParser
  20098. {
  20099. public function buildDependencyInfo($depArray)
  20100. {
  20101. if (!is_array($depArray)) {
  20102. return new DependencyInfo(array(), array());
  20103. }
  20104. if (!$this->isHash($depArray)) {
  20105. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  20106. }
  20107. return $this->buildDependency20Info($depArray);
  20108. }
  20109. private function buildDependency10Info($depArray)
  20110. {
  20111. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  20112. $result = array();
  20113. foreach ($depArray as $depItem) {
  20114. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  20115. continue;
  20116. }
  20117. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  20118. ? 'optional'
  20119. : 'required';
  20120. $depType = 'not' == $depItem['rel']
  20121. ? 'conflicts'
  20122. : $depType;
  20123. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  20124. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  20125. ? '*'
  20126. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  20127. switch ($depItem['type']) {
  20128. case 'php':
  20129. $depChannelName = 'php';
  20130. $depPackageName = '';
  20131. break;
  20132. case 'pkg':
  20133. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  20134. $depPackageName = $depItem['name'];
  20135. break;
  20136. case 'ext':
  20137. $depChannelName = 'ext';
  20138. $depPackageName = $depItem['name'];
  20139. break;
  20140. case 'os':
  20141. case 'sapi':
  20142. $depChannelName = '';
  20143. $depPackageName = '';
  20144. break;
  20145. default:
  20146. $depChannelName = '';
  20147. $depPackageName = '';
  20148. break;
  20149. }
  20150. if ('' != $depChannelName) {
  20151. $result[] = new DependencyConstraint(
  20152. $depType,
  20153. $depVersionConstraint,
  20154. $depChannelName,
  20155. $depPackageName
  20156. );
  20157. }
  20158. }
  20159. return $result;
  20160. }
  20161. private function buildDependency20Info($depArray)
  20162. {
  20163. $result = array();
  20164. $optionals = array();
  20165. $defaultOptionals = array();
  20166. foreach ($depArray as $depType => $depTypeGroup) {
  20167. if (!is_array($depTypeGroup)) {
  20168. continue;
  20169. }
  20170. if ('required' == $depType || 'optional' == $depType) {
  20171. foreach ($depTypeGroup as $depItemType => $depItem) {
  20172. switch ($depItemType) {
  20173. case 'php':
  20174. $result[] = new DependencyConstraint(
  20175. $depType,
  20176. $this->parse20VersionConstraint($depItem),
  20177. 'php',
  20178. ''
  20179. );
  20180. break;
  20181. case 'package':
  20182. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  20183. $result = array_merge($result, $deps);
  20184. break;
  20185. case 'extension':
  20186. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  20187. $result = array_merge($result, $deps);
  20188. break;
  20189. case 'subpackage':
  20190. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  20191. $defaultOptionals += $deps;
  20192. break;
  20193. case 'os':
  20194. case 'pearinstaller':
  20195. break;
  20196. default:
  20197. break;
  20198. }
  20199. }
  20200. } elseif ('group' == $depType) {
  20201. if ($this->isHash($depTypeGroup)) {
  20202. $depTypeGroup = array($depTypeGroup);
  20203. }
  20204. foreach ($depTypeGroup as $depItem) {
  20205. $groupName = $depItem['attribs']['name'];
  20206. if (!isset($optionals[$groupName])) {
  20207. $optionals[$groupName] = array();
  20208. }
  20209. if (isset($depItem['subpackage'])) {
  20210. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  20211. } else {
  20212. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  20213. }
  20214. }
  20215. }
  20216. }
  20217. if (count($defaultOptionals) > 0) {
  20218. $optionals['*'] = $defaultOptionals;
  20219. }
  20220. return new DependencyInfo($result, $optionals);
  20221. }
  20222. private function buildDepExtensionConstraints($depItem, $depType)
  20223. {
  20224. if ($this->isHash($depItem)) {
  20225. $depItem = array($depItem);
  20226. }
  20227. $result = array();
  20228. foreach ($depItem as $subDepItem) {
  20229. $depChannelName = 'ext';
  20230. $depPackageName = $subDepItem['name'];
  20231. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  20232. $result[] = new DependencyConstraint(
  20233. $depType,
  20234. $depVersionConstraint,
  20235. $depChannelName,
  20236. $depPackageName
  20237. );
  20238. }
  20239. return $result;
  20240. }
  20241. private function buildDepPackageConstraints($depItem, $depType)
  20242. {
  20243. if ($this->isHash($depItem)) {
  20244. $depItem = array($depItem);
  20245. }
  20246. $result = array();
  20247. foreach ($depItem as $subDepItem) {
  20248. if (!array_key_exists('channel', $subDepItem)) {
  20249. $subDepItem['channel'] = $subDepItem['uri'];
  20250. }
  20251. $depChannelName = $subDepItem['channel'];
  20252. $depPackageName = $subDepItem['name'];
  20253. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  20254. if (isset($subDepItem['conflicts'])) {
  20255. $depType = 'conflicts';
  20256. }
  20257. $result[] = new DependencyConstraint(
  20258. $depType,
  20259. $depVersionConstraint,
  20260. $depChannelName,
  20261. $depPackageName
  20262. );
  20263. }
  20264. return $result;
  20265. }
  20266. private function parse20VersionConstraint(array $data)
  20267. {
  20268. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  20269. $versions = array();
  20270. $values = array_intersect_key($data, $dep20toOperatorMap);
  20271. if (0 == count($values)) {
  20272. return '*';
  20273. }
  20274. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  20275. $versions[] = '>' . $this->parseVersion($values['min']);
  20276. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  20277. $versions[] = '<' . $this->parseVersion($values['max']);
  20278. } else {
  20279. foreach ($values as $op => $version) {
  20280. if ('exclude' == $op && is_array($version)) {
  20281. foreach ($version as $versionPart) {
  20282. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  20283. }
  20284. } else {
  20285. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  20286. }
  20287. }
  20288. }
  20289. return implode(',', $versions);
  20290. }
  20291. private function parseVersion($version)
  20292. {
  20293. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  20294. $version = $matches[1]
  20295. .(!empty($matches[2]) ? $matches[2] : '.0')
  20296. .(!empty($matches[3]) ? $matches[3] : '.0')
  20297. .(!empty($matches[4]) ? $matches[4] : '.0');
  20298. return $version;
  20299. }
  20300. return null;
  20301. }
  20302. private function isHash(array $array)
  20303. {
  20304. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  20305. }
  20306. }
  20307. <?php
  20308. namespace Composer\Repository\Pear;
  20309. class PackageInfo
  20310. {
  20311. private $channelName;
  20312. private $packageName;
  20313. private $license;
  20314. private $shortDescription;
  20315. private $description;
  20316. private $releases;
  20317. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  20318. {
  20319. $this->channelName = $channelName;
  20320. $this->packageName = $packageName;
  20321. $this->license = $license;
  20322. $this->shortDescription = $shortDescription;
  20323. $this->description = $description;
  20324. $this->releases = $releases;
  20325. }
  20326. public function getChannelName()
  20327. {
  20328. return $this->channelName;
  20329. }
  20330. public function getPackageName()
  20331. {
  20332. return $this->packageName;
  20333. }
  20334. public function getDescription()
  20335. {
  20336. return $this->description;
  20337. }
  20338. public function getShortDescription()
  20339. {
  20340. return $this->shortDescription;
  20341. }
  20342. public function getLicense()
  20343. {
  20344. return $this->license;
  20345. }
  20346. public function getReleases()
  20347. {
  20348. return $this->releases;
  20349. }
  20350. }
  20351. <?php
  20352. namespace Composer\Repository\Pear;
  20353. class ReleaseInfo
  20354. {
  20355. private $stability;
  20356. private $dependencyInfo;
  20357. public function __construct($stability, $dependencyInfo)
  20358. {
  20359. $this->stability = $stability;
  20360. $this->dependencyInfo = $dependencyInfo;
  20361. }
  20362. public function getDependencyInfo()
  20363. {
  20364. return $this->dependencyInfo;
  20365. }
  20366. public function getStability()
  20367. {
  20368. return $this->stability;
  20369. }
  20370. }
  20371. <?php
  20372. namespace Composer\Repository;
  20373. use Composer\IO\IOInterface;
  20374. use Composer\Semver\VersionParser as SemverVersionParser;
  20375. use Composer\Package\Version\VersionParser;
  20376. use Composer\Repository\Pear\ChannelReader;
  20377. use Composer\Package\CompletePackage;
  20378. use Composer\Repository\Pear\ChannelInfo;
  20379. use Composer\EventDispatcher\EventDispatcher;
  20380. use Composer\Package\Link;
  20381. use Composer\Semver\Constraint\Constraint;
  20382. use Composer\Util\RemoteFilesystem;
  20383. use Composer\Config;
  20384. use Composer\Factory;
  20385. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20386. {
  20387. private $url;
  20388. private $io;
  20389. private $rfs;
  20390. private $versionParser;
  20391. private $repoConfig;
  20392. private $vendorAlias;
  20393. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  20394. {
  20395. parent::__construct();
  20396. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  20397. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20398. }
  20399. $urlBits = parse_url($repoConfig['url']);
  20400. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  20401. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  20402. }
  20403. $this->url = rtrim($repoConfig['url'], '/');
  20404. $this->io = $io;
  20405. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  20406. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  20407. $this->versionParser = new VersionParser();
  20408. $this->repoConfig = $repoConfig;
  20409. }
  20410. public function getRepoConfig()
  20411. {
  20412. return $this->repoConfig;
  20413. }
  20414. protected function initialize()
  20415. {
  20416. parent::initialize();
  20417. $this->io->writeError('Initializing PEAR repository '.$this->url);
  20418. $reader = new ChannelReader($this->rfs);
  20419. try {
  20420. $channelInfo = $reader->read($this->url);
  20421. } catch (\Exception $e) {
  20422. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  20423. return;
  20424. }
  20425. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  20426. foreach ($packages as $package) {
  20427. $this->addPackage($package);
  20428. }
  20429. }
  20430. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  20431. {
  20432. $result = array();
  20433. foreach ($channelInfo->getPackages() as $packageDefinition) {
  20434. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  20435. try {
  20436. $normalizedVersion = $versionParser->normalize($version);
  20437. } catch (\UnexpectedValueException $e) {
  20438. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  20439. continue;
  20440. }
  20441. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  20442. $urlBits = parse_url($this->url);
  20443. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  20444. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  20445. $requires = array();
  20446. $suggests = array();
  20447. $conflicts = array();
  20448. $replaces = array();
  20449. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  20450. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  20451. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20452. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20453. }
  20454. if (!empty($this->vendorAlias)
  20455. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  20456. ) {
  20457. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  20458. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20459. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20460. }
  20461. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  20462. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20463. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  20464. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  20465. switch ($dependencyConstraint->getType()) {
  20466. case 'required':
  20467. $requires[] = $link;
  20468. break;
  20469. case 'conflicts':
  20470. $conflicts[] = $link;
  20471. break;
  20472. case 'replaces':
  20473. $replaces[] = $link;
  20474. break;
  20475. }
  20476. }
  20477. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  20478. foreach ($dependencyConstraints as $dependencyConstraint) {
  20479. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20480. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  20481. }
  20482. }
  20483. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  20484. $package->setType('pear-library');
  20485. $package->setDescription($packageDefinition->getDescription());
  20486. $package->setLicense(array($packageDefinition->getLicense()));
  20487. $package->setDistType('file');
  20488. $package->setDistUrl($distUrl);
  20489. $package->setAutoload(array('classmap' => array('')));
  20490. $package->setIncludePaths(array('/'));
  20491. $package->setRequires($requires);
  20492. $package->setConflicts($conflicts);
  20493. $package->setSuggests($suggests);
  20494. $package->setReplaces($replaces);
  20495. $result[] = $package;
  20496. }
  20497. }
  20498. return $result;
  20499. }
  20500. private function buildComposerPackageName($channelName, $packageName)
  20501. {
  20502. if ('php' === $channelName) {
  20503. return "php";
  20504. }
  20505. if ('ext' === $channelName) {
  20506. return "ext-{$packageName}";
  20507. }
  20508. return "pear-{$channelName}/{$packageName}";
  20509. }
  20510. }
  20511. <?php
  20512. namespace Composer\Repository;
  20513. use Composer\XdebugHandler;
  20514. use Composer\Package\CompletePackage;
  20515. use Composer\Package\PackageInterface;
  20516. use Composer\Package\Version\VersionParser;
  20517. use Composer\Plugin\PluginInterface;
  20518. use Composer\Util\Silencer;
  20519. class PlatformRepository extends ArrayRepository
  20520. {
  20521. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[^/]+)$}i';
  20522. private $versionParser;
  20523. private $overrides = array();
  20524. public function __construct(array $packages = array(), array $overrides = array())
  20525. {
  20526. foreach ($overrides as $name => $version) {
  20527. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  20528. }
  20529. parent::__construct($packages);
  20530. }
  20531. protected function initialize()
  20532. {
  20533. parent::initialize();
  20534. $this->versionParser = new VersionParser();
  20535. foreach ($this->overrides as $override) {
  20536. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  20537. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  20538. }
  20539. $this->addOverriddenPackage($override);
  20540. }
  20541. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  20542. $version = $this->versionParser->normalize($prettyVersion);
  20543. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  20544. $composerPluginApi->setDescription('The Composer Plugin API');
  20545. $this->addPackage($composerPluginApi);
  20546. try {
  20547. $prettyVersion = PHP_VERSION;
  20548. $version = $this->versionParser->normalize($prettyVersion);
  20549. } catch (\UnexpectedValueException $e) {
  20550. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  20551. $version = $this->versionParser->normalize($prettyVersion);
  20552. }
  20553. $php = new CompletePackage('php', $version, $prettyVersion);
  20554. $php->setDescription('The PHP interpreter');
  20555. $this->addPackage($php);
  20556. if (PHP_DEBUG) {
  20557. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  20558. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  20559. $this->addPackage($phpdebug);
  20560. }
  20561. if (defined('PHP_ZTS') && PHP_ZTS) {
  20562. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  20563. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  20564. $this->addPackage($phpzts);
  20565. }
  20566. if (PHP_INT_SIZE === 8) {
  20567. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  20568. $php64->setDescription('The PHP interpreter, 64bit');
  20569. $this->addPackage($php64);
  20570. }
  20571. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  20572. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  20573. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  20574. $this->addPackage($phpIpv6);
  20575. }
  20576. $loadedExtensions = get_loaded_extensions();
  20577. foreach ($loadedExtensions as $name) {
  20578. if (in_array($name, array('standard', 'Core'))) {
  20579. continue;
  20580. }
  20581. $reflExt = new \ReflectionExtension($name);
  20582. $prettyVersion = $reflExt->getVersion();
  20583. $this->addExtension($name, $prettyVersion);
  20584. }
  20585. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = strval(getenv(XdebugHandler::ENV_VERSION)))) {
  20586. $this->addExtension('xdebug', $prettyVersion);
  20587. }
  20588. foreach ($loadedExtensions as $name) {
  20589. $prettyVersion = null;
  20590. $description = 'The '.$name.' PHP library';
  20591. switch ($name) {
  20592. case 'curl':
  20593. $curlVersion = curl_version();
  20594. $prettyVersion = $curlVersion['version'];
  20595. break;
  20596. case 'iconv':
  20597. $prettyVersion = ICONV_VERSION;
  20598. break;
  20599. case 'intl':
  20600. $name = 'ICU';
  20601. if (defined('INTL_ICU_VERSION')) {
  20602. $prettyVersion = INTL_ICU_VERSION;
  20603. } else {
  20604. $reflector = new \ReflectionExtension('intl');
  20605. ob_start();
  20606. $reflector->info();
  20607. $output = ob_get_clean();
  20608. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  20609. $prettyVersion = $matches[1];
  20610. }
  20611. break;
  20612. case 'libxml':
  20613. $prettyVersion = LIBXML_DOTTED_VERSION;
  20614. break;
  20615. case 'openssl':
  20616. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  20617. if (empty($match[2])) {
  20618. return $match[1];
  20619. }
  20620. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  20621. return 0;
  20622. }
  20623. $len = strlen($match[2]);
  20624. $patchVersion = ($len - 1) * 26;
  20625. $patchVersion += ord($match[2][$len - 1]) - 96;
  20626. return $match[1].'.'.$patchVersion;
  20627. }, OPENSSL_VERSION_TEXT);
  20628. $description = OPENSSL_VERSION_TEXT;
  20629. break;
  20630. case 'pcre':
  20631. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  20632. break;
  20633. case 'uuid':
  20634. $prettyVersion = phpversion('uuid');
  20635. break;
  20636. case 'xsl':
  20637. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  20638. break;
  20639. default:
  20640. continue 2;
  20641. }
  20642. try {
  20643. $version = $this->versionParser->normalize($prettyVersion);
  20644. } catch (\UnexpectedValueException $e) {
  20645. continue;
  20646. }
  20647. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  20648. $lib->setDescription($description);
  20649. $this->addPackage($lib);
  20650. }
  20651. if (defined('HHVM_VERSION')) {
  20652. try {
  20653. $prettyVersion = HHVM_VERSION;
  20654. $version = $this->versionParser->normalize($prettyVersion);
  20655. } catch (\UnexpectedValueException $e) {
  20656. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
  20657. $version = $this->versionParser->normalize($prettyVersion);
  20658. }
  20659. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  20660. $hhvm->setDescription('The HHVM Runtime (64bit)');
  20661. $this->addPackage($hhvm);
  20662. }
  20663. }
  20664. public function addPackage(PackageInterface $package)
  20665. {
  20666. if (isset($this->overrides[$package->getName()])) {
  20667. $overrider = $this->findPackage($package->getName(), '*');
  20668. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  20669. return;
  20670. }
  20671. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  20672. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  20673. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  20674. return;
  20675. }
  20676. parent::addPackage($package);
  20677. }
  20678. private function addOverriddenPackage(array $override, $name = null)
  20679. {
  20680. $version = $this->versionParser->normalize($override['version']);
  20681. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  20682. $package->setDescription('Package overridden via config.platform');
  20683. $package->setExtra(array('config.platform' => true));
  20684. parent::addPackage($package);
  20685. return $package;
  20686. }
  20687. private function addExtension($name, $prettyVersion)
  20688. {
  20689. $extraDescription = null;
  20690. try {
  20691. $version = $this->versionParser->normalize($prettyVersion);
  20692. } catch (\UnexpectedValueException $e) {
  20693. $extraDescription = ' (actual version: '.$prettyVersion.')';
  20694. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  20695. $prettyVersion = $match[1];
  20696. } else {
  20697. $prettyVersion = '0';
  20698. }
  20699. $version = $this->versionParser->normalize($prettyVersion);
  20700. }
  20701. $packageName = $this->buildPackageName($name);
  20702. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  20703. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  20704. $this->addPackage($ext);
  20705. }
  20706. private function buildPackageName($name)
  20707. {
  20708. return 'ext-' . str_replace(' ', '-', $name);
  20709. }
  20710. }
  20711. <?php
  20712. namespace Composer\Repository;
  20713. use Composer\Factory;
  20714. use Composer\IO\IOInterface;
  20715. use Composer\Config;
  20716. use Composer\EventDispatcher\EventDispatcher;
  20717. use Composer\Util\RemoteFilesystem;
  20718. use Composer\Json\JsonFile;
  20719. class RepositoryFactory
  20720. {
  20721. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  20722. {
  20723. if (0 === strpos($repository, 'http')) {
  20724. $repoConfig = array('type' => 'composer', 'url' => $repository);
  20725. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  20726. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  20727. $data = $json->read();
  20728. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  20729. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  20730. } elseif ($allowFilesystem) {
  20731. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  20732. } else {
  20733. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  20734. }
  20735. } elseif ('{' === substr($repository, 0, 1)) {
  20736. $repoConfig = JsonFile::parseJson($repository);
  20737. } else {
  20738. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  20739. }
  20740. return $repoConfig;
  20741. }
  20742. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  20743. {
  20744. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  20745. return static::createRepo($io, $config, $repoConfig);
  20746. }
  20747. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  20748. {
  20749. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  20750. $repos = static::createRepos($rm, array($repoConfig));
  20751. return reset($repos);
  20752. }
  20753. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  20754. {
  20755. if (!$config) {
  20756. $config = Factory::createConfig($io);
  20757. }
  20758. if (!$rm) {
  20759. if (!$io) {
  20760. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  20761. }
  20762. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  20763. }
  20764. return static::createRepos($rm, $config->getRepositories());
  20765. }
  20766. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20767. {
  20768. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  20769. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  20770. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  20771. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  20772. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  20773. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  20774. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  20775. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  20776. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  20777. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  20778. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  20779. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  20780. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  20781. return $rm;
  20782. }
  20783. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  20784. {
  20785. $repos = array();
  20786. foreach ($repoConfigs as $index => $repo) {
  20787. if (is_string($repo)) {
  20788. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  20789. }
  20790. if (!is_array($repo)) {
  20791. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  20792. }
  20793. if (!isset($repo['type'])) {
  20794. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  20795. }
  20796. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  20797. while (isset($repos[$name])) {
  20798. $name .= '2';
  20799. }
  20800. if ($repo['type'] === 'filesystem') {
  20801. $repos[$name] = new FilesystemRepository($repo['json']);
  20802. } else {
  20803. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  20804. }
  20805. }
  20806. return $repos;
  20807. }
  20808. }
  20809. <?php
  20810. namespace Composer\Repository;
  20811. use Composer\Package\PackageInterface;
  20812. interface RepositoryInterface extends \Countable
  20813. {
  20814. const SEARCH_FULLTEXT = 0;
  20815. const SEARCH_NAME = 1;
  20816. public function hasPackage(PackageInterface $package);
  20817. public function findPackage($name, $constraint);
  20818. public function findPackages($name, $constraint = null);
  20819. public function getPackages();
  20820. public function search($query, $mode = 0);
  20821. }
  20822. <?php
  20823. namespace Composer\Repository;
  20824. use Composer\IO\IOInterface;
  20825. use Composer\Config;
  20826. use Composer\EventDispatcher\EventDispatcher;
  20827. use Composer\Package\PackageInterface;
  20828. use Composer\Util\RemoteFilesystem;
  20829. class RepositoryManager
  20830. {
  20831. private $localRepository;
  20832. private $repositories = array();
  20833. private $repositoryClasses = array();
  20834. private $io;
  20835. private $config;
  20836. private $eventDispatcher;
  20837. private $rfs;
  20838. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20839. {
  20840. $this->io = $io;
  20841. $this->config = $config;
  20842. $this->eventDispatcher = $eventDispatcher;
  20843. $this->rfs = $rfs;
  20844. }
  20845. public function findPackage($name, $constraint)
  20846. {
  20847. foreach ($this->repositories as $repository) {
  20848. if ($package = $repository->findPackage($name, $constraint)) {
  20849. return $package;
  20850. }
  20851. }
  20852. return null;
  20853. }
  20854. public function findPackages($name, $constraint)
  20855. {
  20856. $packages = array();
  20857. foreach ($this->repositories as $repository) {
  20858. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  20859. }
  20860. return $packages;
  20861. }
  20862. public function addRepository(RepositoryInterface $repository)
  20863. {
  20864. $this->repositories[] = $repository;
  20865. }
  20866. public function prependRepository(RepositoryInterface $repository)
  20867. {
  20868. array_unshift($this->repositories, $repository);
  20869. }
  20870. public function createRepository($type, $config, $name = null)
  20871. {
  20872. if (!isset($this->repositoryClasses[$type])) {
  20873. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  20874. }
  20875. if (isset($config['packagist']) && false === $config['packagist']) {
  20876. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  20877. }
  20878. $class = $this->repositoryClasses[$type];
  20879. $reflMethod = new \ReflectionMethod($class, '__construct');
  20880. $params = $reflMethod->getParameters();
  20881. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  20882. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  20883. }
  20884. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  20885. }
  20886. public function setRepositoryClass($type, $class)
  20887. {
  20888. $this->repositoryClasses[$type] = $class;
  20889. }
  20890. public function getRepositories()
  20891. {
  20892. return $this->repositories;
  20893. }
  20894. public function setLocalRepository(WritableRepositoryInterface $repository)
  20895. {
  20896. $this->localRepository = $repository;
  20897. }
  20898. public function getLocalRepository()
  20899. {
  20900. return $this->localRepository;
  20901. }
  20902. }
  20903. <?php
  20904. namespace Composer\Repository;
  20905. class RepositorySecurityException extends \Exception
  20906. {
  20907. }
  20908. <?php
  20909. namespace Composer\Repository\Vcs;
  20910. use Composer\Cache;
  20911. use Composer\Downloader\TransportException;
  20912. use Composer\Json\JsonFile;
  20913. use Composer\Util\Bitbucket;
  20914. abstract class BitbucketDriver extends VcsDriver
  20915. {
  20916. protected $cache;
  20917. protected $owner;
  20918. protected $repository;
  20919. protected $hasIssues;
  20920. protected $rootIdentifier;
  20921. protected $tags;
  20922. protected $branches;
  20923. protected $infoCache = array();
  20924. protected $branchesUrl = '';
  20925. protected $tagsUrl = '';
  20926. protected $homeUrl = '';
  20927. protected $website = '';
  20928. protected $cloneHttpsUrl = '';
  20929. protected $fallbackDriver;
  20930. protected $vcsType;
  20931. public function initialize()
  20932. {
  20933. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  20934. $this->owner = $match[1];
  20935. $this->repository = $match[2];
  20936. $this->originUrl = 'bitbucket.org';
  20937. $this->cache = new Cache(
  20938. $this->io,
  20939. implode('/', array(
  20940. $this->config->get('cache-repo-dir'),
  20941. $this->originUrl,
  20942. $this->owner,
  20943. $this->repository,
  20944. ))
  20945. );
  20946. }
  20947. public function getUrl()
  20948. {
  20949. if ($this->fallbackDriver) {
  20950. return $this->fallbackDriver->getUrl();
  20951. }
  20952. return $this->cloneHttpsUrl;
  20953. }
  20954. protected function getRepoData()
  20955. {
  20956. $resource = sprintf(
  20957. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  20958. $this->owner,
  20959. $this->repository,
  20960. http_build_query(
  20961. array('fields' => '-project,-owner'),
  20962. null,
  20963. '&'
  20964. )
  20965. );
  20966. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  20967. if ($this->fallbackDriver) {
  20968. return false;
  20969. }
  20970. $this->parseCloneUrls($repoData['links']['clone']);
  20971. $this->hasIssues = !empty($repoData['has_issues']);
  20972. $this->branchesUrl = $repoData['links']['branches']['href'];
  20973. $this->tagsUrl = $repoData['links']['tags']['href'];
  20974. $this->homeUrl = $repoData['links']['html']['href'];
  20975. $this->website = $repoData['website'];
  20976. $this->vcsType = $repoData['scm'];
  20977. return true;
  20978. }
  20979. public function getComposerInformation($identifier)
  20980. {
  20981. if ($this->fallbackDriver) {
  20982. return $this->fallbackDriver->getComposerInformation($identifier);
  20983. }
  20984. if (!isset($this->infoCache[$identifier])) {
  20985. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  20986. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  20987. }
  20988. $composer = $this->getBaseComposerInformation($identifier);
  20989. if (!isset($composer['support']['source'])) {
  20990. $label = array_search(
  20991. $identifier,
  20992. $this->getTags()
  20993. ) ?: array_search(
  20994. $identifier,
  20995. $this->getBranches()
  20996. ) ?: $identifier;
  20997. if (array_key_exists($label, $tags = $this->getTags())) {
  20998. $hash = $tags[$label];
  20999. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  21000. $hash = $branches[$label];
  21001. }
  21002. if (! isset($hash)) {
  21003. $composer['support']['source'] = sprintf(
  21004. 'https://%s/%s/%s/src',
  21005. $this->originUrl,
  21006. $this->owner,
  21007. $this->repository
  21008. );
  21009. } else {
  21010. $composer['support']['source'] = sprintf(
  21011. 'https://%s/%s/%s/src/%s/?at=%s',
  21012. $this->originUrl,
  21013. $this->owner,
  21014. $this->repository,
  21015. $hash,
  21016. $label
  21017. );
  21018. }
  21019. }
  21020. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  21021. $composer['support']['issues'] = sprintf(
  21022. 'https://%s/%s/%s/issues',
  21023. $this->originUrl,
  21024. $this->owner,
  21025. $this->repository
  21026. );
  21027. }
  21028. if (!isset($composer['homepage'])) {
  21029. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  21030. }
  21031. $this->infoCache[$identifier] = $composer;
  21032. if ($this->shouldCache($identifier)) {
  21033. $this->cache->write($identifier, json_encode($composer));
  21034. }
  21035. }
  21036. return $this->infoCache[$identifier];
  21037. }
  21038. public function getFileContent($file, $identifier)
  21039. {
  21040. if ($this->fallbackDriver) {
  21041. return $this->fallbackDriver->getFileContent($file, $identifier);
  21042. }
  21043. $resource = sprintf(
  21044. 'https://api.bitbucket.org/1.0/repositories/%s/%s/raw/%s/%s',
  21045. $this->owner,
  21046. $this->repository,
  21047. $identifier,
  21048. $file
  21049. );
  21050. return $this->getContentsWithOAuthCredentials($resource);
  21051. }
  21052. public function getChangeDate($identifier)
  21053. {
  21054. if ($this->fallbackDriver) {
  21055. return $this->fallbackDriver->getChangeDate($identifier);
  21056. }
  21057. $resource = sprintf(
  21058. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  21059. $this->owner,
  21060. $this->repository,
  21061. $identifier
  21062. );
  21063. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21064. return new \DateTime($commit['date']);
  21065. }
  21066. public function getSource($identifier)
  21067. {
  21068. if ($this->fallbackDriver) {
  21069. return $this->fallbackDriver->getSource($identifier);
  21070. }
  21071. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  21072. }
  21073. public function getDist($identifier)
  21074. {
  21075. if ($this->fallbackDriver) {
  21076. return $this->fallbackDriver->getDist($identifier);
  21077. }
  21078. $url = sprintf(
  21079. 'https://bitbucket.org/%s/%s/get/%s.zip',
  21080. $this->owner,
  21081. $this->repository,
  21082. $identifier
  21083. );
  21084. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21085. }
  21086. public function getTags()
  21087. {
  21088. if ($this->fallbackDriver) {
  21089. return $this->fallbackDriver->getTags();
  21090. }
  21091. if (null === $this->tags) {
  21092. $this->tags = array();
  21093. $resource = sprintf(
  21094. '%s?%s',
  21095. $this->tagsUrl,
  21096. http_build_query(
  21097. array(
  21098. 'pagelen' => 100,
  21099. 'fields' => 'values.name,values.target.hash,next',
  21100. 'sort' => '-target.date',
  21101. ),
  21102. null,
  21103. '&'
  21104. )
  21105. );
  21106. $hasNext = true;
  21107. while ($hasNext) {
  21108. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21109. foreach ($tagsData['values'] as $data) {
  21110. $this->tags[$data['name']] = $data['target']['hash'];
  21111. }
  21112. if (empty($tagsData['next'])) {
  21113. $hasNext = false;
  21114. } else {
  21115. $resource = $tagsData['next'];
  21116. }
  21117. }
  21118. if ($this->vcsType === 'hg') {
  21119. unset($this->tags['tip']);
  21120. }
  21121. }
  21122. return $this->tags;
  21123. }
  21124. public function getBranches()
  21125. {
  21126. if ($this->fallbackDriver) {
  21127. return $this->fallbackDriver->getBranches();
  21128. }
  21129. if (null === $this->branches) {
  21130. $this->branches = array();
  21131. $resource = sprintf(
  21132. '%s?%s',
  21133. $this->branchesUrl,
  21134. http_build_query(
  21135. array(
  21136. 'pagelen' => 100,
  21137. 'fields' => 'values.name,values.target.hash,values.heads,next',
  21138. 'sort' => '-target.date',
  21139. ),
  21140. null,
  21141. '&'
  21142. )
  21143. );
  21144. $hasNext = true;
  21145. while ($hasNext) {
  21146. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21147. foreach ($branchData['values'] as $data) {
  21148. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  21149. continue;
  21150. }
  21151. $this->branches[$data['name']] = $data['target']['hash'];
  21152. }
  21153. if (empty($branchData['next'])) {
  21154. $hasNext = false;
  21155. } else {
  21156. $resource = $branchData['next'];
  21157. }
  21158. }
  21159. }
  21160. return $this->branches;
  21161. }
  21162. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  21163. {
  21164. try {
  21165. return parent::getContents($url);
  21166. } catch (TransportException $e) {
  21167. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  21168. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  21169. if (!$this->io->hasAuthentication($this->originUrl)
  21170. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  21171. ) {
  21172. return parent::getContents($url);
  21173. }
  21174. if (!$this->io->isInteractive() && $fetchingRepoData) {
  21175. return $this->attemptCloneFallback();
  21176. }
  21177. }
  21178. throw $e;
  21179. }
  21180. }
  21181. abstract protected function generateSshUrl();
  21182. protected function attemptCloneFallback()
  21183. {
  21184. try {
  21185. $this->setupFallbackDriver($this->generateSshUrl());
  21186. } catch (\RuntimeException $e) {
  21187. $this->fallbackDriver = null;
  21188. $this->io->writeError(
  21189. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  21190. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  21191. );
  21192. throw $e;
  21193. }
  21194. }
  21195. abstract protected function setupFallbackDriver($url);
  21196. protected function parseCloneUrls(array $cloneLinks)
  21197. {
  21198. foreach ($cloneLinks as $cloneLink) {
  21199. if ($cloneLink['name'] === 'https') {
  21200. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  21201. }
  21202. }
  21203. }
  21204. protected function getMainBranchData()
  21205. {
  21206. $resource = sprintf(
  21207. 'https://api.bitbucket.org/1.0/repositories/%s/%s/main-branch',
  21208. $this->owner,
  21209. $this->repository
  21210. );
  21211. return JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21212. }
  21213. }
  21214. <?php
  21215. namespace Composer\Repository\Vcs;
  21216. use Composer\Config;
  21217. use Composer\Util\ProcessExecutor;
  21218. use Composer\Util\Filesystem;
  21219. use Composer\IO\IOInterface;
  21220. class FossilDriver extends VcsDriver
  21221. {
  21222. protected $tags;
  21223. protected $branches;
  21224. protected $rootIdentifier;
  21225. protected $repoFile;
  21226. protected $checkoutDir;
  21227. protected $infoCache = array();
  21228. public function initialize()
  21229. {
  21230. if (Filesystem::isLocalPath($this->url)) {
  21231. $this->checkoutDir = $this->url;
  21232. } else {
  21233. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '.fossil';
  21234. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  21235. $fs = new Filesystem();
  21236. $fs->ensureDirectoryExists($this->checkoutDir);
  21237. if (!is_writable(dirname($this->checkoutDir))) {
  21238. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  21239. }
  21240. $this->config->prohibitUrlByConfig($this->url, $this->io);
  21241. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  21242. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  21243. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  21244. }
  21245. } else {
  21246. $fs->removeDirectory($this->checkoutDir);
  21247. $fs->remove($this->repoFile);
  21248. $fs->ensureDirectoryExists($this->checkoutDir);
  21249. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  21250. $output = $this->process->getErrorOutput();
  21251. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  21252. throw new \RuntimeException('Failed to clone '.$this->url.', fossil was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  21253. }
  21254. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  21255. }
  21256. if (0 !== $this->process->execute(sprintf('fossil open %s', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  21257. $output = $this->process->getErrorOutput();
  21258. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  21259. }
  21260. }
  21261. }
  21262. $this->getTags();
  21263. $this->getBranches();
  21264. }
  21265. public function getRootIdentifier()
  21266. {
  21267. if (null === $this->rootIdentifier) {
  21268. $this->rootIdentifier = 'trunk';
  21269. }
  21270. return $this->rootIdentifier;
  21271. }
  21272. public function getUrl()
  21273. {
  21274. return $this->url;
  21275. }
  21276. public function getSource($identifier)
  21277. {
  21278. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  21279. }
  21280. public function getDist($identifier)
  21281. {
  21282. return null;
  21283. }
  21284. public function getFileContent($file, $identifier)
  21285. {
  21286. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21287. $this->process->execute($command, $content, $this->checkoutDir);
  21288. if (!trim($content)) {
  21289. return null;
  21290. }
  21291. return $content;
  21292. }
  21293. public function getChangeDate($identifier)
  21294. {
  21295. $this->process->execute(sprintf('fossil finfo composer.json | head -n 2 | tail -n 1 | awk \'{print $1}\''), $output, $this->checkoutDir);
  21296. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  21297. }
  21298. public function getTags()
  21299. {
  21300. if (null === $this->tags) {
  21301. $tags = array();
  21302. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  21303. foreach ($this->process->splitLines($output) as $tag) {
  21304. $tags[$tag] = $tag;
  21305. }
  21306. $this->tags = $tags;
  21307. }
  21308. return $this->tags;
  21309. }
  21310. public function getBranches()
  21311. {
  21312. if (null === $this->branches) {
  21313. $branches = array();
  21314. $bookmarks = array();
  21315. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  21316. foreach ($this->process->splitLines($output) as $branch) {
  21317. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  21318. $branches[$branch] = $branch;
  21319. }
  21320. $this->branches = $branches;
  21321. }
  21322. return $this->branches;
  21323. }
  21324. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21325. {
  21326. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  21327. return true;
  21328. }
  21329. if (preg_match('!/fossil/|\.fossil!', $url)) {
  21330. return true;
  21331. }
  21332. if (Filesystem::isLocalPath($url)) {
  21333. $url = Filesystem::getPlatformPath($url);
  21334. if (!is_dir($url)) {
  21335. return false;
  21336. }
  21337. $process = new ProcessExecutor();
  21338. if ($process->execute('fossil info', $output, $url) === 0) {
  21339. return true;
  21340. }
  21341. }
  21342. return false;
  21343. }
  21344. }
  21345. <?php
  21346. namespace Composer\Repository\Vcs;
  21347. use Composer\Config;
  21348. use Composer\IO\IOInterface;
  21349. class GitBitbucketDriver extends BitbucketDriver
  21350. {
  21351. public function getRootIdentifier()
  21352. {
  21353. if ($this->fallbackDriver) {
  21354. return $this->fallbackDriver->getRootIdentifier();
  21355. }
  21356. if (null === $this->rootIdentifier) {
  21357. if (! $this->getRepoData()) {
  21358. return $this->fallbackDriver->getRootIdentifier();
  21359. }
  21360. if ($this->vcsType !== 'git') {
  21361. throw new \RuntimeException(
  21362. $this->url.' does not appear to be a git repository, use '.
  21363. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  21364. );
  21365. }
  21366. $mainBranchData = $this->getMainBranchData();
  21367. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  21368. }
  21369. return $this->rootIdentifier;
  21370. }
  21371. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21372. {
  21373. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  21374. return false;
  21375. }
  21376. if (!extension_loaded('openssl')) {
  21377. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21378. return false;
  21379. }
  21380. return true;
  21381. }
  21382. protected function setupFallbackDriver($url)
  21383. {
  21384. $this->fallbackDriver = new GitDriver(
  21385. array('url' => $url),
  21386. $this->io,
  21387. $this->config,
  21388. $this->process,
  21389. $this->remoteFilesystem
  21390. );
  21391. $this->fallbackDriver->initialize();
  21392. }
  21393. protected function generateSshUrl()
  21394. {
  21395. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  21396. }
  21397. }
  21398. <?php
  21399. namespace Composer\Repository\Vcs;
  21400. use Composer\Util\ProcessExecutor;
  21401. use Composer\Util\Filesystem;
  21402. use Composer\Util\Git as GitUtil;
  21403. use Composer\IO\IOInterface;
  21404. use Composer\Cache;
  21405. use Composer\Config;
  21406. class GitDriver extends VcsDriver
  21407. {
  21408. protected $cache;
  21409. protected $tags;
  21410. protected $branches;
  21411. protected $rootIdentifier;
  21412. protected $repoDir;
  21413. protected $infoCache = array();
  21414. public function initialize()
  21415. {
  21416. if (Filesystem::isLocalPath($this->url)) {
  21417. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  21418. $this->repoDir = $this->url;
  21419. $cacheUrl = realpath($this->url);
  21420. } else {
  21421. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  21422. GitUtil::cleanEnv();
  21423. $fs = new Filesystem();
  21424. $fs->ensureDirectoryExists(dirname($this->repoDir));
  21425. if (!is_writable(dirname($this->repoDir))) {
  21426. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  21427. }
  21428. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  21429. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://[email protected]:22/path or just [email protected]:path if you do not want to provide a password or custom port.');
  21430. }
  21431. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  21432. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  21433. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  21434. }
  21435. $cacheUrl = $this->url;
  21436. }
  21437. $this->getTags();
  21438. $this->getBranches();
  21439. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  21440. }
  21441. public function getRootIdentifier()
  21442. {
  21443. if (null === $this->rootIdentifier) {
  21444. $this->rootIdentifier = 'master';
  21445. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  21446. $branches = $this->process->splitLines($output);
  21447. if (!in_array('* master', $branches)) {
  21448. foreach ($branches as $branch) {
  21449. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  21450. $this->rootIdentifier = $match[1];
  21451. break;
  21452. }
  21453. }
  21454. }
  21455. }
  21456. return $this->rootIdentifier;
  21457. }
  21458. public function getUrl()
  21459. {
  21460. return $this->url;
  21461. }
  21462. public function getSource($identifier)
  21463. {
  21464. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  21465. }
  21466. public function getDist($identifier)
  21467. {
  21468. return null;
  21469. }
  21470. public function getFileContent($file, $identifier)
  21471. {
  21472. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21473. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  21474. if (!trim($content)) {
  21475. return null;
  21476. }
  21477. return $content;
  21478. }
  21479. public function getChangeDate($identifier)
  21480. {
  21481. $this->process->execute(sprintf(
  21482. 'git log -1 --format=%%at %s',
  21483. ProcessExecutor::escape($identifier)
  21484. ), $output, $this->repoDir);
  21485. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  21486. }
  21487. public function getTags()
  21488. {
  21489. if (null === $this->tags) {
  21490. $this->tags = array();
  21491. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  21492. foreach ($output = $this->process->splitLines($output) as $tag) {
  21493. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  21494. $this->tags[$match[2]] = $match[1];
  21495. }
  21496. }
  21497. }
  21498. return $this->tags;
  21499. }
  21500. public function getBranches()
  21501. {
  21502. if (null === $this->branches) {
  21503. $branches = array();
  21504. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  21505. foreach ($this->process->splitLines($output) as $branch) {
  21506. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  21507. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  21508. $branches[$match[1]] = $match[2];
  21509. }
  21510. }
  21511. }
  21512. $this->branches = $branches;
  21513. }
  21514. return $this->branches;
  21515. }
  21516. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21517. {
  21518. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  21519. return true;
  21520. }
  21521. if (Filesystem::isLocalPath($url)) {
  21522. $url = Filesystem::getPlatformPath($url);
  21523. if (!is_dir($url)) {
  21524. return false;
  21525. }
  21526. $process = new ProcessExecutor($io);
  21527. if ($process->execute('git tag', $output, $url) === 0) {
  21528. return true;
  21529. }
  21530. }
  21531. if (!$deep) {
  21532. return false;
  21533. }
  21534. $process = new ProcessExecutor($io);
  21535. if ($process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0) {
  21536. return true;
  21537. }
  21538. return false;
  21539. }
  21540. }
  21541. <?php
  21542. namespace Composer\Repository\Vcs;
  21543. use Composer\Config;
  21544. use Composer\Downloader\TransportException;
  21545. use Composer\Json\JsonFile;
  21546. use Composer\Cache;
  21547. use Composer\IO\IOInterface;
  21548. use Composer\Util\GitHub;
  21549. class GitHubDriver extends VcsDriver
  21550. {
  21551. protected $cache;
  21552. protected $owner;
  21553. protected $repository;
  21554. protected $tags;
  21555. protected $branches;
  21556. protected $rootIdentifier;
  21557. protected $repoData;
  21558. protected $hasIssues;
  21559. protected $infoCache = array();
  21560. protected $isPrivate = false;
  21561. protected $gitDriver;
  21562. public function initialize()
  21563. {
  21564. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  21565. $this->owner = $match[3];
  21566. $this->repository = $match[4];
  21567. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  21568. if ($this->originUrl === 'www.github.com') {
  21569. $this->originUrl = 'github.com';
  21570. }
  21571. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  21572. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  21573. $this->setupGitDriver($this->url);
  21574. return;
  21575. }
  21576. $this->fetchRootIdentifier();
  21577. }
  21578. public function getRepositoryUrl()
  21579. {
  21580. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  21581. }
  21582. public function getRootIdentifier()
  21583. {
  21584. if ($this->gitDriver) {
  21585. return $this->gitDriver->getRootIdentifier();
  21586. }
  21587. return $this->rootIdentifier;
  21588. }
  21589. public function getUrl()
  21590. {
  21591. if ($this->gitDriver) {
  21592. return $this->gitDriver->getUrl();
  21593. }
  21594. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  21595. }
  21596. protected function getApiUrl()
  21597. {
  21598. if ('github.com' === $this->originUrl) {
  21599. $apiUrl = 'api.github.com';
  21600. } else {
  21601. $apiUrl = $this->originUrl . '/api/v3';
  21602. }
  21603. return 'https://' . $apiUrl;
  21604. }
  21605. public function getSource($identifier)
  21606. {
  21607. if ($this->gitDriver) {
  21608. return $this->gitDriver->getSource($identifier);
  21609. }
  21610. if ($this->isPrivate) {
  21611. $url = $this->generateSshUrl();
  21612. } else {
  21613. $url = $this->getUrl();
  21614. }
  21615. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  21616. }
  21617. public function getDist($identifier)
  21618. {
  21619. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  21620. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21621. }
  21622. public function getComposerInformation($identifier)
  21623. {
  21624. if ($this->gitDriver) {
  21625. return $this->gitDriver->getComposerInformation($identifier);
  21626. }
  21627. if (!isset($this->infoCache[$identifier])) {
  21628. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  21629. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  21630. }
  21631. $composer = $this->getBaseComposerInformation($identifier);
  21632. if ($composer) {
  21633. if (!isset($composer['support']['source'])) {
  21634. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  21635. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  21636. }
  21637. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  21638. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  21639. }
  21640. }
  21641. if ($this->shouldCache($identifier)) {
  21642. $this->cache->write($identifier, json_encode($composer));
  21643. }
  21644. $this->infoCache[$identifier] = $composer;
  21645. }
  21646. return $this->infoCache[$identifier];
  21647. }
  21648. public function getFileContent($file, $identifier)
  21649. {
  21650. if ($this->gitDriver) {
  21651. return $this->gitDriver->getFileContent($file, $identifier);
  21652. }
  21653. $notFoundRetries = 2;
  21654. while ($notFoundRetries) {
  21655. try {
  21656. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  21657. $resource = JsonFile::parseJson($this->getContents($resource));
  21658. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  21659. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  21660. }
  21661. return $content;
  21662. } catch (TransportException $e) {
  21663. if (404 !== $e->getCode()) {
  21664. throw $e;
  21665. }
  21666. $notFoundRetries--;
  21667. return null;
  21668. }
  21669. }
  21670. return null;
  21671. }
  21672. public function getChangeDate($identifier)
  21673. {
  21674. if ($this->gitDriver) {
  21675. return $this->gitDriver->getChangeDate($identifier);
  21676. }
  21677. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  21678. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  21679. return new \DateTime($commit['commit']['committer']['date']);
  21680. }
  21681. public function getTags()
  21682. {
  21683. if ($this->gitDriver) {
  21684. return $this->gitDriver->getTags();
  21685. }
  21686. if (null === $this->tags) {
  21687. $this->tags = array();
  21688. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  21689. do {
  21690. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  21691. foreach ($tagsData as $tag) {
  21692. $this->tags[$tag['name']] = $tag['commit']['sha'];
  21693. }
  21694. $resource = $this->getNextPage();
  21695. } while ($resource);
  21696. }
  21697. return $this->tags;
  21698. }
  21699. public function getBranches()
  21700. {
  21701. if ($this->gitDriver) {
  21702. return $this->gitDriver->getBranches();
  21703. }
  21704. if (null === $this->branches) {
  21705. $this->branches = array();
  21706. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  21707. $branchBlacklist = array('gh-pages');
  21708. do {
  21709. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  21710. foreach ($branchData as $branch) {
  21711. $name = substr($branch['ref'], 11);
  21712. if (!in_array($name, $branchBlacklist)) {
  21713. $this->branches[$name] = $branch['object']['sha'];
  21714. }
  21715. }
  21716. $resource = $this->getNextPage();
  21717. } while ($resource);
  21718. }
  21719. return $this->branches;
  21720. }
  21721. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21722. {
  21723. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  21724. return false;
  21725. }
  21726. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  21727. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  21728. return false;
  21729. }
  21730. if (!extension_loaded('openssl')) {
  21731. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21732. return false;
  21733. }
  21734. return true;
  21735. }
  21736. public function getRepoData()
  21737. {
  21738. $this->fetchRootIdentifier();
  21739. return $this->repoData;
  21740. }
  21741. protected function generateSshUrl()
  21742. {
  21743. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  21744. }
  21745. protected function getContents($url, $fetchingRepoData = false)
  21746. {
  21747. try {
  21748. return parent::getContents($url);
  21749. } catch (TransportException $e) {
  21750. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  21751. switch ($e->getCode()) {
  21752. case 401:
  21753. case 404:
  21754. if (!$fetchingRepoData) {
  21755. throw $e;
  21756. }
  21757. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  21758. return parent::getContents($url);
  21759. }
  21760. if (!$this->io->isInteractive()) {
  21761. return $this->attemptCloneFallback();
  21762. }
  21763. $scopesIssued = array();
  21764. $scopesNeeded = array();
  21765. if ($headers = $e->getHeaders()) {
  21766. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  21767. $scopesIssued = explode(' ', $scopes);
  21768. }
  21769. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  21770. $scopesNeeded = explode(' ', $scopes);
  21771. }
  21772. }
  21773. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  21774. if (!$headers || count($scopesFailed)) {
  21775. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  21776. }
  21777. return parent::getContents($url);
  21778. case 403:
  21779. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  21780. return parent::getContents($url);
  21781. }
  21782. if (!$this->io->isInteractive() && $fetchingRepoData) {
  21783. return $this->attemptCloneFallback();
  21784. }
  21785. $rateLimited = false;
  21786. foreach ($e->getHeaders() as $header) {
  21787. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  21788. $rateLimited = true;
  21789. }
  21790. }
  21791. if (!$this->io->hasAuthentication($this->originUrl)) {
  21792. if (!$this->io->isInteractive()) {
  21793. $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>');
  21794. throw $e;
  21795. }
  21796. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  21797. return parent::getContents($url);
  21798. }
  21799. if ($rateLimited) {
  21800. $rateLimit = $this->getRateLimit($e->getHeaders());
  21801. $this->io->writeError(sprintf(
  21802. '<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>',
  21803. $rateLimit['limit'],
  21804. $rateLimit['reset']
  21805. ));
  21806. }
  21807. throw $e;
  21808. default:
  21809. throw $e;
  21810. }
  21811. }
  21812. }
  21813. protected function getRateLimit(array $headers)
  21814. {
  21815. $rateLimit = array(
  21816. 'limit' => '?',
  21817. 'reset' => '?',
  21818. );
  21819. foreach ($headers as $header) {
  21820. $header = trim($header);
  21821. if (false === strpos($header, 'X-RateLimit-')) {
  21822. continue;
  21823. }
  21824. list($type, $value) = explode(':', $header, 2);
  21825. switch ($type) {
  21826. case 'X-RateLimit-Limit':
  21827. $rateLimit['limit'] = (int) trim($value);
  21828. break;
  21829. case 'X-RateLimit-Reset':
  21830. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  21831. break;
  21832. }
  21833. }
  21834. return $rateLimit;
  21835. }
  21836. protected function fetchRootIdentifier()
  21837. {
  21838. if ($this->repoData) {
  21839. return;
  21840. }
  21841. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  21842. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  21843. if (null === $this->repoData && null !== $this->gitDriver) {
  21844. return;
  21845. }
  21846. $this->owner = $this->repoData['owner']['login'];
  21847. $this->repository = $this->repoData['name'];
  21848. $this->isPrivate = !empty($this->repoData['private']);
  21849. if (isset($this->repoData['default_branch'])) {
  21850. $this->rootIdentifier = $this->repoData['default_branch'];
  21851. } elseif (isset($this->repoData['master_branch'])) {
  21852. $this->rootIdentifier = $this->repoData['master_branch'];
  21853. } else {
  21854. $this->rootIdentifier = 'master';
  21855. }
  21856. $this->hasIssues = !empty($this->repoData['has_issues']);
  21857. }
  21858. protected function attemptCloneFallback()
  21859. {
  21860. $this->isPrivate = true;
  21861. try {
  21862. $this->setupGitDriver($this->generateSshUrl());
  21863. return;
  21864. } catch (\RuntimeException $e) {
  21865. $this->gitDriver = null;
  21866. $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>');
  21867. throw $e;
  21868. }
  21869. }
  21870. protected function setupGitDriver($url)
  21871. {
  21872. $this->gitDriver = new GitDriver(
  21873. array('url' => $url),
  21874. $this->io,
  21875. $this->config,
  21876. $this->process,
  21877. $this->remoteFilesystem
  21878. );
  21879. $this->gitDriver->initialize();
  21880. }
  21881. protected function getNextPage()
  21882. {
  21883. $headers = $this->remoteFilesystem->getLastHeaders();
  21884. foreach ($headers as $header) {
  21885. if (substr($header, 0, 5) === 'Link:') {
  21886. $links = explode(',', substr($header, 5));
  21887. foreach ($links as $link) {
  21888. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  21889. return $match[1];
  21890. }
  21891. }
  21892. }
  21893. }
  21894. }
  21895. }
  21896. <?php
  21897. namespace Composer\Repository\Vcs;
  21898. use Composer\Config;
  21899. use Composer\Cache;
  21900. use Composer\IO\IOInterface;
  21901. use Composer\Json\JsonFile;
  21902. use Composer\Downloader\TransportException;
  21903. use Composer\Util\RemoteFilesystem;
  21904. use Composer\Util\GitLab;
  21905. class GitLabDriver extends VcsDriver
  21906. {
  21907. private $scheme;
  21908. private $owner;
  21909. private $repository;
  21910. private $project;
  21911. private $commits = array();
  21912. private $tags;
  21913. private $branches;
  21914. protected $gitDriver;
  21915. private $isPrivate = true;
  21916. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)/|git@(?P<domain2>[^:]+):)(?P<owner>[^/]+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  21917. public function initialize()
  21918. {
  21919. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  21920. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  21921. }
  21922. $this->scheme = !empty($match['scheme']) ? $match['scheme'] : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https');
  21923. $this->originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  21924. $this->owner = $match['owner'];
  21925. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  21926. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  21927. $this->fetchProject();
  21928. }
  21929. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  21930. {
  21931. $this->remoteFilesystem = $remoteFilesystem;
  21932. }
  21933. public function getFileContent($file, $identifier)
  21934. {
  21935. if ($this->gitDriver) {
  21936. return $this->gitDriver->getFileContent($file, $identifier);
  21937. }
  21938. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  21939. $branches = $this->getBranches();
  21940. if (isset($branches[$identifier])) {
  21941. $identifier = $branches[$identifier];
  21942. }
  21943. }
  21944. $resource = $this->getApiUrl().'/repository/blobs/'.$identifier.'?filepath=' . $file;
  21945. try {
  21946. $content = $this->getContents($resource);
  21947. } catch (TransportException $e) {
  21948. if ($e->getCode() !== 404) {
  21949. throw $e;
  21950. }
  21951. return null;
  21952. }
  21953. return $content;
  21954. }
  21955. public function getChangeDate($identifier)
  21956. {
  21957. if ($this->gitDriver) {
  21958. return $this->gitDriver->getChangeDate($identifier);
  21959. }
  21960. if (isset($this->commits[$identifier])) {
  21961. return new \DateTime($this->commits[$identifier]['committed_date']);
  21962. }
  21963. return new \DateTime();
  21964. }
  21965. public function getRepositoryUrl()
  21966. {
  21967. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  21968. }
  21969. public function getUrl()
  21970. {
  21971. if ($this->gitDriver) {
  21972. return $this->gitDriver->getUrl();
  21973. }
  21974. return $this->project['web_url'];
  21975. }
  21976. public function getDist($identifier)
  21977. {
  21978. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  21979. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21980. }
  21981. public function getSource($identifier)
  21982. {
  21983. if ($this->gitDriver) {
  21984. return $this->gitDriver->getSource($identifier);
  21985. }
  21986. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  21987. }
  21988. public function getRootIdentifier()
  21989. {
  21990. if ($this->gitDriver) {
  21991. return $this->gitDriver->getRootIdentifier();
  21992. }
  21993. return $this->project['default_branch'];
  21994. }
  21995. public function getBranches()
  21996. {
  21997. if ($this->gitDriver) {
  21998. return $this->gitDriver->getBranches();
  21999. }
  22000. if (!$this->branches) {
  22001. $this->branches = $this->getReferences('branches');
  22002. }
  22003. return $this->branches;
  22004. }
  22005. public function getTags()
  22006. {
  22007. if ($this->gitDriver) {
  22008. return $this->gitDriver->getTags();
  22009. }
  22010. if (!$this->tags) {
  22011. $this->tags = $this->getReferences('tags');
  22012. }
  22013. return $this->tags;
  22014. }
  22015. public function getApiUrl()
  22016. {
  22017. return $this->scheme.'://'.$this->originUrl.'/api/v3/projects/'.$this->urlEncodeAll($this->owner).'%2F'.$this->urlEncodeAll($this->repository);
  22018. }
  22019. private function urlEncodeAll($string)
  22020. {
  22021. $encoded = '';
  22022. for ($i = 0; isset($string[$i]); $i++) {
  22023. $character = $string[$i];
  22024. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  22025. $character = '%' . sprintf('%02X', ord($character));
  22026. }
  22027. $encoded .= $character;
  22028. }
  22029. return $encoded;
  22030. }
  22031. protected function getReferences($type)
  22032. {
  22033. $resource = $this->getApiUrl().'/repository/'.$type;
  22034. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  22035. $references = array();
  22036. foreach ($data as $datum) {
  22037. $references[$datum['name']] = $datum['commit']['id'];
  22038. $this->commits[$datum['commit']['id']] = $datum['commit'];
  22039. }
  22040. return $references;
  22041. }
  22042. protected function fetchProject()
  22043. {
  22044. $resource = $this->getApiUrl();
  22045. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  22046. $this->isPrivate = !$this->project['public'];
  22047. }
  22048. protected function attemptCloneFallback()
  22049. {
  22050. try {
  22051. if ($this->isPrivate === false) {
  22052. $url = $this->generatePublicUrl();
  22053. } else {
  22054. $url = $this->generateSshUrl();
  22055. }
  22056. $this->setupGitDriver($url);
  22057. return;
  22058. } catch (\RuntimeException $e) {
  22059. $this->gitDriver = null;
  22060. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  22061. throw $e;
  22062. }
  22063. }
  22064. protected function generateSshUrl()
  22065. {
  22066. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  22067. }
  22068. protected function generatePublicUrl()
  22069. {
  22070. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  22071. }
  22072. protected function setupGitDriver($url)
  22073. {
  22074. $this->gitDriver = new GitDriver(
  22075. array('url' => $url),
  22076. $this->io,
  22077. $this->config,
  22078. $this->process,
  22079. $this->remoteFilesystem
  22080. );
  22081. $this->gitDriver->initialize();
  22082. }
  22083. protected function getContents($url, $fetchingRepoData = false)
  22084. {
  22085. try {
  22086. $res = parent::getContents($url);
  22087. if ($fetchingRepoData) {
  22088. $json = JsonFile::parseJson($res, $url);
  22089. if (!isset($json['default_branch'])) {
  22090. if (!empty($json['id'])) {
  22091. $this->isPrivate = false;
  22092. }
  22093. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  22094. }
  22095. }
  22096. return $res;
  22097. } catch (TransportException $e) {
  22098. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22099. switch ($e->getCode()) {
  22100. case 401:
  22101. case 404:
  22102. if (!$fetchingRepoData) {
  22103. throw $e;
  22104. }
  22105. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  22106. return parent::getContents($url);
  22107. }
  22108. if (!$this->io->isInteractive()) {
  22109. return $this->attemptCloneFallback();
  22110. }
  22111. $this->io->writeError('<warning>Failed to download ' . $this->owner . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  22112. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  22113. return parent::getContents($url);
  22114. case 403:
  22115. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  22116. return parent::getContents($url);
  22117. }
  22118. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22119. return $this->attemptCloneFallback();
  22120. }
  22121. throw $e;
  22122. default:
  22123. throw $e;
  22124. }
  22125. }
  22126. }
  22127. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22128. {
  22129. if (!preg_match(self::URL_REGEX, $url, $match)) {
  22130. return false;
  22131. }
  22132. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  22133. $originUrl = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  22134. if (!in_array($originUrl, (array) $config->get('gitlab-domains'))) {
  22135. return false;
  22136. }
  22137. if ('https' === $scheme && !extension_loaded('openssl')) {
  22138. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22139. return false;
  22140. }
  22141. return true;
  22142. }
  22143. }
  22144. <?php
  22145. namespace Composer\Repository\Vcs;
  22146. use Composer\Config;
  22147. use Composer\IO\IOInterface;
  22148. class HgBitbucketDriver extends BitbucketDriver
  22149. {
  22150. public function getRootIdentifier()
  22151. {
  22152. if ($this->fallbackDriver) {
  22153. return $this->fallbackDriver->getRootIdentifier();
  22154. }
  22155. if (null === $this->rootIdentifier) {
  22156. if (! $this->getRepoData()) {
  22157. return $this->fallbackDriver->getRootIdentifier();
  22158. }
  22159. if ($this->vcsType !== 'hg') {
  22160. throw new \RuntimeException(
  22161. $this->url.' does not appear to be a mercurial repository, use '.
  22162. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  22163. );
  22164. }
  22165. $mainBranchData = $this->getMainBranchData();
  22166. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  22167. }
  22168. return $this->rootIdentifier;
  22169. }
  22170. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22171. {
  22172. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  22173. return false;
  22174. }
  22175. if (!extension_loaded('openssl')) {
  22176. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22177. return false;
  22178. }
  22179. return true;
  22180. }
  22181. protected function setupFallbackDriver($url)
  22182. {
  22183. $this->fallbackDriver = new HgDriver(
  22184. array('url' => $url),
  22185. $this->io,
  22186. $this->config,
  22187. $this->process,
  22188. $this->remoteFilesystem
  22189. );
  22190. $this->fallbackDriver->initialize();
  22191. }
  22192. protected function generateSshUrl()
  22193. {
  22194. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  22195. }
  22196. }
  22197. <?php
  22198. namespace Composer\Repository\Vcs;
  22199. use Composer\Config;
  22200. use Composer\Util\ProcessExecutor;
  22201. use Composer\Util\Filesystem;
  22202. use Composer\IO\IOInterface;
  22203. use Symfony\Component\Process\Process;
  22204. class HgDriver extends VcsDriver
  22205. {
  22206. protected $tags;
  22207. protected $branches;
  22208. protected $rootIdentifier;
  22209. protected $repoDir;
  22210. protected $infoCache = array();
  22211. public function initialize()
  22212. {
  22213. if (Filesystem::isLocalPath($this->url)) {
  22214. $this->repoDir = $this->url;
  22215. } else {
  22216. $cacheDir = $this->config->get('cache-vcs-dir');
  22217. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  22218. $fs = new Filesystem();
  22219. $fs->ensureDirectoryExists($cacheDir);
  22220. if (!is_writable(dirname($this->repoDir))) {
  22221. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  22222. }
  22223. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22224. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  22225. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  22226. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22227. }
  22228. } else {
  22229. $fs->removeDirectory($this->repoDir);
  22230. if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoDir)), $output, $cacheDir)) {
  22231. $output = $this->process->getErrorOutput();
  22232. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  22233. 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());
  22234. }
  22235. throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
  22236. }
  22237. }
  22238. }
  22239. $this->getTags();
  22240. $this->getBranches();
  22241. }
  22242. public function getRootIdentifier()
  22243. {
  22244. if (null === $this->rootIdentifier) {
  22245. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  22246. $output = $this->process->splitLines($output);
  22247. $this->rootIdentifier = $output[0];
  22248. }
  22249. return $this->rootIdentifier;
  22250. }
  22251. public function getUrl()
  22252. {
  22253. return $this->url;
  22254. }
  22255. public function getSource($identifier)
  22256. {
  22257. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  22258. }
  22259. public function getDist($identifier)
  22260. {
  22261. return null;
  22262. }
  22263. public function getFileContent($file, $identifier)
  22264. {
  22265. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22266. $this->process->execute(sprintf('hg cat -r %s', $resource), $content, $this->repoDir);
  22267. if (!trim($content)) {
  22268. return;
  22269. }
  22270. return $content;
  22271. }
  22272. public function getChangeDate($identifier)
  22273. {
  22274. $this->process->execute(
  22275. sprintf(
  22276. 'hg log --template "{date|rfc3339date}" -r %s',
  22277. ProcessExecutor::escape($identifier)
  22278. ),
  22279. $output,
  22280. $this->repoDir
  22281. );
  22282. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  22283. }
  22284. public function getTags()
  22285. {
  22286. if (null === $this->tags) {
  22287. $tags = array();
  22288. $this->process->execute('hg tags', $output, $this->repoDir);
  22289. foreach ($this->process->splitLines($output) as $tag) {
  22290. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  22291. $tags[$match[1]] = $match[2];
  22292. }
  22293. }
  22294. unset($tags['tip']);
  22295. $this->tags = $tags;
  22296. }
  22297. return $this->tags;
  22298. }
  22299. public function getBranches()
  22300. {
  22301. if (null === $this->branches) {
  22302. $branches = array();
  22303. $bookmarks = array();
  22304. $this->process->execute('hg branches', $output, $this->repoDir);
  22305. foreach ($this->process->splitLines($output) as $branch) {
  22306. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  22307. $branches[$match[1]] = $match[2];
  22308. }
  22309. }
  22310. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  22311. foreach ($this->process->splitLines($output) as $branch) {
  22312. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  22313. $bookmarks[$match[1]] = $match[2];
  22314. }
  22315. }
  22316. $this->branches = array_merge($bookmarks, $branches);
  22317. }
  22318. return $this->branches;
  22319. }
  22320. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22321. {
  22322. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  22323. return true;
  22324. }
  22325. if (Filesystem::isLocalPath($url)) {
  22326. $url = Filesystem::getPlatformPath($url);
  22327. if (!is_dir($url)) {
  22328. return false;
  22329. }
  22330. $process = new ProcessExecutor();
  22331. if ($process->execute('hg summary', $output, $url) === 0) {
  22332. return true;
  22333. }
  22334. }
  22335. if (!$deep) {
  22336. return false;
  22337. }
  22338. $processExecutor = new ProcessExecutor();
  22339. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  22340. return $exit === 0;
  22341. }
  22342. }
  22343. <?php
  22344. namespace Composer\Repository\Vcs;
  22345. use Composer\Config;
  22346. use Composer\IO\IOInterface;
  22347. use Composer\Util\ProcessExecutor;
  22348. use Composer\Util\Perforce;
  22349. class PerforceDriver extends VcsDriver
  22350. {
  22351. protected $depot;
  22352. protected $branch;
  22353. protected $perforce;
  22354. public function initialize()
  22355. {
  22356. $this->depot = $this->repoConfig['depot'];
  22357. $this->branch = '';
  22358. if (!empty($this->repoConfig['branch'])) {
  22359. $this->branch = $this->repoConfig['branch'];
  22360. }
  22361. $this->initPerforce($this->repoConfig);
  22362. $this->perforce->p4Login();
  22363. $this->perforce->checkStream();
  22364. $this->perforce->writeP4ClientSpec();
  22365. $this->perforce->connectClient();
  22366. return true;
  22367. }
  22368. private function initPerforce($repoConfig)
  22369. {
  22370. if (!empty($this->perforce)) {
  22371. return;
  22372. }
  22373. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  22374. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  22375. }
  22376. public function getFileContent($file, $identifier)
  22377. {
  22378. return $this->perforce->getFileContent($file, $identifier);
  22379. }
  22380. public function getChangeDate($identifier)
  22381. {
  22382. return null;
  22383. }
  22384. public function getRootIdentifier()
  22385. {
  22386. return $this->branch;
  22387. }
  22388. public function getBranches()
  22389. {
  22390. $branches = $this->perforce->getBranches();
  22391. return $branches;
  22392. }
  22393. public function getTags()
  22394. {
  22395. $tags = $this->perforce->getTags();
  22396. return $tags;
  22397. }
  22398. public function getDist($identifier)
  22399. {
  22400. return null;
  22401. }
  22402. public function getSource($identifier)
  22403. {
  22404. $source = array(
  22405. 'type' => 'perforce',
  22406. 'url' => $this->repoConfig['url'],
  22407. 'reference' => $identifier,
  22408. 'p4user' => $this->perforce->getUser(),
  22409. );
  22410. return $source;
  22411. }
  22412. public function getUrl()
  22413. {
  22414. return $this->url;
  22415. }
  22416. public function hasComposerFile($identifier)
  22417. {
  22418. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  22419. $composerInfoIdentifier = $identifier;
  22420. return !empty($composerInfo);
  22421. }
  22422. public function getContents($url)
  22423. {
  22424. return false;
  22425. }
  22426. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22427. {
  22428. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  22429. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  22430. }
  22431. return false;
  22432. }
  22433. public function cleanup()
  22434. {
  22435. $this->perforce->cleanupClientSpec();
  22436. $this->perforce = null;
  22437. }
  22438. public function getDepot()
  22439. {
  22440. return $this->depot;
  22441. }
  22442. public function getBranch()
  22443. {
  22444. return $this->branch;
  22445. }
  22446. }
  22447. <?php
  22448. namespace Composer\Repository\Vcs;
  22449. use Composer\Cache;
  22450. use Composer\Config;
  22451. use Composer\Json\JsonFile;
  22452. use Composer\Util\ProcessExecutor;
  22453. use Composer\Util\Filesystem;
  22454. use Composer\Util\Svn as SvnUtil;
  22455. use Composer\IO\IOInterface;
  22456. use Composer\Downloader\TransportException;
  22457. class SvnDriver extends VcsDriver
  22458. {
  22459. protected $cache;
  22460. protected $baseUrl;
  22461. protected $tags;
  22462. protected $branches;
  22463. protected $rootIdentifier;
  22464. protected $infoCache = array();
  22465. protected $trunkPath = 'trunk';
  22466. protected $branchesPath = 'branches';
  22467. protected $tagsPath = 'tags';
  22468. protected $packagePath = '';
  22469. protected $cacheCredentials = true;
  22470. private $util;
  22471. public function initialize()
  22472. {
  22473. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  22474. SvnUtil::cleanEnv();
  22475. if (isset($this->repoConfig['trunk-path'])) {
  22476. $this->trunkPath = $this->repoConfig['trunk-path'];
  22477. }
  22478. if (isset($this->repoConfig['branches-path'])) {
  22479. $this->branchesPath = $this->repoConfig['branches-path'];
  22480. }
  22481. if (isset($this->repoConfig['tags-path'])) {
  22482. $this->tagsPath = $this->repoConfig['tags-path'];
  22483. }
  22484. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  22485. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  22486. }
  22487. if (isset($this->repoConfig['package-path'])) {
  22488. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  22489. }
  22490. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  22491. $this->baseUrl = substr($this->url, 0, $pos);
  22492. }
  22493. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  22494. $this->getBranches();
  22495. $this->getTags();
  22496. }
  22497. public function getRootIdentifier()
  22498. {
  22499. return $this->rootIdentifier ?: $this->trunkPath;
  22500. }
  22501. public function getUrl()
  22502. {
  22503. return $this->url;
  22504. }
  22505. public function getSource($identifier)
  22506. {
  22507. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  22508. }
  22509. public function getDist($identifier)
  22510. {
  22511. return null;
  22512. }
  22513. public function getComposerInformation($identifier)
  22514. {
  22515. if (!isset($this->infoCache[$identifier])) {
  22516. if ($res = $this->cache->read($identifier.'.json')) {
  22517. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22518. }
  22519. $composer = $this->getBaseComposerInformation($identifier);
  22520. $this->cache->write($identifier.'.json', json_encode($composer));
  22521. $this->infoCache[$identifier] = $composer;
  22522. }
  22523. return $this->infoCache[$identifier];
  22524. }
  22525. public function getFileContent($file, $identifier)
  22526. {
  22527. $identifier = '/' . trim($identifier, '/') . '/';
  22528. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  22529. if (!empty($match[2])) {
  22530. $path = $match[1];
  22531. $rev = $match[2];
  22532. } else {
  22533. $path = $identifier;
  22534. $rev = '';
  22535. }
  22536. try {
  22537. $resource = $path.$file;
  22538. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  22539. if (!trim($output)) {
  22540. return null;
  22541. }
  22542. } catch (\RuntimeException $e) {
  22543. throw new TransportException($e->getMessage());
  22544. }
  22545. return $output;
  22546. }
  22547. public function getChangeDate($identifier)
  22548. {
  22549. $identifier = '/' . trim($identifier, '/') . '/';
  22550. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  22551. if (!empty($match[2])) {
  22552. $path = $match[1];
  22553. $rev = $match[2];
  22554. } else {
  22555. $path = $identifier;
  22556. $rev = '';
  22557. }
  22558. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  22559. foreach ($this->process->splitLines($output) as $line) {
  22560. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  22561. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  22562. }
  22563. }
  22564. return null;
  22565. }
  22566. public function getTags()
  22567. {
  22568. if (null === $this->tags) {
  22569. $this->tags = array();
  22570. if ($this->tagsPath !== false) {
  22571. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  22572. if ($output) {
  22573. foreach ($this->process->splitLines($output) as $line) {
  22574. $line = trim($line);
  22575. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  22576. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  22577. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  22578. '/' . $this->tagsPath . '/' . $match[2],
  22579. $match[1]
  22580. );
  22581. }
  22582. }
  22583. }
  22584. }
  22585. }
  22586. }
  22587. return $this->tags;
  22588. }
  22589. public function getBranches()
  22590. {
  22591. if (null === $this->branches) {
  22592. $this->branches = array();
  22593. if (false === $this->trunkPath) {
  22594. $trunkParent = $this->baseUrl . '/';
  22595. } else {
  22596. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  22597. }
  22598. $output = $this->execute('svn ls --verbose', $trunkParent);
  22599. if ($output) {
  22600. foreach ($this->process->splitLines($output) as $line) {
  22601. $line = trim($line);
  22602. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  22603. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  22604. $this->branches['trunk'] = $this->buildIdentifier(
  22605. '/' . $this->trunkPath,
  22606. $match[1]
  22607. );
  22608. $this->rootIdentifier = $this->branches['trunk'];
  22609. break;
  22610. }
  22611. }
  22612. }
  22613. }
  22614. unset($output);
  22615. if ($this->branchesPath !== false) {
  22616. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  22617. if ($output) {
  22618. foreach ($this->process->splitLines(trim($output)) as $line) {
  22619. $line = trim($line);
  22620. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  22621. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  22622. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  22623. '/' . $this->branchesPath . '/' . $match[2],
  22624. $match[1]
  22625. );
  22626. }
  22627. }
  22628. }
  22629. }
  22630. }
  22631. }
  22632. return $this->branches;
  22633. }
  22634. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22635. {
  22636. $url = self::normalizeUrl($url);
  22637. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  22638. return true;
  22639. }
  22640. if (!$deep && !Filesystem::isLocalPath($url)) {
  22641. return false;
  22642. }
  22643. $processExecutor = new ProcessExecutor();
  22644. $exit = $processExecutor->execute(
  22645. "svn info --non-interactive {$url}",
  22646. $ignoredOutput
  22647. );
  22648. if ($exit === 0) {
  22649. return true;
  22650. }
  22651. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  22652. return true;
  22653. }
  22654. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  22655. return true;
  22656. }
  22657. return false;
  22658. }
  22659. protected static function normalizeUrl($url)
  22660. {
  22661. $fs = new Filesystem();
  22662. if ($fs->isAbsolutePath($url)) {
  22663. return 'file://' . strtr($url, '\\', '/');
  22664. }
  22665. return $url;
  22666. }
  22667. protected function execute($command, $url)
  22668. {
  22669. if (null === $this->util) {
  22670. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  22671. $this->util->setCacheCredentials($this->cacheCredentials);
  22672. }
  22673. try {
  22674. return $this->util->execute($command, $url);
  22675. } catch (\RuntimeException $e) {
  22676. if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
  22677. 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());
  22678. }
  22679. throw new \RuntimeException(
  22680. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  22681. );
  22682. }
  22683. }
  22684. protected function buildIdentifier($baseDir, $revision)
  22685. {
  22686. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  22687. }
  22688. }
  22689. <?php
  22690. namespace Composer\Repository\Vcs;
  22691. use Composer\Cache;
  22692. use Composer\Downloader\TransportException;
  22693. use Composer\Config;
  22694. use Composer\Factory;
  22695. use Composer\IO\IOInterface;
  22696. use Composer\Json\JsonFile;
  22697. use Composer\Util\ProcessExecutor;
  22698. use Composer\Util\RemoteFilesystem;
  22699. use Composer\Util\Filesystem;
  22700. abstract class VcsDriver implements VcsDriverInterface
  22701. {
  22702. protected $url;
  22703. protected $originUrl;
  22704. protected $repoConfig;
  22705. protected $io;
  22706. protected $config;
  22707. protected $process;
  22708. protected $remoteFilesystem;
  22709. protected $infoCache = array();
  22710. protected $cache;
  22711. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  22712. {
  22713. if (Filesystem::isLocalPath($repoConfig['url'])) {
  22714. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  22715. }
  22716. $this->url = $repoConfig['url'];
  22717. $this->originUrl = $repoConfig['url'];
  22718. $this->repoConfig = $repoConfig;
  22719. $this->io = $io;
  22720. $this->config = $config;
  22721. $this->process = $process ?: new ProcessExecutor($io);
  22722. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  22723. }
  22724. protected function shouldCache($identifier)
  22725. {
  22726. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  22727. }
  22728. public function getComposerInformation($identifier)
  22729. {
  22730. if (!isset($this->infoCache[$identifier])) {
  22731. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22732. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22733. }
  22734. $composer = $this->getBaseComposerInformation($identifier);
  22735. if ($this->shouldCache($identifier)) {
  22736. $this->cache->write($identifier, json_encode($composer));
  22737. }
  22738. $this->infoCache[$identifier] = $composer;
  22739. }
  22740. return $this->infoCache[$identifier];
  22741. }
  22742. protected function getBaseComposerInformation($identifier)
  22743. {
  22744. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  22745. if (!$composerFileContent) {
  22746. return null;
  22747. }
  22748. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  22749. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  22750. $composer['time'] = $changeDate->format('Y-m-d H:i:s');
  22751. }
  22752. return $composer;
  22753. }
  22754. public function hasComposerFile($identifier)
  22755. {
  22756. try {
  22757. return (bool) $this->getComposerInformation($identifier);
  22758. } catch (TransportException $e) {
  22759. }
  22760. return false;
  22761. }
  22762. protected function getScheme()
  22763. {
  22764. if (extension_loaded('openssl')) {
  22765. return 'https';
  22766. }
  22767. return 'http';
  22768. }
  22769. protected function getContents($url)
  22770. {
  22771. return $this->remoteFilesystem->getContents($this->originUrl, $url, false);
  22772. }
  22773. public function cleanup()
  22774. {
  22775. return;
  22776. }
  22777. }
  22778. <?php
  22779. namespace Composer\Repository\Vcs;
  22780. use Composer\Config;
  22781. use Composer\IO\IOInterface;
  22782. interface VcsDriverInterface
  22783. {
  22784. public function initialize();
  22785. public function getComposerInformation($identifier);
  22786. public function getFileContent($file, $identifier);
  22787. public function getChangeDate($identifier);
  22788. public function getRootIdentifier();
  22789. public function getBranches();
  22790. public function getTags();
  22791. public function getDist($identifier);
  22792. public function getSource($identifier);
  22793. public function getUrl();
  22794. public function hasComposerFile($identifier);
  22795. public function cleanup();
  22796. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  22797. }
  22798. <?php
  22799. namespace Composer\Repository;
  22800. use Composer\Downloader\TransportException;
  22801. use Composer\Repository\Vcs\VcsDriverInterface;
  22802. use Composer\Package\Version\VersionParser;
  22803. use Composer\Package\Loader\ArrayLoader;
  22804. use Composer\Package\Loader\ValidatingArrayLoader;
  22805. use Composer\Package\Loader\InvalidPackageException;
  22806. use Composer\Package\Loader\LoaderInterface;
  22807. use Composer\EventDispatcher\EventDispatcher;
  22808. use Composer\IO\IOInterface;
  22809. use Composer\Config;
  22810. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  22811. {
  22812. protected $url;
  22813. protected $packageName;
  22814. protected $verbose;
  22815. protected $io;
  22816. protected $config;
  22817. protected $versionParser;
  22818. protected $type;
  22819. protected $loader;
  22820. protected $repoConfig;
  22821. protected $branchErrorOccurred = false;
  22822. private $drivers;
  22823. private $driver;
  22824. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
  22825. {
  22826. parent::__construct();
  22827. $this->drivers = $drivers ?: array(
  22828. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  22829. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  22830. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  22831. 'git' => 'Composer\Repository\Vcs\GitDriver',
  22832. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  22833. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  22834. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  22835. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  22836. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  22837. );
  22838. $this->url = $repoConfig['url'];
  22839. $this->io = $io;
  22840. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  22841. $this->verbose = $io->isVeryVerbose();
  22842. $this->config = $config;
  22843. $this->repoConfig = $repoConfig;
  22844. }
  22845. public function getRepoConfig()
  22846. {
  22847. return $this->repoConfig;
  22848. }
  22849. public function setLoader(LoaderInterface $loader)
  22850. {
  22851. $this->loader = $loader;
  22852. }
  22853. public function getDriver()
  22854. {
  22855. if ($this->driver) {
  22856. return $this->driver;
  22857. }
  22858. if (isset($this->drivers[$this->type])) {
  22859. $class = $this->drivers[$this->type];
  22860. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  22861. $this->driver->initialize();
  22862. return $this->driver;
  22863. }
  22864. foreach ($this->drivers as $driver) {
  22865. if ($driver::supports($this->io, $this->config, $this->url)) {
  22866. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  22867. $this->driver->initialize();
  22868. return $this->driver;
  22869. }
  22870. }
  22871. foreach ($this->drivers as $driver) {
  22872. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  22873. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  22874. $this->driver->initialize();
  22875. return $this->driver;
  22876. }
  22877. }
  22878. }
  22879. public function hadInvalidBranches()
  22880. {
  22881. return $this->branchErrorOccurred;
  22882. }
  22883. protected function initialize()
  22884. {
  22885. parent::initialize();
  22886. $verbose = $this->verbose;
  22887. $driver = $this->getDriver();
  22888. if (!$driver) {
  22889. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  22890. }
  22891. $this->versionParser = new VersionParser;
  22892. if (!$this->loader) {
  22893. $this->loader = new ArrayLoader($this->versionParser);
  22894. }
  22895. try {
  22896. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  22897. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  22898. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  22899. }
  22900. } catch (\Exception $e) {
  22901. if ($verbose) {
  22902. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  22903. }
  22904. }
  22905. foreach ($driver->getTags() as $tag => $identifier) {
  22906. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  22907. if ($verbose) {
  22908. $this->io->writeError($msg);
  22909. } else {
  22910. $this->io->overwriteError($msg, false);
  22911. }
  22912. $tag = str_replace('release-', '', $tag);
  22913. if (!$parsedTag = $this->validateTag($tag)) {
  22914. if ($verbose) {
  22915. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  22916. }
  22917. continue;
  22918. }
  22919. try {
  22920. if (!$data = $driver->getComposerInformation($identifier)) {
  22921. if ($verbose) {
  22922. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  22923. }
  22924. continue;
  22925. }
  22926. if (isset($data['version'])) {
  22927. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  22928. } else {
  22929. $data['version'] = $tag;
  22930. $data['version_normalized'] = $parsedTag;
  22931. }
  22932. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  22933. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  22934. if ($data['version_normalized'] !== $parsedTag) {
  22935. if ($verbose) {
  22936. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  22937. }
  22938. continue;
  22939. }
  22940. if ($verbose) {
  22941. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  22942. }
  22943. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  22944. } catch (\Exception $e) {
  22945. if ($verbose) {
  22946. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  22947. }
  22948. continue;
  22949. }
  22950. }
  22951. if (!$verbose) {
  22952. $this->io->overwriteError('', false);
  22953. }
  22954. foreach ($driver->getBranches() as $branch => $identifier) {
  22955. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  22956. if ($verbose) {
  22957. $this->io->writeError($msg);
  22958. } else {
  22959. $this->io->overwriteError($msg, false);
  22960. }
  22961. if (!$parsedBranch = $this->validateBranch($branch)) {
  22962. if ($verbose) {
  22963. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  22964. }
  22965. continue;
  22966. }
  22967. try {
  22968. if (!$data = $driver->getComposerInformation($identifier)) {
  22969. if ($verbose) {
  22970. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  22971. }
  22972. continue;
  22973. }
  22974. $data['version'] = $branch;
  22975. $data['version_normalized'] = $parsedBranch;
  22976. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  22977. $data['version'] = 'dev-' . $data['version'];
  22978. } else {
  22979. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  22980. $data['version'] = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  22981. }
  22982. if ($verbose) {
  22983. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  22984. }
  22985. $packageData = $this->preProcess($driver, $data, $identifier);
  22986. $package = $this->loader->load($packageData);
  22987. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  22988. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  22989. }
  22990. $this->addPackage($package);
  22991. } catch (TransportException $e) {
  22992. if ($verbose) {
  22993. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  22994. }
  22995. continue;
  22996. } catch (\Exception $e) {
  22997. if (!$verbose) {
  22998. $this->io->writeError('');
  22999. }
  23000. $this->branchErrorOccurred = true;
  23001. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  23002. $this->io->writeError('');
  23003. continue;
  23004. }
  23005. }
  23006. $driver->cleanup();
  23007. if (!$verbose) {
  23008. $this->io->overwriteError('', false);
  23009. }
  23010. if (!$this->getPackages()) {
  23011. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  23012. }
  23013. }
  23014. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  23015. {
  23016. $data['name'] = $this->packageName ?: $data['name'];
  23017. if (!isset($data['dist'])) {
  23018. $data['dist'] = $driver->getDist($identifier);
  23019. }
  23020. if (!isset($data['source'])) {
  23021. $data['source'] = $driver->getSource($identifier);
  23022. }
  23023. return $data;
  23024. }
  23025. private function validateBranch($branch)
  23026. {
  23027. try {
  23028. return $this->versionParser->normalizeBranch($branch);
  23029. } catch (\Exception $e) {
  23030. }
  23031. return false;
  23032. }
  23033. private function validateTag($version)
  23034. {
  23035. try {
  23036. return $this->versionParser->normalize($version);
  23037. } catch (\Exception $e) {
  23038. }
  23039. return false;
  23040. }
  23041. }
  23042. <?php
  23043. namespace Composer\Repository;
  23044. use Composer\Package\AliasPackage;
  23045. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  23046. {
  23047. public function write()
  23048. {
  23049. }
  23050. public function reload()
  23051. {
  23052. }
  23053. public function getCanonicalPackages()
  23054. {
  23055. $packages = $this->getPackages();
  23056. $packagesByName = array();
  23057. foreach ($packages as $package) {
  23058. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  23059. $packagesByName[$package->getName()] = $package;
  23060. }
  23061. }
  23062. $canonicalPackages = array();
  23063. foreach ($packagesByName as $package) {
  23064. while ($package instanceof AliasPackage) {
  23065. $package = $package->getAliasOf();
  23066. }
  23067. $canonicalPackages[] = $package;
  23068. }
  23069. return $canonicalPackages;
  23070. }
  23071. }
  23072. <?php
  23073. namespace Composer\Repository;
  23074. use Composer\Package\PackageInterface;
  23075. interface WritableRepositoryInterface extends RepositoryInterface
  23076. {
  23077. public function write();
  23078. public function addPackage(PackageInterface $package);
  23079. public function removePackage(PackageInterface $package);
  23080. public function getCanonicalPackages();
  23081. public function reload();
  23082. }
  23083. <?php
  23084. namespace Composer\Script;
  23085. class CommandEvent extends Event
  23086. {
  23087. }
  23088. <?php
  23089. namespace Composer\Script;
  23090. use Composer\Composer;
  23091. use Composer\IO\IOInterface;
  23092. use Composer\EventDispatcher\Event as BaseEvent;
  23093. class Event extends BaseEvent
  23094. {
  23095. private $composer;
  23096. private $io;
  23097. private $devMode;
  23098. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  23099. {
  23100. parent::__construct($name, $args, $flags);
  23101. $this->composer = $composer;
  23102. $this->io = $io;
  23103. $this->devMode = $devMode;
  23104. }
  23105. public function getComposer()
  23106. {
  23107. return $this->composer;
  23108. }
  23109. public function getIO()
  23110. {
  23111. return $this->io;
  23112. }
  23113. public function isDevMode()
  23114. {
  23115. return $this->devMode;
  23116. }
  23117. }
  23118. <?php
  23119. namespace Composer\Script;
  23120. use Composer\Installer\PackageEvent as BasePackageEvent;
  23121. class PackageEvent extends BasePackageEvent
  23122. {
  23123. }
  23124. <?php
  23125. namespace Composer\Script;
  23126. class ScriptEvents
  23127. {
  23128. const PRE_INSTALL_CMD = 'pre-install-cmd';
  23129. const POST_INSTALL_CMD = 'post-install-cmd';
  23130. const PRE_UPDATE_CMD = 'pre-update-cmd';
  23131. const POST_UPDATE_CMD = 'post-update-cmd';
  23132. const PRE_STATUS_CMD = 'pre-status-cmd';
  23133. const POST_STATUS_CMD = 'post-status-cmd';
  23134. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  23135. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  23136. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  23137. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  23138. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  23139. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  23140. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  23141. const POST_PACKAGE_INSTALL = 'post-package-install';
  23142. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  23143. const POST_PACKAGE_UPDATE = 'post-package-update';
  23144. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  23145. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  23146. }
  23147. <?php
  23148. namespace Composer\SelfUpdate;
  23149. class Keys
  23150. {
  23151. public static function fingerprint($path)
  23152. {
  23153. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  23154. return implode(' ', array(
  23155. substr($hash, 0, 8),
  23156. substr($hash, 8, 8),
  23157. substr($hash, 16, 8),
  23158. substr($hash, 24, 8),
  23159. '',
  23160. substr($hash, 32, 8),
  23161. substr($hash, 40, 8),
  23162. substr($hash, 48, 8),
  23163. substr($hash, 56, 8),
  23164. ));
  23165. }
  23166. }
  23167. <?php
  23168. namespace Composer\SelfUpdate;
  23169. use Composer\Util\RemoteFilesystem;
  23170. use Composer\Config;
  23171. use Composer\Json\JsonFile;
  23172. class Versions
  23173. {
  23174. private $rfs;
  23175. private $config;
  23176. private $channel;
  23177. public function __construct(Config $config, RemoteFilesystem $rfs)
  23178. {
  23179. $this->rfs = $rfs;
  23180. $this->config = $config;
  23181. }
  23182. public function getChannel()
  23183. {
  23184. if ($this->channel) {
  23185. return $this->channel;
  23186. }
  23187. $channelFile = $this->config->get('home').'/update-channel';
  23188. if (file_exists($channelFile)) {
  23189. $channel = trim(file_get_contents($channelFile));
  23190. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  23191. return $this->channel = $channel;
  23192. }
  23193. }
  23194. return $this->channel = 'stable';
  23195. }
  23196. public function setChannel($channel)
  23197. {
  23198. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  23199. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  23200. }
  23201. $channelFile = $this->config->get('home').'/update-channel';
  23202. $this->channel = $channel;
  23203. file_put_contents($channelFile, $channel.PHP_EOL);
  23204. }
  23205. public function getLatest()
  23206. {
  23207. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  23208. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  23209. foreach ($versions[$this->getChannel()] as $version) {
  23210. if ($version['min-php'] <= PHP_VERSION_ID) {
  23211. return $version;
  23212. }
  23213. }
  23214. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  23215. }
  23216. }
  23217. <?php
  23218. namespace Composer\Util;
  23219. use Composer\Config;
  23220. use Composer\IO\IOInterface;
  23221. class AuthHelper
  23222. {
  23223. protected $io;
  23224. protected $config;
  23225. public function __construct(IOInterface $io, Config $config)
  23226. {
  23227. $this->io = $io;
  23228. $this->config = $config;
  23229. }
  23230. public function storeAuth($originUrl, $storeAuth)
  23231. {
  23232. $store = false;
  23233. $configSource = $this->config->getAuthConfigSource();
  23234. if ($storeAuth === true) {
  23235. $store = $configSource;
  23236. } elseif ($storeAuth === 'prompt') {
  23237. $answer = $this->io->askAndValidate(
  23238. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  23239. function ($value) {
  23240. $input = strtolower(substr(trim($value), 0, 1));
  23241. if (in_array($input, array('y','n'))) {
  23242. return $input;
  23243. }
  23244. throw new \RuntimeException('Please answer (y)es or (n)o');
  23245. },
  23246. null,
  23247. 'y'
  23248. );
  23249. if ($answer === 'y') {
  23250. $store = $configSource;
  23251. }
  23252. }
  23253. if ($store) {
  23254. $store->addConfigSetting(
  23255. 'http-basic.'.$originUrl,
  23256. $this->io->getAuthentication($originUrl)
  23257. );
  23258. }
  23259. }
  23260. }
  23261. <?php
  23262. namespace Composer\Util;
  23263. use Composer\Factory;
  23264. use Composer\IO\IOInterface;
  23265. use Composer\Config;
  23266. use Composer\Downloader\TransportException;
  23267. class Bitbucket
  23268. {
  23269. private $io;
  23270. private $config;
  23271. private $process;
  23272. private $remoteFilesystem;
  23273. private $token = array();
  23274. private $time;
  23275. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  23276. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  23277. {
  23278. $this->io = $io;
  23279. $this->config = $config;
  23280. $this->process = $process ?: new ProcessExecutor;
  23281. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23282. $this->time = $time;
  23283. }
  23284. public function getToken()
  23285. {
  23286. if (!isset($this->token['access_token'])) {
  23287. return '';
  23288. }
  23289. return $this->token['access_token'];
  23290. }
  23291. public function authorizeOAuth($originUrl)
  23292. {
  23293. if ($originUrl !== 'bitbucket.org') {
  23294. return false;
  23295. }
  23296. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  23297. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  23298. return true;
  23299. }
  23300. return false;
  23301. }
  23302. private function requestAccessToken($originUrl)
  23303. {
  23304. try {
  23305. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  23306. 'retry-auth-failure' => false,
  23307. 'http' => array(
  23308. 'method' => 'POST',
  23309. 'content' => 'grant_type=client_credentials',
  23310. ),
  23311. ));
  23312. $this->token = json_decode($json, true);
  23313. } catch (TransportException $e) {
  23314. if ($e->getCode() === 400) {
  23315. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  23316. $this->io->writeError('This can have two reasons:');
  23317. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  23318. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  23319. return false;
  23320. } elseif (in_array($e->getCode(), array(403, 401))) {
  23321. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  23322. $this->io->writeError('You can also add it manually later by using "composer config bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23323. return false;
  23324. }
  23325. throw $e;
  23326. }
  23327. return true;
  23328. }
  23329. public function authorizeOAuthInteractively($originUrl, $message = null)
  23330. {
  23331. if ($message) {
  23332. $this->io->writeError($message);
  23333. }
  23334. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  23335. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  23336. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  23337. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  23338. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  23339. if (!$consumerKey) {
  23340. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  23341. $this->io->writeError('You can also add it manually later by using "composer config bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23342. return false;
  23343. }
  23344. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  23345. if (!$consumerSecret) {
  23346. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  23347. $this->io->writeError('You can also add it manually later by using "composer config bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23348. return false;
  23349. }
  23350. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  23351. if (!$this->requestAccessToken($originUrl)) {
  23352. return false;
  23353. }
  23354. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  23355. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  23356. $this->io->writeError('<info>Consumer stored successfully.</info>');
  23357. return true;
  23358. }
  23359. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  23360. {
  23361. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  23362. return $this->token['access_token'];
  23363. }
  23364. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  23365. if (!$this->requestAccessToken($originUrl)) {
  23366. return '';
  23367. }
  23368. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  23369. return $this->token['access_token'];
  23370. }
  23371. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  23372. {
  23373. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  23374. $time = null === $this->time ? time() : $this->time;
  23375. $consumer = array(
  23376. "consumer-key" => $consumerKey,
  23377. "consumer-secret" => $consumerSecret,
  23378. "access-token" => $this->token['access_token'],
  23379. "access-token-expiration" => $time + $this->token['expires_in'],
  23380. );
  23381. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  23382. }
  23383. private function getTokenFromConfig($originUrl)
  23384. {
  23385. $authConfig = $this->config->get('bitbucket-oauth');
  23386. if (
  23387. !isset($authConfig[$originUrl]['access-token'])
  23388. || !isset($authConfig[$originUrl]['access-token-expiration'])
  23389. || time() > $authConfig[$originUrl]['access-token-expiration']
  23390. ) {
  23391. return false;
  23392. }
  23393. $this->token = array(
  23394. 'access_token' => $authConfig[$originUrl]['access-token'],
  23395. );
  23396. return true;
  23397. }
  23398. }
  23399. <?php
  23400. namespace Composer\Util;
  23401. class ComposerMirror
  23402. {
  23403. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  23404. {
  23405. if ($reference) {
  23406. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  23407. }
  23408. $version = strpos($version, '/') === false ? $version : md5($version);
  23409. return str_replace(
  23410. array('%package%', '%version%', '%reference%', '%type%'),
  23411. array($packageName, $version, $reference, $type),
  23412. $mirrorUrl
  23413. );
  23414. }
  23415. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  23416. {
  23417. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  23418. $url = 'gh-'.$match[1].'/'.$match[2];
  23419. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  23420. $url = 'bb-'.$match[1].'/'.$match[2];
  23421. } else {
  23422. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  23423. }
  23424. return str_replace(
  23425. array('%package%', '%normalizedUrl%', '%type%'),
  23426. array($packageName, $url, $type),
  23427. $mirrorUrl
  23428. );
  23429. }
  23430. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  23431. {
  23432. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  23433. }
  23434. }
  23435. <?php
  23436. namespace Composer\Util;
  23437. use Composer\Package\Loader\ArrayLoader;
  23438. use Composer\Package\Loader\ValidatingArrayLoader;
  23439. use Composer\Package\Loader\InvalidPackageException;
  23440. use Composer\Json\JsonValidationException;
  23441. use Composer\IO\IOInterface;
  23442. use Composer\Json\JsonFile;
  23443. use Composer\Spdx\SpdxLicenses;
  23444. class ConfigValidator
  23445. {
  23446. private $io;
  23447. public function __construct(IOInterface $io)
  23448. {
  23449. $this->io = $io;
  23450. }
  23451. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  23452. {
  23453. $errors = array();
  23454. $publishErrors = array();
  23455. $warnings = array();
  23456. $laxValid = false;
  23457. try {
  23458. $json = new JsonFile($file, null, $this->io);
  23459. $manifest = $json->read();
  23460. $json->validateSchema(JsonFile::LAX_SCHEMA);
  23461. $laxValid = true;
  23462. $json->validateSchema();
  23463. } catch (JsonValidationException $e) {
  23464. foreach ($e->getErrors() as $message) {
  23465. if ($laxValid) {
  23466. $publishErrors[] = $message;
  23467. } else {
  23468. $errors[] = $message;
  23469. }
  23470. }
  23471. } catch (\Exception $e) {
  23472. $errors[] = $e->getMessage();
  23473. return array($errors, $publishErrors, $warnings);
  23474. }
  23475. if (!empty($manifest['license'])) {
  23476. if (is_array($manifest['license'])) {
  23477. foreach ($manifest['license'] as $key => $license) {
  23478. if ('proprietary' === $license) {
  23479. unset($manifest['license'][$key]);
  23480. }
  23481. }
  23482. }
  23483. $licenseValidator = new SpdxLicenses();
  23484. if ('proprietary' !== $manifest['license'] && array() !== $manifest['license'] && !$licenseValidator->validate($manifest['license'])) {
  23485. $warnings[] = sprintf(
  23486. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.'
  23487. ."\nIf the software is closed-source, you may use \"proprietary\" as license.",
  23488. json_encode($manifest['license'])
  23489. );
  23490. }
  23491. } else {
  23492. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  23493. }
  23494. if (isset($manifest['version'])) {
  23495. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  23496. }
  23497. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  23498. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  23499. $suggestName = strtolower($suggestName);
  23500. $publishErrors[] = sprintf(
  23501. '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.',
  23502. $manifest['name'],
  23503. $suggestName
  23504. );
  23505. }
  23506. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  23507. $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.";
  23508. }
  23509. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  23510. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  23511. if (!empty($requireOverrides)) {
  23512. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  23513. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  23514. }
  23515. }
  23516. $require = isset($manifest['require']) ? $manifest['require'] : array();
  23517. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  23518. $packages = array_merge($require, $requireDev);
  23519. foreach ($packages as $package => $version) {
  23520. if (preg_match('/#/', $version) === 1) {
  23521. $warnings[] = sprintf(
  23522. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  23523. $package
  23524. );
  23525. }
  23526. }
  23527. if (isset($manifest['autoload']['psr-0'][''])) {
  23528. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  23529. }
  23530. if (isset($manifest['autoload']['psr-4'][''])) {
  23531. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  23532. }
  23533. try {
  23534. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  23535. if (!isset($manifest['version'])) {
  23536. $manifest['version'] = '1.0.0';
  23537. }
  23538. if (!isset($manifest['name'])) {
  23539. $manifest['name'] = 'dummy/dummy';
  23540. }
  23541. $loader->load($manifest);
  23542. } catch (InvalidPackageException $e) {
  23543. $errors = array_merge($errors, $e->getErrors());
  23544. }
  23545. $warnings = array_merge($warnings, $loader->getWarnings());
  23546. return array($errors, $publishErrors, $warnings);
  23547. }
  23548. }
  23549. <?php
  23550. namespace Composer\Util;
  23551. use Composer\IO\IOInterface;
  23552. class ErrorHandler
  23553. {
  23554. private static $io;
  23555. public static function handle($level, $message, $file, $line)
  23556. {
  23557. if (!(error_reporting() & $level)) {
  23558. return;
  23559. }
  23560. if (ini_get('xdebug.scream')) {
  23561. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  23562. "\na legitimately suppressed error that you were not supposed to see.";
  23563. }
  23564. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  23565. throw new \ErrorException($message, 0, $level, $file, $line);
  23566. }
  23567. if (self::$io) {
  23568. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  23569. if (self::$io->isVerbose()) {
  23570. self::$io->writeError('<warning>Stack trace:</warning>');
  23571. self::$io->writeError(array_filter(array_map(function ($a) {
  23572. if (isset($a['line'], $a['file'])) {
  23573. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  23574. }
  23575. return null;
  23576. }, array_slice(debug_backtrace(), 2))));
  23577. }
  23578. }
  23579. }
  23580. public static function register(IOInterface $io = null)
  23581. {
  23582. set_error_handler(array(__CLASS__, 'handle'));
  23583. error_reporting(E_ALL | E_STRICT);
  23584. self::$io = $io;
  23585. }
  23586. }
  23587. <?php
  23588. namespace Composer\Util;
  23589. use RecursiveDirectoryIterator;
  23590. use RecursiveIteratorIterator;
  23591. use Symfony\Component\Filesystem\Exception\IOException;
  23592. use Symfony\Component\Finder\Finder;
  23593. class Filesystem
  23594. {
  23595. private $processExecutor;
  23596. public function __construct(ProcessExecutor $executor = null)
  23597. {
  23598. $this->processExecutor = $executor ?: new ProcessExecutor();
  23599. }
  23600. public function remove($file)
  23601. {
  23602. if (is_dir($file)) {
  23603. return $this->removeDirectory($file);
  23604. }
  23605. if (file_exists($file)) {
  23606. return $this->unlink($file);
  23607. }
  23608. return false;
  23609. }
  23610. public function isDirEmpty($dir)
  23611. {
  23612. $finder = Finder::create()
  23613. ->ignoreVCS(false)
  23614. ->ignoreDotFiles(false)
  23615. ->depth(0)
  23616. ->in($dir);
  23617. return count($finder) === 0;
  23618. }
  23619. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  23620. {
  23621. if (file_exists($dir) && is_link($dir)) {
  23622. $this->unlink($dir);
  23623. }
  23624. if ($ensureDirectoryExists) {
  23625. $this->ensureDirectoryExists($dir);
  23626. }
  23627. if (is_dir($dir)) {
  23628. $finder = Finder::create()
  23629. ->ignoreVCS(false)
  23630. ->ignoreDotFiles(false)
  23631. ->depth(0)
  23632. ->in($dir);
  23633. foreach ($finder as $path) {
  23634. $this->remove((string) $path);
  23635. }
  23636. }
  23637. }
  23638. public function removeDirectory($directory)
  23639. {
  23640. if ($this->isSymlinkedDirectory($directory)) {
  23641. return $this->unlinkSymlinkedDirectory($directory);
  23642. }
  23643. if ($this->isJunction($directory)) {
  23644. return $this->removeJunction($directory);
  23645. }
  23646. if (!file_exists($directory) || !is_dir($directory)) {
  23647. return true;
  23648. }
  23649. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  23650. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  23651. }
  23652. if (!function_exists('proc_open')) {
  23653. return $this->removeDirectoryPhp($directory);
  23654. }
  23655. if (Platform::isWindows()) {
  23656. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  23657. } else {
  23658. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  23659. }
  23660. $result = $this->getProcess()->execute($cmd, $output) === 0;
  23661. clearstatcache();
  23662. if ($result && !file_exists($directory)) {
  23663. return true;
  23664. }
  23665. return $this->removeDirectoryPhp($directory);
  23666. }
  23667. public function removeDirectoryPhp($directory)
  23668. {
  23669. try {
  23670. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  23671. } catch (\UnexpectedValueException $e) {
  23672. clearstatcache();
  23673. usleep(100000);
  23674. if (!is_dir($directory)) {
  23675. return true;
  23676. }
  23677. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  23678. }
  23679. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  23680. foreach ($ri as $file) {
  23681. if ($file->isDir()) {
  23682. $this->rmdir($file->getPathname());
  23683. } else {
  23684. $this->unlink($file->getPathname());
  23685. }
  23686. }
  23687. return $this->rmdir($directory);
  23688. }
  23689. public function ensureDirectoryExists($directory)
  23690. {
  23691. if (!is_dir($directory)) {
  23692. if (file_exists($directory)) {
  23693. throw new \RuntimeException(
  23694. $directory.' exists and is not a directory.'
  23695. );
  23696. }
  23697. if (!@mkdir($directory, 0777, true)) {
  23698. throw new \RuntimeException(
  23699. $directory.' does not exist and could not be created.'
  23700. );
  23701. }
  23702. }
  23703. }
  23704. public function unlink($path)
  23705. {
  23706. if (!@$this->unlinkImplementation($path)) {
  23707. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  23708. $error = error_get_last();
  23709. $message = 'Could not delete '.$path.': ' . @$error['message'];
  23710. if (Platform::isWindows()) {
  23711. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  23712. }
  23713. throw new \RuntimeException($message);
  23714. }
  23715. }
  23716. return true;
  23717. }
  23718. public function rmdir($path)
  23719. {
  23720. if (!@rmdir($path)) {
  23721. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  23722. $error = error_get_last();
  23723. $message = 'Could not delete '.$path.': ' . @$error['message'];
  23724. if (Platform::isWindows()) {
  23725. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  23726. }
  23727. throw new \RuntimeException($message);
  23728. }
  23729. }
  23730. return true;
  23731. }
  23732. public function copyThenRemove($source, $target)
  23733. {
  23734. if (!is_dir($source)) {
  23735. copy($source, $target);
  23736. $this->unlink($source);
  23737. return;
  23738. }
  23739. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  23740. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  23741. $this->ensureDirectoryExists($target);
  23742. foreach ($ri as $file) {
  23743. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  23744. if ($file->isDir()) {
  23745. $this->ensureDirectoryExists($targetPath);
  23746. } else {
  23747. copy($file->getPathname(), $targetPath);
  23748. }
  23749. }
  23750. $this->removeDirectoryPhp($source);
  23751. }
  23752. public function rename($source, $target)
  23753. {
  23754. if (true === @rename($source, $target)) {
  23755. return;
  23756. }
  23757. if (!function_exists('proc_open')) {
  23758. return $this->copyThenRemove($source, $target);
  23759. }
  23760. if (Platform::isWindows()) {
  23761. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  23762. $result = $this->processExecutor->execute($command, $output);
  23763. clearstatcache();
  23764. if (0 === $result) {
  23765. $this->remove($source);
  23766. return;
  23767. }
  23768. } else {
  23769. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  23770. $result = $this->processExecutor->execute($command, $output);
  23771. clearstatcache();
  23772. if (0 === $result) {
  23773. return;
  23774. }
  23775. }
  23776. return $this->copyThenRemove($source, $target);
  23777. }
  23778. public function findShortestPath($from, $to, $directories = false)
  23779. {
  23780. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  23781. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  23782. }
  23783. $from = lcfirst($this->normalizePath($from));
  23784. $to = lcfirst($this->normalizePath($to));
  23785. if ($directories) {
  23786. $from = rtrim($from, '/') . '/dummy_file';
  23787. }
  23788. if (dirname($from) === dirname($to)) {
  23789. return './'.basename($to);
  23790. }
  23791. $commonPath = $to;
  23792. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  23793. $commonPath = strtr(dirname($commonPath), '\\', '/');
  23794. }
  23795. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  23796. return $to;
  23797. }
  23798. $commonPath = rtrim($commonPath, '/') . '/';
  23799. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  23800. $commonPathCode = str_repeat('../', $sourcePathDepth);
  23801. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  23802. }
  23803. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  23804. {
  23805. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  23806. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  23807. }
  23808. $from = lcfirst($this->normalizePath($from));
  23809. $to = lcfirst($this->normalizePath($to));
  23810. if ($from === $to) {
  23811. return $directories ? '__DIR__' : '__FILE__';
  23812. }
  23813. $commonPath = $to;
  23814. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  23815. $commonPath = strtr(dirname($commonPath), '\\', '/');
  23816. }
  23817. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  23818. return var_export($to, true);
  23819. }
  23820. $commonPath = rtrim($commonPath, '/') . '/';
  23821. if (strpos($to, $from.'/') === 0) {
  23822. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  23823. }
  23824. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  23825. if ($staticCode) {
  23826. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  23827. } else {
  23828. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  23829. }
  23830. $relTarget = substr($to, strlen($commonPath));
  23831. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  23832. }
  23833. public function isAbsolutePath($path)
  23834. {
  23835. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  23836. }
  23837. public function size($path)
  23838. {
  23839. if (!file_exists($path)) {
  23840. throw new \RuntimeException("$path does not exist.");
  23841. }
  23842. if (is_dir($path)) {
  23843. return $this->directorySize($path);
  23844. }
  23845. return filesize($path);
  23846. }
  23847. public function normalizePath($path)
  23848. {
  23849. $parts = array();
  23850. $path = strtr($path, '\\', '/');
  23851. $prefix = '';
  23852. $absolute = false;
  23853. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  23854. $prefix = $match[1];
  23855. $path = substr($path, strlen($prefix));
  23856. }
  23857. if (substr($path, 0, 1) === '/') {
  23858. $absolute = true;
  23859. $path = substr($path, 1);
  23860. }
  23861. $up = false;
  23862. foreach (explode('/', $path) as $chunk) {
  23863. if ('..' === $chunk && ($absolute || $up)) {
  23864. array_pop($parts);
  23865. $up = !(empty($parts) || '..' === end($parts));
  23866. } elseif ('.' !== $chunk && '' !== $chunk) {
  23867. $parts[] = $chunk;
  23868. $up = '..' !== $chunk;
  23869. }
  23870. }
  23871. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  23872. }
  23873. public static function isLocalPath($path)
  23874. {
  23875. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  23876. }
  23877. public static function getPlatformPath($path)
  23878. {
  23879. if (Platform::isWindows()) {
  23880. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  23881. }
  23882. return preg_replace('{^file://}i', '', $path);
  23883. }
  23884. protected function directorySize($directory)
  23885. {
  23886. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  23887. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  23888. $size = 0;
  23889. foreach ($ri as $file) {
  23890. if ($file->isFile()) {
  23891. $size += $file->getSize();
  23892. }
  23893. }
  23894. return $size;
  23895. }
  23896. protected function getProcess()
  23897. {
  23898. return new ProcessExecutor;
  23899. }
  23900. private function unlinkImplementation($path)
  23901. {
  23902. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  23903. return rmdir($path);
  23904. }
  23905. return unlink($path);
  23906. }
  23907. public function relativeSymlink($target, $link)
  23908. {
  23909. $cwd = getcwd();
  23910. $relativePath = $this->findShortestPath($link, $target);
  23911. chdir(dirname($link));
  23912. $result = @symlink($relativePath, $link);
  23913. chdir($cwd);
  23914. return (bool) $result;
  23915. }
  23916. public function isSymlinkedDirectory($directory)
  23917. {
  23918. if (!is_dir($directory)) {
  23919. return false;
  23920. }
  23921. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  23922. return is_link($resolved);
  23923. }
  23924. private function unlinkSymlinkedDirectory($directory)
  23925. {
  23926. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  23927. return $this->unlink($resolved);
  23928. }
  23929. private function resolveSymlinkedDirectorySymlink($pathname)
  23930. {
  23931. if (!is_dir($pathname)) {
  23932. return $pathname;
  23933. }
  23934. $resolved = rtrim($pathname, '/');
  23935. if (!strlen($resolved)) {
  23936. return $pathname;
  23937. }
  23938. return $resolved;
  23939. }
  23940. public function junction($target, $junction)
  23941. {
  23942. if (!Platform::isWindows()) {
  23943. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  23944. }
  23945. if (!is_dir($target)) {
  23946. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  23947. }
  23948. $cmd = sprintf('mklink /J %s %s',
  23949. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  23950. ProcessExecutor::escape(realpath($target)));
  23951. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  23952. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  23953. }
  23954. clearstatcache(true, $junction);
  23955. }
  23956. public function isJunction($junction)
  23957. {
  23958. if (!Platform::isWindows()) {
  23959. return false;
  23960. }
  23961. if (!is_dir($junction) || is_link($junction)) {
  23962. return false;
  23963. }
  23964. clearstatcache(true, $junction);
  23965. $stat = lstat($junction);
  23966. return !($stat['mode'] & 0xC000);
  23967. }
  23968. public function removeJunction($junction)
  23969. {
  23970. if (!Platform::isWindows()) {
  23971. return false;
  23972. }
  23973. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  23974. if (!$this->isJunction($junction)) {
  23975. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  23976. }
  23977. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  23978. clearstatcache(true, $junction);
  23979. return ($this->getProcess()->execute($cmd, $output) === 0);
  23980. }
  23981. }
  23982. <?php
  23983. namespace Composer\Util;
  23984. use Composer\Config;
  23985. use Composer\IO\IOInterface;
  23986. class Git
  23987. {
  23988. private static $version;
  23989. protected $io;
  23990. protected $config;
  23991. protected $process;
  23992. protected $filesystem;
  23993. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  23994. {
  23995. $this->io = $io;
  23996. $this->config = $config;
  23997. $this->process = $process;
  23998. $this->filesystem = $fs;
  23999. }
  24000. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  24001. {
  24002. $this->config->prohibitUrlByConfig($url, $this->io);
  24003. if ($initialClone) {
  24004. $origCwd = $cwd;
  24005. $cwd = null;
  24006. }
  24007. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  24008. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://[email protected]:22/path or just [email protected]:path if you do not want to provide a password or custom port.');
  24009. }
  24010. if (!$initialClone) {
  24011. $this->process->execute('git remote -v', $output, $cwd);
  24012. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  24013. $this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
  24014. }
  24015. }
  24016. $protocols = $this->config->get('github-protocols');
  24017. if (!is_array($protocols)) {
  24018. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  24019. }
  24020. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  24021. $messages = array();
  24022. foreach ($protocols as $protocol) {
  24023. if ('ssh' === $protocol) {
  24024. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  24025. } else {
  24026. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  24027. }
  24028. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  24029. return;
  24030. }
  24031. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  24032. if ($initialClone) {
  24033. $this->filesystem->removeDirectory($origCwd);
  24034. }
  24035. }
  24036. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  24037. }
  24038. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  24039. $command = call_user_func($commandCallable, $url);
  24040. $auth = null;
  24041. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  24042. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  24043. if (!$this->io->hasAuthentication($match[1])) {
  24044. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  24045. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  24046. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  24047. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  24048. }
  24049. }
  24050. if ($this->io->hasAuthentication($match[1])) {
  24051. $auth = $this->io->getAuthentication($match[1]);
  24052. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  24053. $command = call_user_func($commandCallable, $authUrl);
  24054. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24055. return;
  24056. }
  24057. }
  24058. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  24059. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  24060. if (!$this->io->hasAuthentication($match[1])) {
  24061. $message = 'Enter your Bitbucket credentials to access private repos';
  24062. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  24063. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  24064. $accessToken = $bitbucketUtil->getToken();
  24065. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  24066. }
  24067. } else {
  24068. $auth = $this->io->getAuthentication($match[1]);
  24069. if ($auth['username'] !== 'x-token-auth') {
  24070. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  24071. if (! empty($accessToken)) {
  24072. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  24073. }
  24074. }
  24075. }
  24076. if ($this->io->hasAuthentication($match[1])) {
  24077. $auth = $this->io->getAuthentication($match[1]);
  24078. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  24079. $command = call_user_func($commandCallable, $authUrl);
  24080. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24081. return;
  24082. }
  24083. } else {
  24084. $sshUrl = '[email protected]:' . $match[2] . '.git';
  24085. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  24086. $command = call_user_func($commandCallable, $sshUrl);
  24087. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24088. return;
  24089. }
  24090. }
  24091. } elseif ($this->isAuthenticationFailure($url, $match)) {
  24092. if (strpos($match[2], '@')) {
  24093. list($authParts, $match[2]) = explode('@', $match[2], 2);
  24094. }
  24095. $storeAuth = false;
  24096. if ($this->io->hasAuthentication($match[2])) {
  24097. $auth = $this->io->getAuthentication($match[2]);
  24098. } elseif ($this->io->isInteractive()) {
  24099. $defaultUsername = null;
  24100. if (isset($authParts) && $authParts) {
  24101. if (false !== strpos($authParts, ':')) {
  24102. list($defaultUsername, ) = explode(':', $authParts, 2);
  24103. } else {
  24104. $defaultUsername = $authParts;
  24105. }
  24106. }
  24107. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  24108. $auth = array(
  24109. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  24110. 'password' => $this->io->askAndHideAnswer(' Password: '),
  24111. );
  24112. $storeAuth = $this->config->get('store-auths');
  24113. }
  24114. if ($auth) {
  24115. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  24116. $command = call_user_func($commandCallable, $authUrl);
  24117. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24118. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  24119. $authHelper = new AuthHelper($this->io, $this->config);
  24120. $authHelper->storeAuth($match[2], $storeAuth);
  24121. return;
  24122. }
  24123. }
  24124. }
  24125. if ($initialClone) {
  24126. $this->filesystem->removeDirectory($origCwd);
  24127. }
  24128. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  24129. }
  24130. }
  24131. public function syncMirror($url, $dir)
  24132. {
  24133. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  24134. try {
  24135. $commandCallable = function ($url) {
  24136. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  24137. };
  24138. $this->runCommand($commandCallable, $url, $dir);
  24139. } catch (\Exception $e) {
  24140. return false;
  24141. }
  24142. return true;
  24143. }
  24144. $this->filesystem->removeDirectory($dir);
  24145. $commandCallable = function ($url) use ($dir) {
  24146. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  24147. };
  24148. $this->runCommand($commandCallable, $url, $dir, true);
  24149. return true;
  24150. }
  24151. private function isAuthenticationFailure($url, &$match)
  24152. {
  24153. if (!preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match)) {
  24154. return false;
  24155. }
  24156. $authFailures = array(
  24157. 'fatal: Authentication failed',
  24158. 'remote error: Invalid username or password.',
  24159. 'error: 401 Unauthorized',
  24160. 'fatal: unable to access',
  24161. );
  24162. foreach ($authFailures as $authFailure) {
  24163. if (strpos($this->process->getErrorOutput(), $authFailure) !== false) {
  24164. return true;
  24165. }
  24166. }
  24167. return false;
  24168. }
  24169. public static function cleanEnv()
  24170. {
  24171. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  24172. 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');
  24173. }
  24174. if (getenv('GIT_ASKPASS') !== 'echo') {
  24175. putenv('GIT_ASKPASS=echo');
  24176. unset($_SERVER['GIT_ASKPASS']);
  24177. }
  24178. if (getenv('GIT_DIR')) {
  24179. putenv('GIT_DIR');
  24180. unset($_SERVER['GIT_DIR']);
  24181. }
  24182. if (getenv('GIT_WORK_TREE')) {
  24183. putenv('GIT_WORK_TREE');
  24184. unset($_SERVER['GIT_WORK_TREE']);
  24185. }
  24186. if (getenv('LANGUAGE') !== 'C') {
  24187. putenv('LANGUAGE=C');
  24188. }
  24189. putenv("DYLD_LIBRARY_PATH");
  24190. unset($_SERVER['DYLD_LIBRARY_PATH']);
  24191. }
  24192. public static function getGitHubDomainsRegex(Config $config)
  24193. {
  24194. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  24195. }
  24196. public static function sanitizeUrl($message)
  24197. {
  24198. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  24199. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  24200. return '://***:***@';
  24201. }
  24202. return '://' . $m[1] . ':***@';
  24203. }, $message);
  24204. }
  24205. private function throwException($message, $url)
  24206. {
  24207. clearstatcache();
  24208. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  24209. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  24210. }
  24211. throw new \RuntimeException(self::sanitizeUrl($message));
  24212. }
  24213. public function getVersion()
  24214. {
  24215. if (isset(self::$version)) {
  24216. return self::$version;
  24217. }
  24218. if (0 !== $this->process->execute('git --version', $output)) {
  24219. return;
  24220. }
  24221. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  24222. return self::$version = $matches[1];
  24223. }
  24224. }
  24225. }
  24226. <?php
  24227. namespace Composer\Util;
  24228. use Composer\Factory;
  24229. use Composer\IO\IOInterface;
  24230. use Composer\Config;
  24231. use Composer\Downloader\TransportException;
  24232. class GitHub
  24233. {
  24234. protected $io;
  24235. protected $config;
  24236. protected $process;
  24237. protected $remoteFilesystem;
  24238. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24239. {
  24240. $this->io = $io;
  24241. $this->config = $config;
  24242. $this->process = $process ?: new ProcessExecutor;
  24243. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24244. }
  24245. public function authorizeOAuth($originUrl)
  24246. {
  24247. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  24248. return false;
  24249. }
  24250. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  24251. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  24252. return true;
  24253. }
  24254. return false;
  24255. }
  24256. public function authorizeOAuthInteractively($originUrl, $message = null)
  24257. {
  24258. if ($message) {
  24259. $this->io->writeError($message);
  24260. }
  24261. $note = 'Composer';
  24262. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  24263. $note .= ' on ' . trim($output);
  24264. }
  24265. $note .= ' ' . date('Y-m-d Hi');
  24266. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  24267. $this->io->writeError(sprintf('Head to %s', $url));
  24268. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24269. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  24270. if (!$token) {
  24271. $this->io->writeError('<warning>No token given, aborting.</warning>');
  24272. $this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');
  24273. return false;
  24274. }
  24275. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  24276. try {
  24277. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  24278. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  24279. 'retry-auth-failure' => false,
  24280. ));
  24281. } catch (TransportException $e) {
  24282. if (in_array($e->getCode(), array(403, 401))) {
  24283. $this->io->writeError('<error>Invalid token provided.</error>');
  24284. $this->io->writeError('You can also add it manually later by using "composer config github-oauth.github.com <token>"');
  24285. return false;
  24286. }
  24287. throw $e;
  24288. }
  24289. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  24290. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  24291. $this->io->writeError('<info>Token stored successfully.</info>');
  24292. return true;
  24293. }
  24294. }
  24295. <?php
  24296. namespace Composer\Util;
  24297. use Composer\IO\IOInterface;
  24298. use Composer\Config;
  24299. use Composer\Factory;
  24300. use Composer\Downloader\TransportException;
  24301. use Composer\Json\JsonFile;
  24302. class GitLab
  24303. {
  24304. protected $io;
  24305. protected $config;
  24306. protected $process;
  24307. protected $remoteFilesystem;
  24308. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24309. {
  24310. $this->io = $io;
  24311. $this->config = $config;
  24312. $this->process = $process ?: new ProcessExecutor();
  24313. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24314. }
  24315. public function authorizeOAuth($originUrl)
  24316. {
  24317. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  24318. return false;
  24319. }
  24320. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  24321. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  24322. return true;
  24323. }
  24324. $authTokens = $this->config->get('gitlab-token');
  24325. if (isset($authTokens[$originUrl])) {
  24326. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  24327. return true;
  24328. }
  24329. return false;
  24330. }
  24331. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  24332. {
  24333. if ($message) {
  24334. $this->io->writeError($message);
  24335. }
  24336. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  24337. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  24338. $attemptCounter = 0;
  24339. while ($attemptCounter++ < 5) {
  24340. try {
  24341. $response = $this->createToken($scheme, $originUrl);
  24342. } catch (TransportException $e) {
  24343. if (in_array($e->getCode(), array(403, 401))) {
  24344. if (401 === $e->getCode()) {
  24345. $this->io->writeError('Bad credentials.');
  24346. } else {
  24347. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  24348. }
  24349. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/applications');
  24350. $this->io->writeError('Add it using "composer config gitlab-oauth.'.$originUrl.' <token>"');
  24351. continue;
  24352. }
  24353. throw $e;
  24354. }
  24355. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  24356. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  24357. return true;
  24358. }
  24359. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  24360. }
  24361. private function createToken($scheme, $originUrl)
  24362. {
  24363. $username = $this->io->ask('Username: ');
  24364. $password = $this->io->askAndHideAnswer('Password: ');
  24365. $headers = array('Content-Type: application/x-www-form-urlencoded');
  24366. $apiUrl = $originUrl;
  24367. $data = http_build_query(array(
  24368. 'username' => $username,
  24369. 'password' => $password,
  24370. 'grant_type' => 'password',
  24371. ), null, '&');
  24372. $options = array(
  24373. 'retry-auth-failure' => false,
  24374. 'http' => array(
  24375. 'method' => 'POST',
  24376. 'header' => $headers,
  24377. 'content' => $data,
  24378. ),
  24379. );
  24380. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  24381. $this->io->writeError('Token successfully created');
  24382. return JsonFile::parseJson($json);
  24383. }
  24384. }
  24385. <?php
  24386. namespace Composer\Util;
  24387. class IniHelper
  24388. {
  24389. const ENV_ORIGINAL = 'COMPOSER_ORIGINAL_INIS';
  24390. public static function getAll()
  24391. {
  24392. if ($env = strval(getenv(self::ENV_ORIGINAL))) {
  24393. return explode(PATH_SEPARATOR, $env);
  24394. }
  24395. $paths = array(strval(php_ini_loaded_file()));
  24396. if ($scanned = php_ini_scanned_files()) {
  24397. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  24398. }
  24399. return $paths;
  24400. }
  24401. public static function getMessage()
  24402. {
  24403. $paths = self::getAll();
  24404. if (empty($paths[0])) {
  24405. return 'A php.ini file does not exist. You will have to create one.';
  24406. }
  24407. return 'The php.ini used by your command-line PHP is: '.$paths[0];
  24408. }
  24409. }
  24410. <?php
  24411. namespace Composer\Util;
  24412. class NoProxyPattern
  24413. {
  24414. protected $rules = array();
  24415. public function __construct($pattern)
  24416. {
  24417. $this->rules = preg_split("/[\s,]+/", $pattern);
  24418. }
  24419. public function test($url)
  24420. {
  24421. $host = parse_url($url, PHP_URL_HOST);
  24422. $port = parse_url($url, PHP_URL_PORT);
  24423. if (empty($port)) {
  24424. switch (parse_url($url, PHP_URL_SCHEME)) {
  24425. case 'http':
  24426. $port = 80;
  24427. break;
  24428. case 'https':
  24429. $port = 443;
  24430. break;
  24431. }
  24432. }
  24433. foreach ($this->rules as $rule) {
  24434. if ($rule == '*') {
  24435. return true;
  24436. }
  24437. $match = false;
  24438. list($ruleHost) = explode(':', $rule);
  24439. list($base) = explode('/', $ruleHost);
  24440. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  24441. if (!isset($ip)) {
  24442. $ip = gethostbyname($host);
  24443. }
  24444. if (strpos($ruleHost, '/') === false) {
  24445. $match = $ip === $ruleHost;
  24446. } else {
  24447. if ($ip === $host) {
  24448. $match = false;
  24449. } else {
  24450. $match = self::inCIDRBlock($ruleHost, $ip);
  24451. }
  24452. }
  24453. } else {
  24454. $haystack = '.' . trim($host, '.') . '.';
  24455. $needle = '.'. trim($ruleHost, '.') .'.';
  24456. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  24457. }
  24458. if ($match && strpos($rule, ':') !== false) {
  24459. list(, $rulePort) = explode(':', $rule);
  24460. if (!empty($rulePort) && $port != $rulePort) {
  24461. $match = false;
  24462. }
  24463. }
  24464. if ($match) {
  24465. return true;
  24466. }
  24467. }
  24468. return false;
  24469. }
  24470. private static function inCIDRBlock($cidr, $ip)
  24471. {
  24472. list($base, $bits) = explode('/', $cidr);
  24473. list($a, $b, $c, $d) = explode('.', $base);
  24474. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  24475. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  24476. $low = $i & $mask;
  24477. $high = $i | (~$mask & 0xFFFFFFFF);
  24478. list($a, $b, $c, $d) = explode('.', $ip);
  24479. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  24480. return $check >= $low && $check <= $high;
  24481. }
  24482. }
  24483. <?php
  24484. namespace Composer\Util;
  24485. use Composer\IO\IOInterface;
  24486. use Symfony\Component\Process\Process;
  24487. class Perforce
  24488. {
  24489. protected $path;
  24490. protected $p4Depot;
  24491. protected $p4Client;
  24492. protected $p4User;
  24493. protected $p4Password;
  24494. protected $p4Port;
  24495. protected $p4Stream;
  24496. protected $p4ClientSpec;
  24497. protected $p4DepotType;
  24498. protected $p4Branch;
  24499. protected $process;
  24500. protected $uniquePerforceClientName;
  24501. protected $windowsFlag;
  24502. protected $commandResult;
  24503. protected $io;
  24504. protected $filesystem;
  24505. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  24506. {
  24507. $this->windowsFlag = $isWindows;
  24508. $this->p4Port = $port;
  24509. $this->initializePath($path);
  24510. $this->process = $process;
  24511. $this->initialize($repoConfig);
  24512. $this->io = $io;
  24513. }
  24514. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  24515. {
  24516. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  24517. }
  24518. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  24519. {
  24520. $output = null;
  24521. return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s', $output);
  24522. }
  24523. public function initialize($repoConfig)
  24524. {
  24525. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  24526. if (!$repoConfig) {
  24527. return;
  24528. }
  24529. if (isset($repoConfig['unique_perforce_client_name'])) {
  24530. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  24531. }
  24532. if (isset($repoConfig['depot'])) {
  24533. $this->p4Depot = $repoConfig['depot'];
  24534. }
  24535. if (isset($repoConfig['branch'])) {
  24536. $this->p4Branch = $repoConfig['branch'];
  24537. }
  24538. if (isset($repoConfig['p4user'])) {
  24539. $this->p4User = $repoConfig['p4user'];
  24540. } else {
  24541. $this->p4User = $this->getP4variable('P4USER');
  24542. }
  24543. if (isset($repoConfig['p4password'])) {
  24544. $this->p4Password = $repoConfig['p4password'];
  24545. }
  24546. }
  24547. public function initializeDepotAndBranch($depot, $branch)
  24548. {
  24549. if (isset($depot)) {
  24550. $this->p4Depot = $depot;
  24551. }
  24552. if (isset($branch)) {
  24553. $this->p4Branch = $branch;
  24554. }
  24555. }
  24556. public function generateUniquePerforceClientName()
  24557. {
  24558. return gethostname() . "_" . time();
  24559. }
  24560. public function cleanupClientSpec()
  24561. {
  24562. $client = $this->getClient();
  24563. $task = 'client -d ' . $client;
  24564. $useP4Client = false;
  24565. $command = $this->generateP4Command($task, $useP4Client);
  24566. $this->executeCommand($command);
  24567. $clientSpec = $this->getP4ClientSpec();
  24568. $fileSystem = $this->getFilesystem();
  24569. $fileSystem->remove($clientSpec);
  24570. }
  24571. protected function executeCommand($command)
  24572. {
  24573. $this->commandResult = "";
  24574. $exit_code = $this->process->execute($command, $this->commandResult);
  24575. return $exit_code;
  24576. }
  24577. public function getClient()
  24578. {
  24579. if (!isset($this->p4Client)) {
  24580. $cleanStreamName = str_replace('@', '', str_replace('/', '_', str_replace('//', '', $this->getStream())));
  24581. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  24582. }
  24583. return $this->p4Client;
  24584. }
  24585. protected function getPath()
  24586. {
  24587. return $this->path;
  24588. }
  24589. public function initializePath($path)
  24590. {
  24591. $this->path = $path;
  24592. $fs = $this->getFilesystem();
  24593. $fs->ensureDirectoryExists($path);
  24594. }
  24595. protected function getPort()
  24596. {
  24597. return $this->p4Port;
  24598. }
  24599. public function setStream($stream)
  24600. {
  24601. $this->p4Stream = $stream;
  24602. $index = strrpos($stream, '/');
  24603. if ($index > 2) {
  24604. $this->p4DepotType = 'stream';
  24605. }
  24606. }
  24607. public function isStream()
  24608. {
  24609. return (strcmp($this->p4DepotType, 'stream') === 0);
  24610. }
  24611. public function getStream()
  24612. {
  24613. if (!isset($this->p4Stream)) {
  24614. if ($this->isStream()) {
  24615. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  24616. } else {
  24617. $this->p4Stream = '//' . $this->p4Depot;
  24618. }
  24619. }
  24620. return $this->p4Stream;
  24621. }
  24622. public function getStreamWithoutLabel($stream)
  24623. {
  24624. $index = strpos($stream, '@');
  24625. if ($index === false) {
  24626. return $stream;
  24627. }
  24628. return substr($stream, 0, $index);
  24629. }
  24630. public function getP4ClientSpec()
  24631. {
  24632. $p4clientSpec = $this->path . '/' . $this->getClient() . '.p4.spec';
  24633. return $p4clientSpec;
  24634. }
  24635. public function getUser()
  24636. {
  24637. return $this->p4User;
  24638. }
  24639. public function setUser($user)
  24640. {
  24641. $this->p4User = $user;
  24642. }
  24643. public function queryP4User()
  24644. {
  24645. $this->getUser();
  24646. if (strlen($this->p4User) > 0) {
  24647. return;
  24648. }
  24649. $this->p4User = $this->getP4variable('P4USER');
  24650. if (strlen($this->p4User) > 0) {
  24651. return;
  24652. }
  24653. $this->p4User = $this->io->ask('Enter P4 User:');
  24654. if ($this->windowsFlag) {
  24655. $command = 'p4 set P4USER=' . $this->p4User;
  24656. } else {
  24657. $command = 'export P4USER=' . $this->p4User;
  24658. }
  24659. $this->executeCommand($command);
  24660. }
  24661. protected function getP4variable($name)
  24662. {
  24663. if ($this->windowsFlag) {
  24664. $command = 'p4 set';
  24665. $this->executeCommand($command);
  24666. $result = trim($this->commandResult);
  24667. $resArray = explode(PHP_EOL, $result);
  24668. foreach ($resArray as $line) {
  24669. $fields = explode('=', $line);
  24670. if (strcmp($name, $fields[0]) == 0) {
  24671. $index = strpos($fields[1], ' ');
  24672. if ($index === false) {
  24673. $value = $fields[1];
  24674. } else {
  24675. $value = substr($fields[1], 0, $index);
  24676. }
  24677. $value = trim($value);
  24678. return $value;
  24679. }
  24680. }
  24681. return null;
  24682. } else {
  24683. $command = 'echo $' . $name;
  24684. $this->executeCommand($command);
  24685. $result = trim($this->commandResult);
  24686. return $result;
  24687. }
  24688. }
  24689. public function queryP4Password()
  24690. {
  24691. if (isset($this->p4Password)) {
  24692. return $this->p4Password;
  24693. }
  24694. $password = $this->getP4variable('P4PASSWD');
  24695. if (strlen($password) <= 0) {
  24696. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  24697. }
  24698. $this->p4Password = $password;
  24699. return $password;
  24700. }
  24701. public function generateP4Command($command, $useClient = true)
  24702. {
  24703. $p4Command = 'p4 ';
  24704. $p4Command = $p4Command . '-u ' . $this->getUser() . ' ';
  24705. if ($useClient) {
  24706. $p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
  24707. }
  24708. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ';
  24709. $p4Command = $p4Command . $command;
  24710. return $p4Command;
  24711. }
  24712. public function isLoggedIn()
  24713. {
  24714. $command = $this->generateP4Command('login -s', false);
  24715. $exitCode = $this->executeCommand($command);
  24716. if ($exitCode) {
  24717. $errorOutput = $this->process->getErrorOutput();
  24718. $index = strpos($errorOutput, $this->getUser());
  24719. if ($index === false) {
  24720. $index = strpos($errorOutput, 'p4');
  24721. if ($index === false) {
  24722. return false;
  24723. }
  24724. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  24725. }
  24726. throw new \Exception('Invalid user name: ' . $this->getUser());
  24727. }
  24728. return true;
  24729. }
  24730. public function connectClient()
  24731. {
  24732. $p4CreateClientCommand = $this->generateP4Command(
  24733. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  24734. );
  24735. $this->executeCommand($p4CreateClientCommand);
  24736. }
  24737. public function syncCodeBase($sourceReference)
  24738. {
  24739. $prevDir = getcwd();
  24740. chdir($this->path);
  24741. $p4SyncCommand = $this->generateP4Command('sync -f ');
  24742. if (null !== $sourceReference) {
  24743. $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
  24744. }
  24745. $this->executeCommand($p4SyncCommand);
  24746. chdir($prevDir);
  24747. }
  24748. public function writeClientSpecToFile($spec)
  24749. {
  24750. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  24751. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  24752. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  24753. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  24754. fwrite($spec, 'Description:' . PHP_EOL);
  24755. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  24756. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  24757. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  24758. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  24759. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  24760. if ($this->isStream()) {
  24761. fwrite($spec, 'Stream:' . PHP_EOL);
  24762. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  24763. } else {
  24764. fwrite(
  24765. $spec,
  24766. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  24767. );
  24768. }
  24769. }
  24770. public function writeP4ClientSpec()
  24771. {
  24772. $clientSpec = $this->getP4ClientSpec();
  24773. $spec = fopen($clientSpec, 'w');
  24774. try {
  24775. $this->writeClientSpecToFile($spec);
  24776. } catch (\Exception $e) {
  24777. fclose($spec);
  24778. throw $e;
  24779. }
  24780. fclose($spec);
  24781. }
  24782. protected function read($pipe, $name)
  24783. {
  24784. if (feof($pipe)) {
  24785. return;
  24786. }
  24787. $line = fgets($pipe);
  24788. while ($line !== false) {
  24789. $line = fgets($pipe);
  24790. }
  24791. return;
  24792. }
  24793. public function windowsLogin($password)
  24794. {
  24795. $command = $this->generateP4Command(' login -a');
  24796. $process = new Process($command, null, null, $password);
  24797. return $process->run();
  24798. }
  24799. public function p4Login()
  24800. {
  24801. $this->queryP4User();
  24802. if (!$this->isLoggedIn()) {
  24803. $password = $this->queryP4Password();
  24804. if ($this->windowsFlag) {
  24805. $this->windowsLogin($password);
  24806. } else {
  24807. $command = 'echo ' . $password . ' | ' . $this->generateP4Command(' login -a', false);
  24808. $exitCode = $this->executeCommand($command);
  24809. $result = trim($this->commandResult);
  24810. if ($exitCode) {
  24811. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  24812. }
  24813. }
  24814. }
  24815. }
  24816. public function getComposerInformation($identifier)
  24817. {
  24818. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  24819. if (!$composerFileContent) {
  24820. return;
  24821. }
  24822. return json_decode($composerFileContent, true);
  24823. }
  24824. public function getFileContent($file, $identifier)
  24825. {
  24826. $path = $this->getFilePath($file, $identifier);
  24827. $command = $this->generateP4Command(' print ' . $path);
  24828. $this->executeCommand($command);
  24829. $result = $this->commandResult;
  24830. if (!trim($result)) {
  24831. return null;
  24832. }
  24833. return $result;
  24834. }
  24835. public function getFilePath($file, $identifier)
  24836. {
  24837. $index = strpos($identifier, '@');
  24838. if ($index === false) {
  24839. $path = $identifier. '/' . $file;
  24840. return $path;
  24841. } else {
  24842. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  24843. $command = $this->generateP4Command(' files ' . $path, false);
  24844. $this->executeCommand($command);
  24845. $result = $this->commandResult;
  24846. $index2 = strpos($result, 'no such file(s).');
  24847. if ($index2 === false) {
  24848. $index3 = strpos($result, 'change');
  24849. if ($index3 !== false) {
  24850. $phrase = trim(substr($result, $index3));
  24851. $fields = explode(' ', $phrase);
  24852. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  24853. }
  24854. }
  24855. }
  24856. return null;
  24857. }
  24858. public function getBranches()
  24859. {
  24860. $possibleBranches = array();
  24861. if (!$this->isStream()) {
  24862. $possibleBranches[$this->p4Branch] = $this->getStream();
  24863. } else {
  24864. $command = $this->generateP4Command('streams //' . $this->p4Depot . '/...');
  24865. $this->executeCommand($command);
  24866. $result = $this->commandResult;
  24867. $resArray = explode(PHP_EOL, $result);
  24868. foreach ($resArray as $line) {
  24869. $resBits = explode(' ', $line);
  24870. if (count($resBits) > 4) {
  24871. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  24872. $possibleBranches[$branch] = $resBits[1];
  24873. }
  24874. }
  24875. }
  24876. $command = $this->generateP4Command('changes '. $this->getStream() . '/...', false);
  24877. $this->executeCommand($command);
  24878. $result = $this->commandResult;
  24879. $resArray = explode(PHP_EOL, $result);
  24880. $lastCommit = $resArray[0];
  24881. $lastCommitArr = explode(' ', $lastCommit);
  24882. $lastCommitNum = $lastCommitArr[1];
  24883. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  24884. return $branches;
  24885. }
  24886. public function getTags()
  24887. {
  24888. $command = $this->generateP4Command('labels');
  24889. $this->executeCommand($command);
  24890. $result = $this->commandResult;
  24891. $resArray = explode(PHP_EOL, $result);
  24892. $tags = array();
  24893. foreach ($resArray as $line) {
  24894. $index = strpos($line, 'Label');
  24895. if (!($index === false)) {
  24896. $fields = explode(' ', $line);
  24897. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  24898. }
  24899. }
  24900. return $tags;
  24901. }
  24902. public function checkStream()
  24903. {
  24904. $command = $this->generateP4Command('depots', false);
  24905. $this->executeCommand($command);
  24906. $result = $this->commandResult;
  24907. $resArray = explode(PHP_EOL, $result);
  24908. foreach ($resArray as $line) {
  24909. $index = strpos($line, 'Depot');
  24910. if (!($index === false)) {
  24911. $fields = explode(' ', $line);
  24912. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  24913. $this->p4DepotType = $fields[3];
  24914. return $this->isStream();
  24915. }
  24916. }
  24917. }
  24918. return false;
  24919. }
  24920. protected function getChangeList($reference)
  24921. {
  24922. $index = strpos($reference, '@');
  24923. if ($index === false) {
  24924. return null;
  24925. }
  24926. $label = substr($reference, $index);
  24927. $command = $this->generateP4Command(' changes -m1 ' . $label);
  24928. $this->executeCommand($command);
  24929. $changes = $this->commandResult;
  24930. if (strpos($changes, 'Change') !== 0) {
  24931. return null;
  24932. }
  24933. $fields = explode(' ', $changes);
  24934. $changeList = $fields[1];
  24935. return $changeList;
  24936. }
  24937. public function getCommitLogs($fromReference, $toReference)
  24938. {
  24939. $fromChangeList = $this->getChangeList($fromReference);
  24940. if ($fromChangeList === null) {
  24941. return null;
  24942. }
  24943. $toChangeList = $this->getChangeList($toReference);
  24944. if ($toChangeList === null) {
  24945. return null;
  24946. }
  24947. $index = strpos($fromReference, '@');
  24948. $main = substr($fromReference, 0, $index) . '/...';
  24949. $command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
  24950. $this->executeCommand($command);
  24951. $result = $this->commandResult;
  24952. return $result;
  24953. }
  24954. public function getFilesystem()
  24955. {
  24956. if (empty($this->filesystem)) {
  24957. $this->filesystem = new Filesystem($this->process);
  24958. }
  24959. return $this->filesystem;
  24960. }
  24961. public function setFilesystem(Filesystem $fs)
  24962. {
  24963. $this->filesystem = $fs;
  24964. }
  24965. }
  24966. <?php
  24967. namespace Composer\Util;
  24968. class Platform
  24969. {
  24970. public static function expandPath($path)
  24971. {
  24972. if (preg_match('#^~[\\/]#', $path)) {
  24973. return self::getUserDirectory() . substr($path, 1);
  24974. }
  24975. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  24976. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  24977. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  24978. }
  24979. return getenv($matches['var']) . $matches['path'];
  24980. }, $path);
  24981. }
  24982. public static function getUserDirectory()
  24983. {
  24984. if (false !== ($home = getenv('HOME'))) {
  24985. return $home;
  24986. }
  24987. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  24988. return $home;
  24989. }
  24990. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  24991. $info = posix_getpwuid(posix_getuid());
  24992. return $info['dir'];
  24993. }
  24994. throw new \RuntimeException('Could not determine user directory');
  24995. }
  24996. public static function isWindows()
  24997. {
  24998. return defined('PHP_WINDOWS_VERSION_BUILD');
  24999. }
  25000. public static function strlen($str)
  25001. {
  25002. static $useMbString = null;
  25003. if (null === $useMbString) {
  25004. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  25005. }
  25006. if ($useMbString) {
  25007. return mb_strlen($str, '8bit');
  25008. }
  25009. return strlen($str);
  25010. }
  25011. }
  25012. <?php
  25013. namespace Composer\Util;
  25014. use Symfony\Component\Process\Process;
  25015. use Symfony\Component\Process\ProcessUtils;
  25016. use Composer\IO\IOInterface;
  25017. class ProcessExecutor
  25018. {
  25019. protected static $timeout = 300;
  25020. protected $captureOutput;
  25021. protected $errorOutput;
  25022. protected $io;
  25023. public function __construct(IOInterface $io = null)
  25024. {
  25025. $this->io = $io;
  25026. }
  25027. public function execute($command, &$output = null, $cwd = null)
  25028. {
  25029. if ($this->io && $this->io->isDebug()) {
  25030. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  25031. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  25032. return '://***:***@';
  25033. }
  25034. return '://'.$m['user'].':***@';
  25035. }, $command);
  25036. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  25037. }
  25038. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  25039. $cwd = realpath(getcwd());
  25040. }
  25041. $this->captureOutput = count(func_get_args()) > 1;
  25042. $this->errorOutput = null;
  25043. $process = new Process($command, $cwd, null, null, static::getTimeout());
  25044. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  25045. $process->run($callback);
  25046. if ($this->captureOutput && !is_callable($output)) {
  25047. $output = $process->getOutput();
  25048. }
  25049. $this->errorOutput = $process->getErrorOutput();
  25050. return $process->getExitCode();
  25051. }
  25052. public function splitLines($output)
  25053. {
  25054. $output = trim($output);
  25055. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  25056. }
  25057. public function getErrorOutput()
  25058. {
  25059. return $this->errorOutput;
  25060. }
  25061. public function outputHandler($type, $buffer)
  25062. {
  25063. if ($this->captureOutput) {
  25064. return;
  25065. }
  25066. if (null === $this->io) {
  25067. echo $buffer;
  25068. return;
  25069. }
  25070. if (Process::ERR === $type) {
  25071. $this->io->writeError($buffer, false);
  25072. } else {
  25073. $this->io->write($buffer, false);
  25074. }
  25075. }
  25076. public static function getTimeout()
  25077. {
  25078. return static::$timeout;
  25079. }
  25080. public static function setTimeout($timeout)
  25081. {
  25082. static::$timeout = $timeout;
  25083. }
  25084. public static function escape($argument)
  25085. {
  25086. return ProcessUtils::escapeArgument($argument);
  25087. }
  25088. }
  25089. <?php
  25090. namespace Composer\Util;
  25091. use Composer\Config;
  25092. use Composer\IO\IOInterface;
  25093. use Composer\Downloader\TransportException;
  25094. use Composer\CaBundle\CaBundle;
  25095. use Psr\Log\LoggerInterface;
  25096. class RemoteFilesystem
  25097. {
  25098. private $io;
  25099. private $config;
  25100. private $scheme;
  25101. private $bytesMax;
  25102. private $originUrl;
  25103. private $fileUrl;
  25104. private $fileName;
  25105. private $retry;
  25106. private $progress;
  25107. private $lastProgress;
  25108. private $options = array();
  25109. private $peerCertificateMap = array();
  25110. private $disableTls = false;
  25111. private $retryAuthFailure;
  25112. private $lastHeaders;
  25113. private $storeAuth;
  25114. private $degradedMode = false;
  25115. private $redirects;
  25116. private $maxRedirects = 20;
  25117. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  25118. {
  25119. $this->io = $io;
  25120. if ($disableTls === false) {
  25121. $this->options = $this->getTlsDefaults($options);
  25122. } else {
  25123. $this->disableTls = true;
  25124. }
  25125. $this->options = array_replace_recursive($this->options, $options);
  25126. $this->config = $config;
  25127. }
  25128. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  25129. {
  25130. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  25131. }
  25132. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  25133. {
  25134. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  25135. }
  25136. public function getOptions()
  25137. {
  25138. return $this->options;
  25139. }
  25140. public function setOptions(array $options)
  25141. {
  25142. $this->options = array_replace_recursive($this->options, $options);
  25143. }
  25144. public function isTlsDisabled()
  25145. {
  25146. return $this->disableTls === true;
  25147. }
  25148. public function getLastHeaders()
  25149. {
  25150. return $this->lastHeaders;
  25151. }
  25152. public function findHeaderValue(array $headers, $name)
  25153. {
  25154. $value = null;
  25155. foreach ($headers as $header) {
  25156. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  25157. $value = $match[1];
  25158. } elseif (preg_match('{^HTTP/}i', $header)) {
  25159. $value = null;
  25160. }
  25161. }
  25162. return $value;
  25163. }
  25164. public function findStatusCode(array $headers)
  25165. {
  25166. $value = null;
  25167. foreach ($headers as $header) {
  25168. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  25169. $value = (int) $match[1];
  25170. }
  25171. }
  25172. return $value;
  25173. }
  25174. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  25175. {
  25176. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  25177. $originUrl = 'github.com';
  25178. }
  25179. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  25180. $this->bytesMax = 0;
  25181. $this->originUrl = $originUrl;
  25182. $this->fileUrl = $fileUrl;
  25183. $this->fileName = $fileName;
  25184. $this->progress = $progress;
  25185. $this->lastProgress = null;
  25186. $this->retryAuthFailure = true;
  25187. $this->lastHeaders = array();
  25188. $this->redirects = 1;
  25189. if (preg_match('{^https?://(.+):(.+)@([^/]+)}i', $fileUrl, $match)) {
  25190. $this->io->setAuthentication($originUrl, urldecode($match[1]), urldecode($match[2]));
  25191. }
  25192. $tempAdditionalOptions = $additionalOptions;
  25193. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  25194. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  25195. unset($tempAdditionalOptions['retry-auth-failure']);
  25196. }
  25197. $isRedirect = false;
  25198. if (isset($tempAdditionalOptions['redirects'])) {
  25199. $this->redirects = $tempAdditionalOptions['redirects'];
  25200. $isRedirect = true;
  25201. unset($tempAdditionalOptions['redirects']);
  25202. }
  25203. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  25204. unset($tempAdditionalOptions);
  25205. $userlandFollow = isset($options['http']['follow_location']) && !$options['http']['follow_location'];
  25206. $origFileUrl = $fileUrl;
  25207. if (isset($options['github-token'])) {
  25208. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  25209. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  25210. }
  25211. unset($options['github-token']);
  25212. }
  25213. if (isset($options['gitlab-token'])) {
  25214. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  25215. unset($options['gitlab-token']);
  25216. }
  25217. if (isset($options['http'])) {
  25218. $options['http']['ignore_errors'] = true;
  25219. }
  25220. if ($this->degradedMode && substr($fileUrl, 0, 21) === 'http://packagist.org/') {
  25221. $fileUrl = 'http://' . gethostbyname('packagist.org') . substr($fileUrl, 20);
  25222. $degradedPackagist = true;
  25223. }
  25224. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  25225. $actualContextOptions = stream_context_get_options($ctx);
  25226. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  25227. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  25228. unset($origFileUrl, $actualContextOptions);
  25229. if ((substr($fileUrl, 0, 23) !== 'http://packagist.org/p/' || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  25230. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  25231. }
  25232. if ($this->progress && !$isRedirect) {
  25233. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  25234. }
  25235. $errorMessage = '';
  25236. $errorCode = 0;
  25237. $result = false;
  25238. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  25239. if ($errorMessage) {
  25240. $errorMessage .= "\n";
  25241. }
  25242. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  25243. });
  25244. try {
  25245. $result = file_get_contents($fileUrl, false, $ctx);
  25246. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  25247. if ($contentLength && Platform::strlen($result) < $contentLength) {
  25248. throw new TransportException('Content-Length mismatch');
  25249. }
  25250. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  25251. $params = stream_context_get_params($ctx);
  25252. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  25253. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  25254. if ($expectedPeerFingerprint !== $peerFingerprint) {
  25255. throw new TransportException('Peer fingerprint did not match');
  25256. }
  25257. }
  25258. } catch (\Exception $e) {
  25259. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  25260. $e->setHeaders($http_response_header);
  25261. $e->setStatusCode($this->findStatusCode($http_response_header));
  25262. }
  25263. if ($e instanceof TransportException && $result !== false) {
  25264. $e->setResponse($result);
  25265. }
  25266. $result = false;
  25267. }
  25268. if ($errorMessage && !ini_get('allow_url_fopen')) {
  25269. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  25270. }
  25271. restore_error_handler();
  25272. if (isset($e) && !$this->retry) {
  25273. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  25274. $this->degradedMode = true;
  25275. $this->io->writeError('');
  25276. $this->io->writeError(array(
  25277. '<error>'.$e->getMessage().'</error>',
  25278. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  25279. ));
  25280. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  25281. }
  25282. throw $e;
  25283. }
  25284. $statusCode = null;
  25285. $contentType = null;
  25286. if (!empty($http_response_header[0])) {
  25287. $statusCode = $this->findStatusCode($http_response_header);
  25288. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  25289. }
  25290. if ($originUrl === 'bitbucket.org'
  25291. && !$this->isPublicBitBucketDownload($fileUrl)
  25292. && substr($fileUrl, -4) === '.zip'
  25293. && $contentType && preg_match('{^text/html\b}i', $contentType)
  25294. ) {
  25295. $result = false;
  25296. if ($this->retryAuthFailure) {
  25297. $this->promptAuthAndRetry(401);
  25298. }
  25299. }
  25300. $hasFollowedRedirect = false;
  25301. if ($userlandFollow && $statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  25302. $hasFollowedRedirect = true;
  25303. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  25304. }
  25305. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  25306. if (!$this->retry) {
  25307. if ($this->progress && !$this->retry && !$isRedirect) {
  25308. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  25309. }
  25310. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  25311. $e->setHeaders($http_response_header);
  25312. $e->setResponse($result);
  25313. $e->setStatusCode($statusCode);
  25314. throw $e;
  25315. }
  25316. $result = false;
  25317. }
  25318. if ($this->progress && !$this->retry && !$isRedirect) {
  25319. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  25320. }
  25321. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  25322. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  25323. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  25324. if ($decode) {
  25325. try {
  25326. if (PHP_VERSION_ID >= 50400) {
  25327. $result = zlib_decode($result);
  25328. } else {
  25329. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  25330. }
  25331. if (!$result) {
  25332. throw new TransportException('Failed to decode zlib stream');
  25333. }
  25334. } catch (\Exception $e) {
  25335. if ($this->degradedMode) {
  25336. throw $e;
  25337. }
  25338. $this->degradedMode = true;
  25339. $this->io->writeError(array(
  25340. '',
  25341. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  25342. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  25343. ));
  25344. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  25345. }
  25346. }
  25347. }
  25348. if (false !== $result && null !== $fileName && !$isRedirect) {
  25349. if ('' === $result) {
  25350. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  25351. }
  25352. $errorMessage = '';
  25353. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  25354. if ($errorMessage) {
  25355. $errorMessage .= "\n";
  25356. }
  25357. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  25358. });
  25359. $result = (bool) file_put_contents($fileName, $result);
  25360. restore_error_handler();
  25361. if (false === $result) {
  25362. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  25363. }
  25364. }
  25365. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  25366. if (CaBundle::isOpensslParseSafe()) {
  25367. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  25368. if ($certDetails) {
  25369. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  25370. $this->retry = true;
  25371. }
  25372. } else {
  25373. $this->io->writeError('');
  25374. $this->io->writeError(sprintf(
  25375. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  25376. PHP_VERSION
  25377. ));
  25378. }
  25379. }
  25380. if ($this->retry) {
  25381. $this->retry = false;
  25382. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  25383. if ($this->storeAuth && $this->config) {
  25384. $authHelper = new AuthHelper($this->io, $this->config);
  25385. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  25386. $this->storeAuth = false;
  25387. }
  25388. return $result;
  25389. }
  25390. if (false === $result) {
  25391. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  25392. if (!empty($http_response_header[0])) {
  25393. $e->setHeaders($http_response_header);
  25394. }
  25395. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  25396. $this->degradedMode = true;
  25397. $this->io->writeError('');
  25398. $this->io->writeError(array(
  25399. '<error>'.$e->getMessage().'</error>',
  25400. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  25401. ));
  25402. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  25403. }
  25404. throw $e;
  25405. }
  25406. if (!empty($http_response_header[0])) {
  25407. $this->lastHeaders = $http_response_header;
  25408. }
  25409. return $result;
  25410. }
  25411. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  25412. {
  25413. switch ($notificationCode) {
  25414. case STREAM_NOTIFY_FAILURE:
  25415. if (400 === $messageCode) {
  25416. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  25417. }
  25418. case STREAM_NOTIFY_AUTH_REQUIRED:
  25419. if (401 === $messageCode) {
  25420. if (!$this->retryAuthFailure) {
  25421. break;
  25422. }
  25423. $this->promptAuthAndRetry($messageCode);
  25424. }
  25425. break;
  25426. case STREAM_NOTIFY_AUTH_RESULT:
  25427. if (403 === $messageCode) {
  25428. if (!$this->retryAuthFailure) {
  25429. break;
  25430. }
  25431. $this->promptAuthAndRetry($messageCode, $message);
  25432. }
  25433. break;
  25434. case STREAM_NOTIFY_FILE_SIZE_IS:
  25435. $this->bytesMax = $bytesMax;
  25436. break;
  25437. case STREAM_NOTIFY_PROGRESS:
  25438. if ($this->bytesMax > 0 && $this->progress) {
  25439. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  25440. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  25441. $this->lastProgress = $progression;
  25442. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  25443. }
  25444. }
  25445. break;
  25446. default:
  25447. break;
  25448. }
  25449. }
  25450. protected function promptAuthAndRetry($httpStatus, $reason = null)
  25451. {
  25452. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  25453. $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');
  25454. $gitHubUtil = new GitHub($this->io, $this->config, null);
  25455. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  25456. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  25457. ) {
  25458. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  25459. }
  25460. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  25461. $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');
  25462. $gitLabUtil = new GitLab($this->io, $this->config, null);
  25463. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
  25464. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  25465. }
  25466. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  25467. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  25468. ) {
  25469. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  25470. }
  25471. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  25472. $askForOAuthToken = true;
  25473. if ($this->io->hasAuthentication($this->originUrl)) {
  25474. $auth = $this->io->getAuthentication($this->originUrl);
  25475. if ($auth['username'] !== 'x-token-auth') {
  25476. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  25477. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  25478. if (!empty($accessToken)) {
  25479. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  25480. $askForOAuthToken = false;
  25481. }
  25482. } else {
  25483. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  25484. }
  25485. }
  25486. if ($askForOAuthToken) {
  25487. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  25488. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  25489. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  25490. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  25491. ) {
  25492. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  25493. }
  25494. }
  25495. } else {
  25496. if ($httpStatus === 404) {
  25497. return;
  25498. }
  25499. if (!$this->io->isInteractive()) {
  25500. if ($httpStatus === 401) {
  25501. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  25502. }
  25503. if ($httpStatus === 403) {
  25504. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  25505. }
  25506. throw new TransportException($message, $httpStatus);
  25507. }
  25508. if ($this->io->hasAuthentication($this->originUrl)) {
  25509. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  25510. }
  25511. $this->io->overwriteError('');
  25512. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  25513. $username = $this->io->ask(' Username: ');
  25514. $password = $this->io->askAndHideAnswer(' Password: ');
  25515. $this->io->setAuthentication($this->originUrl, $username, $password);
  25516. $this->storeAuth = $this->config->get('store-auths');
  25517. }
  25518. $this->retry = true;
  25519. throw new TransportException('RETRY');
  25520. }
  25521. protected function getOptionsForUrl($originUrl, $additionalOptions)
  25522. {
  25523. $tlsOptions = array();
  25524. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  25525. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  25526. if (PHP_VERSION_ID >= 50304) {
  25527. $userlandFollow = true;
  25528. } else {
  25529. if ($host === 'github.com' || $host === 'api.github.com') {
  25530. $host = '*.github.com';
  25531. }
  25532. }
  25533. $tlsOptions['ssl']['CN_match'] = $host;
  25534. $tlsOptions['ssl']['SNI_server_name'] = $host;
  25535. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  25536. if (isset($this->peerCertificateMap[$urlAuthority])) {
  25537. $certMap = $this->peerCertificateMap[$urlAuthority];
  25538. $this->io->writeError('', true, IOInterface::DEBUG);
  25539. $this->io->writeError(sprintf(
  25540. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  25541. $certMap['cn'],
  25542. $urlAuthority
  25543. ), true, IOInterface::DEBUG);
  25544. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  25545. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  25546. }
  25547. }
  25548. $headers = array();
  25549. if (extension_loaded('zlib')) {
  25550. $headers[] = 'Accept-Encoding: gzip';
  25551. }
  25552. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  25553. if (!$this->degradedMode) {
  25554. $options['http']['protocol_version'] = 1.1;
  25555. $headers[] = 'Connection: close';
  25556. }
  25557. if (isset($userlandFollow)) {
  25558. $options['http']['follow_location'] = 0;
  25559. }
  25560. if ($this->io->hasAuthentication($originUrl)) {
  25561. $auth = $this->io->getAuthentication($originUrl);
  25562. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  25563. $options['github-token'] = $auth['username'];
  25564. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  25565. if ($auth['password'] === 'oauth2') {
  25566. $headers[] = 'Authorization: Bearer '.$auth['username'];
  25567. } elseif ($auth['password'] === 'private-token') {
  25568. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  25569. }
  25570. } elseif ('bitbucket.org' === $originUrl
  25571. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  25572. ) {
  25573. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  25574. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  25575. }
  25576. } else {
  25577. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  25578. $headers[] = 'Authorization: Basic '.$authStr;
  25579. }
  25580. }
  25581. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  25582. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  25583. }
  25584. foreach ($headers as $header) {
  25585. $options['http']['header'][] = $header;
  25586. }
  25587. return $options;
  25588. }
  25589. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  25590. {
  25591. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  25592. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  25593. $targetUrl = $locationHeader;
  25594. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  25595. $targetUrl = $this->scheme.':'.$locationHeader;
  25596. } elseif ('/' === $locationHeader[0]) {
  25597. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  25598. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  25599. } else {
  25600. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  25601. }
  25602. }
  25603. if (!empty($targetUrl)) {
  25604. $this->redirects++;
  25605. $this->io->writeError('', true, IOInterface::DEBUG);
  25606. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  25607. $additionalOptions['redirects'] = $this->redirects;
  25608. return $this->get($this->originUrl, $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  25609. }
  25610. if (!$this->retry) {
  25611. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  25612. $e->setHeaders($http_response_header);
  25613. $e->setResponse($result);
  25614. throw $e;
  25615. }
  25616. return false;
  25617. }
  25618. private function getTlsDefaults(array $options)
  25619. {
  25620. $ciphers = implode(':', array(
  25621. 'ECDHE-RSA-AES128-GCM-SHA256',
  25622. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  25623. 'ECDHE-RSA-AES256-GCM-SHA384',
  25624. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  25625. 'DHE-RSA-AES128-GCM-SHA256',
  25626. 'DHE-DSS-AES128-GCM-SHA256',
  25627. 'kEDH+AESGCM',
  25628. 'ECDHE-RSA-AES128-SHA256',
  25629. 'ECDHE-ECDSA-AES128-SHA256',
  25630. 'ECDHE-RSA-AES128-SHA',
  25631. 'ECDHE-ECDSA-AES128-SHA',
  25632. 'ECDHE-RSA-AES256-SHA384',
  25633. 'ECDHE-ECDSA-AES256-SHA384',
  25634. 'ECDHE-RSA-AES256-SHA',
  25635. 'ECDHE-ECDSA-AES256-SHA',
  25636. 'DHE-RSA-AES128-SHA256',
  25637. 'DHE-RSA-AES128-SHA',
  25638. 'DHE-DSS-AES128-SHA256',
  25639. 'DHE-RSA-AES256-SHA256',
  25640. 'DHE-DSS-AES256-SHA',
  25641. 'DHE-RSA-AES256-SHA',
  25642. 'AES128-GCM-SHA256',
  25643. 'AES256-GCM-SHA384',
  25644. 'AES128-SHA256',
  25645. 'AES256-SHA256',
  25646. 'AES128-SHA',
  25647. 'AES256-SHA',
  25648. 'AES',
  25649. 'CAMELLIA',
  25650. 'DES-CBC3-SHA',
  25651. '!aNULL',
  25652. '!eNULL',
  25653. '!EXPORT',
  25654. '!DES',
  25655. '!RC4',
  25656. '!MD5',
  25657. '!PSK',
  25658. '!aECDH',
  25659. '!EDH-DSS-DES-CBC3-SHA',
  25660. '!EDH-RSA-DES-CBC3-SHA',
  25661. '!KRB5-DES-CBC3-SHA',
  25662. ));
  25663. $defaults = array(
  25664. 'ssl' => array(
  25665. 'ciphers' => $ciphers,
  25666. 'verify_peer' => true,
  25667. 'verify_depth' => 7,
  25668. 'SNI_enabled' => true,
  25669. 'capture_peer_cert' => true,
  25670. ),
  25671. );
  25672. if (isset($options['ssl'])) {
  25673. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  25674. }
  25675. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  25676. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  25677. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  25678. if (preg_match('{^phar://}', $result)) {
  25679. $hash = hash_file('sha256', $result);
  25680. $targetPath = rtrim(sys_get_temp_dir(), '\\/') . '/composer-cacert-' . $hash . '.pem';
  25681. if (!file_exists($targetPath) || $hash !== hash_file('sha256', $targetPath)) {
  25682. $this->streamCopy($result, $targetPath);
  25683. chmod($targetPath, 0666);
  25684. }
  25685. $defaults['ssl']['cafile'] = $targetPath;
  25686. } elseif (is_dir($result)) {
  25687. $defaults['ssl']['capath'] = $result;
  25688. } else {
  25689. $defaults['ssl']['cafile'] = $result;
  25690. }
  25691. }
  25692. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  25693. throw new TransportException('The configured cafile was not valid or could not be read.');
  25694. }
  25695. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  25696. throw new TransportException('The configured capath was not valid or could not be read.');
  25697. }
  25698. if (PHP_VERSION_ID >= 50413) {
  25699. $defaults['ssl']['disable_compression'] = true;
  25700. }
  25701. return $defaults;
  25702. }
  25703. private function streamCopy($source, $target)
  25704. {
  25705. $source = fopen($source, 'r');
  25706. $target = fopen($target, 'w+');
  25707. stream_copy_to_stream($source, $target);
  25708. fclose($source);
  25709. fclose($target);
  25710. unset($source, $target);
  25711. }
  25712. private function getCertificateCnAndFp($url, $options)
  25713. {
  25714. if (PHP_VERSION_ID >= 50600) {
  25715. throw new \BadMethodCallException(sprintf(
  25716. '%s must not be used on PHP >= 5.6',
  25717. __METHOD__
  25718. ));
  25719. }
  25720. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  25721. 'ssl' => array(
  25722. 'capture_peer_cert' => true,
  25723. 'verify_peer' => false,
  25724. ), ),
  25725. ));
  25726. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  25727. return;
  25728. }
  25729. fclose($handle);
  25730. $handle = null;
  25731. $params = stream_context_get_params($context);
  25732. if (!empty($params['options']['ssl']['peer_certificate'])) {
  25733. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  25734. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  25735. return array(
  25736. 'cn' => $commonName,
  25737. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  25738. );
  25739. }
  25740. }
  25741. }
  25742. private function getUrlAuthority($url)
  25743. {
  25744. $defaultPorts = array(
  25745. 'ftp' => 21,
  25746. 'http' => 80,
  25747. 'https' => 443,
  25748. 'ssh2.sftp' => 22,
  25749. 'ssh2.scp' => 22,
  25750. );
  25751. $scheme = parse_url($url, PHP_URL_SCHEME);
  25752. if (!isset($defaultPorts[$scheme])) {
  25753. throw new \InvalidArgumentException(sprintf(
  25754. 'Could not get default port for unknown scheme: %s',
  25755. $scheme
  25756. ));
  25757. }
  25758. $defaultPort = $defaultPorts[$scheme];
  25759. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  25760. return parse_url($url, PHP_URL_HOST).':'.$port;
  25761. }
  25762. private function isPublicBitBucketDownload($urlToBitBucketFile)
  25763. {
  25764. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  25765. if (strpos($domain, 'bitbucket.org') === false) {
  25766. return true;
  25767. }
  25768. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  25769. $pathParts = explode('/', $path);
  25770. if (count($pathParts) >= 4 && $pathParts[3] == 'downloads') {
  25771. return true;
  25772. }
  25773. return false;
  25774. }
  25775. }
  25776. <?php
  25777. namespace Composer\Util;
  25778. class Silencer
  25779. {
  25780. private static $stack = array();
  25781. public static function suppress($mask = null)
  25782. {
  25783. if (!isset($mask)) {
  25784. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  25785. }
  25786. $old = error_reporting();
  25787. array_push(self::$stack, $old);
  25788. error_reporting($old & ~$mask);
  25789. return $old;
  25790. }
  25791. public static function restore()
  25792. {
  25793. if (!empty(self::$stack)) {
  25794. error_reporting(array_pop(self::$stack));
  25795. }
  25796. }
  25797. public static function call($callable )
  25798. {
  25799. try {
  25800. self::suppress();
  25801. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  25802. self::restore();
  25803. return $result;
  25804. } catch (\Exception $e) {
  25805. self::restore();
  25806. throw $e;
  25807. }
  25808. }
  25809. }
  25810. <?php
  25811. namespace Composer\Util;
  25812. use Composer\Spdx\SpdxLicenses;
  25813. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  25814. class SpdxLicense extends SpdxLicenses
  25815. {
  25816. }
  25817. <?php
  25818. namespace Composer\Util;
  25819. use Composer\Composer;
  25820. final class StreamContextFactory
  25821. {
  25822. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  25823. {
  25824. $options = array('http' => array(
  25825. 'follow_location' => 1,
  25826. 'max_redirects' => 20,
  25827. ));
  25828. if (PHP_SAPI === 'cli' && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  25829. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  25830. }
  25831. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  25832. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  25833. }
  25834. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  25835. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  25836. }
  25837. if (!empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  25838. $pattern = new NoProxyPattern($_SERVER['no_proxy']);
  25839. if ($pattern->test($url)) {
  25840. unset($proxy);
  25841. }
  25842. }
  25843. if (!empty($proxy)) {
  25844. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  25845. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  25846. if (isset($proxy['port'])) {
  25847. $proxyURL .= ":" . $proxy['port'];
  25848. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  25849. $proxyURL .= ":80";
  25850. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  25851. $proxyURL .= ":443";
  25852. }
  25853. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  25854. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  25855. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  25856. }
  25857. $options['http']['proxy'] = $proxyURL;
  25858. switch (parse_url($url, PHP_URL_SCHEME)) {
  25859. case 'http':
  25860. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  25861. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  25862. $options['http']['request_fulluri'] = true;
  25863. }
  25864. break;
  25865. case 'https':
  25866. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  25867. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  25868. $options['http']['request_fulluri'] = true;
  25869. }
  25870. break;
  25871. }
  25872. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  25873. $options['ssl']['SNI_enabled'] = true;
  25874. if (PHP_VERSION_ID < 50600) {
  25875. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  25876. }
  25877. }
  25878. if (isset($proxy['user'])) {
  25879. $auth = urldecode($proxy['user']);
  25880. if (isset($proxy['pass'])) {
  25881. $auth .= ':' . urldecode($proxy['pass']);
  25882. }
  25883. $auth = base64_encode($auth);
  25884. if (isset($defaultOptions['http']['header'])) {
  25885. if (is_string($defaultOptions['http']['header'])) {
  25886. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  25887. }
  25888. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  25889. } else {
  25890. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  25891. }
  25892. }
  25893. }
  25894. $options = array_replace_recursive($options, $defaultOptions);
  25895. if (isset($options['http']['header'])) {
  25896. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  25897. }
  25898. if (defined('HHVM_VERSION')) {
  25899. $phpVersion = 'HHVM ' . HHVM_VERSION;
  25900. } else {
  25901. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  25902. }
  25903. if (!isset($options['http']['header']) || false === strpos(strtolower(implode('', $options['http']['header'])), 'user-agent')) {
  25904. $options['http']['header'][] = sprintf(
  25905. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  25906. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  25907. php_uname('s'),
  25908. php_uname('r'),
  25909. $phpVersion,
  25910. getenv('CI') ? '; CI' : ''
  25911. );
  25912. }
  25913. return stream_context_create($options, $defaultParams);
  25914. }
  25915. private static function fixHttpHeaderField($header)
  25916. {
  25917. if (!is_array($header)) {
  25918. $header = explode("\r\n", $header);
  25919. }
  25920. uasort($header, function ($el) {
  25921. return preg_match('{^content-type}i', $el) ? 1 : -1;
  25922. });
  25923. return $header;
  25924. }
  25925. }
  25926. <?php
  25927. namespace Composer\Util;
  25928. use Composer\Config;
  25929. use Composer\IO\IOInterface;
  25930. class Svn
  25931. {
  25932. const MAX_QTY_AUTH_TRIES = 5;
  25933. protected $credentials;
  25934. protected $hasAuth;
  25935. protected $io;
  25936. protected $url;
  25937. protected $cacheCredentials = true;
  25938. protected $process;
  25939. protected $qtyAuthTries = 0;
  25940. protected $config;
  25941. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  25942. {
  25943. $this->url = $url;
  25944. $this->io = $io;
  25945. $this->config = $config;
  25946. $this->process = $process ?: new ProcessExecutor;
  25947. }
  25948. public static function cleanEnv()
  25949. {
  25950. putenv("DYLD_LIBRARY_PATH");
  25951. unset($_SERVER['DYLD_LIBRARY_PATH']);
  25952. }
  25953. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  25954. {
  25955. $this->config->prohibitUrlByConfig($url, $this->io);
  25956. $svnCommand = $this->getCommand($command, $url, $path);
  25957. $output = null;
  25958. $io = $this->io;
  25959. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  25960. if ($type !== 'out') {
  25961. return;
  25962. }
  25963. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  25964. return;
  25965. }
  25966. $output .= $buffer;
  25967. if ($verbose) {
  25968. $io->writeError($buffer, false);
  25969. }
  25970. };
  25971. $status = $this->process->execute($svnCommand, $handler, $cwd);
  25972. if (0 === $status) {
  25973. return $output;
  25974. }
  25975. $errorOutput = $this->process->getErrorOutput();
  25976. $fullOutput = implode("\n", array($output, $errorOutput));
  25977. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  25978. && false === stripos($fullOutput, 'authorization failed')
  25979. && false === stripos($fullOutput, 'svn: E170001:')
  25980. && false === stripos($fullOutput, 'svn: E215004:')) {
  25981. throw new \RuntimeException($fullOutput);
  25982. }
  25983. if (!$this->hasAuth()) {
  25984. $this->doAuthDance();
  25985. }
  25986. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  25987. return $this->execute($command, $url, $cwd, $path, $verbose);
  25988. }
  25989. throw new \RuntimeException(
  25990. 'wrong credentials provided ('.$fullOutput.')'
  25991. );
  25992. }
  25993. public function setCacheCredentials($cacheCredentials)
  25994. {
  25995. $this->cacheCredentials = $cacheCredentials;
  25996. }
  25997. protected function doAuthDance()
  25998. {
  25999. if (!$this->io->isInteractive()) {
  26000. throw new \RuntimeException(
  26001. 'can not ask for authentication in non interactive mode'
  26002. );
  26003. }
  26004. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  26005. $this->hasAuth = true;
  26006. $this->credentials['username'] = $this->io->ask("Username: ");
  26007. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  26008. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  26009. return $this;
  26010. }
  26011. protected function getCommand($cmd, $url, $path = null)
  26012. {
  26013. $cmd = sprintf('%s %s%s %s',
  26014. $cmd,
  26015. '--non-interactive ',
  26016. $this->getCredentialString(),
  26017. ProcessExecutor::escape($url)
  26018. );
  26019. if ($path) {
  26020. $cmd .= ' ' . ProcessExecutor::escape($path);
  26021. }
  26022. return $cmd;
  26023. }
  26024. protected function getCredentialString()
  26025. {
  26026. if (!$this->hasAuth()) {
  26027. return '';
  26028. }
  26029. return sprintf(
  26030. ' %s--username %s --password %s ',
  26031. $this->getAuthCache(),
  26032. ProcessExecutor::escape($this->getUsername()),
  26033. ProcessExecutor::escape($this->getPassword())
  26034. );
  26035. }
  26036. protected function getPassword()
  26037. {
  26038. if ($this->credentials === null) {
  26039. throw new \LogicException("No svn auth detected.");
  26040. }
  26041. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  26042. }
  26043. protected function getUsername()
  26044. {
  26045. if ($this->credentials === null) {
  26046. throw new \LogicException("No svn auth detected.");
  26047. }
  26048. return $this->credentials['username'];
  26049. }
  26050. protected function hasAuth()
  26051. {
  26052. if (null !== $this->hasAuth) {
  26053. return $this->hasAuth;
  26054. }
  26055. if (false === $this->createAuthFromConfig()) {
  26056. $this->createAuthFromUrl();
  26057. }
  26058. return $this->hasAuth;
  26059. }
  26060. protected function getAuthCache()
  26061. {
  26062. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  26063. }
  26064. private function createAuthFromConfig()
  26065. {
  26066. if (!$this->config->has('http-basic')) {
  26067. return $this->hasAuth = false;
  26068. }
  26069. $authConfig = $this->config->get('http-basic');
  26070. $host = parse_url($this->url, PHP_URL_HOST);
  26071. if (isset($authConfig[$host])) {
  26072. $this->credentials['username'] = $authConfig[$host]['username'];
  26073. $this->credentials['password'] = $authConfig[$host]['password'];
  26074. return $this->hasAuth = true;
  26075. }
  26076. return $this->hasAuth = false;
  26077. }
  26078. private function createAuthFromUrl()
  26079. {
  26080. $uri = parse_url($this->url);
  26081. if (empty($uri['user'])) {
  26082. return $this->hasAuth = false;
  26083. }
  26084. $this->credentials['username'] = $uri['user'];
  26085. if (!empty($uri['pass'])) {
  26086. $this->credentials['password'] = $uri['pass'];
  26087. }
  26088. return $this->hasAuth = true;
  26089. }
  26090. }
  26091. <?php
  26092. namespace Composer\Util;
  26093. use Composer\CaBundle\CaBundle;
  26094. final class TlsHelper
  26095. {
  26096. private static $useOpensslParse;
  26097. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  26098. {
  26099. $names = self::getCertificateNames($certificate);
  26100. if (empty($names)) {
  26101. return false;
  26102. }
  26103. $combinedNames = array_merge($names['san'], array($names['cn']));
  26104. $hostname = strtolower($hostname);
  26105. foreach ($combinedNames as $certName) {
  26106. $matcher = self::certNameMatcher($certName);
  26107. if ($matcher && $matcher($hostname)) {
  26108. $cn = $names['cn'];
  26109. return true;
  26110. }
  26111. }
  26112. return false;
  26113. }
  26114. public static function getCertificateNames($certificate)
  26115. {
  26116. if (is_array($certificate)) {
  26117. $info = $certificate;
  26118. } elseif (CaBundle::isOpensslParseSafe()) {
  26119. $info = openssl_x509_parse($certificate, false);
  26120. }
  26121. if (!isset($info['subject']['commonName'])) {
  26122. return null;
  26123. }
  26124. $commonName = strtolower($info['subject']['commonName']);
  26125. $subjectAltNames = array();
  26126. if (isset($info['extensions']['subjectAltName'])) {
  26127. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  26128. $subjectAltNames = array_filter(array_map(function ($name) {
  26129. if (0 === strpos($name, 'DNS:')) {
  26130. return strtolower(ltrim(substr($name, 4)));
  26131. }
  26132. return null;
  26133. }, $subjectAltNames));
  26134. $subjectAltNames = array_values($subjectAltNames);
  26135. }
  26136. return array(
  26137. 'cn' => $commonName,
  26138. 'san' => $subjectAltNames,
  26139. );
  26140. }
  26141. public static function getCertificateFingerprint($certificate)
  26142. {
  26143. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  26144. $pubkeypem = $pubkeydetails['key'];
  26145. $start = '-----BEGIN PUBLIC KEY-----';
  26146. $end = '-----END PUBLIC KEY-----';
  26147. $pemtrim = substr($pubkeypem, (strpos($pubkeypem, $start) + strlen($start)), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  26148. $der = base64_decode($pemtrim);
  26149. return sha1($der);
  26150. }
  26151. public static function isOpensslParseSafe()
  26152. {
  26153. return CaBundle::isOpensslParseSafe();
  26154. }
  26155. private static function certNameMatcher($certName)
  26156. {
  26157. $wildcards = substr_count($certName, '*');
  26158. if (0 === $wildcards) {
  26159. return function ($hostname) use ($certName) {
  26160. return $hostname === $certName;
  26161. };
  26162. }
  26163. if (1 === $wildcards) {
  26164. $components = explode('.', $certName);
  26165. if (3 > count($components)) {
  26166. return;
  26167. }
  26168. $firstComponent = $components[0];
  26169. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  26170. return;
  26171. }
  26172. $wildcardRegex = preg_quote($certName);
  26173. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  26174. $wildcardRegex = "{^{$wildcardRegex}$}";
  26175. return function ($hostname) use ($wildcardRegex) {
  26176. return 1 === preg_match($wildcardRegex, $hostname);
  26177. };
  26178. }
  26179. }
  26180. }
  26181. <?php
  26182. namespace Composer;
  26183. use Composer\Util\IniHelper;
  26184. use Symfony\Component\Console\Output\OutputInterface;
  26185. class XdebugHandler
  26186. {
  26187. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  26188. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  26189. const RESTART_ID = 'internal';
  26190. private $output;
  26191. private $loaded;
  26192. private $envScanDir;
  26193. private $version;
  26194. private $tmpIni;
  26195. public function __construct(OutputInterface $output)
  26196. {
  26197. $this->output = $output;
  26198. $this->loaded = extension_loaded('xdebug');
  26199. $this->envScanDir = getenv('PHP_INI_SCAN_DIR');
  26200. if ($this->loaded) {
  26201. $ext = new \ReflectionExtension('xdebug');
  26202. $this->version = strval($ext->getVersion());
  26203. }
  26204. }
  26205. public function check()
  26206. {
  26207. $args = explode('|', strval(getenv(self::ENV_ALLOW)), 2);
  26208. if ($this->needsRestart($args[0])) {
  26209. if ($this->prepareRestart()) {
  26210. $command = $this->getCommand();
  26211. $this->restart($command);
  26212. }
  26213. return;
  26214. }
  26215. if (self::RESTART_ID === $args[0]) {
  26216. putenv(self::ENV_ALLOW);
  26217. if (false !== $this->envScanDir) {
  26218. if (isset($args[1])) {
  26219. putenv('PHP_INI_SCAN_DIR='.$args[1]);
  26220. } else {
  26221. putenv('PHP_INI_SCAN_DIR');
  26222. }
  26223. }
  26224. if ($this->loaded) {
  26225. putenv(self::ENV_VERSION);
  26226. }
  26227. }
  26228. }
  26229. protected function restart($command)
  26230. {
  26231. passthru($command, $exitCode);
  26232. if (!empty($this->tmpIni)) {
  26233. @unlink($this->tmpIni);
  26234. }
  26235. exit($exitCode);
  26236. }
  26237. private function needsRestart($allow)
  26238. {
  26239. if (PHP_SAPI !== 'cli' || !defined('PHP_BINARY')) {
  26240. return false;
  26241. }
  26242. return empty($allow) && $this->loaded;
  26243. }
  26244. private function prepareRestart()
  26245. {
  26246. $this->tmpIni = '';
  26247. $iniPaths = IniHelper::getAll();
  26248. $additional = count($iniPaths) > 1;
  26249. if (empty($iniPaths[0])) {
  26250. array_shift($iniPaths);
  26251. }
  26252. if ($this->writeTmpIni($iniPaths)) {
  26253. return $this->setEnvironment($additional, $iniPaths);
  26254. }
  26255. return false;
  26256. }
  26257. private function writeTmpIni(array $iniFiles)
  26258. {
  26259. if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) {
  26260. return false;
  26261. }
  26262. $content = '';
  26263. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  26264. foreach ($iniFiles as $file) {
  26265. $data = preg_replace($regex, ';$1', file_get_contents($file));
  26266. $content .= $data.PHP_EOL;
  26267. }
  26268. $content .= 'allow_url_fopen='.ini_get('allow_url_fopen').PHP_EOL;
  26269. $content .= 'disable_functions="'.ini_get('disable_functions').'"'.PHP_EOL;
  26270. $content .= 'memory_limit='.ini_get('memory_limit').PHP_EOL;
  26271. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  26272. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  26273. }
  26274. return @file_put_contents($this->tmpIni, $content);
  26275. }
  26276. private function getCommand()
  26277. {
  26278. $phpArgs = array(PHP_BINARY, '-c', $this->tmpIni);
  26279. $params = array_merge($phpArgs, $this->getScriptArgs($_SERVER['argv']));
  26280. return implode(' ', array_map(array($this, 'escape'), $params));
  26281. }
  26282. private function setEnvironment($additional, array $iniPaths)
  26283. {
  26284. if ($additional && !putenv('PHP_INI_SCAN_DIR=')) {
  26285. return false;
  26286. }
  26287. if (!putenv(IniHelper::ENV_ORIGINAL.'='.implode(PATH_SEPARATOR, $iniPaths))) {
  26288. return false;
  26289. }
  26290. if (!putenv(self::ENV_VERSION.'='.$this->version)) {
  26291. return false;
  26292. }
  26293. $args = array(self::RESTART_ID);
  26294. if (false !== $this->envScanDir) {
  26295. $args[] = $this->envScanDir;
  26296. }
  26297. return putenv(self::ENV_ALLOW.'='.implode('|', $args));
  26298. }
  26299. private function getScriptArgs(array $args)
  26300. {
  26301. if (in_array('--no-ansi', $args) || in_array('--ansi', $args)) {
  26302. return $args;
  26303. }
  26304. if ($this->output->isDecorated()) {
  26305. $offset = count($args) > 1 ? 2 : 1;
  26306. array_splice($args, $offset, 0, '--ansi');
  26307. }
  26308. return $args;
  26309. }
  26310. private function escape($arg, $meta = true)
  26311. {
  26312. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  26313. return escapeshellarg($arg);
  26314. }
  26315. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  26316. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  26317. if ($meta) {
  26318. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  26319. if (!$meta && !$quote) {
  26320. $quote = strpbrk($arg, '^&|<>()') !== false;
  26321. }
  26322. }
  26323. if ($quote) {
  26324. $arg = preg_replace('/(\\\\*)$/', '$1$1', $arg);
  26325. $arg = '"'.$arg.'"';
  26326. }
  26327. if ($meta) {
  26328. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  26329. }
  26330. return $arg;
  26331. }
  26332. }
  26333. <?php
  26334. function includeIfExists($file)
  26335. {
  26336. return file_exists($file) ? include $file : false;
  26337. }
  26338. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  26339. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  26340. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  26341. exit(1);
  26342. }
  26343. return $loader;
  26344. <?php
  26345. /*
  26346. * This file is part of Composer.
  26347. *
  26348. * (c) Nils Adermann <[email protected]>
  26349. * Jordi Boggiano <[email protected]>
  26350. *
  26351. * For the full copyright and license information, please view the LICENSE
  26352. * file that was distributed with this source code.
  26353. */
  26354. namespace Composer\Autoload;
  26355. /**
  26356. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  26357. *
  26358. * $loader = new \Composer\Autoload\ClassLoader();
  26359. *
  26360. * // register classes with namespaces
  26361. * $loader->add('Symfony\Component', __DIR__.'/component');
  26362. * $loader->add('Symfony', __DIR__.'/framework');
  26363. *
  26364. * // activate the autoloader
  26365. * $loader->register();
  26366. *
  26367. * // to enable searching the include path (eg. for PEAR packages)
  26368. * $loader->setUseIncludePath(true);
  26369. *
  26370. * In this example, if you try to use a class in the Symfony\Component
  26371. * namespace or one of its children (Symfony\Component\Console for instance),
  26372. * the autoloader will first look for the class under the component/
  26373. * directory, and it will then fallback to the framework/ directory if not
  26374. * found before giving up.
  26375. *
  26376. * This class is loosely based on the Symfony UniversalClassLoader.
  26377. *
  26378. * @author Fabien Potencier <[email protected]>
  26379. * @author Jordi Boggiano <[email protected]>
  26380. * @see http://www.php-fig.org/psr/psr-0/
  26381. * @see http://www.php-fig.org/psr/psr-4/
  26382. */
  26383. class ClassLoader
  26384. {
  26385. // PSR-4
  26386. private $prefixLengthsPsr4 = array();
  26387. private $prefixDirsPsr4 = array();
  26388. private $fallbackDirsPsr4 = array();
  26389. // PSR-0
  26390. private $prefixesPsr0 = array();
  26391. private $fallbackDirsPsr0 = array();
  26392. private $useIncludePath = false;
  26393. private $classMap = array();
  26394. private $classMapAuthoritative = false;
  26395. private $missingClasses = array();
  26396. private $apcuPrefix;
  26397. public function getPrefixes()
  26398. {
  26399. if (!empty($this->prefixesPsr0)) {
  26400. return call_user_func_array('array_merge', $this->prefixesPsr0);
  26401. }
  26402. return array();
  26403. }
  26404. public function getPrefixesPsr4()
  26405. {
  26406. return $this->prefixDirsPsr4;
  26407. }
  26408. public function getFallbackDirs()
  26409. {
  26410. return $this->fallbackDirsPsr0;
  26411. }
  26412. public function getFallbackDirsPsr4()
  26413. {
  26414. return $this->fallbackDirsPsr4;
  26415. }
  26416. public function getClassMap()
  26417. {
  26418. return $this->classMap;
  26419. }
  26420. /**
  26421. * @param array $classMap Class to filename map
  26422. */
  26423. public function addClassMap(array $classMap)
  26424. {
  26425. if ($this->classMap) {
  26426. $this->classMap = array_merge($this->classMap, $classMap);
  26427. } else {
  26428. $this->classMap = $classMap;
  26429. }
  26430. }
  26431. /**
  26432. * Registers a set of PSR-0 directories for a given prefix, either
  26433. * appending or prepending to the ones previously set for this prefix.
  26434. *
  26435. * @param string $prefix The prefix
  26436. * @param array|string $paths The PSR-0 root directories
  26437. * @param bool $prepend Whether to prepend the directories
  26438. */
  26439. public function add($prefix, $paths, $prepend = false)
  26440. {
  26441. if (!$prefix) {
  26442. if ($prepend) {
  26443. $this->fallbackDirsPsr0 = array_merge(
  26444. (array) $paths,
  26445. $this->fallbackDirsPsr0
  26446. );
  26447. } else {
  26448. $this->fallbackDirsPsr0 = array_merge(
  26449. $this->fallbackDirsPsr0,
  26450. (array) $paths
  26451. );
  26452. }
  26453. return;
  26454. }
  26455. $first = $prefix[0];
  26456. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  26457. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  26458. return;
  26459. }
  26460. if ($prepend) {
  26461. $this->prefixesPsr0[$first][$prefix] = array_merge(
  26462. (array) $paths,
  26463. $this->prefixesPsr0[$first][$prefix]
  26464. );
  26465. } else {
  26466. $this->prefixesPsr0[$first][$prefix] = array_merge(
  26467. $this->prefixesPsr0[$first][$prefix],
  26468. (array) $paths
  26469. );
  26470. }
  26471. }
  26472. /**
  26473. * Registers a set of PSR-4 directories for a given namespace, either
  26474. * appending or prepending to the ones previously set for this namespace.
  26475. *
  26476. * @param string $prefix The prefix/namespace, with trailing '\\'
  26477. * @param array|string $paths The PSR-4 base directories
  26478. * @param bool $prepend Whether to prepend the directories
  26479. *
  26480. * @throws \InvalidArgumentException
  26481. */
  26482. public function addPsr4($prefix, $paths, $prepend = false)
  26483. {
  26484. if (!$prefix) {
  26485. // Register directories for the root namespace.
  26486. if ($prepend) {
  26487. $this->fallbackDirsPsr4 = array_merge(
  26488. (array) $paths,
  26489. $this->fallbackDirsPsr4
  26490. );
  26491. } else {
  26492. $this->fallbackDirsPsr4 = array_merge(
  26493. $this->fallbackDirsPsr4,
  26494. (array) $paths
  26495. );
  26496. }
  26497. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  26498. // Register directories for a new namespace.
  26499. $length = strlen($prefix);
  26500. if ('\\' !== $prefix[$length - 1]) {
  26501. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  26502. }
  26503. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  26504. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  26505. } elseif ($prepend) {
  26506. // Prepend directories for an already registered namespace.
  26507. $this->prefixDirsPsr4[$prefix] = array_merge(
  26508. (array) $paths,
  26509. $this->prefixDirsPsr4[$prefix]
  26510. );
  26511. } else {
  26512. // Append directories for an already registered namespace.
  26513. $this->prefixDirsPsr4[$prefix] = array_merge(
  26514. $this->prefixDirsPsr4[$prefix],
  26515. (array) $paths
  26516. );
  26517. }
  26518. }
  26519. /**
  26520. * Registers a set of PSR-0 directories for a given prefix,
  26521. * replacing any others previously set for this prefix.
  26522. *
  26523. * @param string $prefix The prefix
  26524. * @param array|string $paths The PSR-0 base directories
  26525. */
  26526. public function set($prefix, $paths)
  26527. {
  26528. if (!$prefix) {
  26529. $this->fallbackDirsPsr0 = (array) $paths;
  26530. } else {
  26531. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  26532. }
  26533. }
  26534. /**
  26535. * Registers a set of PSR-4 directories for a given namespace,
  26536. * replacing any others previously set for this namespace.
  26537. *
  26538. * @param string $prefix The prefix/namespace, with trailing '\\'
  26539. * @param array|string $paths The PSR-4 base directories
  26540. *
  26541. * @throws \InvalidArgumentException
  26542. */
  26543. public function setPsr4($prefix, $paths)
  26544. {
  26545. if (!$prefix) {
  26546. $this->fallbackDirsPsr4 = (array) $paths;
  26547. } else {
  26548. $length = strlen($prefix);
  26549. if ('\\' !== $prefix[$length - 1]) {
  26550. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  26551. }
  26552. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  26553. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  26554. }
  26555. }
  26556. /**
  26557. * Turns on searching the include path for class files.
  26558. *
  26559. * @param bool $useIncludePath
  26560. */
  26561. public function setUseIncludePath($useIncludePath)
  26562. {
  26563. $this->useIncludePath = $useIncludePath;
  26564. }
  26565. /**
  26566. * Can be used to check if the autoloader uses the include path to check
  26567. * for classes.
  26568. *
  26569. * @return bool
  26570. */
  26571. public function getUseIncludePath()
  26572. {
  26573. return $this->useIncludePath;
  26574. }
  26575. /**
  26576. * Turns off searching the prefix and fallback directories for classes
  26577. * that have not been registered with the class map.
  26578. *
  26579. * @param bool $classMapAuthoritative
  26580. */
  26581. public function setClassMapAuthoritative($classMapAuthoritative)
  26582. {
  26583. $this->classMapAuthoritative = $classMapAuthoritative;
  26584. }
  26585. /**
  26586. * Should class lookup fail if not found in the current class map?
  26587. *
  26588. * @return bool
  26589. */
  26590. public function isClassMapAuthoritative()
  26591. {
  26592. return $this->classMapAuthoritative;
  26593. }
  26594. /**
  26595. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  26596. *
  26597. * @param string|null $apcuPrefix
  26598. */
  26599. public function setApcuPrefix($apcuPrefix)
  26600. {
  26601. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  26602. }
  26603. /**
  26604. * The APCu prefix in use, or null if APCu caching is not enabled.
  26605. *
  26606. * @return string|null
  26607. */
  26608. public function getApcuPrefix()
  26609. {
  26610. return $this->apcuPrefix;
  26611. }
  26612. /**
  26613. * Registers this instance as an autoloader.
  26614. *
  26615. * @param bool $prepend Whether to prepend the autoloader or not
  26616. */
  26617. public function register($prepend = false)
  26618. {
  26619. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  26620. }
  26621. /**
  26622. * Unregisters this instance as an autoloader.
  26623. */
  26624. public function unregister()
  26625. {
  26626. spl_autoload_unregister(array($this, 'loadClass'));
  26627. }
  26628. /**
  26629. * Loads the given class or interface.
  26630. *
  26631. * @param string $class The name of the class
  26632. * @return bool|null True if loaded, null otherwise
  26633. */
  26634. public function loadClass($class)
  26635. {
  26636. if ($file = $this->findFile($class)) {
  26637. includeFile($file);
  26638. return true;
  26639. }
  26640. }
  26641. /**
  26642. * Finds the path to the file where the class is defined.
  26643. *
  26644. * @param string $class The name of the class
  26645. *
  26646. * @return string|false The path if found, false otherwise
  26647. */
  26648. public function findFile($class)
  26649. {
  26650. // class map lookup
  26651. if (isset($this->classMap[$class])) {
  26652. return $this->classMap[$class];
  26653. }
  26654. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  26655. return false;
  26656. }
  26657. if (null !== $this->apcuPrefix) {
  26658. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  26659. if ($hit) {
  26660. return $file;
  26661. }
  26662. }
  26663. $file = $this->findFileWithExtension($class, '.php');
  26664. // Search for Hack files if we are running on HHVM
  26665. if (false === $file && defined('HHVM_VERSION')) {
  26666. $file = $this->findFileWithExtension($class, '.hh');
  26667. }
  26668. if (null !== $this->apcuPrefix) {
  26669. apcu_add($this->apcuPrefix.$class, $file);
  26670. }
  26671. if (false === $file) {
  26672. // Remember that this class does not exist.
  26673. $this->missingClasses[$class] = true;
  26674. }
  26675. return $file;
  26676. }
  26677. private function findFileWithExtension($class, $ext)
  26678. {
  26679. // PSR-4 lookup
  26680. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  26681. $first = $class[0];
  26682. if (isset($this->prefixLengthsPsr4[$first])) {
  26683. $subPath = $class;
  26684. while (false !== $lastPos = strrpos($subPath, '\\')) {
  26685. $subPath = substr($subPath, 0, $lastPos);
  26686. $search = $subPath.'\\';
  26687. if (isset($this->prefixDirsPsr4[$search])) {
  26688. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  26689. $length = $this->prefixLengthsPsr4[$first][$search];
  26690. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
  26691. return $file;
  26692. }
  26693. }
  26694. }
  26695. }
  26696. }
  26697. // PSR-4 fallback dirs
  26698. foreach ($this->fallbackDirsPsr4 as $dir) {
  26699. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  26700. return $file;
  26701. }
  26702. }
  26703. // PSR-0 lookup
  26704. if (false !== $pos = strrpos($class, '\\')) {
  26705. // namespaced class name
  26706. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  26707. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  26708. } else {
  26709. // PEAR-like class name
  26710. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  26711. }
  26712. if (isset($this->prefixesPsr0[$first])) {
  26713. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  26714. if (0 === strpos($class, $prefix)) {
  26715. foreach ($dirs as $dir) {
  26716. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  26717. return $file;
  26718. }
  26719. }
  26720. }
  26721. }
  26722. }
  26723. // PSR-0 fallback dirs
  26724. foreach ($this->fallbackDirsPsr0 as $dir) {
  26725. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  26726. return $file;
  26727. }
  26728. }
  26729. // PSR-0 include paths.
  26730. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  26731. return $file;
  26732. }
  26733. return false;
  26734. }
  26735. }
  26736. /**
  26737. * Scope isolated include.
  26738. *
  26739. * Prevents access to $this/self from included files.
  26740. */
  26741. function includeFile($file)
  26742. {
  26743. include $file;
  26744. }
  26745. {
  26746. "$schema": "http://json-schema.org/draft-04/schema#",
  26747. "description": "A representation of packages metadata.",
  26748. "type": "object",
  26749. "oneOf": [
  26750. { "required": [ "packages" ] },
  26751. { "required": [ "providers" ] },
  26752. { "required": [ "provider-includes", "providers-url" ] }
  26753. ],
  26754. "properties": {
  26755. "packages": {
  26756. "type": ["object", "array"],
  26757. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  26758. "additionalProperties": { "$ref": "#/definitions/versions" }
  26759. },
  26760. "providers-url": {
  26761. "type": "string",
  26762. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  26763. },
  26764. "provider-includes": {
  26765. "type": "object",
  26766. "description": "A hashmap of provider listings.",
  26767. "additionalProperties": { "$ref": "#/definitions/provider" }
  26768. },
  26769. "providers": {
  26770. "type": "object",
  26771. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  26772. "additionalProperties": { "$ref": "#/definitions/provider" }
  26773. },
  26774. "notify-batch": {
  26775. "type": "string",
  26776. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  26777. },
  26778. "search": {
  26779. "type": "string",
  26780. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  26781. },
  26782. "warning": {
  26783. "type": "string",
  26784. "description": "A message that will be output by Composer as a warning when this source is consulted."
  26785. }
  26786. },
  26787. "definitions": {
  26788. "versions": {
  26789. "type": "object",
  26790. "description": "A hashmap of versions and their metadata.",
  26791. "additionalProperties": { "$ref": "#/definitions/version" }
  26792. },
  26793. "version": {
  26794. "type": "object",
  26795. "oneOf": [
  26796. { "$ref": "#/definitions/package" },
  26797. { "$ref": "#/definitions/metapackage" }
  26798. ]
  26799. },
  26800. "package-base": {
  26801. "properties": {
  26802. "name": { "type": "string" },
  26803. "type": { "type": "string" },
  26804. "version": { "type": "string" },
  26805. "version_normalized": {
  26806. "type": "string",
  26807. "description": "Normalized version, optional but can save computational time on client side."
  26808. },
  26809. "autoload": { "type": "object" },
  26810. "require": { "type": "object" },
  26811. "replace": { "type": "object" },
  26812. "conflict": { "type": "object" },
  26813. "provide": { "type": "object" },
  26814. "time": { "type": "string" }
  26815. },
  26816. "additionalProperties": true
  26817. },
  26818. "package": {
  26819. "allOf": [
  26820. { "$ref": "#/definitions/package-base" },
  26821. {
  26822. "properties": {
  26823. "dist": { "type": "object" },
  26824. "source": { "type": "object" }
  26825. }
  26826. },
  26827. { "oneOf": [
  26828. { "required": [ "name", "version", "source" ] },
  26829. { "required": [ "name", "version", "dist" ] }
  26830. ] }
  26831. ]
  26832. },
  26833. "metapackage": {
  26834. "allOf": [
  26835. { "$ref": "#/definitions/package-base" },
  26836. {
  26837. "properties": {
  26838. "type": { "type": "string", "enum": [ "metapackage" ] }
  26839. },
  26840. "required": [ "name", "version", "type" ]
  26841. }
  26842. ]
  26843. },
  26844. "provider": {
  26845. "type": "object",
  26846. "properties": {
  26847. "sha256": {
  26848. "type": "string",
  26849. "description": "Hash value that can be used to validate the resource."
  26850. }
  26851. }
  26852. }
  26853. }
  26854. }
  26855. {
  26856. "$schema": "http://json-schema.org/draft-04/schema#",
  26857. "name": "Package",
  26858. "type": "object",
  26859. "additionalProperties": false,
  26860. "required": [ "name", "description" ],
  26861. "properties": {
  26862. "name": {
  26863. "type": "string",
  26864. "description": "Package name, including 'vendor-name/' prefix."
  26865. },
  26866. "type": {
  26867. "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.",
  26868. "type": "string"
  26869. },
  26870. "target-dir": {
  26871. "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.",
  26872. "type": "string"
  26873. },
  26874. "description": {
  26875. "type": "string",
  26876. "description": "Short package description."
  26877. },
  26878. "keywords": {
  26879. "type": "array",
  26880. "items": {
  26881. "type": "string",
  26882. "description": "A tag/keyword that this package relates to."
  26883. }
  26884. },
  26885. "homepage": {
  26886. "type": "string",
  26887. "description": "Homepage URL for the project.",
  26888. "format": "uri"
  26889. },
  26890. "version": {
  26891. "type": "string",
  26892. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  26893. },
  26894. "time": {
  26895. "type": "string",
  26896. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  26897. },
  26898. "license": {
  26899. "type": ["string", "array"],
  26900. "description": "License name. Or an array of license names."
  26901. },
  26902. "authors": {
  26903. "$ref": "#/definitions/authors"
  26904. },
  26905. "require": {
  26906. "type": "object",
  26907. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  26908. "additionalProperties": {
  26909. "type": "string"
  26910. }
  26911. },
  26912. "replace": {
  26913. "type": "object",
  26914. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  26915. "additionalProperties": {
  26916. "type": "string"
  26917. }
  26918. },
  26919. "conflict": {
  26920. "type": "object",
  26921. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  26922. "additionalProperties": {
  26923. "type": "string"
  26924. }
  26925. },
  26926. "provide": {
  26927. "type": "object",
  26928. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  26929. "additionalProperties": {
  26930. "type": "string"
  26931. }
  26932. },
  26933. "require-dev": {
  26934. "type": "object",
  26935. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  26936. "additionalProperties": {
  26937. "type": "string"
  26938. }
  26939. },
  26940. "suggest": {
  26941. "type": "object",
  26942. "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).",
  26943. "additionalProperties": {
  26944. "type": "string"
  26945. }
  26946. },
  26947. "config": {
  26948. "type": "object",
  26949. "description": "Composer options.",
  26950. "properties": {
  26951. "process-timeout": {
  26952. "type": "integer",
  26953. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  26954. },
  26955. "use-include-path": {
  26956. "type": "boolean",
  26957. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  26958. },
  26959. "preferred-install": {
  26960. "type": ["string", "object"],
  26961. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  26962. },
  26963. "notify-on-install": {
  26964. "type": "boolean",
  26965. "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."
  26966. },
  26967. "github-protocols": {
  26968. "type": "array",
  26969. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  26970. "items": {
  26971. "type": "string"
  26972. }
  26973. },
  26974. "github-oauth": {
  26975. "type": "object",
  26976. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  26977. "additionalProperties": {
  26978. "type": "string"
  26979. }
  26980. },
  26981. "gitlab-oauth": {
  26982. "type": "object",
  26983. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  26984. "additionalProperties": {
  26985. "type": "string"
  26986. }
  26987. },
  26988. "gitlab-token": {
  26989. "type": "object",
  26990. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  26991. "additionalProperties": true
  26992. },
  26993. "disable-tls": {
  26994. "type": "boolean",
  26995. "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."
  26996. },
  26997. "secure-http": {
  26998. "type": "boolean",
  26999. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  27000. },
  27001. "cafile": {
  27002. "type": "string",
  27003. "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."
  27004. },
  27005. "capath": {
  27006. "type": "string",
  27007. "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."
  27008. },
  27009. "http-basic": {
  27010. "type": "object",
  27011. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  27012. "additionalProperties": {
  27013. "type": "object",
  27014. "required": ["username", "password"],
  27015. "properties": {
  27016. "username": {
  27017. "type": "string",
  27018. "description": "The username used for HTTP Basic authentication"
  27019. },
  27020. "password": {
  27021. "type": "string",
  27022. "description": "The password used for HTTP Basic authentication"
  27023. }
  27024. }
  27025. }
  27026. },
  27027. "store-auths": {
  27028. "type": ["string", "boolean"],
  27029. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  27030. },
  27031. "platform": {
  27032. "type": "object",
  27033. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  27034. "additionalProperties": {
  27035. "type": "string"
  27036. }
  27037. },
  27038. "vendor-dir": {
  27039. "type": "string",
  27040. "description": "The location where all packages are installed, defaults to \"vendor\"."
  27041. },
  27042. "bin-dir": {
  27043. "type": "string",
  27044. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  27045. },
  27046. "data-dir": {
  27047. "type": "string",
  27048. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  27049. },
  27050. "cache-dir": {
  27051. "type": "string",
  27052. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  27053. },
  27054. "cache-files-dir": {
  27055. "type": "string",
  27056. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  27057. },
  27058. "cache-repo-dir": {
  27059. "type": "string",
  27060. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  27061. },
  27062. "cache-vcs-dir": {
  27063. "type": "string",
  27064. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  27065. },
  27066. "cache-ttl": {
  27067. "type": "integer",
  27068. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  27069. },
  27070. "cache-files-ttl": {
  27071. "type": "integer",
  27072. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  27073. },
  27074. "cache-files-maxsize": {
  27075. "type": ["string", "integer"],
  27076. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  27077. },
  27078. "bin-compat": {
  27079. "enum": ["auto", "full"],
  27080. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  27081. },
  27082. "discard-changes": {
  27083. "type": ["string", "boolean"],
  27084. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  27085. },
  27086. "autoloader-suffix": {
  27087. "type": "string",
  27088. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  27089. },
  27090. "optimize-autoloader": {
  27091. "type": "boolean",
  27092. "description": "Always optimize when dumping the autoloader."
  27093. },
  27094. "prepend-autoloader": {
  27095. "type": "boolean",
  27096. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  27097. },
  27098. "classmap-authoritative": {
  27099. "type": "boolean",
  27100. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  27101. },
  27102. "apcu-autoloader": {
  27103. "type": "boolean",
  27104. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  27105. },
  27106. "github-domains": {
  27107. "type": "array",
  27108. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  27109. "items": {
  27110. "type": "string"
  27111. }
  27112. },
  27113. "github-expose-hostname": {
  27114. "type": "boolean",
  27115. "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."
  27116. },
  27117. "gitlab-domains": {
  27118. "type": "array",
  27119. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  27120. "items": {
  27121. "type": "string"
  27122. }
  27123. },
  27124. "archive-format": {
  27125. "type": "string",
  27126. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  27127. },
  27128. "archive-dir": {
  27129. "type": "string",
  27130. "description": "The default archive path when not provided on cli, defaults to \".\"."
  27131. }
  27132. }
  27133. },
  27134. "extra": {
  27135. "type": ["object", "array"],
  27136. "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.",
  27137. "additionalProperties": true
  27138. },
  27139. "autoload": {
  27140. "$ref": "#/definitions/autoload"
  27141. },
  27142. "autoload-dev": {
  27143. "type": "object",
  27144. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  27145. "properties": {
  27146. "psr-0": {
  27147. "type": "object",
  27148. "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.",
  27149. "additionalProperties": {
  27150. "type": ["string", "array"],
  27151. "items": {
  27152. "type": "string"
  27153. }
  27154. }
  27155. },
  27156. "psr-4": {
  27157. "type": "object",
  27158. "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.",
  27159. "additionalProperties": {
  27160. "type": ["string", "array"],
  27161. "items": {
  27162. "type": "string"
  27163. }
  27164. }
  27165. },
  27166. "classmap": {
  27167. "type": "array",
  27168. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  27169. },
  27170. "files": {
  27171. "type": "array",
  27172. "description": "This is an array of files that are always required on every request."
  27173. }
  27174. }
  27175. },
  27176. "archive": {
  27177. "type": ["object"],
  27178. "description": "Options for creating package archives for distribution.",
  27179. "properties": {
  27180. "exclude": {
  27181. "type": "array",
  27182. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  27183. }
  27184. }
  27185. },
  27186. "repositories": {
  27187. "type": ["object", "array"],
  27188. "description": "A set of additional repositories where packages can be found.",
  27189. "additionalProperties": {
  27190. "oneOf": [
  27191. { "$ref": "#/definitions/repository" },
  27192. { "type": "boolean", "enum": [false] }
  27193. ]
  27194. },
  27195. "items": {
  27196. "oneOf": [
  27197. { "$ref": "#/definitions/repository" },
  27198. {
  27199. "type": "object",
  27200. "additionalProperties": { "type": "boolean", "enum": [false] },
  27201. "minProperties": 1,
  27202. "maxProperties": 1
  27203. }
  27204. ]
  27205. }
  27206. },
  27207. "minimum-stability": {
  27208. "type": ["string"],
  27209. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  27210. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  27211. },
  27212. "prefer-stable": {
  27213. "type": ["boolean"],
  27214. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  27215. },
  27216. "bin": {
  27217. "type": ["array"],
  27218. "description": "A set of files that should be treated as binaries and symlinked into bin-dir (from config).",
  27219. "items": {
  27220. "type": "string"
  27221. }
  27222. },
  27223. "include-path": {
  27224. "type": ["array"],
  27225. "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.",
  27226. "items": {
  27227. "type": "string"
  27228. }
  27229. },
  27230. "scripts": {
  27231. "type": ["object"],
  27232. "description": "Scripts listeners that will be executed before/after some events.",
  27233. "properties": {
  27234. "pre-install-cmd": {
  27235. "type": ["array", "string"],
  27236. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  27237. },
  27238. "post-install-cmd": {
  27239. "type": ["array", "string"],
  27240. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  27241. },
  27242. "pre-update-cmd": {
  27243. "type": ["array", "string"],
  27244. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  27245. },
  27246. "post-update-cmd": {
  27247. "type": ["array", "string"],
  27248. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  27249. },
  27250. "pre-status-cmd": {
  27251. "type": ["array", "string"],
  27252. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  27253. },
  27254. "post-status-cmd": {
  27255. "type": ["array", "string"],
  27256. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  27257. },
  27258. "pre-package-install": {
  27259. "type": ["array", "string"],
  27260. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  27261. },
  27262. "post-package-install": {
  27263. "type": ["array", "string"],
  27264. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  27265. },
  27266. "pre-package-update": {
  27267. "type": ["array", "string"],
  27268. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  27269. },
  27270. "post-package-update": {
  27271. "type": ["array", "string"],
  27272. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  27273. },
  27274. "pre-package-uninstall": {
  27275. "type": ["array", "string"],
  27276. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  27277. },
  27278. "post-package-uninstall": {
  27279. "type": ["array", "string"],
  27280. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  27281. },
  27282. "pre-autoload-dump": {
  27283. "type": ["array", "string"],
  27284. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  27285. },
  27286. "post-autoload-dump": {
  27287. "type": ["array", "string"],
  27288. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  27289. },
  27290. "post-root-package-install": {
  27291. "type": ["array", "string"],
  27292. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  27293. },
  27294. "post-create-project-cmd": {
  27295. "type": ["array", "string"],
  27296. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  27297. }
  27298. }
  27299. },
  27300. "support": {
  27301. "type": "object",
  27302. "properties": {
  27303. "email": {
  27304. "type": "string",
  27305. "description": "Email address for support.",
  27306. "format": "email"
  27307. },
  27308. "issues": {
  27309. "type": "string",
  27310. "description": "URL to the issue tracker.",
  27311. "format": "uri"
  27312. },
  27313. "forum": {
  27314. "type": "string",
  27315. "description": "URL to the forum.",
  27316. "format": "uri"
  27317. },
  27318. "wiki": {
  27319. "type": "string",
  27320. "description": "URL to the wiki.",
  27321. "format": "uri"
  27322. },
  27323. "irc": {
  27324. "type": "string",
  27325. "description": "IRC channel for support, as irc://server/channel.",
  27326. "format": "uri"
  27327. },
  27328. "source": {
  27329. "type": "string",
  27330. "description": "URL to browse or download the sources.",
  27331. "format": "uri"
  27332. },
  27333. "docs": {
  27334. "type": "string",
  27335. "description": "URL to the documentation.",
  27336. "format": "uri"
  27337. },
  27338. "rss": {
  27339. "type": "string",
  27340. "description": "URL to the RSS feed.",
  27341. "format": "uri"
  27342. }
  27343. }
  27344. },
  27345. "non-feature-branches": {
  27346. "type": ["array"],
  27347. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  27348. "items": {
  27349. "type": "string"
  27350. }
  27351. },
  27352. "abandoned": {
  27353. "type": ["boolean", "string"],
  27354. "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."
  27355. },
  27356. "_comment": {
  27357. "type": ["array", "string"],
  27358. "description": "A key to store comments in"
  27359. }
  27360. },
  27361. "definitions": {
  27362. "authors": {
  27363. "type": "array",
  27364. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  27365. "items": {
  27366. "type": "object",
  27367. "additionalProperties": false,
  27368. "required": [ "name"],
  27369. "properties": {
  27370. "name": {
  27371. "type": "string",
  27372. "description": "Full name of the author."
  27373. },
  27374. "email": {
  27375. "type": "string",
  27376. "description": "Email address of the author.",
  27377. "format": "email"
  27378. },
  27379. "homepage": {
  27380. "type": "string",
  27381. "description": "Homepage URL for the author.",
  27382. "format": "uri"
  27383. },
  27384. "role": {
  27385. "type": "string",
  27386. "description": "Author's role in the project."
  27387. }
  27388. }
  27389. }
  27390. },
  27391. "autoload": {
  27392. "type": "object",
  27393. "description": "Description of how the package can be autoloaded.",
  27394. "properties": {
  27395. "psr-0": {
  27396. "type": "object",
  27397. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  27398. "additionalProperties": {
  27399. "type": ["string", "array"],
  27400. "items": {
  27401. "type": "string"
  27402. }
  27403. }
  27404. },
  27405. "psr-4": {
  27406. "type": "object",
  27407. "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.",
  27408. "additionalProperties": {
  27409. "type": ["string", "array"],
  27410. "items": {
  27411. "type": "string"
  27412. }
  27413. }
  27414. },
  27415. "classmap": {
  27416. "type": "array",
  27417. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  27418. },
  27419. "files": {
  27420. "type": "array",
  27421. "description": "This is an array of files that are always required on every request."
  27422. },
  27423. "exclude-from-classmap": {
  27424. "type": "array",
  27425. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  27426. }
  27427. }
  27428. },
  27429. "repository": {
  27430. "type": "object",
  27431. "oneOf": [
  27432. { "$ref": "#/definitions/composer-repository" },
  27433. { "$ref": "#/definitions/vcs-repository" },
  27434. { "$ref": "#/definitions/path-repository" },
  27435. { "$ref": "#/definitions/artifact-repository" },
  27436. { "$ref": "#/definitions/pear-repository" },
  27437. { "$ref": "#/definitions/package-repository" }
  27438. ]
  27439. },
  27440. "composer-repository": {
  27441. "type": "object",
  27442. "required": ["type", "url"],
  27443. "properties": {
  27444. "type": { "type": "string", "enum": ["composer"] },
  27445. "url": { "type": "string" },
  27446. "options": {
  27447. "type": "object",
  27448. "additionalProperties": true
  27449. },
  27450. "allow_ssl_downgrade": { "type": "boolean" },
  27451. "force-lazy-providers": { "type": "boolean" }
  27452. }
  27453. },
  27454. "vcs-repository": {
  27455. "type": "object",
  27456. "required": ["type", "url"],
  27457. "properties": {
  27458. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  27459. "url": { "type": "string" },
  27460. "no-api": { "type": "boolean" },
  27461. "secure-http": { "type": "boolean" },
  27462. "svn-cache-credentials": { "type": "boolean" },
  27463. "trunk-path": { "type": ["string", "boolean"] },
  27464. "branches-path": { "type": ["string", "boolean"] },
  27465. "tags-path": { "type": ["string", "boolean"] },
  27466. "package-path": { "type": "string" },
  27467. "depot": { "type": "string" },
  27468. "branch": { "type": "string" },
  27469. "unique_perforce_client_name": { "type": "string" },
  27470. "p4user": { "type": "string" },
  27471. "p4password": { "type": "string" }
  27472. }
  27473. },
  27474. "path-repository": {
  27475. "type": "object",
  27476. "required": ["type", "url"],
  27477. "properties": {
  27478. "type": { "type": "string", "enum": ["path"] },
  27479. "url": { "type": "string" },
  27480. "options": {
  27481. "type": "object",
  27482. "properties": {
  27483. "symlink": { "type": ["boolean", "null"] }
  27484. },
  27485. "additionalProperties": true
  27486. }
  27487. }
  27488. },
  27489. "artifact-repository": {
  27490. "type": "object",
  27491. "required": ["type", "url"],
  27492. "properties": {
  27493. "type": { "type": "string", "enum": ["artifact"] },
  27494. "url": { "type": "string" }
  27495. }
  27496. },
  27497. "pear-repository": {
  27498. "type": "object",
  27499. "required": ["type", "url"],
  27500. "properties": {
  27501. "type": { "type": "string", "enum": ["pear"] },
  27502. "url": { "type": "string" },
  27503. "vendor-alias": { "type": "string" }
  27504. }
  27505. },
  27506. "package-repository": {
  27507. "type": "object",
  27508. "required": ["type", "package"],
  27509. "properties": {
  27510. "type": { "type": "string", "enum": ["package"] },
  27511. "package": {
  27512. "oneOf": [
  27513. { "$ref": "#/definitions/inline-package" },
  27514. {
  27515. "type": "array",
  27516. "items": {
  27517. "type": { "$ref": "#/definitions/inline-package" }
  27518. }
  27519. }
  27520. ]
  27521. }
  27522. }
  27523. },
  27524. "inline-package": {
  27525. "required": ["name", "version"],
  27526. "properties": {
  27527. "name": {
  27528. "type": "string",
  27529. "description": "Package name, including 'vendor-name/' prefix."
  27530. },
  27531. "type": {
  27532. "type": "string"
  27533. },
  27534. "target-dir": {
  27535. "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.",
  27536. "type": "string"
  27537. },
  27538. "description": {
  27539. "type": "string"
  27540. },
  27541. "keywords": {
  27542. "type": "array",
  27543. "items": {
  27544. "type": "string"
  27545. }
  27546. },
  27547. "homepage": {
  27548. "type": "string",
  27549. "format": "uri"
  27550. },
  27551. "version": {
  27552. "type": "string"
  27553. },
  27554. "time": {
  27555. "type": "string"
  27556. },
  27557. "license": {
  27558. "type": [
  27559. "string",
  27560. "array"
  27561. ]
  27562. },
  27563. "authors": {
  27564. "$ref": "#/definitions/authors"
  27565. },
  27566. "require": {
  27567. "type": "object",
  27568. "additionalProperties": {
  27569. "type": "string"
  27570. }
  27571. },
  27572. "replace": {
  27573. "type": "object",
  27574. "additionalProperties": {
  27575. "type": "string"
  27576. }
  27577. },
  27578. "conflict": {
  27579. "type": "object",
  27580. "additionalProperties": {
  27581. "type": "string"
  27582. }
  27583. },
  27584. "provide": {
  27585. "type": "object",
  27586. "additionalProperties": {
  27587. "type": "string"
  27588. }
  27589. },
  27590. "require-dev": {
  27591. "type": "object",
  27592. "additionalProperties": {
  27593. "type": "string"
  27594. }
  27595. },
  27596. "suggest": {
  27597. "type": "object",
  27598. "additionalProperties": {
  27599. "type": "string"
  27600. }
  27601. },
  27602. "extra": {
  27603. "type": ["object", "array"],
  27604. "additionalProperties": true
  27605. },
  27606. "autoload": {
  27607. "$ref": "#/definitions/autoload"
  27608. },
  27609. "archive": {
  27610. "type": ["object"],
  27611. "properties": {
  27612. "exclude": {
  27613. "type": "array"
  27614. }
  27615. }
  27616. },
  27617. "bin": {
  27618. "type": ["array"],
  27619. "description": "A set of files that should be treated as binaries and symlinked into bin-dir (from config).",
  27620. "items": {
  27621. "type": "string"
  27622. }
  27623. },
  27624. "include-path": {
  27625. "type": ["array"],
  27626. "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.",
  27627. "items": {
  27628. "type": "string"
  27629. }
  27630. },
  27631. "source": {
  27632. "type": "object",
  27633. "required": ["type", "url", "reference"],
  27634. "properties": {
  27635. "type": {
  27636. "type": "string"
  27637. },
  27638. "url": {
  27639. "type": "string"
  27640. },
  27641. "reference": {
  27642. "type": "string"
  27643. },
  27644. "mirrors": {
  27645. "type": "array"
  27646. }
  27647. }
  27648. },
  27649. "dist": {
  27650. "type": "object",
  27651. "required": ["type", "url"],
  27652. "properties": {
  27653. "type": {
  27654. "type": "string"
  27655. },
  27656. "url": {
  27657. "type": "string"
  27658. },
  27659. "reference": {
  27660. "type": "string"
  27661. },
  27662. "shasum": {
  27663. "type": "string"
  27664. },
  27665. "mirrors": {
  27666. "type": "array"
  27667. }
  27668. }
  27669. }
  27670. },
  27671. "additionalProperties": true
  27672. }
  27673. }
  27674. }
  27675. {
  27676. "389-exception": [
  27677. "389 Directory Server\nException"
  27678. ],
  27679. "Autoconf-exception-2.0": [
  27680. "Autoconf exception 2.0"
  27681. ],
  27682. "Autoconf-exception-3.0": [
  27683. "Autoconf exception 3.0"
  27684. ],
  27685. "Bison-exception-2.2": [
  27686. "Bison exception 2.2"
  27687. ],
  27688. "Classpath-exception-2.0": [
  27689. "Classpath exception 2.0"
  27690. ],
  27691. "CLISP-exception-2.0": [
  27692. "CLISP exception 2.0"
  27693. ],
  27694. "DigiRule-FOSS-exception": [
  27695. "DigiRule FOSS License Exception"
  27696. ],
  27697. "eCos-exception-2.0": [
  27698. "eCos exception 2.0"
  27699. ],
  27700. "Fawkes-Runtime-exception": [
  27701. "Fawkes Runtime Exception"
  27702. ],
  27703. "FLTK-exception": [
  27704. "FLTK exception"
  27705. ],
  27706. "Font-exception-2.0": [
  27707. "Font exception 2.0"
  27708. ],
  27709. "freertos-exception-2.0": [
  27710. "FreeRTOS Exception 2.0"
  27711. ],
  27712. "GCC-exception-2.0": [
  27713. "GCC Runtime Library exception 2.0"
  27714. ],
  27715. "GCC-exception-3.1": [
  27716. "GCC Runtime Library exception 3.1"
  27717. ],
  27718. "gnu-javamail-exception": [
  27719. "GNU JavaMail exception"
  27720. ],
  27721. "i2p-gpl-java-exception": [
  27722. "i2p GPL+Java Exception"
  27723. ],
  27724. "Libtool-exception": [
  27725. "Libtool Exception"
  27726. ],
  27727. "LZMA-exception": [
  27728. "LZMA exception"
  27729. ],
  27730. "mif-exception": [
  27731. "Macros and Inline Functions Exception"
  27732. ],
  27733. "Nokia-Qt-exception-1.1": [
  27734. "Nokia Qt LGPL exception 1.1"
  27735. ],
  27736. "OCCT-exception-1.0": [
  27737. "Open CASCADE Exception 1.0"
  27738. ],
  27739. "openvpn-openssl-exception": [
  27740. "OpenVPN OpenSSL Exception"
  27741. ],
  27742. "Qwt-exception-1.0": [
  27743. "Qwt exception 1.0"
  27744. ],
  27745. "u-boot-exception-2.0": [
  27746. "U-Boot exception 2.0"
  27747. ],
  27748. "WxWindows-exception-3.1": [
  27749. "WxWindows Library Exception 3.1"
  27750. ]
  27751. }{
  27752. "0BSD": [
  27753. "BSD Zero Clause License",
  27754. true
  27755. ],
  27756. "AAL": [
  27757. "Attribution Assurance License",
  27758. true
  27759. ],
  27760. "Abstyles": [
  27761. "Abstyles License",
  27762. false
  27763. ],
  27764. "Adobe-2006": [
  27765. "Adobe Systems Incorporated Source Code License Agreement",
  27766. false
  27767. ],
  27768. "Adobe-Glyph": [
  27769. "Adobe Glyph List License",
  27770. false
  27771. ],
  27772. "ADSL": [
  27773. "Amazon Digital Services License",
  27774. false
  27775. ],
  27776. "AFL-1.1": [
  27777. "Academic Free License v1.1",
  27778. true
  27779. ],
  27780. "AFL-1.2": [
  27781. "Academic Free License v1.2",
  27782. true
  27783. ],
  27784. "AFL-2.0": [
  27785. "Academic Free License v2.0",
  27786. true
  27787. ],
  27788. "AFL-2.1": [
  27789. "Academic Free License v2.1",
  27790. true
  27791. ],
  27792. "AFL-3.0": [
  27793. "Academic Free License v3.0",
  27794. true
  27795. ],
  27796. "Afmparse": [
  27797. "Afmparse License",
  27798. false
  27799. ],
  27800. "AGPL-1.0": [
  27801. "Affero General Public License v1.0",
  27802. false
  27803. ],
  27804. "AGPL-3.0": [
  27805. "GNU Affero General Public License v3.0",
  27806. true
  27807. ],
  27808. "Aladdin": [
  27809. "Aladdin Free Public License",
  27810. false
  27811. ],
  27812. "AMDPLPA": [
  27813. "AMD's plpa_map.c License",
  27814. false
  27815. ],
  27816. "AML": [
  27817. "Apple MIT License",
  27818. false
  27819. ],
  27820. "AMPAS": [
  27821. "Academy of Motion Picture Arts and Sciences BSD",
  27822. false
  27823. ],
  27824. "ANTLR-PD": [
  27825. "ANTLR Software Rights Notice",
  27826. false
  27827. ],
  27828. "Apache-1.0": [
  27829. "Apache License 1.0",
  27830. false
  27831. ],
  27832. "Apache-1.1": [
  27833. "Apache License 1.1",
  27834. true
  27835. ],
  27836. "Apache-2.0": [
  27837. "Apache License 2.0",
  27838. true
  27839. ],
  27840. "APAFML": [
  27841. "Adobe Postscript AFM License",
  27842. false
  27843. ],
  27844. "APL-1.0": [
  27845. "Adaptive Public License 1.0",
  27846. true
  27847. ],
  27848. "APSL-1.0": [
  27849. "Apple Public Source License 1.0",
  27850. true
  27851. ],
  27852. "APSL-1.1": [
  27853. "Apple Public Source License 1.1",
  27854. true
  27855. ],
  27856. "APSL-1.2": [
  27857. "Apple Public Source License 1.2",
  27858. true
  27859. ],
  27860. "APSL-2.0": [
  27861. "Apple Public Source License 2.0",
  27862. true
  27863. ],
  27864. "Artistic-1.0": [
  27865. "Artistic License 1.0",
  27866. true
  27867. ],
  27868. "Artistic-1.0-cl8": [
  27869. "Artistic License 1.0 w/clause 8",
  27870. true
  27871. ],
  27872. "Artistic-1.0-Perl": [
  27873. "Artistic License 1.0 (Perl)",
  27874. true
  27875. ],
  27876. "Artistic-2.0": [
  27877. "Artistic License 2.0",
  27878. true
  27879. ],
  27880. "Bahyph": [
  27881. "Bahyph License",
  27882. false
  27883. ],
  27884. "Barr": [
  27885. "Barr License",
  27886. false
  27887. ],
  27888. "Beerware": [
  27889. "Beerware License",
  27890. false
  27891. ],
  27892. "BitTorrent-1.0": [
  27893. "BitTorrent Open Source License v1.0",
  27894. false
  27895. ],
  27896. "BitTorrent-1.1": [
  27897. "BitTorrent Open Source License v1.1",
  27898. false
  27899. ],
  27900. "Borceux": [
  27901. "Borceux license",
  27902. false
  27903. ],
  27904. "BSD-2-Clause": [
  27905. "BSD 2-clause \"Simplified\" License",
  27906. true
  27907. ],
  27908. "BSD-2-Clause-FreeBSD": [
  27909. "BSD 2-clause FreeBSD License",
  27910. false
  27911. ],
  27912. "BSD-2-Clause-NetBSD": [
  27913. "BSD 2-clause NetBSD License",
  27914. false
  27915. ],
  27916. "BSD-3-Clause": [
  27917. "BSD 3-clause \"New\" or \"Revised\" License",
  27918. true
  27919. ],
  27920. "BSD-3-Clause-Attribution": [
  27921. "BSD with attribution",
  27922. false
  27923. ],
  27924. "BSD-3-Clause-Clear": [
  27925. "BSD 3-clause Clear License",
  27926. false
  27927. ],
  27928. "BSD-3-Clause-LBNL": [
  27929. "Lawrence Berkeley National Labs BSD variant license",
  27930. false
  27931. ],
  27932. "BSD-3-Clause-No-Nuclear-License": [
  27933. "BSD 3-Clause No Nuclear License",
  27934. false
  27935. ],
  27936. "BSD-3-Clause-No-Nuclear-License-2014": [
  27937. "BSD 3-Clause No Nuclear License 2014",
  27938. false
  27939. ],
  27940. "BSD-3-Clause-No-Nuclear-Warranty": [
  27941. "BSD 3-Clause No Nuclear Warranty",
  27942. false
  27943. ],
  27944. "BSD-4-Clause": [
  27945. "BSD 4-clause \"Original\" or \"Old\" License",
  27946. false
  27947. ],
  27948. "BSD-4-Clause-UC": [
  27949. "BSD-4-Clause (University of California-Specific)",
  27950. false
  27951. ],
  27952. "BSD-Protection": [
  27953. "BSD Protection License",
  27954. false
  27955. ],
  27956. "BSD-Source-Code": [
  27957. "BSD Source Code Attribution",
  27958. false
  27959. ],
  27960. "BSL-1.0": [
  27961. "Boost Software License 1.0",
  27962. true
  27963. ],
  27964. "bzip2-1.0.5": [
  27965. "bzip2 and libbzip2 License v1.0.5",
  27966. false
  27967. ],
  27968. "bzip2-1.0.6": [
  27969. "bzip2 and libbzip2 License v1.0.6",
  27970. false
  27971. ],
  27972. "Caldera": [
  27973. "Caldera License",
  27974. false
  27975. ],
  27976. "CATOSL-1.1": [
  27977. "Computer Associates Trusted Open Source License 1.1",
  27978. true
  27979. ],
  27980. "CC-BY-1.0": [
  27981. "Creative Commons Attribution 1.0",
  27982. false
  27983. ],
  27984. "CC-BY-2.0": [
  27985. "Creative Commons Attribution 2.0",
  27986. false
  27987. ],
  27988. "CC-BY-2.5": [
  27989. "Creative Commons Attribution 2.5",
  27990. false
  27991. ],
  27992. "CC-BY-3.0": [
  27993. "Creative Commons Attribution 3.0",
  27994. false
  27995. ],
  27996. "CC-BY-4.0": [
  27997. "Creative Commons Attribution 4.0",
  27998. false
  27999. ],
  28000. "CC-BY-NC-1.0": [
  28001. "Creative Commons Attribution Non Commercial 1.0",
  28002. false
  28003. ],
  28004. "CC-BY-NC-2.0": [
  28005. "Creative Commons Attribution Non Commercial 2.0",
  28006. false
  28007. ],
  28008. "CC-BY-NC-2.5": [
  28009. "Creative Commons Attribution Non Commercial 2.5",
  28010. false
  28011. ],
  28012. "CC-BY-NC-3.0": [
  28013. "Creative Commons Attribution Non Commercial 3.0",
  28014. false
  28015. ],
  28016. "CC-BY-NC-4.0": [
  28017. "Creative Commons Attribution Non Commercial 4.0",
  28018. false
  28019. ],
  28020. "CC-BY-NC-ND-1.0": [
  28021. "Creative Commons Attribution Non Commercial No Derivatives 1.0",
  28022. false
  28023. ],
  28024. "CC-BY-NC-ND-2.0": [
  28025. "Creative Commons Attribution Non Commercial No Derivatives 2.0",
  28026. false
  28027. ],
  28028. "CC-BY-NC-ND-2.5": [
  28029. "Creative Commons Attribution Non Commercial No Derivatives 2.5",
  28030. false
  28031. ],
  28032. "CC-BY-NC-ND-3.0": [
  28033. "Creative Commons Attribution Non Commercial No Derivatives 3.0",
  28034. false
  28035. ],
  28036. "CC-BY-NC-ND-4.0": [
  28037. "Creative Commons Attribution Non Commercial No Derivatives 4.0",
  28038. false
  28039. ],
  28040. "CC-BY-NC-SA-1.0": [
  28041. "Creative Commons Attribution Non Commercial Share Alike 1.0",
  28042. false
  28043. ],
  28044. "CC-BY-NC-SA-2.0": [
  28045. "Creative Commons Attribution Non Commercial Share Alike 2.0",
  28046. false
  28047. ],
  28048. "CC-BY-NC-SA-2.5": [
  28049. "Creative Commons Attribution Non Commercial Share Alike 2.5",
  28050. false
  28051. ],
  28052. "CC-BY-NC-SA-3.0": [
  28053. "Creative Commons Attribution Non Commercial Share Alike 3.0",
  28054. false
  28055. ],
  28056. "CC-BY-NC-SA-4.0": [
  28057. "Creative Commons Attribution Non Commercial Share Alike 4.0",
  28058. false
  28059. ],
  28060. "CC-BY-ND-1.0": [
  28061. "Creative Commons Attribution No Derivatives 1.0",
  28062. false
  28063. ],
  28064. "CC-BY-ND-2.0": [
  28065. "Creative Commons Attribution No Derivatives 2.0",
  28066. false
  28067. ],
  28068. "CC-BY-ND-2.5": [
  28069. "Creative Commons Attribution No Derivatives 2.5",
  28070. false
  28071. ],
  28072. "CC-BY-ND-3.0": [
  28073. "Creative Commons Attribution No Derivatives 3.0",
  28074. false
  28075. ],
  28076. "CC-BY-ND-4.0": [
  28077. "Creative Commons Attribution No Derivatives 4.0",
  28078. false
  28079. ],
  28080. "CC-BY-SA-1.0": [
  28081. "Creative Commons Attribution Share Alike 1.0",
  28082. false
  28083. ],
  28084. "CC-BY-SA-2.0": [
  28085. "Creative Commons Attribution Share Alike 2.0",
  28086. false
  28087. ],
  28088. "CC-BY-SA-2.5": [
  28089. "Creative Commons Attribution Share Alike 2.5",
  28090. false
  28091. ],
  28092. "CC-BY-SA-3.0": [
  28093. "Creative Commons Attribution Share Alike 3.0",
  28094. false
  28095. ],
  28096. "CC-BY-SA-4.0": [
  28097. "Creative Commons Attribution Share Alike 4.0",
  28098. false
  28099. ],
  28100. "CC0-1.0": [
  28101. "Creative Commons Zero v1.0 Universal",
  28102. false
  28103. ],
  28104. "CDDL-1.0": [
  28105. "Common Development and Distribution License 1.0",
  28106. true
  28107. ],
  28108. "CDDL-1.1": [
  28109. "Common Development and Distribution License 1.1",
  28110. false
  28111. ],
  28112. "CECILL-1.0": [
  28113. "CeCILL Free Software License Agreement v1.0",
  28114. false
  28115. ],
  28116. "CECILL-1.1": [
  28117. "CeCILL Free Software License Agreement v1.1",
  28118. false
  28119. ],
  28120. "CECILL-2.0": [
  28121. "CeCILL Free Software License Agreement v2.0",
  28122. false
  28123. ],
  28124. "CECILL-2.1": [
  28125. "CeCILL Free Software License Agreement v2.1",
  28126. true
  28127. ],
  28128. "CECILL-B": [
  28129. "CeCILL-B Free Software License Agreement",
  28130. false
  28131. ],
  28132. "CECILL-C": [
  28133. "CeCILL-C Free Software License Agreement",
  28134. false
  28135. ],
  28136. "ClArtistic": [
  28137. "Clarified Artistic License",
  28138. false
  28139. ],
  28140. "CNRI-Jython": [
  28141. "CNRI Jython License",
  28142. false
  28143. ],
  28144. "CNRI-Python": [
  28145. "CNRI Python License",
  28146. true
  28147. ],
  28148. "CNRI-Python-GPL-Compatible": [
  28149. "CNRI Python Open Source GPL Compatible License Agreement",
  28150. false
  28151. ],
  28152. "Condor-1.1": [
  28153. "Condor Public License v1.1",
  28154. false
  28155. ],
  28156. "CPAL-1.0": [
  28157. "Common Public Attribution License 1.0",
  28158. true
  28159. ],
  28160. "CPL-1.0": [
  28161. "Common Public License 1.0",
  28162. true
  28163. ],
  28164. "CPOL-1.02": [
  28165. "Code Project Open License 1.02",
  28166. false
  28167. ],
  28168. "Crossword": [
  28169. "Crossword License",
  28170. false
  28171. ],
  28172. "CrystalStacker": [
  28173. "CrystalStacker License",
  28174. false
  28175. ],
  28176. "CUA-OPL-1.0": [
  28177. "CUA Office Public License v1.0",
  28178. true
  28179. ],
  28180. "Cube": [
  28181. "Cube License",
  28182. false
  28183. ],
  28184. "curl": [
  28185. "curl License",
  28186. false
  28187. ],
  28188. "D-FSL-1.0": [
  28189. "Deutsche Freie Software Lizenz",
  28190. false
  28191. ],
  28192. "diffmark": [
  28193. "diffmark license",
  28194. false
  28195. ],
  28196. "DOC": [
  28197. "DOC License",
  28198. false
  28199. ],
  28200. "Dotseqn": [
  28201. "Dotseqn License",
  28202. false
  28203. ],
  28204. "DSDP": [
  28205. "DSDP License",
  28206. false
  28207. ],
  28208. "dvipdfm": [
  28209. "dvipdfm License",
  28210. false
  28211. ],
  28212. "ECL-1.0": [
  28213. "Educational Community License v1.0",
  28214. true
  28215. ],
  28216. "ECL-2.0": [
  28217. "Educational Community License v2.0",
  28218. true
  28219. ],
  28220. "EFL-1.0": [
  28221. "Eiffel Forum License v1.0",
  28222. true
  28223. ],
  28224. "EFL-2.0": [
  28225. "Eiffel Forum License v2.0",
  28226. true
  28227. ],
  28228. "eGenix": [
  28229. "eGenix.com Public License 1.1.0",
  28230. false
  28231. ],
  28232. "Entessa": [
  28233. "Entessa Public License v1.0",
  28234. true
  28235. ],
  28236. "EPL-1.0": [
  28237. "Eclipse Public License 1.0",
  28238. true
  28239. ],
  28240. "ErlPL-1.1": [
  28241. "Erlang Public License v1.1",
  28242. false
  28243. ],
  28244. "EUDatagrid": [
  28245. "EU DataGrid Software License",
  28246. true
  28247. ],
  28248. "EUPL-1.0": [
  28249. "European Union Public License 1.0",
  28250. false
  28251. ],
  28252. "EUPL-1.1": [
  28253. "European Union Public License 1.1",
  28254. true
  28255. ],
  28256. "Eurosym": [
  28257. "Eurosym License",
  28258. false
  28259. ],
  28260. "Fair": [
  28261. "Fair License",
  28262. true
  28263. ],
  28264. "Frameworx-1.0": [
  28265. "Frameworx Open License 1.0",
  28266. true
  28267. ],
  28268. "FreeImage": [
  28269. "FreeImage Public License v1.0",
  28270. false
  28271. ],
  28272. "FSFAP": [
  28273. "FSF All Permissive License",
  28274. false
  28275. ],
  28276. "FSFUL": [
  28277. "FSF Unlimited License",
  28278. false
  28279. ],
  28280. "FSFULLR": [
  28281. "FSF Unlimited License (with License Retention)",
  28282. false
  28283. ],
  28284. "FTL": [
  28285. "Freetype Project License",
  28286. false
  28287. ],
  28288. "GFDL-1.1": [
  28289. "GNU Free Documentation License v1.1",
  28290. false
  28291. ],
  28292. "GFDL-1.2": [
  28293. "GNU Free Documentation License v1.2",
  28294. false
  28295. ],
  28296. "GFDL-1.3": [
  28297. "GNU Free Documentation License v1.3",
  28298. false
  28299. ],
  28300. "Giftware": [
  28301. "Giftware License",
  28302. false
  28303. ],
  28304. "GL2PS": [
  28305. "GL2PS License",
  28306. false
  28307. ],
  28308. "Glide": [
  28309. "3dfx Glide License",
  28310. false
  28311. ],
  28312. "Glulxe": [
  28313. "Glulxe License",
  28314. false
  28315. ],
  28316. "gnuplot": [
  28317. "gnuplot License",
  28318. false
  28319. ],
  28320. "GPL-1.0": [
  28321. "GNU General Public License v1.0 only",
  28322. false
  28323. ],
  28324. "GPL-2.0": [
  28325. "GNU General Public License v2.0 only",
  28326. true
  28327. ],
  28328. "GPL-3.0": [
  28329. "GNU General Public License v3.0 only",
  28330. true
  28331. ],
  28332. "gSOAP-1.3b": [
  28333. "gSOAP Public License v1.3b",
  28334. false
  28335. ],
  28336. "HaskellReport": [
  28337. "Haskell Language Report License",
  28338. false
  28339. ],
  28340. "HPND": [
  28341. "Historic Permission Notice and Disclaimer",
  28342. true
  28343. ],
  28344. "IBM-pibs": [
  28345. "IBM PowerPC Initialization and Boot Software",
  28346. false
  28347. ],
  28348. "ICU": [
  28349. "ICU License",
  28350. false
  28351. ],
  28352. "IJG": [
  28353. "Independent JPEG Group License",
  28354. false
  28355. ],
  28356. "ImageMagick": [
  28357. "ImageMagick License",
  28358. false
  28359. ],
  28360. "iMatix": [
  28361. "iMatix Standard Function Library Agreement",
  28362. false
  28363. ],
  28364. "Imlib2": [
  28365. "Imlib2 License",
  28366. false
  28367. ],
  28368. "Info-ZIP": [
  28369. "Info-ZIP License",
  28370. false
  28371. ],
  28372. "Intel": [
  28373. "Intel Open Source License",
  28374. true
  28375. ],
  28376. "Intel-ACPI": [
  28377. "Intel ACPI Software License Agreement",
  28378. false
  28379. ],
  28380. "Interbase-1.0": [
  28381. "Interbase Public License v1.0",
  28382. false
  28383. ],
  28384. "IPA": [
  28385. "IPA Font License",
  28386. true
  28387. ],
  28388. "IPL-1.0": [
  28389. "IBM Public License v1.0",
  28390. true
  28391. ],
  28392. "ISC": [
  28393. "ISC License",
  28394. true
  28395. ],
  28396. "JasPer-2.0": [
  28397. "JasPer License",
  28398. false
  28399. ],
  28400. "JSON": [
  28401. "JSON License",
  28402. false
  28403. ],
  28404. "LAL-1.2": [
  28405. "Licence Art Libre 1.2",
  28406. false
  28407. ],
  28408. "LAL-1.3": [
  28409. "Licence Art Libre 1.3",
  28410. false
  28411. ],
  28412. "Latex2e": [
  28413. "Latex2e License",
  28414. false
  28415. ],
  28416. "Leptonica": [
  28417. "Leptonica License",
  28418. false
  28419. ],
  28420. "LGPL-2.0": [
  28421. "GNU Library General Public License v2 only",
  28422. true
  28423. ],
  28424. "LGPL-2.1": [
  28425. "GNU Lesser General Public License v2.1 only",
  28426. true
  28427. ],
  28428. "LGPL-3.0": [
  28429. "GNU Lesser General Public License v3.0 only",
  28430. true
  28431. ],
  28432. "LGPLLR": [
  28433. "Lesser General Public License For Linguistic Resources",
  28434. false
  28435. ],
  28436. "Libpng": [
  28437. "libpng License",
  28438. false
  28439. ],
  28440. "libtiff": [
  28441. "libtiff License",
  28442. false
  28443. ],
  28444. "LiLiQ-P-1.1": [
  28445. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  28446. true
  28447. ],
  28448. "LiLiQ-R-1.1": [
  28449. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  28450. true
  28451. ],
  28452. "LiLiQ-Rplus-1.1": [
  28453. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  28454. true
  28455. ],
  28456. "LPL-1.0": [
  28457. "Lucent Public License Version 1.0",
  28458. true
  28459. ],
  28460. "LPL-1.02": [
  28461. "Lucent Public License v1.02",
  28462. true
  28463. ],
  28464. "LPPL-1.0": [
  28465. "LaTeX Project Public License v1.0",
  28466. false
  28467. ],
  28468. "LPPL-1.1": [
  28469. "LaTeX Project Public License v1.1",
  28470. false
  28471. ],
  28472. "LPPL-1.2": [
  28473. "LaTeX Project Public License v1.2",
  28474. false
  28475. ],
  28476. "LPPL-1.3a": [
  28477. "LaTeX Project Public License v1.3a",
  28478. false
  28479. ],
  28480. "LPPL-1.3c": [
  28481. "LaTeX Project Public License v1.3c",
  28482. true
  28483. ],
  28484. "MakeIndex": [
  28485. "MakeIndex License",
  28486. false
  28487. ],
  28488. "MirOS": [
  28489. "MirOS Licence",
  28490. true
  28491. ],
  28492. "MIT": [
  28493. "MIT License",
  28494. true
  28495. ],
  28496. "MIT-advertising": [
  28497. "Enlightenment License (e16)",
  28498. false
  28499. ],
  28500. "MIT-CMU": [
  28501. "CMU License",
  28502. false
  28503. ],
  28504. "MIT-enna": [
  28505. "enna License",
  28506. false
  28507. ],
  28508. "MIT-feh": [
  28509. "feh License",
  28510. false
  28511. ],
  28512. "MITNFA": [
  28513. "MIT +no-false-attribs license",
  28514. false
  28515. ],
  28516. "Motosoto": [
  28517. "Motosoto License",
  28518. true
  28519. ],
  28520. "mpich2": [
  28521. "mpich2 License",
  28522. false
  28523. ],
  28524. "MPL-1.0": [
  28525. "Mozilla Public License 1.0",
  28526. true
  28527. ],
  28528. "MPL-1.1": [
  28529. "Mozilla Public License 1.1",
  28530. true
  28531. ],
  28532. "MPL-2.0": [
  28533. "Mozilla Public License 2.0",
  28534. true
  28535. ],
  28536. "MPL-2.0-no-copyleft-exception": [
  28537. "Mozilla Public License 2.0 (no copyleft exception)",
  28538. true
  28539. ],
  28540. "MS-PL": [
  28541. "Microsoft Public License",
  28542. true
  28543. ],
  28544. "MS-RL": [
  28545. "Microsoft Reciprocal License",
  28546. true
  28547. ],
  28548. "MTLL": [
  28549. "Matrix Template Library License",
  28550. false
  28551. ],
  28552. "Multics": [
  28553. "Multics License",
  28554. true
  28555. ],
  28556. "Mup": [
  28557. "Mup License",
  28558. false
  28559. ],
  28560. "NASA-1.3": [
  28561. "NASA Open Source Agreement 1.3",
  28562. true
  28563. ],
  28564. "Naumen": [
  28565. "Naumen Public License",
  28566. true
  28567. ],
  28568. "NBPL-1.0": [
  28569. "Net Boolean Public License v1",
  28570. false
  28571. ],
  28572. "NCSA": [
  28573. "University of Illinois/NCSA Open Source License",
  28574. true
  28575. ],
  28576. "NetCDF": [
  28577. "NetCDF license",
  28578. false
  28579. ],
  28580. "Newsletr": [
  28581. "Newsletr License",
  28582. false
  28583. ],
  28584. "NGPL": [
  28585. "Nethack General Public License",
  28586. true
  28587. ],
  28588. "NLOD-1.0": [
  28589. "Norwegian Licence for Open Government Data",
  28590. false
  28591. ],
  28592. "NLPL": [
  28593. "No Limit Public License",
  28594. false
  28595. ],
  28596. "Nokia": [
  28597. "Nokia Open Source License",
  28598. true
  28599. ],
  28600. "NOSL": [
  28601. "Netizen Open Source License",
  28602. false
  28603. ],
  28604. "Noweb": [
  28605. "Noweb License",
  28606. false
  28607. ],
  28608. "NPL-1.0": [
  28609. "Netscape Public License v1.0",
  28610. false
  28611. ],
  28612. "NPL-1.1": [
  28613. "Netscape Public License v1.1",
  28614. false
  28615. ],
  28616. "NPOSL-3.0": [
  28617. "Non-Profit Open Software License 3.0",
  28618. true
  28619. ],
  28620. "NRL": [
  28621. "NRL License",
  28622. false
  28623. ],
  28624. "NTP": [
  28625. "NTP License",
  28626. true
  28627. ],
  28628. "Nunit": [
  28629. "Nunit License",
  28630. false
  28631. ],
  28632. "OCCT-PL": [
  28633. "Open CASCADE Technology Public License",
  28634. false
  28635. ],
  28636. "OCLC-2.0": [
  28637. "OCLC Research Public License 2.0",
  28638. true
  28639. ],
  28640. "ODbL-1.0": [
  28641. "ODC Open Database License v1.0",
  28642. false
  28643. ],
  28644. "OFL-1.0": [
  28645. "SIL Open Font License 1.0",
  28646. false
  28647. ],
  28648. "OFL-1.1": [
  28649. "SIL Open Font License 1.1",
  28650. true
  28651. ],
  28652. "OGTSL": [
  28653. "Open Group Test Suite License",
  28654. true
  28655. ],
  28656. "OLDAP-1.1": [
  28657. "Open LDAP Public License v1.1",
  28658. false
  28659. ],
  28660. "OLDAP-1.2": [
  28661. "Open LDAP Public License v1.2",
  28662. false
  28663. ],
  28664. "OLDAP-1.3": [
  28665. "Open LDAP Public License v1.3",
  28666. false
  28667. ],
  28668. "OLDAP-1.4": [
  28669. "Open LDAP Public License v1.4",
  28670. false
  28671. ],
  28672. "OLDAP-2.0": [
  28673. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  28674. false
  28675. ],
  28676. "OLDAP-2.0.1": [
  28677. "Open LDAP Public License v2.0.1",
  28678. false
  28679. ],
  28680. "OLDAP-2.1": [
  28681. "Open LDAP Public License v2.1",
  28682. false
  28683. ],
  28684. "OLDAP-2.2": [
  28685. "Open LDAP Public License v2.2",
  28686. false
  28687. ],
  28688. "OLDAP-2.2.1": [
  28689. "Open LDAP Public License v2.2.1",
  28690. false
  28691. ],
  28692. "OLDAP-2.2.2": [
  28693. "Open LDAP Public License 2.2.2",
  28694. false
  28695. ],
  28696. "OLDAP-2.3": [
  28697. "Open LDAP Public License v2.3",
  28698. false
  28699. ],
  28700. "OLDAP-2.4": [
  28701. "Open LDAP Public License v2.4",
  28702. false
  28703. ],
  28704. "OLDAP-2.5": [
  28705. "Open LDAP Public License v2.5",
  28706. false
  28707. ],
  28708. "OLDAP-2.6": [
  28709. "Open LDAP Public License v2.6",
  28710. false
  28711. ],
  28712. "OLDAP-2.7": [
  28713. "Open LDAP Public License v2.7",
  28714. false
  28715. ],
  28716. "OLDAP-2.8": [
  28717. "Open LDAP Public License v2.8",
  28718. false
  28719. ],
  28720. "OML": [
  28721. "Open Market License",
  28722. false
  28723. ],
  28724. "OpenSSL": [
  28725. "OpenSSL License",
  28726. false
  28727. ],
  28728. "OPL-1.0": [
  28729. "Open Public License v1.0",
  28730. false
  28731. ],
  28732. "OSET-PL-2.1": [
  28733. "OSET Public License version 2.1",
  28734. true
  28735. ],
  28736. "OSL-1.0": [
  28737. "Open Software License 1.0",
  28738. true
  28739. ],
  28740. "OSL-1.1": [
  28741. "Open Software License 1.1",
  28742. false
  28743. ],
  28744. "OSL-2.0": [
  28745. "Open Software License 2.0",
  28746. true
  28747. ],
  28748. "OSL-2.1": [
  28749. "Open Software License 2.1",
  28750. true
  28751. ],
  28752. "OSL-3.0": [
  28753. "Open Software License 3.0",
  28754. true
  28755. ],
  28756. "PDDL-1.0": [
  28757. "ODC Public Domain Dedication & License 1.0",
  28758. false
  28759. ],
  28760. "PHP-3.0": [
  28761. "PHP License v3.0",
  28762. true
  28763. ],
  28764. "PHP-3.01": [
  28765. "PHP License v3.01",
  28766. false
  28767. ],
  28768. "Plexus": [
  28769. "Plexus Classworlds License",
  28770. false
  28771. ],
  28772. "PostgreSQL": [
  28773. "PostgreSQL License",
  28774. true
  28775. ],
  28776. "psfrag": [
  28777. "psfrag License",
  28778. false
  28779. ],
  28780. "psutils": [
  28781. "psutils License",
  28782. false
  28783. ],
  28784. "Python-2.0": [
  28785. "Python License 2.0",
  28786. true
  28787. ],
  28788. "Qhull": [
  28789. "Qhull License",
  28790. false
  28791. ],
  28792. "QPL-1.0": [
  28793. "Q Public License 1.0",
  28794. true
  28795. ],
  28796. "Rdisc": [
  28797. "Rdisc License",
  28798. false
  28799. ],
  28800. "RHeCos-1.1": [
  28801. "Red Hat eCos Public License v1.1",
  28802. false
  28803. ],
  28804. "RPL-1.1": [
  28805. "Reciprocal Public License 1.1",
  28806. true
  28807. ],
  28808. "RPL-1.5": [
  28809. "Reciprocal Public License 1.5",
  28810. true
  28811. ],
  28812. "RPSL-1.0": [
  28813. "RealNetworks Public Source License v1.0",
  28814. true
  28815. ],
  28816. "RSA-MD": [
  28817. "RSA Message-Digest License",
  28818. false
  28819. ],
  28820. "RSCPL": [
  28821. "Ricoh Source Code Public License",
  28822. true
  28823. ],
  28824. "Ruby": [
  28825. "Ruby License",
  28826. false
  28827. ],
  28828. "SAX-PD": [
  28829. "Sax Public Domain Notice",
  28830. false
  28831. ],
  28832. "Saxpath": [
  28833. "Saxpath License",
  28834. false
  28835. ],
  28836. "SCEA": [
  28837. "SCEA Shared Source License",
  28838. false
  28839. ],
  28840. "Sendmail": [
  28841. "Sendmail License",
  28842. false
  28843. ],
  28844. "SGI-B-1.0": [
  28845. "SGI Free Software License B v1.0",
  28846. false
  28847. ],
  28848. "SGI-B-1.1": [
  28849. "SGI Free Software License B v1.1",
  28850. false
  28851. ],
  28852. "SGI-B-2.0": [
  28853. "SGI Free Software License B v2.0",
  28854. false
  28855. ],
  28856. "SimPL-2.0": [
  28857. "Simple Public License 2.0",
  28858. true
  28859. ],
  28860. "SISSL": [
  28861. "Sun Industry Standards Source License v1.1",
  28862. true
  28863. ],
  28864. "SISSL-1.2": [
  28865. "Sun Industry Standards Source License v1.2",
  28866. false
  28867. ],
  28868. "Sleepycat": [
  28869. "Sleepycat License",
  28870. true
  28871. ],
  28872. "SMLNJ": [
  28873. "Standard ML of New Jersey License",
  28874. false
  28875. ],
  28876. "SMPPL": [
  28877. "Secure Messaging Protocol Public License",
  28878. false
  28879. ],
  28880. "SNIA": [
  28881. "SNIA Public License 1.1",
  28882. false
  28883. ],
  28884. "Spencer-86": [
  28885. "Spencer License 86",
  28886. false
  28887. ],
  28888. "Spencer-94": [
  28889. "Spencer License 94",
  28890. false
  28891. ],
  28892. "Spencer-99": [
  28893. "Spencer License 99",
  28894. false
  28895. ],
  28896. "SPL-1.0": [
  28897. "Sun Public License v1.0",
  28898. true
  28899. ],
  28900. "SugarCRM-1.1.3": [
  28901. "SugarCRM Public License v1.1.3",
  28902. false
  28903. ],
  28904. "SWL": [
  28905. "Scheme Widget Library (SWL) Software License Agreement",
  28906. false
  28907. ],
  28908. "TCL": [
  28909. "TCL/TK License",
  28910. false
  28911. ],
  28912. "TMate": [
  28913. "TMate Open Source License",
  28914. false
  28915. ],
  28916. "TORQUE-1.1": [
  28917. "TORQUE v2.5+ Software License v1.1",
  28918. false
  28919. ],
  28920. "TOSL": [
  28921. "Trusster Open Source License",
  28922. false
  28923. ],
  28924. "Unicode-TOU": [
  28925. "Unicode Terms of Use",
  28926. false
  28927. ],
  28928. "Unlicense": [
  28929. "The Unlicense",
  28930. false
  28931. ],
  28932. "UPL-1.0": [
  28933. "Universal Permissive License v1.0",
  28934. true
  28935. ],
  28936. "Vim": [
  28937. "Vim License",
  28938. false
  28939. ],
  28940. "VOSTROM": [
  28941. "VOSTROM Public License for Open Source",
  28942. false
  28943. ],
  28944. "VSL-1.0": [
  28945. "Vovida Software License v1.0",
  28946. true
  28947. ],
  28948. "W3C": [
  28949. "W3C Software Notice and License (2002-12-31)",
  28950. true
  28951. ],
  28952. "W3C-19980720": [
  28953. "W3C Software Notice and License (1998-07-20)",
  28954. false
  28955. ],
  28956. "Watcom-1.0": [
  28957. "Sybase Open Watcom Public License 1.0",
  28958. true
  28959. ],
  28960. "Wsuipa": [
  28961. "Wsuipa License",
  28962. false
  28963. ],
  28964. "WTFPL": [
  28965. "Do What The F*ck You Want To Public License",
  28966. false
  28967. ],
  28968. "X11": [
  28969. "X11 License",
  28970. false
  28971. ],
  28972. "Xerox": [
  28973. "Xerox License",
  28974. false
  28975. ],
  28976. "XFree86-1.1": [
  28977. "XFree86 License 1.1",
  28978. false
  28979. ],
  28980. "xinetd": [
  28981. "xinetd License",
  28982. false
  28983. ],
  28984. "Xnet": [
  28985. "X.Net License",
  28986. true
  28987. ],
  28988. "xpp": [
  28989. "XPP License",
  28990. false
  28991. ],
  28992. "XSkat": [
  28993. "XSkat License",
  28994. false
  28995. ],
  28996. "YPL-1.0": [
  28997. "Yahoo! Public License v1.0",
  28998. false
  28999. ],
  29000. "YPL-1.1": [
  29001. "Yahoo! Public License v1.1",
  29002. false
  29003. ],
  29004. "Zed": [
  29005. "Zed License",
  29006. false
  29007. ],
  29008. "Zend-2.0": [
  29009. "Zend License v2.0",
  29010. false
  29011. ],
  29012. "Zimbra-1.3": [
  29013. "Zimbra Public License v1.3",
  29014. false
  29015. ],
  29016. "Zimbra-1.4": [
  29017. "Zimbra Public License v1.4",
  29018. false
  29019. ],
  29020. "Zlib": [
  29021. "zlib License",
  29022. true
  29023. ],
  29024. "zlib-acknowledgement": [
  29025. "zlib/libpng License with Acknowledgement",
  29026. false
  29027. ],
  29028. "ZPL-1.1": [
  29029. "Zope Public License 1.1",
  29030. false
  29031. ],
  29032. "ZPL-2.0": [
  29033. "Zope Public License 2.0",
  29034. true
  29035. ],
  29036. "ZPL-2.1": [
  29037. "Zope Public License 2.1",
  29038. false
  29039. ]
  29040. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  29041. $�������Æ,Í;§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��������à�  ��
  29042. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  29043. ����������������� ��`.rdata����� ���
  29044. �����������������@��@.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
  29045. 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
  29046. 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
  29047. 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">
  29048. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  29049. <security>
  29050. <requestedPrivileges>
  29051. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  29052. </requestedPrivileges>
  29053. </security>
  29054. </trustInfo>
  29055. <dependency>
  29056. <dependentAssembly>
  29057. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  29058. </dependentAssembly>
  29059. </dependency>
  29060. </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
  29061. namespace Symfony\Component\Console;
  29062. use Symfony\Component\Console\Descriptor\TextDescriptor;
  29063. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  29064. use Symfony\Component\Console\Exception\ExceptionInterface;
  29065. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  29066. use Symfony\Component\Console\Helper\ProcessHelper;
  29067. use Symfony\Component\Console\Helper\QuestionHelper;
  29068. use Symfony\Component\Console\Input\InputInterface;
  29069. use Symfony\Component\Console\Input\ArgvInput;
  29070. use Symfony\Component\Console\Input\ArrayInput;
  29071. use Symfony\Component\Console\Input\InputDefinition;
  29072. use Symfony\Component\Console\Input\InputOption;
  29073. use Symfony\Component\Console\Input\InputArgument;
  29074. use Symfony\Component\Console\Input\InputAwareInterface;
  29075. use Symfony\Component\Console\Output\BufferedOutput;
  29076. use Symfony\Component\Console\Output\OutputInterface;
  29077. use Symfony\Component\Console\Output\ConsoleOutput;
  29078. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  29079. use Symfony\Component\Console\Command\Command;
  29080. use Symfony\Component\Console\Command\HelpCommand;
  29081. use Symfony\Component\Console\Command\ListCommand;
  29082. use Symfony\Component\Console\Helper\HelperSet;
  29083. use Symfony\Component\Console\Helper\FormatterHelper;
  29084. use Symfony\Component\Console\Helper\DialogHelper;
  29085. use Symfony\Component\Console\Helper\ProgressHelper;
  29086. use Symfony\Component\Console\Helper\TableHelper;
  29087. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  29088. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  29089. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  29090. use Symfony\Component\Console\Exception\CommandNotFoundException;
  29091. use Symfony\Component\Console\Exception\LogicException;
  29092. use Symfony\Component\Debug\Exception\FatalThrowableError;
  29093. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  29094. class Application
  29095. {
  29096. private $commands = array();
  29097. private $wantHelps = false;
  29098. private $runningCommand;
  29099. private $name;
  29100. private $version;
  29101. private $catchExceptions = true;
  29102. private $autoExit = true;
  29103. private $definition;
  29104. private $helperSet;
  29105. private $dispatcher;
  29106. private $terminalDimensions;
  29107. private $defaultCommand;
  29108. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  29109. {
  29110. $this->name = $name;
  29111. $this->version = $version;
  29112. $this->defaultCommand = 'list';
  29113. $this->helperSet = $this->getDefaultHelperSet();
  29114. $this->definition = $this->getDefaultInputDefinition();
  29115. foreach ($this->getDefaultCommands() as $command) {
  29116. $this->add($command);
  29117. }
  29118. }
  29119. public function setDispatcher(EventDispatcherInterface $dispatcher)
  29120. {
  29121. $this->dispatcher = $dispatcher;
  29122. }
  29123. public function run(InputInterface $input = null, OutputInterface $output = null)
  29124. {
  29125. if (null === $input) {
  29126. $input = new ArgvInput();
  29127. }
  29128. if (null === $output) {
  29129. $output = new ConsoleOutput();
  29130. }
  29131. $this->configureIO($input, $output);
  29132. try {
  29133. $exitCode = $this->doRun($input, $output);
  29134. } catch (\Exception $e) {
  29135. if (!$this->catchExceptions) {
  29136. throw $e;
  29137. }
  29138. if ($output instanceof ConsoleOutputInterface) {
  29139. $this->renderException($e, $output->getErrorOutput());
  29140. } else {
  29141. $this->renderException($e, $output);
  29142. }
  29143. $exitCode = $e->getCode();
  29144. if (is_numeric($exitCode)) {
  29145. $exitCode = (int) $exitCode;
  29146. if (0 === $exitCode) {
  29147. $exitCode = 1;
  29148. }
  29149. } else {
  29150. $exitCode = 1;
  29151. }
  29152. }
  29153. if ($this->autoExit) {
  29154. if ($exitCode > 255) {
  29155. $exitCode = 255;
  29156. }
  29157. exit($exitCode);
  29158. }
  29159. return $exitCode;
  29160. }
  29161. public function doRun(InputInterface $input, OutputInterface $output)
  29162. {
  29163. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  29164. $output->writeln($this->getLongVersion());
  29165. return 0;
  29166. }
  29167. $name = $this->getCommandName($input);
  29168. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  29169. if (!$name) {
  29170. $name = 'help';
  29171. $input = new ArrayInput(array('command' => 'help'));
  29172. } else {
  29173. $this->wantHelps = true;
  29174. }
  29175. }
  29176. if (!$name) {
  29177. $name = $this->defaultCommand;
  29178. $input = new ArrayInput(array('command' => $this->defaultCommand));
  29179. }
  29180. $command = $this->find($name);
  29181. $this->runningCommand = $command;
  29182. $exitCode = $this->doRunCommand($command, $input, $output);
  29183. $this->runningCommand = null;
  29184. return $exitCode;
  29185. }
  29186. public function setHelperSet(HelperSet $helperSet)
  29187. {
  29188. $this->helperSet = $helperSet;
  29189. }
  29190. public function getHelperSet()
  29191. {
  29192. return $this->helperSet;
  29193. }
  29194. public function setDefinition(InputDefinition $definition)
  29195. {
  29196. $this->definition = $definition;
  29197. }
  29198. public function getDefinition()
  29199. {
  29200. return $this->definition;
  29201. }
  29202. public function getHelp()
  29203. {
  29204. return $this->getLongVersion();
  29205. }
  29206. public function setCatchExceptions($boolean)
  29207. {
  29208. $this->catchExceptions = (bool) $boolean;
  29209. }
  29210. public function setAutoExit($boolean)
  29211. {
  29212. $this->autoExit = (bool) $boolean;
  29213. }
  29214. public function getName()
  29215. {
  29216. return $this->name;
  29217. }
  29218. public function setName($name)
  29219. {
  29220. $this->name = $name;
  29221. }
  29222. public function getVersion()
  29223. {
  29224. return $this->version;
  29225. }
  29226. public function setVersion($version)
  29227. {
  29228. $this->version = $version;
  29229. }
  29230. public function getLongVersion()
  29231. {
  29232. if ('UNKNOWN' !== $this->getName()) {
  29233. if ('UNKNOWN' !== $this->getVersion()) {
  29234. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  29235. }
  29236. return sprintf('<info>%s</info>', $this->getName());
  29237. }
  29238. return '<info>Console Tool</info>';
  29239. }
  29240. public function register($name)
  29241. {
  29242. return $this->add(new Command($name));
  29243. }
  29244. public function addCommands(array $commands)
  29245. {
  29246. foreach ($commands as $command) {
  29247. $this->add($command);
  29248. }
  29249. }
  29250. public function add(Command $command)
  29251. {
  29252. $command->setApplication($this);
  29253. if (!$command->isEnabled()) {
  29254. $command->setApplication(null);
  29255. return;
  29256. }
  29257. if (null === $command->getDefinition()) {
  29258. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
  29259. }
  29260. $this->commands[$command->getName()] = $command;
  29261. foreach ($command->getAliases() as $alias) {
  29262. $this->commands[$alias] = $command;
  29263. }
  29264. return $command;
  29265. }
  29266. public function get($name)
  29267. {
  29268. if (!isset($this->commands[$name])) {
  29269. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  29270. }
  29271. $command = $this->commands[$name];
  29272. if ($this->wantHelps) {
  29273. $this->wantHelps = false;
  29274. $helpCommand = $this->get('help');
  29275. $helpCommand->setCommand($command);
  29276. return $helpCommand;
  29277. }
  29278. return $command;
  29279. }
  29280. public function has($name)
  29281. {
  29282. return isset($this->commands[$name]);
  29283. }
  29284. public function getNamespaces()
  29285. {
  29286. $namespaces = array();
  29287. foreach ($this->all() as $command) {
  29288. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  29289. foreach ($command->getAliases() as $alias) {
  29290. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  29291. }
  29292. }
  29293. return array_values(array_unique(array_filter($namespaces)));
  29294. }
  29295. public function findNamespace($namespace)
  29296. {
  29297. $allNamespaces = $this->getNamespaces();
  29298. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  29299. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  29300. if (empty($namespaces)) {
  29301. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  29302. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  29303. if (1 == count($alternatives)) {
  29304. $message .= "\n\nDid you mean this?\n ";
  29305. } else {
  29306. $message .= "\n\nDid you mean one of these?\n ";
  29307. }
  29308. $message .= implode("\n ", $alternatives);
  29309. }
  29310. throw new CommandNotFoundException($message, $alternatives);
  29311. }
  29312. $exact = in_array($namespace, $namespaces, true);
  29313. if (count($namespaces) > 1 && !$exact) {
  29314. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  29315. }
  29316. return $exact ? $namespace : reset($namespaces);
  29317. }
  29318. public function find($name)
  29319. {
  29320. $allCommands = array_keys($this->commands);
  29321. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  29322. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  29323. if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  29324. if (false !== $pos = strrpos($name, ':')) {
  29325. $this->findNamespace(substr($name, 0, $pos));
  29326. }
  29327. $message = sprintf('Command "%s" is not defined.', $name);
  29328. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  29329. if (1 == count($alternatives)) {
  29330. $message .= "\n\nDid you mean this?\n ";
  29331. } else {
  29332. $message .= "\n\nDid you mean one of these?\n ";
  29333. }
  29334. $message .= implode("\n ", $alternatives);
  29335. }
  29336. throw new CommandNotFoundException($message, $alternatives);
  29337. }
  29338. if (count($commands) > 1) {
  29339. $commandList = $this->commands;
  29340. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
  29341. $commandName = $commandList[$nameOrAlias]->getName();
  29342. return $commandName === $nameOrAlias || !in_array($commandName, $commands);
  29343. });
  29344. }
  29345. $exact = in_array($name, $commands, true);
  29346. if (count($commands) > 1 && !$exact) {
  29347. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  29348. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  29349. }
  29350. return $this->get($exact ? $name : reset($commands));
  29351. }
  29352. public function all($namespace = null)
  29353. {
  29354. if (null === $namespace) {
  29355. return $this->commands;
  29356. }
  29357. $commands = array();
  29358. foreach ($this->commands as $name => $command) {
  29359. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  29360. $commands[$name] = $command;
  29361. }
  29362. }
  29363. return $commands;
  29364. }
  29365. public static function getAbbreviations($names)
  29366. {
  29367. $abbrevs = array();
  29368. foreach ($names as $name) {
  29369. for ($len = strlen($name); $len > 0; --$len) {
  29370. $abbrev = substr($name, 0, $len);
  29371. $abbrevs[$abbrev][] = $name;
  29372. }
  29373. }
  29374. return $abbrevs;
  29375. }
  29376. public function asText($namespace = null, $raw = false)
  29377. {
  29378. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  29379. $descriptor = new TextDescriptor();
  29380. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  29381. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  29382. return $output->fetch();
  29383. }
  29384. public function asXml($namespace = null, $asDom = false)
  29385. {
  29386. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  29387. $descriptor = new XmlDescriptor();
  29388. if ($asDom) {
  29389. return $descriptor->getApplicationDocument($this, $namespace);
  29390. }
  29391. $output = new BufferedOutput();
  29392. $descriptor->describe($output, $this, array('namespace' => $namespace));
  29393. return $output->fetch();
  29394. }
  29395. public function renderException($e, $output)
  29396. {
  29397. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  29398. do {
  29399. $title = sprintf(' [%s] ', get_class($e));
  29400. $len = $this->stringWidth($title);
  29401. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  29402. if (defined('HHVM_VERSION') && $width > 1 << 31) {
  29403. $width = 1 << 31;
  29404. }
  29405. $formatter = $output->getFormatter();
  29406. $lines = array();
  29407. foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) {
  29408. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  29409. $lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $formatter->format($line))) + 4;
  29410. $lines[] = array($line, $lineLength);
  29411. $len = max($lineLength, $len);
  29412. }
  29413. }
  29414. $messages = array();
  29415. $messages[] = $emptyLine = $formatter->format(sprintf('<error>%s</error>', str_repeat(' ', $len)));
  29416. $messages[] = $formatter->format(sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - $this->stringWidth($title)))));
  29417. foreach ($lines as $line) {
  29418. $messages[] = $formatter->format(sprintf('<error> %s %s</error>', $line[0], str_repeat(' ', $len - $line[1])));
  29419. }
  29420. $messages[] = $emptyLine;
  29421. $messages[] = '';
  29422. $output->writeln($messages, OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_QUIET);
  29423. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  29424. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  29425. $trace = $e->getTrace();
  29426. array_unshift($trace, array(
  29427. 'function' => '',
  29428. 'file' => $e->getFile() !== null ? $e->getFile() : 'n/a',
  29429. 'line' => $e->getLine() !== null ? $e->getLine() : 'n/a',
  29430. 'args' => array(),
  29431. ));
  29432. for ($i = 0, $count = count($trace); $i < $count; ++$i) {
  29433. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  29434. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  29435. $function = $trace[$i]['function'];
  29436. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  29437. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  29438. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  29439. }
  29440. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  29441. }
  29442. } while ($e = $e->getPrevious());
  29443. if (null !== $this->runningCommand) {
  29444. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  29445. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  29446. }
  29447. }
  29448. protected function getTerminalWidth()
  29449. {
  29450. $dimensions = $this->getTerminalDimensions();
  29451. return $dimensions[0];
  29452. }
  29453. protected function getTerminalHeight()
  29454. {
  29455. $dimensions = $this->getTerminalDimensions();
  29456. return $dimensions[1];
  29457. }
  29458. public function getTerminalDimensions()
  29459. {
  29460. if ($this->terminalDimensions) {
  29461. return $this->terminalDimensions;
  29462. }
  29463. if ('\\' === DIRECTORY_SEPARATOR) {
  29464. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  29465. return array((int) $matches[1], (int) $matches[2]);
  29466. }
  29467. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  29468. return array((int) $matches[1], (int) $matches[2]);
  29469. }
  29470. }
  29471. if ($sttyString = $this->getSttyColumns()) {
  29472. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  29473. return array((int) $matches[2], (int) $matches[1]);
  29474. }
  29475. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  29476. return array((int) $matches[2], (int) $matches[1]);
  29477. }
  29478. }
  29479. return array(null, null);
  29480. }
  29481. public function setTerminalDimensions($width, $height)
  29482. {
  29483. $this->terminalDimensions = array($width, $height);
  29484. return $this;
  29485. }
  29486. protected function configureIO(InputInterface $input, OutputInterface $output)
  29487. {
  29488. if (true === $input->hasParameterOption(array('--ansi'))) {
  29489. $output->setDecorated(true);
  29490. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  29491. $output->setDecorated(false);
  29492. }
  29493. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  29494. $input->setInteractive(false);
  29495. } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  29496. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  29497. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  29498. $input->setInteractive(false);
  29499. }
  29500. }
  29501. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  29502. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  29503. $input->setInteractive(false);
  29504. } else {
  29505. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
  29506. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  29507. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
  29508. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  29509. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  29510. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  29511. }
  29512. }
  29513. }
  29514. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  29515. {
  29516. foreach ($command->getHelperSet() as $helper) {
  29517. if ($helper instanceof InputAwareInterface) {
  29518. $helper->setInput($input);
  29519. }
  29520. }
  29521. if (null === $this->dispatcher) {
  29522. try {
  29523. return $command->run($input, $output);
  29524. } catch (\Exception $e) {
  29525. throw $e;
  29526. } catch (\Throwable $e) {
  29527. throw new FatalThrowableError($e);
  29528. }
  29529. }
  29530. try {
  29531. $command->mergeApplicationDefinition();
  29532. $input->bind($command->getDefinition());
  29533. } catch (ExceptionInterface $e) {
  29534. }
  29535. $command->setInputBound(true);
  29536. $event = new ConsoleCommandEvent($command, $input, $output);
  29537. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  29538. if ($event->commandShouldRun()) {
  29539. try {
  29540. $e = null;
  29541. $exitCode = $command->run($input, $output);
  29542. } catch (\Exception $x) {
  29543. $e = $x;
  29544. } catch (\Throwable $x) {
  29545. $e = new FatalThrowableError($x);
  29546. }
  29547. if (null !== $e) {
  29548. $event = new ConsoleExceptionEvent($command, $input, $output, $e, $e->getCode());
  29549. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  29550. if ($e !== $event->getException()) {
  29551. $x = $e = $event->getException();
  29552. }
  29553. $event = new ConsoleTerminateEvent($command, $input, $output, $e->getCode());
  29554. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  29555. throw $x;
  29556. }
  29557. } else {
  29558. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  29559. }
  29560. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  29561. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  29562. return $event->getExitCode();
  29563. }
  29564. protected function getCommandName(InputInterface $input)
  29565. {
  29566. return $input->getFirstArgument();
  29567. }
  29568. protected function getDefaultInputDefinition()
  29569. {
  29570. return new InputDefinition(array(
  29571. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  29572. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  29573. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  29574. 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'),
  29575. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  29576. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  29577. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  29578. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  29579. ));
  29580. }
  29581. protected function getDefaultCommands()
  29582. {
  29583. return array(new HelpCommand(), new ListCommand());
  29584. }
  29585. protected function getDefaultHelperSet()
  29586. {
  29587. return new HelperSet(array(
  29588. new FormatterHelper(),
  29589. new DialogHelper(false),
  29590. new ProgressHelper(false),
  29591. new TableHelper(false),
  29592. new DebugFormatterHelper(),
  29593. new ProcessHelper(),
  29594. new QuestionHelper(),
  29595. ));
  29596. }
  29597. private function getSttyColumns()
  29598. {
  29599. if (!function_exists('proc_open')) {
  29600. return;
  29601. }
  29602. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  29603. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  29604. if (is_resource($process)) {
  29605. $info = stream_get_contents($pipes[1]);
  29606. fclose($pipes[1]);
  29607. fclose($pipes[2]);
  29608. proc_close($process);
  29609. return $info;
  29610. }
  29611. }
  29612. private function getConsoleMode()
  29613. {
  29614. if (!function_exists('proc_open')) {
  29615. return;
  29616. }
  29617. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  29618. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  29619. if (is_resource($process)) {
  29620. $info = stream_get_contents($pipes[1]);
  29621. fclose($pipes[1]);
  29622. fclose($pipes[2]);
  29623. proc_close($process);
  29624. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  29625. return $matches[2].'x'.$matches[1];
  29626. }
  29627. }
  29628. }
  29629. private function getAbbreviationSuggestions($abbrevs)
  29630. {
  29631. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
  29632. }
  29633. public function extractNamespace($name, $limit = null)
  29634. {
  29635. $parts = explode(':', $name);
  29636. array_pop($parts);
  29637. return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
  29638. }
  29639. private function findAlternatives($name, $collection)
  29640. {
  29641. $threshold = 1e3;
  29642. $alternatives = array();
  29643. $collectionParts = array();
  29644. foreach ($collection as $item) {
  29645. $collectionParts[$item] = explode(':', $item);
  29646. }
  29647. foreach (explode(':', $name) as $i => $subname) {
  29648. foreach ($collectionParts as $collectionName => $parts) {
  29649. $exists = isset($alternatives[$collectionName]);
  29650. if (!isset($parts[$i]) && $exists) {
  29651. $alternatives[$collectionName] += $threshold;
  29652. continue;
  29653. } elseif (!isset($parts[$i])) {
  29654. continue;
  29655. }
  29656. $lev = levenshtein($subname, $parts[$i]);
  29657. if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  29658. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  29659. } elseif ($exists) {
  29660. $alternatives[$collectionName] += $threshold;
  29661. }
  29662. }
  29663. }
  29664. foreach ($collection as $item) {
  29665. $lev = levenshtein($name, $item);
  29666. if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
  29667. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  29668. }
  29669. }
  29670. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  29671. asort($alternatives);
  29672. return array_keys($alternatives);
  29673. }
  29674. public function setDefaultCommand($commandName)
  29675. {
  29676. $this->defaultCommand = $commandName;
  29677. }
  29678. private function stringWidth($string)
  29679. {
  29680. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  29681. return strlen($string);
  29682. }
  29683. return mb_strwidth($string, $encoding);
  29684. }
  29685. private function splitStringByWidth($string, $width)
  29686. {
  29687. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  29688. return str_split($string, $width);
  29689. }
  29690. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  29691. $lines = array();
  29692. $line = '';
  29693. foreach (preg_split('//u', $utf8String) as $char) {
  29694. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  29695. $line .= $char;
  29696. continue;
  29697. }
  29698. $lines[] = str_pad($line, $width);
  29699. $line = $char;
  29700. }
  29701. if ('' !== $line) {
  29702. $lines[] = count($lines) ? str_pad($line, $width) : $line;
  29703. }
  29704. mb_convert_variables($encoding, 'utf8', $lines);
  29705. return $lines;
  29706. }
  29707. private function extractAllNamespaces($name)
  29708. {
  29709. $parts = explode(':', $name, -1);
  29710. $namespaces = array();
  29711. foreach ($parts as $part) {
  29712. if (count($namespaces)) {
  29713. $namespaces[] = end($namespaces).':'.$part;
  29714. } else {
  29715. $namespaces[] = $part;
  29716. }
  29717. }
  29718. return $namespaces;
  29719. }
  29720. }
  29721. <?php
  29722. namespace Symfony\Component\Console\Command;
  29723. use Symfony\Component\Console\Descriptor\TextDescriptor;
  29724. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  29725. use Symfony\Component\Console\Exception\ExceptionInterface;
  29726. use Symfony\Component\Console\Input\InputDefinition;
  29727. use Symfony\Component\Console\Input\InputOption;
  29728. use Symfony\Component\Console\Input\InputArgument;
  29729. use Symfony\Component\Console\Input\InputInterface;
  29730. use Symfony\Component\Console\Output\BufferedOutput;
  29731. use Symfony\Component\Console\Output\OutputInterface;
  29732. use Symfony\Component\Console\Application;
  29733. use Symfony\Component\Console\Helper\HelperSet;
  29734. use Symfony\Component\Console\Exception\InvalidArgumentException;
  29735. use Symfony\Component\Console\Exception\LogicException;
  29736. class Command
  29737. {
  29738. private $application;
  29739. private $name;
  29740. private $processTitle;
  29741. private $aliases = array();
  29742. private $definition;
  29743. private $help;
  29744. private $description;
  29745. private $ignoreValidationErrors = false;
  29746. private $applicationDefinitionMerged = false;
  29747. private $applicationDefinitionMergedWithArgs = false;
  29748. private $inputBound = false;
  29749. private $code;
  29750. private $synopsis = array();
  29751. private $usages = array();
  29752. private $helperSet;
  29753. public function __construct($name = null)
  29754. {
  29755. $this->definition = new InputDefinition();
  29756. if (null !== $name) {
  29757. $this->setName($name);
  29758. }
  29759. $this->configure();
  29760. if (!$this->name) {
  29761. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
  29762. }
  29763. }
  29764. public function ignoreValidationErrors()
  29765. {
  29766. $this->ignoreValidationErrors = true;
  29767. }
  29768. public function setApplication(Application $application = null)
  29769. {
  29770. $this->application = $application;
  29771. if ($application) {
  29772. $this->setHelperSet($application->getHelperSet());
  29773. } else {
  29774. $this->helperSet = null;
  29775. }
  29776. }
  29777. public function setHelperSet(HelperSet $helperSet)
  29778. {
  29779. $this->helperSet = $helperSet;
  29780. }
  29781. public function getHelperSet()
  29782. {
  29783. return $this->helperSet;
  29784. }
  29785. public function getApplication()
  29786. {
  29787. return $this->application;
  29788. }
  29789. public function isEnabled()
  29790. {
  29791. return true;
  29792. }
  29793. protected function configure()
  29794. {
  29795. }
  29796. protected function execute(InputInterface $input, OutputInterface $output)
  29797. {
  29798. throw new LogicException('You must override the execute() method in the concrete command class.');
  29799. }
  29800. protected function interact(InputInterface $input, OutputInterface $output)
  29801. {
  29802. }
  29803. protected function initialize(InputInterface $input, OutputInterface $output)
  29804. {
  29805. }
  29806. public function run(InputInterface $input, OutputInterface $output)
  29807. {
  29808. $this->getSynopsis(true);
  29809. $this->getSynopsis(false);
  29810. $this->mergeApplicationDefinition();
  29811. if (!$this->inputBound) {
  29812. try {
  29813. $input->bind($this->definition);
  29814. } catch (ExceptionInterface $e) {
  29815. if (!$this->ignoreValidationErrors) {
  29816. throw $e;
  29817. }
  29818. }
  29819. }
  29820. $this->initialize($input, $output);
  29821. if (null !== $this->processTitle) {
  29822. if (function_exists('cli_set_process_title')) {
  29823. if (false === @cli_set_process_title($this->processTitle)) {
  29824. if ('Darwin' === PHP_OS) {
  29825. $output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.</comment>');
  29826. } else {
  29827. $error = error_get_last();
  29828. trigger_error($error['message'], E_USER_WARNING);
  29829. }
  29830. }
  29831. } elseif (function_exists('setproctitle')) {
  29832. setproctitle($this->processTitle);
  29833. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  29834. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  29835. }
  29836. }
  29837. if ($input->isInteractive()) {
  29838. $this->interact($input, $output);
  29839. }
  29840. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  29841. $input->setArgument('command', $this->getName());
  29842. }
  29843. $input->validate();
  29844. if ($this->code) {
  29845. $statusCode = call_user_func($this->code, $input, $output);
  29846. } else {
  29847. $statusCode = $this->execute($input, $output);
  29848. }
  29849. return is_numeric($statusCode) ? (int) $statusCode : 0;
  29850. }
  29851. public function setCode($code)
  29852. {
  29853. if (!is_callable($code)) {
  29854. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  29855. }
  29856. if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  29857. $r = new \ReflectionFunction($code);
  29858. if (null === $r->getClosureThis()) {
  29859. if (PHP_VERSION_ID < 70000) {
  29860. $code = @\Closure::bind($code, $this);
  29861. } else {
  29862. $code = \Closure::bind($code, $this);
  29863. }
  29864. }
  29865. }
  29866. $this->code = $code;
  29867. return $this;
  29868. }
  29869. public function mergeApplicationDefinition($mergeArgs = true)
  29870. {
  29871. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  29872. return;
  29873. }
  29874. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  29875. if ($mergeArgs) {
  29876. $currentArguments = $this->definition->getArguments();
  29877. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  29878. $this->definition->addArguments($currentArguments);
  29879. }
  29880. $this->applicationDefinitionMerged = true;
  29881. if ($mergeArgs) {
  29882. $this->applicationDefinitionMergedWithArgs = true;
  29883. }
  29884. }
  29885. public function setDefinition($definition)
  29886. {
  29887. if ($definition instanceof InputDefinition) {
  29888. $this->definition = $definition;
  29889. } else {
  29890. $this->definition->setDefinition($definition);
  29891. }
  29892. $this->applicationDefinitionMerged = false;
  29893. return $this;
  29894. }
  29895. public function getDefinition()
  29896. {
  29897. return $this->definition;
  29898. }
  29899. public function getNativeDefinition()
  29900. {
  29901. return $this->getDefinition();
  29902. }
  29903. public function addArgument($name, $mode = null, $description = '', $default = null)
  29904. {
  29905. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  29906. return $this;
  29907. }
  29908. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  29909. {
  29910. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  29911. return $this;
  29912. }
  29913. public function setName($name)
  29914. {
  29915. $this->validateName($name);
  29916. $this->name = $name;
  29917. return $this;
  29918. }
  29919. public function setProcessTitle($title)
  29920. {
  29921. $this->processTitle = $title;
  29922. return $this;
  29923. }
  29924. public function getName()
  29925. {
  29926. return $this->name;
  29927. }
  29928. public function setDescription($description)
  29929. {
  29930. $this->description = $description;
  29931. return $this;
  29932. }
  29933. public function getDescription()
  29934. {
  29935. return $this->description;
  29936. }
  29937. public function setHelp($help)
  29938. {
  29939. $this->help = $help;
  29940. return $this;
  29941. }
  29942. public function getHelp()
  29943. {
  29944. return $this->help;
  29945. }
  29946. public function getProcessedHelp()
  29947. {
  29948. $name = $this->name;
  29949. $placeholders = array(
  29950. '%command.name%',
  29951. '%command.full_name%',
  29952. );
  29953. $replacements = array(
  29954. $name,
  29955. $_SERVER['PHP_SELF'].' '.$name,
  29956. );
  29957. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  29958. }
  29959. public function setAliases($aliases)
  29960. {
  29961. if (!is_array($aliases) && !$aliases instanceof \Traversable) {
  29962. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  29963. }
  29964. foreach ($aliases as $alias) {
  29965. $this->validateName($alias);
  29966. }
  29967. $this->aliases = $aliases;
  29968. return $this;
  29969. }
  29970. public function getAliases()
  29971. {
  29972. return $this->aliases;
  29973. }
  29974. public function getSynopsis($short = false)
  29975. {
  29976. $key = $short ? 'short' : 'long';
  29977. if (!isset($this->synopsis[$key])) {
  29978. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  29979. }
  29980. return $this->synopsis[$key];
  29981. }
  29982. public function addUsage($usage)
  29983. {
  29984. if (0 !== strpos($usage, $this->name)) {
  29985. $usage = sprintf('%s %s', $this->name, $usage);
  29986. }
  29987. $this->usages[] = $usage;
  29988. return $this;
  29989. }
  29990. public function getUsages()
  29991. {
  29992. return $this->usages;
  29993. }
  29994. public function getHelper($name)
  29995. {
  29996. if (null === $this->helperSet) {
  29997. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  29998. }
  29999. return $this->helperSet->get($name);
  30000. }
  30001. public function asText()
  30002. {
  30003. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30004. $descriptor = new TextDescriptor();
  30005. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  30006. $descriptor->describe($output, $this, array('raw_output' => true));
  30007. return $output->fetch();
  30008. }
  30009. public function asXml($asDom = false)
  30010. {
  30011. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30012. $descriptor = new XmlDescriptor();
  30013. if ($asDom) {
  30014. return $descriptor->getCommandDocument($this);
  30015. }
  30016. $output = new BufferedOutput();
  30017. $descriptor->describe($output, $this);
  30018. return $output->fetch();
  30019. }
  30020. public function setInputBound($inputBound)
  30021. {
  30022. $this->inputBound = $inputBound;
  30023. }
  30024. private function validateName($name)
  30025. {
  30026. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  30027. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  30028. }
  30029. }
  30030. }
  30031. <?php
  30032. namespace Symfony\Component\Console\Command;
  30033. use Symfony\Component\Console\Helper\DescriptorHelper;
  30034. use Symfony\Component\Console\Input\InputArgument;
  30035. use Symfony\Component\Console\Input\InputOption;
  30036. use Symfony\Component\Console\Input\InputInterface;
  30037. use Symfony\Component\Console\Output\OutputInterface;
  30038. class HelpCommand extends Command
  30039. {
  30040. private $command;
  30041. protected function configure()
  30042. {
  30043. $this->ignoreValidationErrors();
  30044. $this
  30045. ->setName('help')
  30046. ->setDefinition(array(
  30047. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  30048. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  30049. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  30050. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  30051. ))
  30052. ->setDescription('Displays help for a command')
  30053. ->setHelp(<<<'EOF'
  30054. The <info>%command.name%</info> command displays help for a given command:
  30055. <info>php %command.full_name% list</info>
  30056. You can also output the help in other formats by using the <comment>--format</comment> option:
  30057. <info>php %command.full_name% --format=xml list</info>
  30058. To display the list of available commands, please use the <info>list</info> command.
  30059. EOF
  30060. )
  30061. ;
  30062. }
  30063. public function setCommand(Command $command)
  30064. {
  30065. $this->command = $command;
  30066. }
  30067. protected function execute(InputInterface $input, OutputInterface $output)
  30068. {
  30069. if (null === $this->command) {
  30070. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  30071. }
  30072. if ($input->getOption('xml')) {
  30073. @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);
  30074. $input->setOption('format', 'xml');
  30075. }
  30076. $helper = new DescriptorHelper();
  30077. $helper->describe($output, $this->command, array(
  30078. 'format' => $input->getOption('format'),
  30079. 'raw_text' => $input->getOption('raw'),
  30080. ));
  30081. $this->command = null;
  30082. }
  30083. }
  30084. <?php
  30085. namespace Symfony\Component\Console\Command;
  30086. use Symfony\Component\Console\Helper\DescriptorHelper;
  30087. use Symfony\Component\Console\Input\InputArgument;
  30088. use Symfony\Component\Console\Input\InputOption;
  30089. use Symfony\Component\Console\Input\InputInterface;
  30090. use Symfony\Component\Console\Output\OutputInterface;
  30091. use Symfony\Component\Console\Input\InputDefinition;
  30092. class ListCommand extends Command
  30093. {
  30094. protected function configure()
  30095. {
  30096. $this
  30097. ->setName('list')
  30098. ->setDefinition($this->createDefinition())
  30099. ->setDescription('Lists commands')
  30100. ->setHelp(<<<'EOF'
  30101. The <info>%command.name%</info> command lists all commands:
  30102. <info>php %command.full_name%</info>
  30103. You can also display the commands for a specific namespace:
  30104. <info>php %command.full_name% test</info>
  30105. You can also output the information in other formats by using the <comment>--format</comment> option:
  30106. <info>php %command.full_name% --format=xml</info>
  30107. It's also possible to get raw list of commands (useful for embedding command runner):
  30108. <info>php %command.full_name% --raw</info>
  30109. EOF
  30110. )
  30111. ;
  30112. }
  30113. public function getNativeDefinition()
  30114. {
  30115. return $this->createDefinition();
  30116. }
  30117. protected function execute(InputInterface $input, OutputInterface $output)
  30118. {
  30119. if ($input->getOption('xml')) {
  30120. @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);
  30121. $input->setOption('format', 'xml');
  30122. }
  30123. $helper = new DescriptorHelper();
  30124. $helper->describe($output, $this->getApplication(), array(
  30125. 'format' => $input->getOption('format'),
  30126. 'raw_text' => $input->getOption('raw'),
  30127. 'namespace' => $input->getArgument('namespace'),
  30128. ));
  30129. }
  30130. private function createDefinition()
  30131. {
  30132. return new InputDefinition(array(
  30133. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  30134. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  30135. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  30136. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  30137. ));
  30138. }
  30139. }
  30140. <?php
  30141. namespace Symfony\Component\Console;
  30142. final class ConsoleEvents
  30143. {
  30144. const COMMAND = 'console.command';
  30145. const TERMINATE = 'console.terminate';
  30146. const EXCEPTION = 'console.exception';
  30147. }
  30148. <?php
  30149. namespace Symfony\Component\Console\Descriptor;
  30150. use Symfony\Component\Console\Application;
  30151. use Symfony\Component\Console\Command\Command;
  30152. use Symfony\Component\Console\Exception\CommandNotFoundException;
  30153. class ApplicationDescription
  30154. {
  30155. const GLOBAL_NAMESPACE = '_global';
  30156. private $application;
  30157. private $namespace;
  30158. private $namespaces;
  30159. private $commands;
  30160. private $aliases;
  30161. public function __construct(Application $application, $namespace = null)
  30162. {
  30163. $this->application = $application;
  30164. $this->namespace = $namespace;
  30165. }
  30166. public function getNamespaces()
  30167. {
  30168. if (null === $this->namespaces) {
  30169. $this->inspectApplication();
  30170. }
  30171. return $this->namespaces;
  30172. }
  30173. public function getCommands()
  30174. {
  30175. if (null === $this->commands) {
  30176. $this->inspectApplication();
  30177. }
  30178. return $this->commands;
  30179. }
  30180. public function getCommand($name)
  30181. {
  30182. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  30183. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  30184. }
  30185. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  30186. }
  30187. private function inspectApplication()
  30188. {
  30189. $this->commands = array();
  30190. $this->namespaces = array();
  30191. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  30192. foreach ($this->sortCommands($all) as $namespace => $commands) {
  30193. $names = array();
  30194. foreach ($commands as $name => $command) {
  30195. if (!$command->getName()) {
  30196. continue;
  30197. }
  30198. if ($command->getName() === $name) {
  30199. $this->commands[$name] = $command;
  30200. } else {
  30201. $this->aliases[$name] = $command;
  30202. }
  30203. $names[] = $name;
  30204. }
  30205. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  30206. }
  30207. }
  30208. private function sortCommands(array $commands)
  30209. {
  30210. $namespacedCommands = array();
  30211. $globalCommands = array();
  30212. foreach ($commands as $name => $command) {
  30213. $key = $this->application->extractNamespace($name, 1);
  30214. if (!$key) {
  30215. $globalCommands['_global'][$name] = $command;
  30216. } else {
  30217. $namespacedCommands[$key][$name] = $command;
  30218. }
  30219. }
  30220. ksort($namespacedCommands);
  30221. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  30222. foreach ($namespacedCommands as &$commandsSet) {
  30223. ksort($commandsSet);
  30224. }
  30225. unset($commandsSet);
  30226. return $namespacedCommands;
  30227. }
  30228. }
  30229. <?php
  30230. namespace Symfony\Component\Console\Descriptor;
  30231. use Symfony\Component\Console\Application;
  30232. use Symfony\Component\Console\Command\Command;
  30233. use Symfony\Component\Console\Input\InputArgument;
  30234. use Symfony\Component\Console\Input\InputDefinition;
  30235. use Symfony\Component\Console\Input\InputOption;
  30236. use Symfony\Component\Console\Output\OutputInterface;
  30237. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30238. abstract class Descriptor implements DescriptorInterface
  30239. {
  30240. private $output;
  30241. public function describe(OutputInterface $output, $object, array $options = array())
  30242. {
  30243. $this->output = $output;
  30244. switch (true) {
  30245. case $object instanceof InputArgument:
  30246. $this->describeInputArgument($object, $options);
  30247. break;
  30248. case $object instanceof InputOption:
  30249. $this->describeInputOption($object, $options);
  30250. break;
  30251. case $object instanceof InputDefinition:
  30252. $this->describeInputDefinition($object, $options);
  30253. break;
  30254. case $object instanceof Command:
  30255. $this->describeCommand($object, $options);
  30256. break;
  30257. case $object instanceof Application:
  30258. $this->describeApplication($object, $options);
  30259. break;
  30260. default:
  30261. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
  30262. }
  30263. }
  30264. protected function write($content, $decorated = false)
  30265. {
  30266. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  30267. }
  30268. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  30269. abstract protected function describeInputOption(InputOption $option, array $options = array());
  30270. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  30271. abstract protected function describeCommand(Command $command, array $options = array());
  30272. abstract protected function describeApplication(Application $application, array $options = array());
  30273. }
  30274. <?php
  30275. namespace Symfony\Component\Console\Descriptor;
  30276. use Symfony\Component\Console\Output\OutputInterface;
  30277. interface DescriptorInterface
  30278. {
  30279. public function describe(OutputInterface $output, $object, array $options = array());
  30280. }
  30281. <?php
  30282. namespace Symfony\Component\Console\Descriptor;
  30283. use Symfony\Component\Console\Application;
  30284. use Symfony\Component\Console\Command\Command;
  30285. use Symfony\Component\Console\Input\InputArgument;
  30286. use Symfony\Component\Console\Input\InputDefinition;
  30287. use Symfony\Component\Console\Input\InputOption;
  30288. class JsonDescriptor extends Descriptor
  30289. {
  30290. protected function describeInputArgument(InputArgument $argument, array $options = array())
  30291. {
  30292. $this->writeData($this->getInputArgumentData($argument), $options);
  30293. }
  30294. protected function describeInputOption(InputOption $option, array $options = array())
  30295. {
  30296. $this->writeData($this->getInputOptionData($option), $options);
  30297. }
  30298. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  30299. {
  30300. $this->writeData($this->getInputDefinitionData($definition), $options);
  30301. }
  30302. protected function describeCommand(Command $command, array $options = array())
  30303. {
  30304. $this->writeData($this->getCommandData($command), $options);
  30305. }
  30306. protected function describeApplication(Application $application, array $options = array())
  30307. {
  30308. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  30309. $description = new ApplicationDescription($application, $describedNamespace);
  30310. $commands = array();
  30311. foreach ($description->getCommands() as $command) {
  30312. $commands[] = $this->getCommandData($command);
  30313. }
  30314. $data = $describedNamespace
  30315. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  30316. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  30317. $this->writeData($data, $options);
  30318. }
  30319. private function writeData(array $data, array $options)
  30320. {
  30321. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  30322. }
  30323. private function getInputArgumentData(InputArgument $argument)
  30324. {
  30325. return array(
  30326. 'name' => $argument->getName(),
  30327. 'is_required' => $argument->isRequired(),
  30328. 'is_array' => $argument->isArray(),
  30329. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  30330. 'default' => $argument->getDefault(),
  30331. );
  30332. }
  30333. private function getInputOptionData(InputOption $option)
  30334. {
  30335. return array(
  30336. 'name' => '--'.$option->getName(),
  30337. 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
  30338. 'accept_value' => $option->acceptValue(),
  30339. 'is_value_required' => $option->isValueRequired(),
  30340. 'is_multiple' => $option->isArray(),
  30341. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  30342. 'default' => $option->getDefault(),
  30343. );
  30344. }
  30345. private function getInputDefinitionData(InputDefinition $definition)
  30346. {
  30347. $inputArguments = array();
  30348. foreach ($definition->getArguments() as $name => $argument) {
  30349. $inputArguments[$name] = $this->getInputArgumentData($argument);
  30350. }
  30351. $inputOptions = array();
  30352. foreach ($definition->getOptions() as $name => $option) {
  30353. $inputOptions[$name] = $this->getInputOptionData($option);
  30354. }
  30355. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  30356. }
  30357. private function getCommandData(Command $command)
  30358. {
  30359. $command->getSynopsis();
  30360. $command->mergeApplicationDefinition(false);
  30361. return array(
  30362. 'name' => $command->getName(),
  30363. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  30364. 'description' => $command->getDescription(),
  30365. 'help' => $command->getProcessedHelp(),
  30366. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  30367. );
  30368. }
  30369. }
  30370. <?php
  30371. namespace Symfony\Component\Console\Descriptor;
  30372. use Symfony\Component\Console\Application;
  30373. use Symfony\Component\Console\Command\Command;
  30374. use Symfony\Component\Console\Helper\Helper;
  30375. use Symfony\Component\Console\Input\InputArgument;
  30376. use Symfony\Component\Console\Input\InputDefinition;
  30377. use Symfony\Component\Console\Input\InputOption;
  30378. class MarkdownDescriptor extends Descriptor
  30379. {
  30380. protected function describeInputArgument(InputArgument $argument, array $options = array())
  30381. {
  30382. $this->write(
  30383. '**'.$argument->getName().':**'."\n\n"
  30384. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  30385. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  30386. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  30387. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  30388. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  30389. );
  30390. }
  30391. protected function describeInputOption(InputOption $option, array $options = array())
  30392. {
  30393. $this->write(
  30394. '**'.$option->getName().':**'."\n\n"
  30395. .'* Name: `--'.$option->getName().'`'."\n"
  30396. .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
  30397. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  30398. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  30399. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  30400. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  30401. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  30402. );
  30403. }
  30404. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  30405. {
  30406. if ($showArguments = count($definition->getArguments()) > 0) {
  30407. $this->write('### Arguments:');
  30408. foreach ($definition->getArguments() as $argument) {
  30409. $this->write("\n\n");
  30410. $this->write($this->describeInputArgument($argument));
  30411. }
  30412. }
  30413. if (count($definition->getOptions()) > 0) {
  30414. if ($showArguments) {
  30415. $this->write("\n\n");
  30416. }
  30417. $this->write('### Options:');
  30418. foreach ($definition->getOptions() as $option) {
  30419. $this->write("\n\n");
  30420. $this->write($this->describeInputOption($option));
  30421. }
  30422. }
  30423. }
  30424. protected function describeCommand(Command $command, array $options = array())
  30425. {
  30426. $command->getSynopsis();
  30427. $command->mergeApplicationDefinition(false);
  30428. $this->write(
  30429. $command->getName()."\n"
  30430. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  30431. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  30432. .'* Usage:'."\n\n"
  30433. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  30434. return $carry.' * `'.$usage.'`'."\n";
  30435. })
  30436. );
  30437. if ($help = $command->getProcessedHelp()) {
  30438. $this->write("\n");
  30439. $this->write($help);
  30440. }
  30441. if ($command->getNativeDefinition()) {
  30442. $this->write("\n\n");
  30443. $this->describeInputDefinition($command->getNativeDefinition());
  30444. }
  30445. }
  30446. protected function describeApplication(Application $application, array $options = array())
  30447. {
  30448. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  30449. $description = new ApplicationDescription($application, $describedNamespace);
  30450. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  30451. foreach ($description->getNamespaces() as $namespace) {
  30452. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  30453. $this->write("\n\n");
  30454. $this->write('**'.$namespace['id'].':**');
  30455. }
  30456. $this->write("\n\n");
  30457. $this->write(implode("\n", array_map(function ($commandName) {
  30458. return '* '.$commandName;
  30459. }, $namespace['commands'])));
  30460. }
  30461. foreach ($description->getCommands() as $command) {
  30462. $this->write("\n\n");
  30463. $this->write($this->describeCommand($command));
  30464. }
  30465. }
  30466. }
  30467. <?php
  30468. namespace Symfony\Component\Console\Descriptor;
  30469. use Symfony\Component\Console\Application;
  30470. use Symfony\Component\Console\Command\Command;
  30471. use Symfony\Component\Console\Formatter\OutputFormatter;
  30472. use Symfony\Component\Console\Helper\Helper;
  30473. use Symfony\Component\Console\Input\InputArgument;
  30474. use Symfony\Component\Console\Input\InputDefinition;
  30475. use Symfony\Component\Console\Input\InputOption;
  30476. class TextDescriptor extends Descriptor
  30477. {
  30478. protected function describeInputArgument(InputArgument $argument, array $options = array())
  30479. {
  30480. if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
  30481. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  30482. } else {
  30483. $default = '';
  30484. }
  30485. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  30486. $spacingWidth = $totalWidth - strlen($argument->getName());
  30487. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  30488. $argument->getName(),
  30489. str_repeat(' ', $spacingWidth),
  30490. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  30491. $default
  30492. ), $options);
  30493. }
  30494. protected function describeInputOption(InputOption $option, array $options = array())
  30495. {
  30496. if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
  30497. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  30498. } else {
  30499. $default = '';
  30500. }
  30501. $value = '';
  30502. if ($option->acceptValue()) {
  30503. $value = '='.strtoupper($option->getName());
  30504. if ($option->isValueOptional()) {
  30505. $value = '['.$value.']';
  30506. }
  30507. }
  30508. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  30509. $synopsis = sprintf('%s%s',
  30510. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  30511. sprintf('--%s%s', $option->getName(), $value)
  30512. );
  30513. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  30514. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  30515. $synopsis,
  30516. str_repeat(' ', $spacingWidth),
  30517. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  30518. $default,
  30519. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  30520. ), $options);
  30521. }
  30522. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  30523. {
  30524. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  30525. foreach ($definition->getArguments() as $argument) {
  30526. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  30527. }
  30528. if ($definition->getArguments()) {
  30529. $this->writeText('<comment>Arguments:</comment>', $options);
  30530. $this->writeText("\n");
  30531. foreach ($definition->getArguments() as $argument) {
  30532. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  30533. $this->writeText("\n");
  30534. }
  30535. }
  30536. if ($definition->getArguments() && $definition->getOptions()) {
  30537. $this->writeText("\n");
  30538. }
  30539. if ($definition->getOptions()) {
  30540. $laterOptions = array();
  30541. $this->writeText('<comment>Options:</comment>', $options);
  30542. foreach ($definition->getOptions() as $option) {
  30543. if (strlen($option->getShortcut()) > 1) {
  30544. $laterOptions[] = $option;
  30545. continue;
  30546. }
  30547. $this->writeText("\n");
  30548. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  30549. }
  30550. foreach ($laterOptions as $option) {
  30551. $this->writeText("\n");
  30552. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  30553. }
  30554. }
  30555. }
  30556. protected function describeCommand(Command $command, array $options = array())
  30557. {
  30558. $command->getSynopsis(true);
  30559. $command->getSynopsis(false);
  30560. $command->mergeApplicationDefinition(false);
  30561. $this->writeText('<comment>Usage:</comment>', $options);
  30562. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  30563. $this->writeText("\n");
  30564. $this->writeText(' '.$usage, $options);
  30565. }
  30566. $this->writeText("\n");
  30567. $definition = $command->getNativeDefinition();
  30568. if ($definition->getOptions() || $definition->getArguments()) {
  30569. $this->writeText("\n");
  30570. $this->describeInputDefinition($definition, $options);
  30571. $this->writeText("\n");
  30572. }
  30573. if ($help = $command->getProcessedHelp()) {
  30574. $this->writeText("\n");
  30575. $this->writeText('<comment>Help:</comment>', $options);
  30576. $this->writeText("\n");
  30577. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  30578. $this->writeText("\n");
  30579. }
  30580. }
  30581. protected function describeApplication(Application $application, array $options = array())
  30582. {
  30583. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  30584. $description = new ApplicationDescription($application, $describedNamespace);
  30585. if (isset($options['raw_text']) && $options['raw_text']) {
  30586. $width = $this->getColumnWidth($description->getCommands());
  30587. foreach ($description->getCommands() as $command) {
  30588. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  30589. $this->writeText("\n");
  30590. }
  30591. } else {
  30592. if ('' != $help = $application->getHelp()) {
  30593. $this->writeText("$help\n\n", $options);
  30594. }
  30595. $this->writeText("<comment>Usage:</comment>\n", $options);
  30596. $this->writeText(" command [options] [arguments]\n\n", $options);
  30597. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  30598. $this->writeText("\n");
  30599. $this->writeText("\n");
  30600. $width = $this->getColumnWidth($description->getCommands());
  30601. if ($describedNamespace) {
  30602. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  30603. } else {
  30604. $this->writeText('<comment>Available commands:</comment>', $options);
  30605. }
  30606. foreach ($description->getNamespaces() as $namespace) {
  30607. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  30608. $this->writeText("\n");
  30609. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  30610. }
  30611. foreach ($namespace['commands'] as $name) {
  30612. $this->writeText("\n");
  30613. $spacingWidth = $width - Helper::strlen($name);
  30614. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  30615. }
  30616. }
  30617. $this->writeText("\n");
  30618. }
  30619. }
  30620. private function writeText($content, array $options = array())
  30621. {
  30622. $this->write(
  30623. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  30624. isset($options['raw_output']) ? !$options['raw_output'] : true
  30625. );
  30626. }
  30627. private function formatDefaultValue($default)
  30628. {
  30629. if (is_string($default)) {
  30630. $default = OutputFormatter::escape($default);
  30631. } elseif (is_array($default)) {
  30632. foreach ($default as $key => $value) {
  30633. if (is_string($value)) {
  30634. $default[$key] = OutputFormatter::escape($value);
  30635. }
  30636. }
  30637. }
  30638. if (PHP_VERSION_ID < 50400) {
  30639. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  30640. }
  30641. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  30642. }
  30643. private function getColumnWidth(array $commands)
  30644. {
  30645. $widths = array();
  30646. foreach ($commands as $command) {
  30647. $widths[] = Helper::strlen($command->getName());
  30648. foreach ($command->getAliases() as $alias) {
  30649. $widths[] = Helper::strlen($alias);
  30650. }
  30651. }
  30652. return max($widths) + 2;
  30653. }
  30654. private function calculateTotalWidthForOptions($options)
  30655. {
  30656. $totalWidth = 0;
  30657. foreach ($options as $option) {
  30658. $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  30659. if ($option->acceptValue()) {
  30660. $valueLength = 1 + Helper::strlen($option->getName());
  30661. $valueLength += $option->isValueOptional() ? 2 : 0;
  30662. $nameLength += $valueLength;
  30663. }
  30664. $totalWidth = max($totalWidth, $nameLength);
  30665. }
  30666. return $totalWidth;
  30667. }
  30668. }
  30669. <?php
  30670. namespace Symfony\Component\Console\Descriptor;
  30671. use Symfony\Component\Console\Application;
  30672. use Symfony\Component\Console\Command\Command;
  30673. use Symfony\Component\Console\Input\InputArgument;
  30674. use Symfony\Component\Console\Input\InputDefinition;
  30675. use Symfony\Component\Console\Input\InputOption;
  30676. class XmlDescriptor extends Descriptor
  30677. {
  30678. public function getInputDefinitionDocument(InputDefinition $definition)
  30679. {
  30680. $dom = new \DOMDocument('1.0', 'UTF-8');
  30681. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  30682. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  30683. foreach ($definition->getArguments() as $argument) {
  30684. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  30685. }
  30686. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  30687. foreach ($definition->getOptions() as $option) {
  30688. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  30689. }
  30690. return $dom;
  30691. }
  30692. public function getCommandDocument(Command $command)
  30693. {
  30694. $dom = new \DOMDocument('1.0', 'UTF-8');
  30695. $dom->appendChild($commandXML = $dom->createElement('command'));
  30696. $command->getSynopsis();
  30697. $command->mergeApplicationDefinition(false);
  30698. $commandXML->setAttribute('id', $command->getName());
  30699. $commandXML->setAttribute('name', $command->getName());
  30700. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  30701. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  30702. $usagesXML->appendChild($dom->createElement('usage', $usage));
  30703. }
  30704. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  30705. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  30706. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  30707. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  30708. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  30709. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  30710. return $dom;
  30711. }
  30712. public function getApplicationDocument(Application $application, $namespace = null)
  30713. {
  30714. $dom = new \DOMDocument('1.0', 'UTF-8');
  30715. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  30716. if ($application->getName() !== 'UNKNOWN') {
  30717. $rootXml->setAttribute('name', $application->getName());
  30718. if ($application->getVersion() !== 'UNKNOWN') {
  30719. $rootXml->setAttribute('version', $application->getVersion());
  30720. }
  30721. }
  30722. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  30723. $description = new ApplicationDescription($application, $namespace);
  30724. if ($namespace) {
  30725. $commandsXML->setAttribute('namespace', $namespace);
  30726. }
  30727. foreach ($description->getCommands() as $command) {
  30728. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  30729. }
  30730. if (!$namespace) {
  30731. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  30732. foreach ($description->getNamespaces() as $namespaceDescription) {
  30733. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  30734. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  30735. foreach ($namespaceDescription['commands'] as $name) {
  30736. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  30737. $commandXML->appendChild($dom->createTextNode($name));
  30738. }
  30739. }
  30740. }
  30741. return $dom;
  30742. }
  30743. protected function describeInputArgument(InputArgument $argument, array $options = array())
  30744. {
  30745. $this->writeDocument($this->getInputArgumentDocument($argument));
  30746. }
  30747. protected function describeInputOption(InputOption $option, array $options = array())
  30748. {
  30749. $this->writeDocument($this->getInputOptionDocument($option));
  30750. }
  30751. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  30752. {
  30753. $this->writeDocument($this->getInputDefinitionDocument($definition));
  30754. }
  30755. protected function describeCommand(Command $command, array $options = array())
  30756. {
  30757. $this->writeDocument($this->getCommandDocument($command));
  30758. }
  30759. protected function describeApplication(Application $application, array $options = array())
  30760. {
  30761. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  30762. }
  30763. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  30764. {
  30765. foreach ($importedParent->childNodes as $childNode) {
  30766. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  30767. }
  30768. }
  30769. private function writeDocument(\DOMDocument $dom)
  30770. {
  30771. $dom->formatOutput = true;
  30772. $this->write($dom->saveXML());
  30773. }
  30774. private function getInputArgumentDocument(InputArgument $argument)
  30775. {
  30776. $dom = new \DOMDocument('1.0', 'UTF-8');
  30777. $dom->appendChild($objectXML = $dom->createElement('argument'));
  30778. $objectXML->setAttribute('name', $argument->getName());
  30779. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  30780. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  30781. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  30782. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  30783. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  30784. $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  30785. foreach ($defaults as $default) {
  30786. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  30787. $defaultXML->appendChild($dom->createTextNode($default));
  30788. }
  30789. return $dom;
  30790. }
  30791. private function getInputOptionDocument(InputOption $option)
  30792. {
  30793. $dom = new \DOMDocument('1.0', 'UTF-8');
  30794. $dom->appendChild($objectXML = $dom->createElement('option'));
  30795. $objectXML->setAttribute('name', '--'.$option->getName());
  30796. $pos = strpos($option->getShortcut(), '|');
  30797. if (false !== $pos) {
  30798. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  30799. $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
  30800. } else {
  30801. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  30802. }
  30803. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  30804. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  30805. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  30806. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  30807. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  30808. if ($option->acceptValue()) {
  30809. $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  30810. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  30811. if (!empty($defaults)) {
  30812. foreach ($defaults as $default) {
  30813. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  30814. $defaultXML->appendChild($dom->createTextNode($default));
  30815. }
  30816. }
  30817. }
  30818. return $dom;
  30819. }
  30820. }
  30821. <?php
  30822. namespace Symfony\Component\Console\Event;
  30823. class ConsoleCommandEvent extends ConsoleEvent
  30824. {
  30825. const RETURN_CODE_DISABLED = 113;
  30826. private $commandShouldRun = true;
  30827. public function disableCommand()
  30828. {
  30829. return $this->commandShouldRun = false;
  30830. }
  30831. public function enableCommand()
  30832. {
  30833. return $this->commandShouldRun = true;
  30834. }
  30835. public function commandShouldRun()
  30836. {
  30837. return $this->commandShouldRun;
  30838. }
  30839. }
  30840. <?php
  30841. namespace Symfony\Component\Console\Event;
  30842. use Symfony\Component\Console\Command\Command;
  30843. use Symfony\Component\Console\Input\InputInterface;
  30844. use Symfony\Component\Console\Output\OutputInterface;
  30845. use Symfony\Component\EventDispatcher\Event;
  30846. class ConsoleEvent extends Event
  30847. {
  30848. protected $command;
  30849. private $input;
  30850. private $output;
  30851. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  30852. {
  30853. $this->command = $command;
  30854. $this->input = $input;
  30855. $this->output = $output;
  30856. }
  30857. public function getCommand()
  30858. {
  30859. return $this->command;
  30860. }
  30861. public function getInput()
  30862. {
  30863. return $this->input;
  30864. }
  30865. public function getOutput()
  30866. {
  30867. return $this->output;
  30868. }
  30869. }
  30870. <?php
  30871. namespace Symfony\Component\Console\Event;
  30872. use Symfony\Component\Console\Command\Command;
  30873. use Symfony\Component\Console\Input\InputInterface;
  30874. use Symfony\Component\Console\Output\OutputInterface;
  30875. class ConsoleExceptionEvent extends ConsoleEvent
  30876. {
  30877. private $exception;
  30878. private $exitCode;
  30879. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  30880. {
  30881. parent::__construct($command, $input, $output);
  30882. $this->setException($exception);
  30883. $this->exitCode = (int) $exitCode;
  30884. }
  30885. public function getException()
  30886. {
  30887. return $this->exception;
  30888. }
  30889. public function setException(\Exception $exception)
  30890. {
  30891. $this->exception = $exception;
  30892. }
  30893. public function getExitCode()
  30894. {
  30895. return $this->exitCode;
  30896. }
  30897. }
  30898. <?php
  30899. namespace Symfony\Component\Console\Event;
  30900. use Symfony\Component\Console\Command\Command;
  30901. use Symfony\Component\Console\Input\InputInterface;
  30902. use Symfony\Component\Console\Output\OutputInterface;
  30903. class ConsoleTerminateEvent extends ConsoleEvent
  30904. {
  30905. private $exitCode;
  30906. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  30907. {
  30908. parent::__construct($command, $input, $output);
  30909. $this->setExitCode($exitCode);
  30910. }
  30911. public function setExitCode($exitCode)
  30912. {
  30913. $this->exitCode = (int) $exitCode;
  30914. }
  30915. public function getExitCode()
  30916. {
  30917. return $this->exitCode;
  30918. }
  30919. }
  30920. <?php
  30921. namespace Symfony\Component\Console\Exception;
  30922. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  30923. {
  30924. private $alternatives;
  30925. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  30926. {
  30927. parent::__construct($message, $code, $previous);
  30928. $this->alternatives = $alternatives;
  30929. }
  30930. public function getAlternatives()
  30931. {
  30932. return $this->alternatives;
  30933. }
  30934. }
  30935. <?php
  30936. namespace Symfony\Component\Console\Exception;
  30937. interface ExceptionInterface
  30938. {
  30939. }
  30940. <?php
  30941. namespace Symfony\Component\Console\Exception;
  30942. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  30943. {
  30944. }
  30945. <?php
  30946. namespace Symfony\Component\Console\Exception;
  30947. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  30948. {
  30949. }
  30950. <?php
  30951. namespace Symfony\Component\Console\Exception;
  30952. class LogicException extends \LogicException implements ExceptionInterface
  30953. {
  30954. }
  30955. <?php
  30956. namespace Symfony\Component\Console\Exception;
  30957. class RuntimeException extends \RuntimeException implements ExceptionInterface
  30958. {
  30959. }
  30960. <?php
  30961. namespace Symfony\Component\Console\Formatter;
  30962. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30963. class OutputFormatter implements OutputFormatterInterface
  30964. {
  30965. private $decorated;
  30966. private $styles = array();
  30967. private $styleStack;
  30968. public static function escape($text)
  30969. {
  30970. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  30971. return self::escapeTrailingBackslash($text);
  30972. }
  30973. public static function escapeTrailingBackslash($text)
  30974. {
  30975. if ('\\' === substr($text, -1)) {
  30976. $len = strlen($text);
  30977. $text = rtrim($text, '\\');
  30978. $text .= str_repeat('<<', $len - strlen($text));
  30979. }
  30980. return $text;
  30981. }
  30982. public function __construct($decorated = false, array $styles = array())
  30983. {
  30984. $this->decorated = (bool) $decorated;
  30985. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  30986. $this->setStyle('info', new OutputFormatterStyle('green'));
  30987. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  30988. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  30989. foreach ($styles as $name => $style) {
  30990. $this->setStyle($name, $style);
  30991. }
  30992. $this->styleStack = new OutputFormatterStyleStack();
  30993. }
  30994. public function setDecorated($decorated)
  30995. {
  30996. $this->decorated = (bool) $decorated;
  30997. }
  30998. public function isDecorated()
  30999. {
  31000. return $this->decorated;
  31001. }
  31002. public function setStyle($name, OutputFormatterStyleInterface $style)
  31003. {
  31004. $this->styles[strtolower($name)] = $style;
  31005. }
  31006. public function hasStyle($name)
  31007. {
  31008. return isset($this->styles[strtolower($name)]);
  31009. }
  31010. public function getStyle($name)
  31011. {
  31012. if (!$this->hasStyle($name)) {
  31013. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  31014. }
  31015. return $this->styles[strtolower($name)];
  31016. }
  31017. public function format($message)
  31018. {
  31019. $message = (string) $message;
  31020. $offset = 0;
  31021. $output = '';
  31022. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  31023. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  31024. foreach ($matches[0] as $i => $match) {
  31025. $pos = $match[1];
  31026. $text = $match[0];
  31027. if (0 != $pos && '\\' == $message[$pos - 1]) {
  31028. continue;
  31029. }
  31030. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  31031. $offset = $pos + strlen($text);
  31032. if ($open = '/' != $text[1]) {
  31033. $tag = $matches[1][$i][0];
  31034. } else {
  31035. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  31036. }
  31037. if (!$open && !$tag) {
  31038. $this->styleStack->pop();
  31039. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  31040. $output .= $this->applyCurrentStyle($text);
  31041. } elseif ($open) {
  31042. $this->styleStack->push($style);
  31043. } else {
  31044. $this->styleStack->pop($style);
  31045. }
  31046. }
  31047. $output .= $this->applyCurrentStyle(substr($message, $offset));
  31048. if (false !== strpos($output, '<<')) {
  31049. return strtr($output, array('\\<' => '<', '<<' => '\\'));
  31050. }
  31051. return str_replace('\\<', '<', $output);
  31052. }
  31053. public function getStyleStack()
  31054. {
  31055. return $this->styleStack;
  31056. }
  31057. private function createStyleFromString($string)
  31058. {
  31059. if (isset($this->styles[$string])) {
  31060. return $this->styles[$string];
  31061. }
  31062. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  31063. return false;
  31064. }
  31065. $style = new OutputFormatterStyle();
  31066. foreach ($matches as $match) {
  31067. array_shift($match);
  31068. if ('fg' == $match[0]) {
  31069. $style->setForeground($match[1]);
  31070. } elseif ('bg' == $match[0]) {
  31071. $style->setBackground($match[1]);
  31072. } else {
  31073. try {
  31074. $style->setOption($match[1]);
  31075. } catch (\InvalidArgumentException $e) {
  31076. return false;
  31077. }
  31078. }
  31079. }
  31080. return $style;
  31081. }
  31082. private function applyCurrentStyle($text)
  31083. {
  31084. return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  31085. }
  31086. }
  31087. <?php
  31088. namespace Symfony\Component\Console\Formatter;
  31089. interface OutputFormatterInterface
  31090. {
  31091. public function setDecorated($decorated);
  31092. public function isDecorated();
  31093. public function setStyle($name, OutputFormatterStyleInterface $style);
  31094. public function hasStyle($name);
  31095. public function getStyle($name);
  31096. public function format($message);
  31097. }
  31098. <?php
  31099. namespace Symfony\Component\Console\Formatter;
  31100. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31101. class OutputFormatterStyle implements OutputFormatterStyleInterface
  31102. {
  31103. private static $availableForegroundColors = array(
  31104. 'black' => array('set' => 30, 'unset' => 39),
  31105. 'red' => array('set' => 31, 'unset' => 39),
  31106. 'green' => array('set' => 32, 'unset' => 39),
  31107. 'yellow' => array('set' => 33, 'unset' => 39),
  31108. 'blue' => array('set' => 34, 'unset' => 39),
  31109. 'magenta' => array('set' => 35, 'unset' => 39),
  31110. 'cyan' => array('set' => 36, 'unset' => 39),
  31111. 'white' => array('set' => 37, 'unset' => 39),
  31112. 'default' => array('set' => 39, 'unset' => 39),
  31113. );
  31114. private static $availableBackgroundColors = array(
  31115. 'black' => array('set' => 40, 'unset' => 49),
  31116. 'red' => array('set' => 41, 'unset' => 49),
  31117. 'green' => array('set' => 42, 'unset' => 49),
  31118. 'yellow' => array('set' => 43, 'unset' => 49),
  31119. 'blue' => array('set' => 44, 'unset' => 49),
  31120. 'magenta' => array('set' => 45, 'unset' => 49),
  31121. 'cyan' => array('set' => 46, 'unset' => 49),
  31122. 'white' => array('set' => 47, 'unset' => 49),
  31123. 'default' => array('set' => 49, 'unset' => 49),
  31124. );
  31125. private static $availableOptions = array(
  31126. 'bold' => array('set' => 1, 'unset' => 22),
  31127. 'underscore' => array('set' => 4, 'unset' => 24),
  31128. 'blink' => array('set' => 5, 'unset' => 25),
  31129. 'reverse' => array('set' => 7, 'unset' => 27),
  31130. 'conceal' => array('set' => 8, 'unset' => 28),
  31131. );
  31132. private $foreground;
  31133. private $background;
  31134. private $options = array();
  31135. public function __construct($foreground = null, $background = null, array $options = array())
  31136. {
  31137. if (null !== $foreground) {
  31138. $this->setForeground($foreground);
  31139. }
  31140. if (null !== $background) {
  31141. $this->setBackground($background);
  31142. }
  31143. if (count($options)) {
  31144. $this->setOptions($options);
  31145. }
  31146. }
  31147. public function setForeground($color = null)
  31148. {
  31149. if (null === $color) {
  31150. $this->foreground = null;
  31151. return;
  31152. }
  31153. if (!isset(static::$availableForegroundColors[$color])) {
  31154. throw new InvalidArgumentException(sprintf(
  31155. 'Invalid foreground color specified: "%s". Expected one of (%s)',
  31156. $color,
  31157. implode(', ', array_keys(static::$availableForegroundColors))
  31158. ));
  31159. }
  31160. $this->foreground = static::$availableForegroundColors[$color];
  31161. }
  31162. public function setBackground($color = null)
  31163. {
  31164. if (null === $color) {
  31165. $this->background = null;
  31166. return;
  31167. }
  31168. if (!isset(static::$availableBackgroundColors[$color])) {
  31169. throw new InvalidArgumentException(sprintf(
  31170. 'Invalid background color specified: "%s". Expected one of (%s)',
  31171. $color,
  31172. implode(', ', array_keys(static::$availableBackgroundColors))
  31173. ));
  31174. }
  31175. $this->background = static::$availableBackgroundColors[$color];
  31176. }
  31177. public function setOption($option)
  31178. {
  31179. if (!isset(static::$availableOptions[$option])) {
  31180. throw new InvalidArgumentException(sprintf(
  31181. 'Invalid option specified: "%s". Expected one of (%s)',
  31182. $option,
  31183. implode(', ', array_keys(static::$availableOptions))
  31184. ));
  31185. }
  31186. if (!in_array(static::$availableOptions[$option], $this->options)) {
  31187. $this->options[] = static::$availableOptions[$option];
  31188. }
  31189. }
  31190. public function unsetOption($option)
  31191. {
  31192. if (!isset(static::$availableOptions[$option])) {
  31193. throw new InvalidArgumentException(sprintf(
  31194. 'Invalid option specified: "%s". Expected one of (%s)',
  31195. $option,
  31196. implode(', ', array_keys(static::$availableOptions))
  31197. ));
  31198. }
  31199. $pos = array_search(static::$availableOptions[$option], $this->options);
  31200. if (false !== $pos) {
  31201. unset($this->options[$pos]);
  31202. }
  31203. }
  31204. public function setOptions(array $options)
  31205. {
  31206. $this->options = array();
  31207. foreach ($options as $option) {
  31208. $this->setOption($option);
  31209. }
  31210. }
  31211. public function apply($text)
  31212. {
  31213. $setCodes = array();
  31214. $unsetCodes = array();
  31215. if (null !== $this->foreground) {
  31216. $setCodes[] = $this->foreground['set'];
  31217. $unsetCodes[] = $this->foreground['unset'];
  31218. }
  31219. if (null !== $this->background) {
  31220. $setCodes[] = $this->background['set'];
  31221. $unsetCodes[] = $this->background['unset'];
  31222. }
  31223. if (count($this->options)) {
  31224. foreach ($this->options as $option) {
  31225. $setCodes[] = $option['set'];
  31226. $unsetCodes[] = $option['unset'];
  31227. }
  31228. }
  31229. if (0 === count($setCodes)) {
  31230. return $text;
  31231. }
  31232. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  31233. }
  31234. }
  31235. <?php
  31236. namespace Symfony\Component\Console\Formatter;
  31237. interface OutputFormatterStyleInterface
  31238. {
  31239. public function setForeground($color = null);
  31240. public function setBackground($color = null);
  31241. public function setOption($option);
  31242. public function unsetOption($option);
  31243. public function setOptions(array $options);
  31244. public function apply($text);
  31245. }
  31246. <?php
  31247. namespace Symfony\Component\Console\Formatter;
  31248. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31249. class OutputFormatterStyleStack
  31250. {
  31251. private $styles;
  31252. private $emptyStyle;
  31253. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  31254. {
  31255. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  31256. $this->reset();
  31257. }
  31258. public function reset()
  31259. {
  31260. $this->styles = array();
  31261. }
  31262. public function push(OutputFormatterStyleInterface $style)
  31263. {
  31264. $this->styles[] = $style;
  31265. }
  31266. public function pop(OutputFormatterStyleInterface $style = null)
  31267. {
  31268. if (empty($this->styles)) {
  31269. return $this->emptyStyle;
  31270. }
  31271. if (null === $style) {
  31272. return array_pop($this->styles);
  31273. }
  31274. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  31275. if ($style->apply('') === $stackedStyle->apply('')) {
  31276. $this->styles = array_slice($this->styles, 0, $index);
  31277. return $stackedStyle;
  31278. }
  31279. }
  31280. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  31281. }
  31282. public function getCurrent()
  31283. {
  31284. if (empty($this->styles)) {
  31285. return $this->emptyStyle;
  31286. }
  31287. return $this->styles[count($this->styles) - 1];
  31288. }
  31289. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  31290. {
  31291. $this->emptyStyle = $emptyStyle;
  31292. return $this;
  31293. }
  31294. public function getEmptyStyle()
  31295. {
  31296. return $this->emptyStyle;
  31297. }
  31298. }
  31299. <?php
  31300. namespace Symfony\Component\Console\Helper;
  31301. class DebugFormatterHelper extends Helper
  31302. {
  31303. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  31304. private $started = array();
  31305. private $count = -1;
  31306. public function start($id, $message, $prefix = 'RUN')
  31307. {
  31308. $this->started[$id] = array('border' => ++$this->count % count($this->colors));
  31309. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  31310. }
  31311. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  31312. {
  31313. $message = '';
  31314. if ($error) {
  31315. if (isset($this->started[$id]['out'])) {
  31316. $message .= "\n";
  31317. unset($this->started[$id]['out']);
  31318. }
  31319. if (!isset($this->started[$id]['err'])) {
  31320. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  31321. $this->started[$id]['err'] = true;
  31322. }
  31323. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  31324. } else {
  31325. if (isset($this->started[$id]['err'])) {
  31326. $message .= "\n";
  31327. unset($this->started[$id]['err']);
  31328. }
  31329. if (!isset($this->started[$id]['out'])) {
  31330. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  31331. $this->started[$id]['out'] = true;
  31332. }
  31333. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  31334. }
  31335. return $message;
  31336. }
  31337. public function stop($id, $message, $successful, $prefix = 'RES')
  31338. {
  31339. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  31340. if ($successful) {
  31341. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  31342. }
  31343. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  31344. unset($this->started[$id]['out'], $this->started[$id]['err']);
  31345. return $message;
  31346. }
  31347. private function getBorder($id)
  31348. {
  31349. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  31350. }
  31351. public function getName()
  31352. {
  31353. return 'debug_formatter';
  31354. }
  31355. }
  31356. <?php
  31357. namespace Symfony\Component\Console\Helper;
  31358. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  31359. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  31360. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  31361. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31362. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31363. use Symfony\Component\Console\Output\OutputInterface;
  31364. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31365. class DescriptorHelper extends Helper
  31366. {
  31367. private $descriptors = array();
  31368. public function __construct()
  31369. {
  31370. $this
  31371. ->register('txt', new TextDescriptor())
  31372. ->register('xml', new XmlDescriptor())
  31373. ->register('json', new JsonDescriptor())
  31374. ->register('md', new MarkdownDescriptor())
  31375. ;
  31376. }
  31377. public function describe(OutputInterface $output, $object, array $options = array())
  31378. {
  31379. $options = array_merge(array(
  31380. 'raw_text' => false,
  31381. 'format' => 'txt',
  31382. ), $options);
  31383. if (!isset($this->descriptors[$options['format']])) {
  31384. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  31385. }
  31386. $descriptor = $this->descriptors[$options['format']];
  31387. $descriptor->describe($output, $object, $options);
  31388. }
  31389. public function register($format, DescriptorInterface $descriptor)
  31390. {
  31391. $this->descriptors[$format] = $descriptor;
  31392. return $this;
  31393. }
  31394. public function getName()
  31395. {
  31396. return 'descriptor';
  31397. }
  31398. }
  31399. <?php
  31400. namespace Symfony\Component\Console\Helper;
  31401. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31402. use Symfony\Component\Console\Exception\RuntimeException;
  31403. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31404. use Symfony\Component\Console\Output\OutputInterface;
  31405. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  31406. class DialogHelper extends InputAwareHelper
  31407. {
  31408. private $inputStream;
  31409. private static $shell;
  31410. private static $stty;
  31411. public function __construct($triggerDeprecationError = true)
  31412. {
  31413. if ($triggerDeprecationError) {
  31414. @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);
  31415. }
  31416. }
  31417. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  31418. {
  31419. if ($output instanceof ConsoleOutputInterface) {
  31420. $output = $output->getErrorOutput();
  31421. }
  31422. $width = max(array_map('strlen', array_keys($choices)));
  31423. $messages = (array) $question;
  31424. foreach ($choices as $key => $value) {
  31425. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  31426. }
  31427. $output->writeln($messages);
  31428. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  31429. $selectedChoices = str_replace(' ', '', $picked);
  31430. if ($multiselect) {
  31431. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  31432. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  31433. }
  31434. $selectedChoices = explode(',', $selectedChoices);
  31435. } else {
  31436. $selectedChoices = array($picked);
  31437. }
  31438. $multiselectChoices = array();
  31439. foreach ($selectedChoices as $value) {
  31440. if (empty($choices[$value])) {
  31441. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  31442. }
  31443. $multiselectChoices[] = $value;
  31444. }
  31445. if ($multiselect) {
  31446. return $multiselectChoices;
  31447. }
  31448. return $picked;
  31449. }, $attempts, $default);
  31450. return $result;
  31451. }
  31452. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  31453. {
  31454. if ($this->input && !$this->input->isInteractive()) {
  31455. return $default;
  31456. }
  31457. if ($output instanceof ConsoleOutputInterface) {
  31458. $output = $output->getErrorOutput();
  31459. }
  31460. $output->write($question);
  31461. $inputStream = $this->inputStream ?: STDIN;
  31462. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  31463. $ret = fgets($inputStream, 4096);
  31464. if (false === $ret) {
  31465. throw new RuntimeException('Aborted');
  31466. }
  31467. $ret = trim($ret);
  31468. } else {
  31469. $ret = '';
  31470. $i = 0;
  31471. $ofs = -1;
  31472. $matches = $autocomplete;
  31473. $numMatches = count($matches);
  31474. $sttyMode = shell_exec('stty -g');
  31475. shell_exec('stty -icanon -echo');
  31476. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  31477. while (!feof($inputStream)) {
  31478. $c = fread($inputStream, 1);
  31479. if ("\177" === $c) {
  31480. if (0 === $numMatches && 0 !== $i) {
  31481. --$i;
  31482. $output->write("\033[1D");
  31483. }
  31484. if ($i === 0) {
  31485. $ofs = -1;
  31486. $matches = $autocomplete;
  31487. $numMatches = count($matches);
  31488. } else {
  31489. $numMatches = 0;
  31490. }
  31491. $ret = substr($ret, 0, $i);
  31492. } elseif ("\033" === $c) {
  31493. $c .= fread($inputStream, 2);
  31494. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  31495. if ('A' === $c[2] && -1 === $ofs) {
  31496. $ofs = 0;
  31497. }
  31498. if (0 === $numMatches) {
  31499. continue;
  31500. }
  31501. $ofs += ('A' === $c[2]) ? -1 : 1;
  31502. $ofs = ($numMatches + $ofs) % $numMatches;
  31503. }
  31504. } elseif (ord($c) < 32) {
  31505. if ("\t" === $c || "\n" === $c) {
  31506. if ($numMatches > 0 && -1 !== $ofs) {
  31507. $ret = $matches[$ofs];
  31508. $output->write(substr($ret, $i));
  31509. $i = strlen($ret);
  31510. }
  31511. if ("\n" === $c) {
  31512. $output->write($c);
  31513. break;
  31514. }
  31515. $numMatches = 0;
  31516. }
  31517. continue;
  31518. } else {
  31519. $output->write($c);
  31520. $ret .= $c;
  31521. ++$i;
  31522. $numMatches = 0;
  31523. $ofs = 0;
  31524. foreach ($autocomplete as $value) {
  31525. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  31526. $matches[$numMatches++] = $value;
  31527. }
  31528. }
  31529. }
  31530. $output->write("\033[K");
  31531. if ($numMatches > 0 && -1 !== $ofs) {
  31532. $output->write("\0337");
  31533. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  31534. $output->write("\0338");
  31535. }
  31536. }
  31537. shell_exec(sprintf('stty %s', $sttyMode));
  31538. }
  31539. return strlen($ret) > 0 ? $ret : $default;
  31540. }
  31541. public function askConfirmation(OutputInterface $output, $question, $default = true)
  31542. {
  31543. $answer = 'z';
  31544. while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
  31545. $answer = $this->ask($output, $question);
  31546. }
  31547. if (false === $default) {
  31548. return $answer && 'y' == strtolower($answer[0]);
  31549. }
  31550. return !$answer || 'y' == strtolower($answer[0]);
  31551. }
  31552. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  31553. {
  31554. if ($output instanceof ConsoleOutputInterface) {
  31555. $output = $output->getErrorOutput();
  31556. }
  31557. if ('\\' === DIRECTORY_SEPARATOR) {
  31558. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  31559. if ('phar:' === substr(__FILE__, 0, 5)) {
  31560. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  31561. copy($exe, $tmpExe);
  31562. $exe = $tmpExe;
  31563. }
  31564. $output->write($question);
  31565. $value = rtrim(shell_exec($exe));
  31566. $output->writeln('');
  31567. if (isset($tmpExe)) {
  31568. unlink($tmpExe);
  31569. }
  31570. return $value;
  31571. }
  31572. if ($this->hasSttyAvailable()) {
  31573. $output->write($question);
  31574. $sttyMode = shell_exec('stty -g');
  31575. shell_exec('stty -echo');
  31576. $value = fgets($this->inputStream ?: STDIN, 4096);
  31577. shell_exec(sprintf('stty %s', $sttyMode));
  31578. if (false === $value) {
  31579. throw new RuntimeException('Aborted');
  31580. }
  31581. $value = trim($value);
  31582. $output->writeln('');
  31583. return $value;
  31584. }
  31585. if (false !== $shell = $this->getShell()) {
  31586. $output->write($question);
  31587. $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword';
  31588. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  31589. $value = rtrim(shell_exec($command));
  31590. $output->writeln('');
  31591. return $value;
  31592. }
  31593. if ($fallback) {
  31594. return $this->ask($output, $question);
  31595. }
  31596. throw new RuntimeException('Unable to hide the response');
  31597. }
  31598. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  31599. {
  31600. $that = $this;
  31601. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  31602. return $that->ask($output, $question, $default, $autocomplete);
  31603. };
  31604. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  31605. }
  31606. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  31607. {
  31608. $that = $this;
  31609. $interviewer = function () use ($output, $question, $fallback, $that) {
  31610. return $that->askHiddenResponse($output, $question, $fallback);
  31611. };
  31612. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  31613. }
  31614. public function setInputStream($stream)
  31615. {
  31616. $this->inputStream = $stream;
  31617. }
  31618. public function getInputStream()
  31619. {
  31620. return $this->inputStream;
  31621. }
  31622. public function getName()
  31623. {
  31624. return 'dialog';
  31625. }
  31626. private function getShell()
  31627. {
  31628. if (null !== self::$shell) {
  31629. return self::$shell;
  31630. }
  31631. self::$shell = false;
  31632. if (file_exists('/usr/bin/env')) {
  31633. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  31634. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  31635. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  31636. self::$shell = $sh;
  31637. break;
  31638. }
  31639. }
  31640. }
  31641. return self::$shell;
  31642. }
  31643. private function hasSttyAvailable()
  31644. {
  31645. if (null !== self::$stty) {
  31646. return self::$stty;
  31647. }
  31648. exec('stty 2>&1', $output, $exitcode);
  31649. return self::$stty = $exitcode === 0;
  31650. }
  31651. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  31652. {
  31653. if ($output instanceof ConsoleOutputInterface) {
  31654. $output = $output->getErrorOutput();
  31655. }
  31656. $e = null;
  31657. while (false === $attempts || $attempts--) {
  31658. if (null !== $e) {
  31659. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  31660. }
  31661. try {
  31662. return call_user_func($validator, $interviewer());
  31663. } catch (\Exception $e) {
  31664. }
  31665. }
  31666. throw $e;
  31667. }
  31668. }
  31669. <?php
  31670. namespace Symfony\Component\Console\Helper;
  31671. use Symfony\Component\Console\Formatter\OutputFormatter;
  31672. class FormatterHelper extends Helper
  31673. {
  31674. public function formatSection($section, $message, $style = 'info')
  31675. {
  31676. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  31677. }
  31678. public function formatBlock($messages, $style, $large = false)
  31679. {
  31680. if (!is_array($messages)) {
  31681. $messages = array($messages);
  31682. }
  31683. $len = 0;
  31684. $lines = array();
  31685. foreach ($messages as $message) {
  31686. $message = OutputFormatter::escape($message);
  31687. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  31688. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  31689. }
  31690. $messages = $large ? array(str_repeat(' ', $len)) : array();
  31691. for ($i = 0; isset($lines[$i]); ++$i) {
  31692. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  31693. }
  31694. if ($large) {
  31695. $messages[] = str_repeat(' ', $len);
  31696. }
  31697. for ($i = 0; isset($messages[$i]); ++$i) {
  31698. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  31699. }
  31700. return implode("\n", $messages);
  31701. }
  31702. public function getName()
  31703. {
  31704. return 'formatter';
  31705. }
  31706. }
  31707. <?php
  31708. namespace Symfony\Component\Console\Helper;
  31709. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  31710. abstract class Helper implements HelperInterface
  31711. {
  31712. protected $helperSet = null;
  31713. public function setHelperSet(HelperSet $helperSet = null)
  31714. {
  31715. $this->helperSet = $helperSet;
  31716. }
  31717. public function getHelperSet()
  31718. {
  31719. return $this->helperSet;
  31720. }
  31721. public static function strlen($string)
  31722. {
  31723. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  31724. return strlen($string);
  31725. }
  31726. return mb_strwidth($string, $encoding);
  31727. }
  31728. public static function formatTime($secs)
  31729. {
  31730. static $timeFormats = array(
  31731. array(0, '< 1 sec'),
  31732. array(1, '1 sec'),
  31733. array(2, 'secs', 1),
  31734. array(60, '1 min'),
  31735. array(120, 'mins', 60),
  31736. array(3600, '1 hr'),
  31737. array(7200, 'hrs', 3600),
  31738. array(86400, '1 day'),
  31739. array(172800, 'days', 86400),
  31740. );
  31741. foreach ($timeFormats as $index => $format) {
  31742. if ($secs >= $format[0]) {
  31743. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  31744. || $index == count($timeFormats) - 1
  31745. ) {
  31746. if (2 == count($format)) {
  31747. return $format[1];
  31748. }
  31749. return floor($secs / $format[2]).' '.$format[1];
  31750. }
  31751. }
  31752. }
  31753. }
  31754. public static function formatMemory($memory)
  31755. {
  31756. if ($memory >= 1024 * 1024 * 1024) {
  31757. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  31758. }
  31759. if ($memory >= 1024 * 1024) {
  31760. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  31761. }
  31762. if ($memory >= 1024) {
  31763. return sprintf('%d KiB', $memory / 1024);
  31764. }
  31765. return sprintf('%d B', $memory);
  31766. }
  31767. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  31768. {
  31769. $isDecorated = $formatter->isDecorated();
  31770. $formatter->setDecorated(false);
  31771. $string = $formatter->format($string);
  31772. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  31773. $formatter->setDecorated($isDecorated);
  31774. return self::strlen($string);
  31775. }
  31776. }
  31777. <?php
  31778. namespace Symfony\Component\Console\Helper;
  31779. interface HelperInterface
  31780. {
  31781. public function setHelperSet(HelperSet $helperSet = null);
  31782. public function getHelperSet();
  31783. public function getName();
  31784. }
  31785. <?php
  31786. namespace Symfony\Component\Console\Helper;
  31787. use Symfony\Component\Console\Command\Command;
  31788. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31789. class HelperSet implements \IteratorAggregate
  31790. {
  31791. private $helpers = array();
  31792. private $command;
  31793. public function __construct(array $helpers = array())
  31794. {
  31795. foreach ($helpers as $alias => $helper) {
  31796. $this->set($helper, is_int($alias) ? null : $alias);
  31797. }
  31798. }
  31799. public function set(HelperInterface $helper, $alias = null)
  31800. {
  31801. $this->helpers[$helper->getName()] = $helper;
  31802. if (null !== $alias) {
  31803. $this->helpers[$alias] = $helper;
  31804. }
  31805. $helper->setHelperSet($this);
  31806. }
  31807. public function has($name)
  31808. {
  31809. return isset($this->helpers[$name]);
  31810. }
  31811. public function get($name)
  31812. {
  31813. if (!$this->has($name)) {
  31814. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  31815. }
  31816. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  31817. @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);
  31818. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  31819. @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);
  31820. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  31821. @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);
  31822. }
  31823. return $this->helpers[$name];
  31824. }
  31825. public function setCommand(Command $command = null)
  31826. {
  31827. $this->command = $command;
  31828. }
  31829. public function getCommand()
  31830. {
  31831. return $this->command;
  31832. }
  31833. public function getIterator()
  31834. {
  31835. return new \ArrayIterator($this->helpers);
  31836. }
  31837. }
  31838. <?php
  31839. namespace Symfony\Component\Console\Helper;
  31840. use Symfony\Component\Console\Input\InputInterface;
  31841. use Symfony\Component\Console\Input\InputAwareInterface;
  31842. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  31843. {
  31844. protected $input;
  31845. public function setInput(InputInterface $input)
  31846. {
  31847. $this->input = $input;
  31848. }
  31849. }
  31850. <?php
  31851. namespace Symfony\Component\Console\Helper;
  31852. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31853. use Symfony\Component\Console\Output\OutputInterface;
  31854. use Symfony\Component\Process\Exception\ProcessFailedException;
  31855. use Symfony\Component\Process\Process;
  31856. use Symfony\Component\Process\ProcessBuilder;
  31857. class ProcessHelper extends Helper
  31858. {
  31859. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  31860. {
  31861. if ($output instanceof ConsoleOutputInterface) {
  31862. $output = $output->getErrorOutput();
  31863. }
  31864. $formatter = $this->getHelperSet()->get('debug_formatter');
  31865. if (is_array($cmd)) {
  31866. $process = ProcessBuilder::create($cmd)->getProcess();
  31867. } elseif ($cmd instanceof Process) {
  31868. $process = $cmd;
  31869. } else {
  31870. $process = new Process($cmd);
  31871. }
  31872. if ($verbosity <= $output->getVerbosity()) {
  31873. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  31874. }
  31875. if ($output->isDebug()) {
  31876. $callback = $this->wrapCallback($output, $process, $callback);
  31877. }
  31878. $process->run($callback);
  31879. if ($verbosity <= $output->getVerbosity()) {
  31880. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  31881. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  31882. }
  31883. if (!$process->isSuccessful() && null !== $error) {
  31884. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  31885. }
  31886. return $process;
  31887. }
  31888. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  31889. {
  31890. $process = $this->run($output, $cmd, $error, $callback);
  31891. if (!$process->isSuccessful()) {
  31892. throw new ProcessFailedException($process);
  31893. }
  31894. return $process;
  31895. }
  31896. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  31897. {
  31898. if ($output instanceof ConsoleOutputInterface) {
  31899. $output = $output->getErrorOutput();
  31900. }
  31901. $formatter = $this->getHelperSet()->get('debug_formatter');
  31902. $that = $this;
  31903. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  31904. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  31905. if (null !== $callback) {
  31906. call_user_func($callback, $type, $buffer);
  31907. }
  31908. };
  31909. }
  31910. public function escapeString($str)
  31911. {
  31912. return str_replace('<', '\\<', $str);
  31913. }
  31914. public function getName()
  31915. {
  31916. return 'process';
  31917. }
  31918. }
  31919. <?php
  31920. namespace Symfony\Component\Console\Helper;
  31921. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31922. use Symfony\Component\Console\Output\OutputInterface;
  31923. use Symfony\Component\Console\Exception\LogicException;
  31924. class ProgressBar
  31925. {
  31926. private $barWidth = 28;
  31927. private $barChar;
  31928. private $emptyBarChar = '-';
  31929. private $progressChar = '>';
  31930. private $format;
  31931. private $internalFormat;
  31932. private $redrawFreq = 1;
  31933. private $output;
  31934. private $step = 0;
  31935. private $max;
  31936. private $startTime;
  31937. private $stepWidth;
  31938. private $percent = 0.0;
  31939. private $formatLineCount;
  31940. private $messages = array();
  31941. private $overwrite = true;
  31942. private $firstRun = true;
  31943. private static $formatters;
  31944. private static $formats;
  31945. public function __construct(OutputInterface $output, $max = 0)
  31946. {
  31947. if ($output instanceof ConsoleOutputInterface) {
  31948. $output = $output->getErrorOutput();
  31949. }
  31950. $this->output = $output;
  31951. $this->setMaxSteps($max);
  31952. if (!$this->output->isDecorated()) {
  31953. $this->overwrite = false;
  31954. $this->setRedrawFrequency($max / 10);
  31955. }
  31956. $this->startTime = time();
  31957. }
  31958. public static function setPlaceholderFormatterDefinition($name, $callable)
  31959. {
  31960. if (!self::$formatters) {
  31961. self::$formatters = self::initPlaceholderFormatters();
  31962. }
  31963. self::$formatters[$name] = $callable;
  31964. }
  31965. public static function getPlaceholderFormatterDefinition($name)
  31966. {
  31967. if (!self::$formatters) {
  31968. self::$formatters = self::initPlaceholderFormatters();
  31969. }
  31970. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  31971. }
  31972. public static function setFormatDefinition($name, $format)
  31973. {
  31974. if (!self::$formats) {
  31975. self::$formats = self::initFormats();
  31976. }
  31977. self::$formats[$name] = $format;
  31978. }
  31979. public static function getFormatDefinition($name)
  31980. {
  31981. if (!self::$formats) {
  31982. self::$formats = self::initFormats();
  31983. }
  31984. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  31985. }
  31986. public function setMessage($message, $name = 'message')
  31987. {
  31988. $this->messages[$name] = $message;
  31989. }
  31990. public function getMessage($name = 'message')
  31991. {
  31992. return $this->messages[$name];
  31993. }
  31994. public function getStartTime()
  31995. {
  31996. return $this->startTime;
  31997. }
  31998. public function getMaxSteps()
  31999. {
  32000. return $this->max;
  32001. }
  32002. public function getStep()
  32003. {
  32004. @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);
  32005. return $this->getProgress();
  32006. }
  32007. public function getProgress()
  32008. {
  32009. return $this->step;
  32010. }
  32011. public function getStepWidth()
  32012. {
  32013. return $this->stepWidth;
  32014. }
  32015. public function getProgressPercent()
  32016. {
  32017. return $this->percent;
  32018. }
  32019. public function setBarWidth($size)
  32020. {
  32021. $this->barWidth = (int) $size;
  32022. }
  32023. public function getBarWidth()
  32024. {
  32025. return $this->barWidth;
  32026. }
  32027. public function setBarCharacter($char)
  32028. {
  32029. $this->barChar = $char;
  32030. }
  32031. public function getBarCharacter()
  32032. {
  32033. if (null === $this->barChar) {
  32034. return $this->max ? '=' : $this->emptyBarChar;
  32035. }
  32036. return $this->barChar;
  32037. }
  32038. public function setEmptyBarCharacter($char)
  32039. {
  32040. $this->emptyBarChar = $char;
  32041. }
  32042. public function getEmptyBarCharacter()
  32043. {
  32044. return $this->emptyBarChar;
  32045. }
  32046. public function setProgressCharacter($char)
  32047. {
  32048. $this->progressChar = $char;
  32049. }
  32050. public function getProgressCharacter()
  32051. {
  32052. return $this->progressChar;
  32053. }
  32054. public function setFormat($format)
  32055. {
  32056. $this->format = null;
  32057. $this->internalFormat = $format;
  32058. }
  32059. public function setRedrawFrequency($freq)
  32060. {
  32061. $this->redrawFreq = max((int) $freq, 1);
  32062. }
  32063. public function start($max = null)
  32064. {
  32065. $this->startTime = time();
  32066. $this->step = 0;
  32067. $this->percent = 0.0;
  32068. if (null !== $max) {
  32069. $this->setMaxSteps($max);
  32070. }
  32071. $this->display();
  32072. }
  32073. public function advance($step = 1)
  32074. {
  32075. $this->setProgress($this->step + $step);
  32076. }
  32077. public function setCurrent($step)
  32078. {
  32079. @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);
  32080. $this->setProgress($step);
  32081. }
  32082. public function setOverwrite($overwrite)
  32083. {
  32084. $this->overwrite = (bool) $overwrite;
  32085. }
  32086. public function setProgress($step)
  32087. {
  32088. $step = (int) $step;
  32089. if ($step < $this->step) {
  32090. throw new LogicException('You can\'t regress the progress bar.');
  32091. }
  32092. if ($this->max && $step > $this->max) {
  32093. $this->max = $step;
  32094. }
  32095. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  32096. $currPeriod = (int) ($step / $this->redrawFreq);
  32097. $this->step = $step;
  32098. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  32099. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  32100. $this->display();
  32101. }
  32102. }
  32103. public function finish()
  32104. {
  32105. if (!$this->max) {
  32106. $this->max = $this->step;
  32107. }
  32108. if ($this->step === $this->max && !$this->overwrite) {
  32109. return;
  32110. }
  32111. $this->setProgress($this->max);
  32112. }
  32113. public function display()
  32114. {
  32115. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  32116. return;
  32117. }
  32118. if (null === $this->format) {
  32119. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  32120. }
  32121. $self = $this;
  32122. $output = $this->output;
  32123. $messages = $this->messages;
  32124. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  32125. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  32126. $text = call_user_func($formatter, $self, $output);
  32127. } elseif (isset($messages[$matches[1]])) {
  32128. $text = $messages[$matches[1]];
  32129. } else {
  32130. return $matches[0];
  32131. }
  32132. if (isset($matches[2])) {
  32133. $text = sprintf('%'.$matches[2], $text);
  32134. }
  32135. return $text;
  32136. }, $this->format));
  32137. }
  32138. public function clear()
  32139. {
  32140. if (!$this->overwrite) {
  32141. return;
  32142. }
  32143. if (null === $this->format) {
  32144. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  32145. }
  32146. $this->overwrite('');
  32147. }
  32148. private function setRealFormat($format)
  32149. {
  32150. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  32151. $this->format = self::getFormatDefinition($format.'_nomax');
  32152. } elseif (null !== self::getFormatDefinition($format)) {
  32153. $this->format = self::getFormatDefinition($format);
  32154. } else {
  32155. $this->format = $format;
  32156. }
  32157. $this->formatLineCount = substr_count($this->format, "\n");
  32158. }
  32159. private function setMaxSteps($max)
  32160. {
  32161. $this->max = max(0, (int) $max);
  32162. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  32163. }
  32164. private function overwrite($message)
  32165. {
  32166. if ($this->overwrite) {
  32167. if (!$this->firstRun) {
  32168. $this->output->write("\x0D");
  32169. $this->output->write("\x1B[2K");
  32170. if ($this->formatLineCount > 0) {
  32171. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  32172. }
  32173. }
  32174. } elseif ($this->step > 0) {
  32175. $this->output->writeln('');
  32176. }
  32177. $this->firstRun = false;
  32178. $this->output->write($message);
  32179. }
  32180. private function determineBestFormat()
  32181. {
  32182. switch ($this->output->getVerbosity()) {
  32183. case OutputInterface::VERBOSITY_VERBOSE:
  32184. return $this->max ? 'verbose' : 'verbose_nomax';
  32185. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  32186. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  32187. case OutputInterface::VERBOSITY_DEBUG:
  32188. return $this->max ? 'debug' : 'debug_nomax';
  32189. default:
  32190. return $this->max ? 'normal' : 'normal_nomax';
  32191. }
  32192. }
  32193. private static function initPlaceholderFormatters()
  32194. {
  32195. return array(
  32196. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  32197. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  32198. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  32199. if ($completeBars < $bar->getBarWidth()) {
  32200. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  32201. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  32202. }
  32203. return $display;
  32204. },
  32205. 'elapsed' => function (ProgressBar $bar) {
  32206. return Helper::formatTime(time() - $bar->getStartTime());
  32207. },
  32208. 'remaining' => function (ProgressBar $bar) {
  32209. if (!$bar->getMaxSteps()) {
  32210. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  32211. }
  32212. if (!$bar->getProgress()) {
  32213. $remaining = 0;
  32214. } else {
  32215. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  32216. }
  32217. return Helper::formatTime($remaining);
  32218. },
  32219. 'estimated' => function (ProgressBar $bar) {
  32220. if (!$bar->getMaxSteps()) {
  32221. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  32222. }
  32223. if (!$bar->getProgress()) {
  32224. $estimated = 0;
  32225. } else {
  32226. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  32227. }
  32228. return Helper::formatTime($estimated);
  32229. },
  32230. 'memory' => function (ProgressBar $bar) {
  32231. return Helper::formatMemory(memory_get_usage(true));
  32232. },
  32233. 'current' => function (ProgressBar $bar) {
  32234. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  32235. },
  32236. 'max' => function (ProgressBar $bar) {
  32237. return $bar->getMaxSteps();
  32238. },
  32239. 'percent' => function (ProgressBar $bar) {
  32240. return floor($bar->getProgressPercent() * 100);
  32241. },
  32242. );
  32243. }
  32244. private static function initFormats()
  32245. {
  32246. return array(
  32247. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  32248. 'normal_nomax' => ' %current% [%bar%]',
  32249. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  32250. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  32251. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  32252. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  32253. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  32254. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  32255. );
  32256. }
  32257. }
  32258. <?php
  32259. namespace Symfony\Component\Console\Helper;
  32260. use Symfony\Component\Console\Output\NullOutput;
  32261. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  32262. use Symfony\Component\Console\Output\OutputInterface;
  32263. use Symfony\Component\Console\Exception\LogicException;
  32264. class ProgressHelper extends Helper
  32265. {
  32266. const FORMAT_QUIET = ' %percent%%';
  32267. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  32268. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  32269. const FORMAT_QUIET_NOMAX = ' %current%';
  32270. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  32271. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  32272. private $barWidth = 28;
  32273. private $barChar = '=';
  32274. private $emptyBarChar = '-';
  32275. private $progressChar = '>';
  32276. private $format = null;
  32277. private $redrawFreq = 1;
  32278. private $lastMessagesLength;
  32279. private $barCharOriginal;
  32280. private $output;
  32281. private $current;
  32282. private $max;
  32283. private $startTime;
  32284. private $defaultFormatVars = array(
  32285. 'current',
  32286. 'max',
  32287. 'bar',
  32288. 'percent',
  32289. 'elapsed',
  32290. );
  32291. private $formatVars;
  32292. private $widths = array(
  32293. 'current' => 4,
  32294. 'max' => 4,
  32295. 'percent' => 3,
  32296. 'elapsed' => 6,
  32297. );
  32298. private $timeFormats = array(
  32299. array(0, '???'),
  32300. array(2, '1 sec'),
  32301. array(59, 'secs', 1),
  32302. array(60, '1 min'),
  32303. array(3600, 'mins', 60),
  32304. array(5400, '1 hr'),
  32305. array(86400, 'hrs', 3600),
  32306. array(129600, '1 day'),
  32307. array(604800, 'days', 86400),
  32308. );
  32309. public function __construct($triggerDeprecationError = true)
  32310. {
  32311. if ($triggerDeprecationError) {
  32312. @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);
  32313. }
  32314. }
  32315. public function setBarWidth($size)
  32316. {
  32317. $this->barWidth = (int) $size;
  32318. }
  32319. public function setBarCharacter($char)
  32320. {
  32321. $this->barChar = $char;
  32322. }
  32323. public function setEmptyBarCharacter($char)
  32324. {
  32325. $this->emptyBarChar = $char;
  32326. }
  32327. public function setProgressCharacter($char)
  32328. {
  32329. $this->progressChar = $char;
  32330. }
  32331. public function setFormat($format)
  32332. {
  32333. $this->format = $format;
  32334. }
  32335. public function setRedrawFrequency($freq)
  32336. {
  32337. $this->redrawFreq = (int) $freq;
  32338. }
  32339. public function start(OutputInterface $output, $max = null)
  32340. {
  32341. if ($output instanceof ConsoleOutputInterface) {
  32342. $output = $output->getErrorOutput();
  32343. }
  32344. $this->startTime = time();
  32345. $this->current = 0;
  32346. $this->max = (int) $max;
  32347. $this->output = $output->isDecorated() ? $output : new NullOutput();
  32348. $this->lastMessagesLength = 0;
  32349. $this->barCharOriginal = '';
  32350. if (null === $this->format) {
  32351. switch ($output->getVerbosity()) {
  32352. case OutputInterface::VERBOSITY_QUIET:
  32353. $this->format = self::FORMAT_QUIET_NOMAX;
  32354. if ($this->max > 0) {
  32355. $this->format = self::FORMAT_QUIET;
  32356. }
  32357. break;
  32358. case OutputInterface::VERBOSITY_VERBOSE:
  32359. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  32360. case OutputInterface::VERBOSITY_DEBUG:
  32361. $this->format = self::FORMAT_VERBOSE_NOMAX;
  32362. if ($this->max > 0) {
  32363. $this->format = self::FORMAT_VERBOSE;
  32364. }
  32365. break;
  32366. default:
  32367. $this->format = self::FORMAT_NORMAL_NOMAX;
  32368. if ($this->max > 0) {
  32369. $this->format = self::FORMAT_NORMAL;
  32370. }
  32371. break;
  32372. }
  32373. }
  32374. $this->initialize();
  32375. }
  32376. public function advance($step = 1, $redraw = false)
  32377. {
  32378. $this->setCurrent($this->current + $step, $redraw);
  32379. }
  32380. public function setCurrent($current, $redraw = false)
  32381. {
  32382. if (null === $this->startTime) {
  32383. throw new LogicException('You must start the progress bar before calling setCurrent().');
  32384. }
  32385. $current = (int) $current;
  32386. if ($current < $this->current) {
  32387. throw new LogicException('You can\'t regress the progress bar');
  32388. }
  32389. if (0 === $this->current) {
  32390. $redraw = true;
  32391. }
  32392. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  32393. $this->current = $current;
  32394. $currPeriod = (int) ($this->current / $this->redrawFreq);
  32395. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  32396. $this->display();
  32397. }
  32398. }
  32399. public function display($finish = false)
  32400. {
  32401. if (null === $this->startTime) {
  32402. throw new LogicException('You must start the progress bar before calling display().');
  32403. }
  32404. $message = $this->format;
  32405. foreach ($this->generate($finish) as $name => $value) {
  32406. $message = str_replace("%{$name}%", $value, $message);
  32407. }
  32408. $this->overwrite($this->output, $message);
  32409. }
  32410. public function clear()
  32411. {
  32412. $this->overwrite($this->output, '');
  32413. }
  32414. public function finish()
  32415. {
  32416. if (null === $this->startTime) {
  32417. throw new LogicException('You must start the progress bar before calling finish().');
  32418. }
  32419. if (null !== $this->startTime) {
  32420. if (!$this->max) {
  32421. $this->barChar = $this->barCharOriginal;
  32422. $this->display(true);
  32423. }
  32424. $this->startTime = null;
  32425. $this->output->writeln('');
  32426. $this->output = null;
  32427. }
  32428. }
  32429. private function initialize()
  32430. {
  32431. $this->formatVars = array();
  32432. foreach ($this->defaultFormatVars as $var) {
  32433. if (false !== strpos($this->format, "%{$var}%")) {
  32434. $this->formatVars[$var] = true;
  32435. }
  32436. }
  32437. if ($this->max > 0) {
  32438. $this->widths['max'] = $this->strlen($this->max);
  32439. $this->widths['current'] = $this->widths['max'];
  32440. } else {
  32441. $this->barCharOriginal = $this->barChar;
  32442. $this->barChar = $this->emptyBarChar;
  32443. }
  32444. }
  32445. private function generate($finish = false)
  32446. {
  32447. $vars = array();
  32448. $percent = 0;
  32449. if ($this->max > 0) {
  32450. $percent = (float) $this->current / $this->max;
  32451. }
  32452. if (isset($this->formatVars['bar'])) {
  32453. if ($this->max > 0) {
  32454. $completeBars = floor($percent * $this->barWidth);
  32455. } else {
  32456. if (!$finish) {
  32457. $completeBars = floor($this->current % $this->barWidth);
  32458. } else {
  32459. $completeBars = $this->barWidth;
  32460. }
  32461. }
  32462. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  32463. $bar = str_repeat($this->barChar, $completeBars);
  32464. if ($completeBars < $this->barWidth) {
  32465. $bar .= $this->progressChar;
  32466. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  32467. }
  32468. $vars['bar'] = $bar;
  32469. }
  32470. if (isset($this->formatVars['elapsed'])) {
  32471. $elapsed = time() - $this->startTime;
  32472. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  32473. }
  32474. if (isset($this->formatVars['current'])) {
  32475. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  32476. }
  32477. if (isset($this->formatVars['max'])) {
  32478. $vars['max'] = $this->max;
  32479. }
  32480. if (isset($this->formatVars['percent'])) {
  32481. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  32482. }
  32483. return $vars;
  32484. }
  32485. private function humaneTime($secs)
  32486. {
  32487. $text = '';
  32488. foreach ($this->timeFormats as $format) {
  32489. if ($secs < $format[0]) {
  32490. if (count($format) == 2) {
  32491. $text = $format[1];
  32492. break;
  32493. } else {
  32494. $text = ceil($secs / $format[2]).' '.$format[1];
  32495. break;
  32496. }
  32497. }
  32498. }
  32499. return $text;
  32500. }
  32501. private function overwrite(OutputInterface $output, $message)
  32502. {
  32503. $length = $this->strlen($message);
  32504. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  32505. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  32506. }
  32507. $output->write("\x0D");
  32508. $output->write($message);
  32509. $this->lastMessagesLength = $this->strlen($message);
  32510. }
  32511. public function getName()
  32512. {
  32513. return 'progress';
  32514. }
  32515. }
  32516. <?php
  32517. namespace Symfony\Component\Console\Helper;
  32518. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32519. use Symfony\Component\Console\Exception\LogicException;
  32520. use Symfony\Component\Console\Output\OutputInterface;
  32521. class ProgressIndicator
  32522. {
  32523. private $output;
  32524. private $startTime;
  32525. private $format;
  32526. private $message;
  32527. private $indicatorValues;
  32528. private $indicatorCurrent;
  32529. private $indicatorChangeInterval;
  32530. private $indicatorUpdateTime;
  32531. private $started = false;
  32532. private static $formatters;
  32533. private static $formats;
  32534. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  32535. {
  32536. $this->output = $output;
  32537. if (null === $format) {
  32538. $format = $this->determineBestFormat();
  32539. }
  32540. if (null === $indicatorValues) {
  32541. $indicatorValues = array('-', '\\', '|', '/');
  32542. }
  32543. $indicatorValues = array_values($indicatorValues);
  32544. if (2 > count($indicatorValues)) {
  32545. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  32546. }
  32547. $this->format = self::getFormatDefinition($format);
  32548. $this->indicatorChangeInterval = $indicatorChangeInterval;
  32549. $this->indicatorValues = $indicatorValues;
  32550. $this->startTime = time();
  32551. }
  32552. public function setMessage($message)
  32553. {
  32554. $this->message = $message;
  32555. $this->display();
  32556. }
  32557. public function getMessage()
  32558. {
  32559. return $this->message;
  32560. }
  32561. public function getStartTime()
  32562. {
  32563. return $this->startTime;
  32564. }
  32565. public function getCurrentValue()
  32566. {
  32567. return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)];
  32568. }
  32569. public function start($message)
  32570. {
  32571. if ($this->started) {
  32572. throw new LogicException('Progress indicator already started.');
  32573. }
  32574. $this->message = $message;
  32575. $this->started = true;
  32576. $this->startTime = time();
  32577. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  32578. $this->indicatorCurrent = 0;
  32579. $this->display();
  32580. }
  32581. public function advance()
  32582. {
  32583. if (!$this->started) {
  32584. throw new LogicException('Progress indicator has not yet been started.');
  32585. }
  32586. if (!$this->output->isDecorated()) {
  32587. return;
  32588. }
  32589. $currentTime = $this->getCurrentTimeInMilliseconds();
  32590. if ($currentTime < $this->indicatorUpdateTime) {
  32591. return;
  32592. }
  32593. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  32594. ++$this->indicatorCurrent;
  32595. $this->display();
  32596. }
  32597. public function finish($message)
  32598. {
  32599. if (!$this->started) {
  32600. throw new LogicException('Progress indicator has not yet been started.');
  32601. }
  32602. $this->message = $message;
  32603. $this->display();
  32604. $this->output->writeln('');
  32605. $this->started = false;
  32606. }
  32607. public static function getFormatDefinition($name)
  32608. {
  32609. if (!self::$formats) {
  32610. self::$formats = self::initFormats();
  32611. }
  32612. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  32613. }
  32614. public static function setPlaceholderFormatterDefinition($name, $callable)
  32615. {
  32616. if (!self::$formatters) {
  32617. self::$formatters = self::initPlaceholderFormatters();
  32618. }
  32619. self::$formatters[$name] = $callable;
  32620. }
  32621. public static function getPlaceholderFormatterDefinition($name)
  32622. {
  32623. if (!self::$formatters) {
  32624. self::$formatters = self::initPlaceholderFormatters();
  32625. }
  32626. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  32627. }
  32628. private function display()
  32629. {
  32630. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  32631. return;
  32632. }
  32633. $self = $this;
  32634. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  32635. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  32636. return call_user_func($formatter, $self);
  32637. }
  32638. return $matches[0];
  32639. }, $this->format));
  32640. }
  32641. private function determineBestFormat()
  32642. {
  32643. switch ($this->output->getVerbosity()) {
  32644. case OutputInterface::VERBOSITY_VERBOSE:
  32645. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  32646. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  32647. case OutputInterface::VERBOSITY_DEBUG:
  32648. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  32649. default:
  32650. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  32651. }
  32652. }
  32653. private function overwrite($message)
  32654. {
  32655. if ($this->output->isDecorated()) {
  32656. $this->output->write("\x0D\x1B[2K");
  32657. $this->output->write($message);
  32658. } else {
  32659. $this->output->writeln($message);
  32660. }
  32661. }
  32662. private function getCurrentTimeInMilliseconds()
  32663. {
  32664. return round(microtime(true) * 1000);
  32665. }
  32666. private static function initPlaceholderFormatters()
  32667. {
  32668. return array(
  32669. 'indicator' => function (ProgressIndicator $indicator) {
  32670. return $indicator->getCurrentValue();
  32671. },
  32672. 'message' => function (ProgressIndicator $indicator) {
  32673. return $indicator->getMessage();
  32674. },
  32675. 'elapsed' => function (ProgressIndicator $indicator) {
  32676. return Helper::formatTime(time() - $indicator->getStartTime());
  32677. },
  32678. 'memory' => function () {
  32679. return Helper::formatMemory(memory_get_usage(true));
  32680. },
  32681. );
  32682. }
  32683. private static function initFormats()
  32684. {
  32685. return array(
  32686. 'normal' => ' %indicator% %message%',
  32687. 'normal_no_ansi' => ' %message%',
  32688. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  32689. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  32690. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  32691. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  32692. );
  32693. }
  32694. }
  32695. <?php
  32696. namespace Symfony\Component\Console\Helper;
  32697. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32698. use Symfony\Component\Console\Exception\RuntimeException;
  32699. use Symfony\Component\Console\Input\InputInterface;
  32700. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  32701. use Symfony\Component\Console\Output\OutputInterface;
  32702. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  32703. use Symfony\Component\Console\Question\Question;
  32704. use Symfony\Component\Console\Question\ChoiceQuestion;
  32705. class QuestionHelper extends Helper
  32706. {
  32707. private $inputStream;
  32708. private static $shell;
  32709. private static $stty;
  32710. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  32711. {
  32712. if ($output instanceof ConsoleOutputInterface) {
  32713. $output = $output->getErrorOutput();
  32714. }
  32715. if (!$input->isInteractive()) {
  32716. return $question->getDefault();
  32717. }
  32718. if (!$question->getValidator()) {
  32719. return $this->doAsk($output, $question);
  32720. }
  32721. $that = $this;
  32722. $interviewer = function () use ($output, $question, $that) {
  32723. return $that->doAsk($output, $question);
  32724. };
  32725. return $this->validateAttempts($interviewer, $output, $question);
  32726. }
  32727. public function setInputStream($stream)
  32728. {
  32729. if (!is_resource($stream)) {
  32730. throw new InvalidArgumentException('Input stream must be a valid resource.');
  32731. }
  32732. $this->inputStream = $stream;
  32733. }
  32734. public function getInputStream()
  32735. {
  32736. return $this->inputStream;
  32737. }
  32738. public function getName()
  32739. {
  32740. return 'question';
  32741. }
  32742. public function doAsk(OutputInterface $output, Question $question)
  32743. {
  32744. $this->writePrompt($output, $question);
  32745. $inputStream = $this->inputStream ?: STDIN;
  32746. $autocomplete = $question->getAutocompleterValues();
  32747. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  32748. $ret = false;
  32749. if ($question->isHidden()) {
  32750. try {
  32751. $ret = trim($this->getHiddenResponse($output, $inputStream));
  32752. } catch (\RuntimeException $e) {
  32753. if (!$question->isHiddenFallback()) {
  32754. throw $e;
  32755. }
  32756. }
  32757. }
  32758. if (false === $ret) {
  32759. $ret = fgets($inputStream, 4096);
  32760. if (false === $ret) {
  32761. throw new RuntimeException('Aborted');
  32762. }
  32763. $ret = trim($ret);
  32764. }
  32765. } else {
  32766. $ret = trim($this->autocomplete($output, $question, $inputStream));
  32767. }
  32768. $ret = strlen($ret) > 0 ? $ret : $question->getDefault();
  32769. if ($normalizer = $question->getNormalizer()) {
  32770. return $normalizer($ret);
  32771. }
  32772. return $ret;
  32773. }
  32774. protected function writePrompt(OutputInterface $output, Question $question)
  32775. {
  32776. $message = $question->getQuestion();
  32777. if ($question instanceof ChoiceQuestion) {
  32778. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  32779. $messages = (array) $question->getQuestion();
  32780. foreach ($question->getChoices() as $key => $value) {
  32781. $width = $maxWidth - $this->strlen($key);
  32782. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  32783. }
  32784. $output->writeln($messages);
  32785. $message = $question->getPrompt();
  32786. }
  32787. $output->write($message);
  32788. }
  32789. protected function writeError(OutputInterface $output, \Exception $error)
  32790. {
  32791. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  32792. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  32793. } else {
  32794. $message = '<error>'.$error->getMessage().'</error>';
  32795. }
  32796. $output->writeln($message);
  32797. }
  32798. private function autocomplete(OutputInterface $output, Question $question, $inputStream)
  32799. {
  32800. $autocomplete = $question->getAutocompleterValues();
  32801. $ret = '';
  32802. $i = 0;
  32803. $ofs = -1;
  32804. $matches = $autocomplete;
  32805. $numMatches = count($matches);
  32806. $sttyMode = shell_exec('stty -g');
  32807. shell_exec('stty -icanon -echo');
  32808. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  32809. while (!feof($inputStream)) {
  32810. $c = fread($inputStream, 1);
  32811. if ("\177" === $c) {
  32812. if (0 === $numMatches && 0 !== $i) {
  32813. --$i;
  32814. $output->write("\033[1D");
  32815. }
  32816. if ($i === 0) {
  32817. $ofs = -1;
  32818. $matches = $autocomplete;
  32819. $numMatches = count($matches);
  32820. } else {
  32821. $numMatches = 0;
  32822. }
  32823. $ret = substr($ret, 0, $i);
  32824. } elseif ("\033" === $c) {
  32825. $c .= fread($inputStream, 2);
  32826. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  32827. if ('A' === $c[2] && -1 === $ofs) {
  32828. $ofs = 0;
  32829. }
  32830. if (0 === $numMatches) {
  32831. continue;
  32832. }
  32833. $ofs += ('A' === $c[2]) ? -1 : 1;
  32834. $ofs = ($numMatches + $ofs) % $numMatches;
  32835. }
  32836. } elseif (ord($c) < 32) {
  32837. if ("\t" === $c || "\n" === $c) {
  32838. if ($numMatches > 0 && -1 !== $ofs) {
  32839. $ret = $matches[$ofs];
  32840. $output->write(substr($ret, $i));
  32841. $i = strlen($ret);
  32842. }
  32843. if ("\n" === $c) {
  32844. $output->write($c);
  32845. break;
  32846. }
  32847. $numMatches = 0;
  32848. }
  32849. continue;
  32850. } else {
  32851. $output->write($c);
  32852. $ret .= $c;
  32853. ++$i;
  32854. $numMatches = 0;
  32855. $ofs = 0;
  32856. foreach ($autocomplete as $value) {
  32857. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  32858. $matches[$numMatches++] = $value;
  32859. }
  32860. }
  32861. }
  32862. $output->write("\033[K");
  32863. if ($numMatches > 0 && -1 !== $ofs) {
  32864. $output->write("\0337");
  32865. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  32866. $output->write("\0338");
  32867. }
  32868. }
  32869. shell_exec(sprintf('stty %s', $sttyMode));
  32870. return $ret;
  32871. }
  32872. private function getHiddenResponse(OutputInterface $output, $inputStream)
  32873. {
  32874. if ('\\' === DIRECTORY_SEPARATOR) {
  32875. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  32876. if ('phar:' === substr(__FILE__, 0, 5)) {
  32877. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  32878. copy($exe, $tmpExe);
  32879. $exe = $tmpExe;
  32880. }
  32881. $value = rtrim(shell_exec($exe));
  32882. $output->writeln('');
  32883. if (isset($tmpExe)) {
  32884. unlink($tmpExe);
  32885. }
  32886. return $value;
  32887. }
  32888. if ($this->hasSttyAvailable()) {
  32889. $sttyMode = shell_exec('stty -g');
  32890. shell_exec('stty -echo');
  32891. $value = fgets($inputStream, 4096);
  32892. shell_exec(sprintf('stty %s', $sttyMode));
  32893. if (false === $value) {
  32894. throw new RuntimeException('Aborted');
  32895. }
  32896. $value = trim($value);
  32897. $output->writeln('');
  32898. return $value;
  32899. }
  32900. if (false !== $shell = $this->getShell()) {
  32901. $readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword';
  32902. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  32903. $value = rtrim(shell_exec($command));
  32904. $output->writeln('');
  32905. return $value;
  32906. }
  32907. throw new RuntimeException('Unable to hide the response.');
  32908. }
  32909. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  32910. {
  32911. $error = null;
  32912. $attempts = $question->getMaxAttempts();
  32913. while (null === $attempts || $attempts--) {
  32914. if (null !== $error) {
  32915. $this->writeError($output, $error);
  32916. }
  32917. try {
  32918. return call_user_func($question->getValidator(), $interviewer());
  32919. } catch (RuntimeException $e) {
  32920. throw $e;
  32921. } catch (\Exception $error) {
  32922. }
  32923. }
  32924. throw $error;
  32925. }
  32926. private function getShell()
  32927. {
  32928. if (null !== self::$shell) {
  32929. return self::$shell;
  32930. }
  32931. self::$shell = false;
  32932. if (file_exists('/usr/bin/env')) {
  32933. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  32934. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  32935. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  32936. self::$shell = $sh;
  32937. break;
  32938. }
  32939. }
  32940. }
  32941. return self::$shell;
  32942. }
  32943. private function hasSttyAvailable()
  32944. {
  32945. if (null !== self::$stty) {
  32946. return self::$stty;
  32947. }
  32948. exec('stty 2>&1', $output, $exitcode);
  32949. return self::$stty = $exitcode === 0;
  32950. }
  32951. }
  32952. <?php
  32953. namespace Symfony\Component\Console\Helper;
  32954. use Symfony\Component\Console\Exception\LogicException;
  32955. use Symfony\Component\Console\Input\InputInterface;
  32956. use Symfony\Component\Console\Output\OutputInterface;
  32957. use Symfony\Component\Console\Question\ChoiceQuestion;
  32958. use Symfony\Component\Console\Question\ConfirmationQuestion;
  32959. use Symfony\Component\Console\Question\Question;
  32960. use Symfony\Component\Console\Style\SymfonyStyle;
  32961. use Symfony\Component\Console\Formatter\OutputFormatter;
  32962. class SymfonyQuestionHelper extends QuestionHelper
  32963. {
  32964. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  32965. {
  32966. $validator = $question->getValidator();
  32967. $question->setValidator(function ($value) use ($validator) {
  32968. if (null !== $validator) {
  32969. $value = $validator($value);
  32970. } else {
  32971. if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
  32972. throw new LogicException('A value is required.');
  32973. }
  32974. }
  32975. return $value;
  32976. });
  32977. return parent::ask($input, $output, $question);
  32978. }
  32979. protected function writePrompt(OutputInterface $output, Question $question)
  32980. {
  32981. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  32982. $default = $question->getDefault();
  32983. switch (true) {
  32984. case null === $default:
  32985. $text = sprintf(' <info>%s</info>:', $text);
  32986. break;
  32987. case $question instanceof ConfirmationQuestion:
  32988. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  32989. break;
  32990. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  32991. $choices = $question->getChoices();
  32992. $default = explode(',', $default);
  32993. foreach ($default as $key => $value) {
  32994. $default[$key] = $choices[trim($value)];
  32995. }
  32996. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  32997. break;
  32998. case $question instanceof ChoiceQuestion:
  32999. $choices = $question->getChoices();
  33000. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default]));
  33001. break;
  33002. default:
  33003. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  33004. }
  33005. $output->writeln($text);
  33006. if ($question instanceof ChoiceQuestion) {
  33007. $width = max(array_map('strlen', array_keys($question->getChoices())));
  33008. foreach ($question->getChoices() as $key => $value) {
  33009. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  33010. }
  33011. }
  33012. $output->write(' > ');
  33013. }
  33014. protected function writeError(OutputInterface $output, \Exception $error)
  33015. {
  33016. if ($output instanceof SymfonyStyle) {
  33017. $output->newLine();
  33018. $output->error($error->getMessage());
  33019. return;
  33020. }
  33021. parent::writeError($output, $error);
  33022. }
  33023. }
  33024. <?php
  33025. namespace Symfony\Component\Console\Helper;
  33026. use Symfony\Component\Console\Output\OutputInterface;
  33027. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33028. class Table
  33029. {
  33030. private $headers = array();
  33031. private $rows = array();
  33032. private $columnWidths = array();
  33033. private $numberOfColumns;
  33034. private $output;
  33035. private $style;
  33036. private $columnStyles = array();
  33037. private static $styles;
  33038. public function __construct(OutputInterface $output)
  33039. {
  33040. $this->output = $output;
  33041. if (!self::$styles) {
  33042. self::$styles = self::initStyles();
  33043. }
  33044. $this->setStyle('default');
  33045. }
  33046. public static function setStyleDefinition($name, TableStyle $style)
  33047. {
  33048. if (!self::$styles) {
  33049. self::$styles = self::initStyles();
  33050. }
  33051. self::$styles[$name] = $style;
  33052. }
  33053. public static function getStyleDefinition($name)
  33054. {
  33055. if (!self::$styles) {
  33056. self::$styles = self::initStyles();
  33057. }
  33058. if (isset(self::$styles[$name])) {
  33059. return self::$styles[$name];
  33060. }
  33061. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  33062. }
  33063. public function setStyle($name)
  33064. {
  33065. $this->style = $this->resolveStyle($name);
  33066. return $this;
  33067. }
  33068. public function getStyle()
  33069. {
  33070. return $this->style;
  33071. }
  33072. public function setColumnStyle($columnIndex, $name)
  33073. {
  33074. $columnIndex = intval($columnIndex);
  33075. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  33076. return $this;
  33077. }
  33078. public function getColumnStyle($columnIndex)
  33079. {
  33080. if (isset($this->columnStyles[$columnIndex])) {
  33081. return $this->columnStyles[$columnIndex];
  33082. }
  33083. return $this->getStyle();
  33084. }
  33085. public function setHeaders(array $headers)
  33086. {
  33087. $headers = array_values($headers);
  33088. if (!empty($headers) && !is_array($headers[0])) {
  33089. $headers = array($headers);
  33090. }
  33091. $this->headers = $headers;
  33092. return $this;
  33093. }
  33094. public function setRows(array $rows)
  33095. {
  33096. $this->rows = array();
  33097. return $this->addRows($rows);
  33098. }
  33099. public function addRows(array $rows)
  33100. {
  33101. foreach ($rows as $row) {
  33102. $this->addRow($row);
  33103. }
  33104. return $this;
  33105. }
  33106. public function addRow($row)
  33107. {
  33108. if ($row instanceof TableSeparator) {
  33109. $this->rows[] = $row;
  33110. return $this;
  33111. }
  33112. if (!is_array($row)) {
  33113. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  33114. }
  33115. $this->rows[] = array_values($row);
  33116. return $this;
  33117. }
  33118. public function setRow($column, array $row)
  33119. {
  33120. $this->rows[$column] = $row;
  33121. return $this;
  33122. }
  33123. public function render()
  33124. {
  33125. $this->calculateNumberOfColumns();
  33126. $rows = $this->buildTableRows($this->rows);
  33127. $headers = $this->buildTableRows($this->headers);
  33128. $this->calculateColumnsWidth(array_merge($headers, $rows));
  33129. $this->renderRowSeparator();
  33130. if (!empty($headers)) {
  33131. foreach ($headers as $header) {
  33132. $this->renderRow($header, $this->style->getCellHeaderFormat());
  33133. $this->renderRowSeparator();
  33134. }
  33135. }
  33136. foreach ($rows as $row) {
  33137. if ($row instanceof TableSeparator) {
  33138. $this->renderRowSeparator();
  33139. } else {
  33140. $this->renderRow($row, $this->style->getCellRowFormat());
  33141. }
  33142. }
  33143. if (!empty($rows)) {
  33144. $this->renderRowSeparator();
  33145. }
  33146. $this->cleanup();
  33147. }
  33148. private function renderRowSeparator()
  33149. {
  33150. if (0 === $count = $this->numberOfColumns) {
  33151. return;
  33152. }
  33153. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  33154. return;
  33155. }
  33156. $markup = $this->style->getCrossingChar();
  33157. for ($column = 0; $column < $count; ++$column) {
  33158. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  33159. }
  33160. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  33161. }
  33162. private function renderColumnSeparator()
  33163. {
  33164. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  33165. }
  33166. private function renderRow(array $row, $cellFormat)
  33167. {
  33168. if (empty($row)) {
  33169. return;
  33170. }
  33171. $rowContent = $this->renderColumnSeparator();
  33172. foreach ($this->getRowColumns($row) as $column) {
  33173. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  33174. $rowContent .= $this->renderColumnSeparator();
  33175. }
  33176. $this->output->writeln($rowContent);
  33177. }
  33178. private function renderCell(array $row, $column, $cellFormat)
  33179. {
  33180. $cell = isset($row[$column]) ? $row[$column] : '';
  33181. $width = $this->columnWidths[$column];
  33182. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  33183. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  33184. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  33185. }
  33186. }
  33187. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  33188. $width += strlen($cell) - mb_strwidth($cell, $encoding);
  33189. }
  33190. $style = $this->getColumnStyle($column);
  33191. if ($cell instanceof TableSeparator) {
  33192. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  33193. }
  33194. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  33195. $content = sprintf($style->getCellRowContentFormat(), $cell);
  33196. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  33197. }
  33198. private function calculateNumberOfColumns()
  33199. {
  33200. if (null !== $this->numberOfColumns) {
  33201. return;
  33202. }
  33203. $columns = array(0);
  33204. foreach (array_merge($this->headers, $this->rows) as $row) {
  33205. if ($row instanceof TableSeparator) {
  33206. continue;
  33207. }
  33208. $columns[] = $this->getNumberOfColumns($row);
  33209. }
  33210. $this->numberOfColumns = max($columns);
  33211. }
  33212. private function buildTableRows($rows)
  33213. {
  33214. $unmergedRows = array();
  33215. for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) {
  33216. $rows = $this->fillNextRows($rows, $rowKey);
  33217. foreach ($rows[$rowKey] as $column => $cell) {
  33218. if (!strstr($cell, "\n")) {
  33219. continue;
  33220. }
  33221. $lines = explode("\n", $cell);
  33222. foreach ($lines as $lineKey => $line) {
  33223. if ($cell instanceof TableCell) {
  33224. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  33225. }
  33226. if (0 === $lineKey) {
  33227. $rows[$rowKey][$column] = $line;
  33228. } else {
  33229. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  33230. }
  33231. }
  33232. }
  33233. }
  33234. $tableRows = array();
  33235. foreach ($rows as $rowKey => $row) {
  33236. $tableRows[] = $this->fillCells($row);
  33237. if (isset($unmergedRows[$rowKey])) {
  33238. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  33239. }
  33240. }
  33241. return $tableRows;
  33242. }
  33243. private function fillNextRows($rows, $line)
  33244. {
  33245. $unmergedRows = array();
  33246. foreach ($rows[$line] as $column => $cell) {
  33247. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  33248. $nbLines = $cell->getRowspan() - 1;
  33249. $lines = array($cell);
  33250. if (strstr($cell, "\n")) {
  33251. $lines = explode("\n", $cell);
  33252. $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  33253. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  33254. unset($lines[0]);
  33255. }
  33256. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  33257. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  33258. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  33259. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  33260. if ($nbLines === $unmergedRowKey - $line) {
  33261. break;
  33262. }
  33263. }
  33264. }
  33265. }
  33266. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  33267. if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  33268. foreach ($unmergedRow as $cellKey => $cell) {
  33269. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  33270. }
  33271. } else {
  33272. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  33273. foreach ($unmergedRow as $column => $cell) {
  33274. if (!empty($cell)) {
  33275. $row[$column] = $unmergedRow[$column];
  33276. }
  33277. }
  33278. array_splice($rows, $unmergedRowKey, 0, array($row));
  33279. }
  33280. }
  33281. return $rows;
  33282. }
  33283. private function fillCells($row)
  33284. {
  33285. $newRow = array();
  33286. foreach ($row as $column => $cell) {
  33287. $newRow[] = $cell;
  33288. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  33289. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  33290. $newRow[] = '';
  33291. }
  33292. }
  33293. }
  33294. return $newRow ?: $row;
  33295. }
  33296. private function copyRow($rows, $line)
  33297. {
  33298. $row = $rows[$line];
  33299. foreach ($row as $cellKey => $cellValue) {
  33300. $row[$cellKey] = '';
  33301. if ($cellValue instanceof TableCell) {
  33302. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  33303. }
  33304. }
  33305. return $row;
  33306. }
  33307. private function getNumberOfColumns(array $row)
  33308. {
  33309. $columns = count($row);
  33310. foreach ($row as $column) {
  33311. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  33312. }
  33313. return $columns;
  33314. }
  33315. private function getRowColumns($row)
  33316. {
  33317. $columns = range(0, $this->numberOfColumns - 1);
  33318. foreach ($row as $cellKey => $cell) {
  33319. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  33320. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  33321. }
  33322. }
  33323. return $columns;
  33324. }
  33325. private function calculateColumnsWidth($rows)
  33326. {
  33327. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  33328. $lengths = array();
  33329. foreach ($rows as $row) {
  33330. if ($row instanceof TableSeparator) {
  33331. continue;
  33332. }
  33333. foreach ($row as $i => $cell) {
  33334. if ($cell instanceof TableCell) {
  33335. $textLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  33336. if ($textLength > 0) {
  33337. $contentColumns = str_split($cell, ceil($textLength / $cell->getColspan()));
  33338. foreach ($contentColumns as $position => $content) {
  33339. $row[$i + $position] = $content;
  33340. }
  33341. }
  33342. }
  33343. }
  33344. $lengths[] = $this->getCellWidth($row, $column);
  33345. }
  33346. $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2;
  33347. }
  33348. }
  33349. private function getColumnSeparatorWidth()
  33350. {
  33351. return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  33352. }
  33353. private function getCellWidth(array $row, $column)
  33354. {
  33355. if (isset($row[$column])) {
  33356. $cell = $row[$column];
  33357. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  33358. return $cellWidth;
  33359. }
  33360. return 0;
  33361. }
  33362. private function cleanup()
  33363. {
  33364. $this->columnWidths = array();
  33365. $this->numberOfColumns = null;
  33366. }
  33367. private static function initStyles()
  33368. {
  33369. $borderless = new TableStyle();
  33370. $borderless
  33371. ->setHorizontalBorderChar('=')
  33372. ->setVerticalBorderChar(' ')
  33373. ->setCrossingChar(' ')
  33374. ;
  33375. $compact = new TableStyle();
  33376. $compact
  33377. ->setHorizontalBorderChar('')
  33378. ->setVerticalBorderChar(' ')
  33379. ->setCrossingChar('')
  33380. ->setCellRowContentFormat('%s')
  33381. ;
  33382. $styleGuide = new TableStyle();
  33383. $styleGuide
  33384. ->setHorizontalBorderChar('-')
  33385. ->setVerticalBorderChar(' ')
  33386. ->setCrossingChar(' ')
  33387. ->setCellHeaderFormat('%s')
  33388. ;
  33389. return array(
  33390. 'default' => new TableStyle(),
  33391. 'borderless' => $borderless,
  33392. 'compact' => $compact,
  33393. 'symfony-style-guide' => $styleGuide,
  33394. );
  33395. }
  33396. private function resolveStyle($name)
  33397. {
  33398. if ($name instanceof TableStyle) {
  33399. return $name;
  33400. }
  33401. if (isset(self::$styles[$name])) {
  33402. return self::$styles[$name];
  33403. }
  33404. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  33405. }
  33406. }
  33407. <?php
  33408. namespace Symfony\Component\Console\Helper;
  33409. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33410. class TableCell
  33411. {
  33412. private $value;
  33413. private $options = array(
  33414. 'rowspan' => 1,
  33415. 'colspan' => 1,
  33416. );
  33417. public function __construct($value = '', array $options = array())
  33418. {
  33419. if (is_numeric($value) && !is_string($value)) {
  33420. $value = (string) $value;
  33421. }
  33422. $this->value = $value;
  33423. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  33424. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  33425. }
  33426. $this->options = array_merge($this->options, $options);
  33427. }
  33428. public function __toString()
  33429. {
  33430. return $this->value;
  33431. }
  33432. public function getColspan()
  33433. {
  33434. return (int) $this->options['colspan'];
  33435. }
  33436. public function getRowspan()
  33437. {
  33438. return (int) $this->options['rowspan'];
  33439. }
  33440. }
  33441. <?php
  33442. namespace Symfony\Component\Console\Helper;
  33443. use Symfony\Component\Console\Output\OutputInterface;
  33444. use Symfony\Component\Console\Output\NullOutput;
  33445. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33446. class TableHelper extends Helper
  33447. {
  33448. const LAYOUT_DEFAULT = 0;
  33449. const LAYOUT_BORDERLESS = 1;
  33450. const LAYOUT_COMPACT = 2;
  33451. private $table;
  33452. public function __construct($triggerDeprecationError = true)
  33453. {
  33454. if ($triggerDeprecationError) {
  33455. @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);
  33456. }
  33457. $this->table = new Table(new NullOutput());
  33458. }
  33459. public function setLayout($layout)
  33460. {
  33461. switch ($layout) {
  33462. case self::LAYOUT_BORDERLESS:
  33463. $this->table->setStyle('borderless');
  33464. break;
  33465. case self::LAYOUT_COMPACT:
  33466. $this->table->setStyle('compact');
  33467. break;
  33468. case self::LAYOUT_DEFAULT:
  33469. $this->table->setStyle('default');
  33470. break;
  33471. default:
  33472. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  33473. }
  33474. return $this;
  33475. }
  33476. public function setHeaders(array $headers)
  33477. {
  33478. $this->table->setHeaders($headers);
  33479. return $this;
  33480. }
  33481. public function setRows(array $rows)
  33482. {
  33483. $this->table->setRows($rows);
  33484. return $this;
  33485. }
  33486. public function addRows(array $rows)
  33487. {
  33488. $this->table->addRows($rows);
  33489. return $this;
  33490. }
  33491. public function addRow(array $row)
  33492. {
  33493. $this->table->addRow($row);
  33494. return $this;
  33495. }
  33496. public function setRow($column, array $row)
  33497. {
  33498. $this->table->setRow($column, $row);
  33499. return $this;
  33500. }
  33501. public function setPaddingChar($paddingChar)
  33502. {
  33503. $this->table->getStyle()->setPaddingChar($paddingChar);
  33504. return $this;
  33505. }
  33506. public function setHorizontalBorderChar($horizontalBorderChar)
  33507. {
  33508. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  33509. return $this;
  33510. }
  33511. public function setVerticalBorderChar($verticalBorderChar)
  33512. {
  33513. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  33514. return $this;
  33515. }
  33516. public function setCrossingChar($crossingChar)
  33517. {
  33518. $this->table->getStyle()->setCrossingChar($crossingChar);
  33519. return $this;
  33520. }
  33521. public function setCellHeaderFormat($cellHeaderFormat)
  33522. {
  33523. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  33524. return $this;
  33525. }
  33526. public function setCellRowFormat($cellRowFormat)
  33527. {
  33528. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  33529. return $this;
  33530. }
  33531. public function setCellRowContentFormat($cellRowContentFormat)
  33532. {
  33533. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  33534. return $this;
  33535. }
  33536. public function setBorderFormat($borderFormat)
  33537. {
  33538. $this->table->getStyle()->setBorderFormat($borderFormat);
  33539. return $this;
  33540. }
  33541. public function setPadType($padType)
  33542. {
  33543. $this->table->getStyle()->setPadType($padType);
  33544. return $this;
  33545. }
  33546. public function render(OutputInterface $output)
  33547. {
  33548. $p = new \ReflectionProperty($this->table, 'output');
  33549. $p->setAccessible(true);
  33550. $p->setValue($this->table, $output);
  33551. $this->table->render();
  33552. }
  33553. public function getName()
  33554. {
  33555. return 'table';
  33556. }
  33557. }
  33558. <?php
  33559. namespace Symfony\Component\Console\Helper;
  33560. class TableSeparator extends TableCell
  33561. {
  33562. public function __construct(array $options = array())
  33563. {
  33564. parent::__construct('', $options);
  33565. }
  33566. }
  33567. <?php
  33568. namespace Symfony\Component\Console\Helper;
  33569. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33570. use Symfony\Component\Console\Exception\LogicException;
  33571. class TableStyle
  33572. {
  33573. private $paddingChar = ' ';
  33574. private $horizontalBorderChar = '-';
  33575. private $verticalBorderChar = '|';
  33576. private $crossingChar = '+';
  33577. private $cellHeaderFormat = '<info>%s</info>';
  33578. private $cellRowFormat = '%s';
  33579. private $cellRowContentFormat = ' %s ';
  33580. private $borderFormat = '%s';
  33581. private $padType = STR_PAD_RIGHT;
  33582. public function setPaddingChar($paddingChar)
  33583. {
  33584. if (!$paddingChar) {
  33585. throw new LogicException('The padding char must not be empty');
  33586. }
  33587. $this->paddingChar = $paddingChar;
  33588. return $this;
  33589. }
  33590. public function getPaddingChar()
  33591. {
  33592. return $this->paddingChar;
  33593. }
  33594. public function setHorizontalBorderChar($horizontalBorderChar)
  33595. {
  33596. $this->horizontalBorderChar = $horizontalBorderChar;
  33597. return $this;
  33598. }
  33599. public function getHorizontalBorderChar()
  33600. {
  33601. return $this->horizontalBorderChar;
  33602. }
  33603. public function setVerticalBorderChar($verticalBorderChar)
  33604. {
  33605. $this->verticalBorderChar = $verticalBorderChar;
  33606. return $this;
  33607. }
  33608. public function getVerticalBorderChar()
  33609. {
  33610. return $this->verticalBorderChar;
  33611. }
  33612. public function setCrossingChar($crossingChar)
  33613. {
  33614. $this->crossingChar = $crossingChar;
  33615. return $this;
  33616. }
  33617. public function getCrossingChar()
  33618. {
  33619. return $this->crossingChar;
  33620. }
  33621. public function setCellHeaderFormat($cellHeaderFormat)
  33622. {
  33623. $this->cellHeaderFormat = $cellHeaderFormat;
  33624. return $this;
  33625. }
  33626. public function getCellHeaderFormat()
  33627. {
  33628. return $this->cellHeaderFormat;
  33629. }
  33630. public function setCellRowFormat($cellRowFormat)
  33631. {
  33632. $this->cellRowFormat = $cellRowFormat;
  33633. return $this;
  33634. }
  33635. public function getCellRowFormat()
  33636. {
  33637. return $this->cellRowFormat;
  33638. }
  33639. public function setCellRowContentFormat($cellRowContentFormat)
  33640. {
  33641. $this->cellRowContentFormat = $cellRowContentFormat;
  33642. return $this;
  33643. }
  33644. public function getCellRowContentFormat()
  33645. {
  33646. return $this->cellRowContentFormat;
  33647. }
  33648. public function setBorderFormat($borderFormat)
  33649. {
  33650. $this->borderFormat = $borderFormat;
  33651. return $this;
  33652. }
  33653. public function getBorderFormat()
  33654. {
  33655. return $this->borderFormat;
  33656. }
  33657. public function setPadType($padType)
  33658. {
  33659. if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  33660. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  33661. }
  33662. $this->padType = $padType;
  33663. return $this;
  33664. }
  33665. public function getPadType()
  33666. {
  33667. return $this->padType;
  33668. }
  33669. }
  33670. <?php
  33671. namespace Symfony\Component\Console\Input;
  33672. use Symfony\Component\Console\Exception\RuntimeException;
  33673. class ArgvInput extends Input
  33674. {
  33675. private $tokens;
  33676. private $parsed;
  33677. public function __construct(array $argv = null, InputDefinition $definition = null)
  33678. {
  33679. if (null === $argv) {
  33680. $argv = $_SERVER['argv'];
  33681. }
  33682. array_shift($argv);
  33683. $this->tokens = $argv;
  33684. parent::__construct($definition);
  33685. }
  33686. protected function setTokens(array $tokens)
  33687. {
  33688. $this->tokens = $tokens;
  33689. }
  33690. protected function parse()
  33691. {
  33692. $parseOptions = true;
  33693. $this->parsed = $this->tokens;
  33694. while (null !== $token = array_shift($this->parsed)) {
  33695. if ($parseOptions && '' == $token) {
  33696. $this->parseArgument($token);
  33697. } elseif ($parseOptions && '--' == $token) {
  33698. $parseOptions = false;
  33699. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  33700. $this->parseLongOption($token);
  33701. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  33702. $this->parseShortOption($token);
  33703. } else {
  33704. $this->parseArgument($token);
  33705. }
  33706. }
  33707. }
  33708. private function parseShortOption($token)
  33709. {
  33710. $name = substr($token, 1);
  33711. if (strlen($name) > 1) {
  33712. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  33713. $this->addShortOption($name[0], substr($name, 1));
  33714. } else {
  33715. $this->parseShortOptionSet($name);
  33716. }
  33717. } else {
  33718. $this->addShortOption($name, null);
  33719. }
  33720. }
  33721. private function parseShortOptionSet($name)
  33722. {
  33723. $len = strlen($name);
  33724. for ($i = 0; $i < $len; ++$i) {
  33725. if (!$this->definition->hasShortcut($name[$i])) {
  33726. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
  33727. }
  33728. $option = $this->definition->getOptionForShortcut($name[$i]);
  33729. if ($option->acceptValue()) {
  33730. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  33731. break;
  33732. } else {
  33733. $this->addLongOption($option->getName(), null);
  33734. }
  33735. }
  33736. }
  33737. private function parseLongOption($token)
  33738. {
  33739. $name = substr($token, 2);
  33740. if (false !== $pos = strpos($name, '=')) {
  33741. if (0 === strlen($value = substr($name, $pos + 1))) {
  33742. array_unshift($this->parsed, null);
  33743. }
  33744. $this->addLongOption(substr($name, 0, $pos), $value);
  33745. } else {
  33746. $this->addLongOption($name, null);
  33747. }
  33748. }
  33749. private function parseArgument($token)
  33750. {
  33751. $c = count($this->arguments);
  33752. if ($this->definition->hasArgument($c)) {
  33753. $arg = $this->definition->getArgument($c);
  33754. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  33755. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  33756. $arg = $this->definition->getArgument($c - 1);
  33757. $this->arguments[$arg->getName()][] = $token;
  33758. } else {
  33759. $all = $this->definition->getArguments();
  33760. if (count($all)) {
  33761. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  33762. }
  33763. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  33764. }
  33765. }
  33766. private function addShortOption($shortcut, $value)
  33767. {
  33768. if (!$this->definition->hasShortcut($shortcut)) {
  33769. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  33770. }
  33771. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  33772. }
  33773. private function addLongOption($name, $value)
  33774. {
  33775. if (!$this->definition->hasOption($name)) {
  33776. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  33777. }
  33778. $option = $this->definition->getOption($name);
  33779. if (!isset($value[0])) {
  33780. $value = null;
  33781. }
  33782. if (null !== $value && !$option->acceptValue()) {
  33783. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  33784. }
  33785. if (null === $value && $option->acceptValue() && count($this->parsed)) {
  33786. $next = array_shift($this->parsed);
  33787. if (isset($next[0]) && '-' !== $next[0]) {
  33788. $value = $next;
  33789. } elseif (empty($next)) {
  33790. $value = null;
  33791. } else {
  33792. array_unshift($this->parsed, $next);
  33793. }
  33794. }
  33795. if (null === $value) {
  33796. if ($option->isValueRequired()) {
  33797. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  33798. }
  33799. if (!$option->isArray()) {
  33800. $value = $option->isValueOptional() ? $option->getDefault() : true;
  33801. }
  33802. }
  33803. if ($option->isArray()) {
  33804. $this->options[$name][] = $value;
  33805. } else {
  33806. $this->options[$name] = $value;
  33807. }
  33808. }
  33809. public function getFirstArgument()
  33810. {
  33811. foreach ($this->tokens as $token) {
  33812. if ($token && '-' === $token[0]) {
  33813. continue;
  33814. }
  33815. return $token;
  33816. }
  33817. }
  33818. public function hasParameterOption($values)
  33819. {
  33820. $values = (array) $values;
  33821. foreach ($this->tokens as $token) {
  33822. foreach ($values as $value) {
  33823. if ($token === $value || 0 === strpos($token, $value.'=')) {
  33824. return true;
  33825. }
  33826. }
  33827. }
  33828. return false;
  33829. }
  33830. public function getParameterOption($values, $default = false)
  33831. {
  33832. $values = (array) $values;
  33833. $tokens = $this->tokens;
  33834. while (0 < count($tokens)) {
  33835. $token = array_shift($tokens);
  33836. foreach ($values as $value) {
  33837. if ($token === $value || 0 === strpos($token, $value.'=')) {
  33838. if (false !== $pos = strpos($token, '=')) {
  33839. return substr($token, $pos + 1);
  33840. }
  33841. return array_shift($tokens);
  33842. }
  33843. }
  33844. }
  33845. return $default;
  33846. }
  33847. public function __toString()
  33848. {
  33849. $self = $this;
  33850. $tokens = array_map(function ($token) use ($self) {
  33851. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  33852. return $match[1].$self->escapeToken($match[2]);
  33853. }
  33854. if ($token && $token[0] !== '-') {
  33855. return $self->escapeToken($token);
  33856. }
  33857. return $token;
  33858. }, $this->tokens);
  33859. return implode(' ', $tokens);
  33860. }
  33861. }
  33862. <?php
  33863. namespace Symfony\Component\Console\Input;
  33864. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33865. use Symfony\Component\Console\Exception\InvalidOptionException;
  33866. class ArrayInput extends Input
  33867. {
  33868. private $parameters;
  33869. public function __construct(array $parameters, InputDefinition $definition = null)
  33870. {
  33871. $this->parameters = $parameters;
  33872. parent::__construct($definition);
  33873. }
  33874. public function getFirstArgument()
  33875. {
  33876. foreach ($this->parameters as $key => $value) {
  33877. if ($key && '-' === $key[0]) {
  33878. continue;
  33879. }
  33880. return $value;
  33881. }
  33882. }
  33883. public function hasParameterOption($values)
  33884. {
  33885. $values = (array) $values;
  33886. foreach ($this->parameters as $k => $v) {
  33887. if (!is_int($k)) {
  33888. $v = $k;
  33889. }
  33890. if (in_array($v, $values)) {
  33891. return true;
  33892. }
  33893. }
  33894. return false;
  33895. }
  33896. public function getParameterOption($values, $default = false)
  33897. {
  33898. $values = (array) $values;
  33899. foreach ($this->parameters as $k => $v) {
  33900. if (is_int($k)) {
  33901. if (in_array($v, $values)) {
  33902. return true;
  33903. }
  33904. } elseif (in_array($k, $values)) {
  33905. return $v;
  33906. }
  33907. }
  33908. return $default;
  33909. }
  33910. public function __toString()
  33911. {
  33912. $params = array();
  33913. foreach ($this->parameters as $param => $val) {
  33914. if ($param && '-' === $param[0]) {
  33915. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  33916. } else {
  33917. $params[] = $this->escapeToken($val);
  33918. }
  33919. }
  33920. return implode(' ', $params);
  33921. }
  33922. protected function parse()
  33923. {
  33924. foreach ($this->parameters as $key => $value) {
  33925. if (0 === strpos($key, '--')) {
  33926. $this->addLongOption(substr($key, 2), $value);
  33927. } elseif ('-' === $key[0]) {
  33928. $this->addShortOption(substr($key, 1), $value);
  33929. } else {
  33930. $this->addArgument($key, $value);
  33931. }
  33932. }
  33933. }
  33934. private function addShortOption($shortcut, $value)
  33935. {
  33936. if (!$this->definition->hasShortcut($shortcut)) {
  33937. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  33938. }
  33939. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  33940. }
  33941. private function addLongOption($name, $value)
  33942. {
  33943. if (!$this->definition->hasOption($name)) {
  33944. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  33945. }
  33946. $option = $this->definition->getOption($name);
  33947. if (null === $value) {
  33948. if ($option->isValueRequired()) {
  33949. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  33950. }
  33951. $value = $option->isValueOptional() ? $option->getDefault() : true;
  33952. }
  33953. $this->options[$name] = $value;
  33954. }
  33955. private function addArgument($name, $value)
  33956. {
  33957. if (!$this->definition->hasArgument($name)) {
  33958. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  33959. }
  33960. $this->arguments[$name] = $value;
  33961. }
  33962. }
  33963. <?php
  33964. namespace Symfony\Component\Console\Input;
  33965. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33966. use Symfony\Component\Console\Exception\RuntimeException;
  33967. abstract class Input implements InputInterface
  33968. {
  33969. protected $definition;
  33970. protected $options = array();
  33971. protected $arguments = array();
  33972. protected $interactive = true;
  33973. public function __construct(InputDefinition $definition = null)
  33974. {
  33975. if (null === $definition) {
  33976. $this->definition = new InputDefinition();
  33977. } else {
  33978. $this->bind($definition);
  33979. $this->validate();
  33980. }
  33981. }
  33982. public function bind(InputDefinition $definition)
  33983. {
  33984. $this->arguments = array();
  33985. $this->options = array();
  33986. $this->definition = $definition;
  33987. $this->parse();
  33988. }
  33989. abstract protected function parse();
  33990. public function validate()
  33991. {
  33992. $definition = $this->definition;
  33993. $givenArguments = $this->arguments;
  33994. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  33995. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  33996. });
  33997. if (count($missingArguments) > 0) {
  33998. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  33999. }
  34000. }
  34001. public function isInteractive()
  34002. {
  34003. return $this->interactive;
  34004. }
  34005. public function setInteractive($interactive)
  34006. {
  34007. $this->interactive = (bool) $interactive;
  34008. }
  34009. public function getArguments()
  34010. {
  34011. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  34012. }
  34013. public function getArgument($name)
  34014. {
  34015. if (!$this->definition->hasArgument($name)) {
  34016. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  34017. }
  34018. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  34019. }
  34020. public function setArgument($name, $value)
  34021. {
  34022. if (!$this->definition->hasArgument($name)) {
  34023. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  34024. }
  34025. $this->arguments[$name] = $value;
  34026. }
  34027. public function hasArgument($name)
  34028. {
  34029. return $this->definition->hasArgument($name);
  34030. }
  34031. public function getOptions()
  34032. {
  34033. return array_merge($this->definition->getOptionDefaults(), $this->options);
  34034. }
  34035. public function getOption($name)
  34036. {
  34037. if (!$this->definition->hasOption($name)) {
  34038. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  34039. }
  34040. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  34041. }
  34042. public function setOption($name, $value)
  34043. {
  34044. if (!$this->definition->hasOption($name)) {
  34045. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  34046. }
  34047. $this->options[$name] = $value;
  34048. }
  34049. public function hasOption($name)
  34050. {
  34051. return $this->definition->hasOption($name);
  34052. }
  34053. public function escapeToken($token)
  34054. {
  34055. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  34056. }
  34057. }
  34058. <?php
  34059. namespace Symfony\Component\Console\Input;
  34060. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34061. use Symfony\Component\Console\Exception\LogicException;
  34062. class InputArgument
  34063. {
  34064. const REQUIRED = 1;
  34065. const OPTIONAL = 2;
  34066. const IS_ARRAY = 4;
  34067. private $name;
  34068. private $mode;
  34069. private $default;
  34070. private $description;
  34071. public function __construct($name, $mode = null, $description = '', $default = null)
  34072. {
  34073. if (null === $mode) {
  34074. $mode = self::OPTIONAL;
  34075. } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
  34076. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  34077. }
  34078. $this->name = $name;
  34079. $this->mode = $mode;
  34080. $this->description = $description;
  34081. $this->setDefault($default);
  34082. }
  34083. public function getName()
  34084. {
  34085. return $this->name;
  34086. }
  34087. public function isRequired()
  34088. {
  34089. return self::REQUIRED === (self::REQUIRED & $this->mode);
  34090. }
  34091. public function isArray()
  34092. {
  34093. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  34094. }
  34095. public function setDefault($default = null)
  34096. {
  34097. if (self::REQUIRED === $this->mode && null !== $default) {
  34098. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  34099. }
  34100. if ($this->isArray()) {
  34101. if (null === $default) {
  34102. $default = array();
  34103. } elseif (!is_array($default)) {
  34104. throw new LogicException('A default value for an array argument must be an array.');
  34105. }
  34106. }
  34107. $this->default = $default;
  34108. }
  34109. public function getDefault()
  34110. {
  34111. return $this->default;
  34112. }
  34113. public function getDescription()
  34114. {
  34115. return $this->description;
  34116. }
  34117. }
  34118. <?php
  34119. namespace Symfony\Component\Console\Input;
  34120. interface InputAwareInterface
  34121. {
  34122. public function setInput(InputInterface $input);
  34123. }
  34124. <?php
  34125. namespace Symfony\Component\Console\Input;
  34126. use Symfony\Component\Console\Descriptor\TextDescriptor;
  34127. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  34128. use Symfony\Component\Console\Output\BufferedOutput;
  34129. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34130. use Symfony\Component\Console\Exception\LogicException;
  34131. class InputDefinition
  34132. {
  34133. private $arguments;
  34134. private $requiredCount;
  34135. private $hasAnArrayArgument = false;
  34136. private $hasOptional;
  34137. private $options;
  34138. private $shortcuts;
  34139. public function __construct(array $definition = array())
  34140. {
  34141. $this->setDefinition($definition);
  34142. }
  34143. public function setDefinition(array $definition)
  34144. {
  34145. $arguments = array();
  34146. $options = array();
  34147. foreach ($definition as $item) {
  34148. if ($item instanceof InputOption) {
  34149. $options[] = $item;
  34150. } else {
  34151. $arguments[] = $item;
  34152. }
  34153. }
  34154. $this->setArguments($arguments);
  34155. $this->setOptions($options);
  34156. }
  34157. public function setArguments($arguments = array())
  34158. {
  34159. $this->arguments = array();
  34160. $this->requiredCount = 0;
  34161. $this->hasOptional = false;
  34162. $this->hasAnArrayArgument = false;
  34163. $this->addArguments($arguments);
  34164. }
  34165. public function addArguments($arguments = array())
  34166. {
  34167. if (null !== $arguments) {
  34168. foreach ($arguments as $argument) {
  34169. $this->addArgument($argument);
  34170. }
  34171. }
  34172. }
  34173. public function addArgument(InputArgument $argument)
  34174. {
  34175. if (isset($this->arguments[$argument->getName()])) {
  34176. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  34177. }
  34178. if ($this->hasAnArrayArgument) {
  34179. throw new LogicException('Cannot add an argument after an array argument.');
  34180. }
  34181. if ($argument->isRequired() && $this->hasOptional) {
  34182. throw new LogicException('Cannot add a required argument after an optional one.');
  34183. }
  34184. if ($argument->isArray()) {
  34185. $this->hasAnArrayArgument = true;
  34186. }
  34187. if ($argument->isRequired()) {
  34188. ++$this->requiredCount;
  34189. } else {
  34190. $this->hasOptional = true;
  34191. }
  34192. $this->arguments[$argument->getName()] = $argument;
  34193. }
  34194. public function getArgument($name)
  34195. {
  34196. if (!$this->hasArgument($name)) {
  34197. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  34198. }
  34199. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  34200. return $arguments[$name];
  34201. }
  34202. public function hasArgument($name)
  34203. {
  34204. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  34205. return isset($arguments[$name]);
  34206. }
  34207. public function getArguments()
  34208. {
  34209. return $this->arguments;
  34210. }
  34211. public function getArgumentCount()
  34212. {
  34213. return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
  34214. }
  34215. public function getArgumentRequiredCount()
  34216. {
  34217. return $this->requiredCount;
  34218. }
  34219. public function getArgumentDefaults()
  34220. {
  34221. $values = array();
  34222. foreach ($this->arguments as $argument) {
  34223. $values[$argument->getName()] = $argument->getDefault();
  34224. }
  34225. return $values;
  34226. }
  34227. public function setOptions($options = array())
  34228. {
  34229. $this->options = array();
  34230. $this->shortcuts = array();
  34231. $this->addOptions($options);
  34232. }
  34233. public function addOptions($options = array())
  34234. {
  34235. foreach ($options as $option) {
  34236. $this->addOption($option);
  34237. }
  34238. }
  34239. public function addOption(InputOption $option)
  34240. {
  34241. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  34242. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  34243. }
  34244. if ($option->getShortcut()) {
  34245. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  34246. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  34247. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  34248. }
  34249. }
  34250. }
  34251. $this->options[$option->getName()] = $option;
  34252. if ($option->getShortcut()) {
  34253. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  34254. $this->shortcuts[$shortcut] = $option->getName();
  34255. }
  34256. }
  34257. }
  34258. public function getOption($name)
  34259. {
  34260. if (!$this->hasOption($name)) {
  34261. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  34262. }
  34263. return $this->options[$name];
  34264. }
  34265. public function hasOption($name)
  34266. {
  34267. return isset($this->options[$name]);
  34268. }
  34269. public function getOptions()
  34270. {
  34271. return $this->options;
  34272. }
  34273. public function hasShortcut($name)
  34274. {
  34275. return isset($this->shortcuts[$name]);
  34276. }
  34277. public function getOptionForShortcut($shortcut)
  34278. {
  34279. return $this->getOption($this->shortcutToName($shortcut));
  34280. }
  34281. public function getOptionDefaults()
  34282. {
  34283. $values = array();
  34284. foreach ($this->options as $option) {
  34285. $values[$option->getName()] = $option->getDefault();
  34286. }
  34287. return $values;
  34288. }
  34289. private function shortcutToName($shortcut)
  34290. {
  34291. if (!isset($this->shortcuts[$shortcut])) {
  34292. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  34293. }
  34294. return $this->shortcuts[$shortcut];
  34295. }
  34296. public function getSynopsis($short = false)
  34297. {
  34298. $elements = array();
  34299. if ($short && $this->getOptions()) {
  34300. $elements[] = '[options]';
  34301. } elseif (!$short) {
  34302. foreach ($this->getOptions() as $option) {
  34303. $value = '';
  34304. if ($option->acceptValue()) {
  34305. $value = sprintf(
  34306. ' %s%s%s',
  34307. $option->isValueOptional() ? '[' : '',
  34308. strtoupper($option->getName()),
  34309. $option->isValueOptional() ? ']' : ''
  34310. );
  34311. }
  34312. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  34313. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  34314. }
  34315. }
  34316. if (count($elements) && $this->getArguments()) {
  34317. $elements[] = '[--]';
  34318. }
  34319. foreach ($this->getArguments() as $argument) {
  34320. $element = '<'.$argument->getName().'>';
  34321. if (!$argument->isRequired()) {
  34322. $element = '['.$element.']';
  34323. } elseif ($argument->isArray()) {
  34324. $element = $element.' ('.$element.')';
  34325. }
  34326. if ($argument->isArray()) {
  34327. $element .= '...';
  34328. }
  34329. $elements[] = $element;
  34330. }
  34331. return implode(' ', $elements);
  34332. }
  34333. public function asText()
  34334. {
  34335. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34336. $descriptor = new TextDescriptor();
  34337. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  34338. $descriptor->describe($output, $this, array('raw_output' => true));
  34339. return $output->fetch();
  34340. }
  34341. public function asXml($asDom = false)
  34342. {
  34343. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34344. $descriptor = new XmlDescriptor();
  34345. if ($asDom) {
  34346. return $descriptor->getInputDefinitionDocument($this);
  34347. }
  34348. $output = new BufferedOutput();
  34349. $descriptor->describe($output, $this);
  34350. return $output->fetch();
  34351. }
  34352. }
  34353. <?php
  34354. namespace Symfony\Component\Console\Input;
  34355. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34356. use Symfony\Component\Console\Exception\RuntimeException;
  34357. interface InputInterface
  34358. {
  34359. public function getFirstArgument();
  34360. public function hasParameterOption($values);
  34361. public function getParameterOption($values, $default = false);
  34362. public function bind(InputDefinition $definition);
  34363. public function validate();
  34364. public function getArguments();
  34365. public function getArgument($name);
  34366. public function setArgument($name, $value);
  34367. public function hasArgument($name);
  34368. public function getOptions();
  34369. public function getOption($name);
  34370. public function setOption($name, $value);
  34371. public function hasOption($name);
  34372. public function isInteractive();
  34373. public function setInteractive($interactive);
  34374. }
  34375. <?php
  34376. namespace Symfony\Component\Console\Input;
  34377. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34378. use Symfony\Component\Console\Exception\LogicException;
  34379. class InputOption
  34380. {
  34381. const VALUE_NONE = 1;
  34382. const VALUE_REQUIRED = 2;
  34383. const VALUE_OPTIONAL = 4;
  34384. const VALUE_IS_ARRAY = 8;
  34385. private $name;
  34386. private $shortcut;
  34387. private $mode;
  34388. private $default;
  34389. private $description;
  34390. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  34391. {
  34392. if (0 === strpos($name, '--')) {
  34393. $name = substr($name, 2);
  34394. }
  34395. if (empty($name)) {
  34396. throw new InvalidArgumentException('An option name cannot be empty.');
  34397. }
  34398. if (empty($shortcut)) {
  34399. $shortcut = null;
  34400. }
  34401. if (null !== $shortcut) {
  34402. if (is_array($shortcut)) {
  34403. $shortcut = implode('|', $shortcut);
  34404. }
  34405. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  34406. $shortcuts = array_filter($shortcuts);
  34407. $shortcut = implode('|', $shortcuts);
  34408. if (empty($shortcut)) {
  34409. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  34410. }
  34411. }
  34412. if (null === $mode) {
  34413. $mode = self::VALUE_NONE;
  34414. } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
  34415. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  34416. }
  34417. $this->name = $name;
  34418. $this->shortcut = $shortcut;
  34419. $this->mode = $mode;
  34420. $this->description = $description;
  34421. if ($this->isArray() && !$this->acceptValue()) {
  34422. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  34423. }
  34424. $this->setDefault($default);
  34425. }
  34426. public function getShortcut()
  34427. {
  34428. return $this->shortcut;
  34429. }
  34430. public function getName()
  34431. {
  34432. return $this->name;
  34433. }
  34434. public function acceptValue()
  34435. {
  34436. return $this->isValueRequired() || $this->isValueOptional();
  34437. }
  34438. public function isValueRequired()
  34439. {
  34440. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  34441. }
  34442. public function isValueOptional()
  34443. {
  34444. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  34445. }
  34446. public function isArray()
  34447. {
  34448. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  34449. }
  34450. public function setDefault($default = null)
  34451. {
  34452. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  34453. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  34454. }
  34455. if ($this->isArray()) {
  34456. if (null === $default) {
  34457. $default = array();
  34458. } elseif (!is_array($default)) {
  34459. throw new LogicException('A default value for an array option must be an array.');
  34460. }
  34461. }
  34462. $this->default = $this->acceptValue() ? $default : false;
  34463. }
  34464. public function getDefault()
  34465. {
  34466. return $this->default;
  34467. }
  34468. public function getDescription()
  34469. {
  34470. return $this->description;
  34471. }
  34472. public function equals(InputOption $option)
  34473. {
  34474. return $option->getName() === $this->getName()
  34475. && $option->getShortcut() === $this->getShortcut()
  34476. && $option->getDefault() === $this->getDefault()
  34477. && $option->isArray() === $this->isArray()
  34478. && $option->isValueRequired() === $this->isValueRequired()
  34479. && $option->isValueOptional() === $this->isValueOptional()
  34480. ;
  34481. }
  34482. }
  34483. <?php
  34484. namespace Symfony\Component\Console\Input;
  34485. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34486. class StringInput extends ArgvInput
  34487. {
  34488. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  34489. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  34490. public function __construct($input, InputDefinition $definition = null)
  34491. {
  34492. if ($definition) {
  34493. @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);
  34494. }
  34495. parent::__construct(array(), null);
  34496. $this->setTokens($this->tokenize($input));
  34497. if (null !== $definition) {
  34498. $this->bind($definition);
  34499. }
  34500. }
  34501. private function tokenize($input)
  34502. {
  34503. $tokens = array();
  34504. $length = strlen($input);
  34505. $cursor = 0;
  34506. while ($cursor < $length) {
  34507. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  34508. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  34509. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
  34510. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  34511. $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
  34512. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  34513. $tokens[] = stripcslashes($match[1]);
  34514. } else {
  34515. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  34516. }
  34517. $cursor += strlen($match[0]);
  34518. }
  34519. return $tokens;
  34520. }
  34521. }
  34522. Copyright (c) 2004-2017 Fabien Potencier
  34523. Permission is hereby granted, free of charge, to any person obtaining a copy
  34524. of this software and associated documentation files (the "Software"), to deal
  34525. in the Software without restriction, including without limitation the rights
  34526. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34527. copies of the Software, and to permit persons to whom the Software is furnished
  34528. to do so, subject to the following conditions:
  34529. The above copyright notice and this permission notice shall be included in all
  34530. copies or substantial portions of the Software.
  34531. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34532. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34533. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34534. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34535. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34536. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  34537. THE SOFTWARE.
  34538. <?php
  34539. namespace Symfony\Component\Console\Logger;
  34540. use Psr\Log\AbstractLogger;
  34541. use Psr\Log\InvalidArgumentException;
  34542. use Psr\Log\LogLevel;
  34543. use Symfony\Component\Console\Output\OutputInterface;
  34544. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34545. class ConsoleLogger extends AbstractLogger
  34546. {
  34547. const INFO = 'info';
  34548. const ERROR = 'error';
  34549. private $output;
  34550. private $verbosityLevelMap = array(
  34551. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  34552. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  34553. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  34554. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  34555. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  34556. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  34557. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  34558. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  34559. );
  34560. private $formatLevelMap = array(
  34561. LogLevel::EMERGENCY => self::ERROR,
  34562. LogLevel::ALERT => self::ERROR,
  34563. LogLevel::CRITICAL => self::ERROR,
  34564. LogLevel::ERROR => self::ERROR,
  34565. LogLevel::WARNING => self::INFO,
  34566. LogLevel::NOTICE => self::INFO,
  34567. LogLevel::INFO => self::INFO,
  34568. LogLevel::DEBUG => self::INFO,
  34569. );
  34570. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  34571. {
  34572. $this->output = $output;
  34573. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  34574. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  34575. }
  34576. public function log($level, $message, array $context = array())
  34577. {
  34578. if (!isset($this->verbosityLevelMap[$level])) {
  34579. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  34580. }
  34581. if ($this->formatLevelMap[$level] === self::ERROR && $this->output instanceof ConsoleOutputInterface) {
  34582. $output = $this->output->getErrorOutput();
  34583. } else {
  34584. $output = $this->output;
  34585. }
  34586. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  34587. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  34588. }
  34589. }
  34590. private function interpolate($message, array $context)
  34591. {
  34592. $replace = array();
  34593. foreach ($context as $key => $val) {
  34594. if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
  34595. $replace[sprintf('{%s}', $key)] = $val;
  34596. }
  34597. }
  34598. return strtr($message, $replace);
  34599. }
  34600. }
  34601. <?php
  34602. namespace Symfony\Component\Console\Output;
  34603. class BufferedOutput extends Output
  34604. {
  34605. private $buffer = '';
  34606. public function fetch()
  34607. {
  34608. $content = $this->buffer;
  34609. $this->buffer = '';
  34610. return $content;
  34611. }
  34612. protected function doWrite($message, $newline)
  34613. {
  34614. $this->buffer .= $message;
  34615. if ($newline) {
  34616. $this->buffer .= "\n";
  34617. }
  34618. }
  34619. }
  34620. <?php
  34621. namespace Symfony\Component\Console\Output;
  34622. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34623. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  34624. {
  34625. private $stderr;
  34626. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  34627. {
  34628. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  34629. $actualDecorated = $this->isDecorated();
  34630. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  34631. if (null === $decorated) {
  34632. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  34633. }
  34634. }
  34635. public function setDecorated($decorated)
  34636. {
  34637. parent::setDecorated($decorated);
  34638. $this->stderr->setDecorated($decorated);
  34639. }
  34640. public function setFormatter(OutputFormatterInterface $formatter)
  34641. {
  34642. parent::setFormatter($formatter);
  34643. $this->stderr->setFormatter($formatter);
  34644. }
  34645. public function setVerbosity($level)
  34646. {
  34647. parent::setVerbosity($level);
  34648. $this->stderr->setVerbosity($level);
  34649. }
  34650. public function getErrorOutput()
  34651. {
  34652. return $this->stderr;
  34653. }
  34654. public function setErrorOutput(OutputInterface $error)
  34655. {
  34656. $this->stderr = $error;
  34657. }
  34658. protected function hasStdoutSupport()
  34659. {
  34660. return false === $this->isRunningOS400();
  34661. }
  34662. protected function hasStderrSupport()
  34663. {
  34664. return false === $this->isRunningOS400();
  34665. }
  34666. private function isRunningOS400()
  34667. {
  34668. $checks = array(
  34669. function_exists('php_uname') ? php_uname('s') : '',
  34670. getenv('OSTYPE'),
  34671. PHP_OS,
  34672. );
  34673. return false !== stripos(implode(';', $checks), 'OS400');
  34674. }
  34675. private function openOutputStream()
  34676. {
  34677. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  34678. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  34679. }
  34680. private function openErrorStream()
  34681. {
  34682. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  34683. return fopen($errorStream, 'w');
  34684. }
  34685. }
  34686. <?php
  34687. namespace Symfony\Component\Console\Output;
  34688. interface ConsoleOutputInterface extends OutputInterface
  34689. {
  34690. public function getErrorOutput();
  34691. public function setErrorOutput(OutputInterface $error);
  34692. }
  34693. <?php
  34694. namespace Symfony\Component\Console\Output;
  34695. use Symfony\Component\Console\Formatter\OutputFormatter;
  34696. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34697. class NullOutput implements OutputInterface
  34698. {
  34699. public function setFormatter(OutputFormatterInterface $formatter)
  34700. {
  34701. }
  34702. public function getFormatter()
  34703. {
  34704. return new OutputFormatter();
  34705. }
  34706. public function setDecorated($decorated)
  34707. {
  34708. }
  34709. public function isDecorated()
  34710. {
  34711. return false;
  34712. }
  34713. public function setVerbosity($level)
  34714. {
  34715. }
  34716. public function getVerbosity()
  34717. {
  34718. return self::VERBOSITY_QUIET;
  34719. }
  34720. public function isQuiet()
  34721. {
  34722. return true;
  34723. }
  34724. public function isVerbose()
  34725. {
  34726. return false;
  34727. }
  34728. public function isVeryVerbose()
  34729. {
  34730. return false;
  34731. }
  34732. public function isDebug()
  34733. {
  34734. return false;
  34735. }
  34736. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  34737. {
  34738. }
  34739. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  34740. {
  34741. }
  34742. }
  34743. <?php
  34744. namespace Symfony\Component\Console\Output;
  34745. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34746. use Symfony\Component\Console\Formatter\OutputFormatter;
  34747. abstract class Output implements OutputInterface
  34748. {
  34749. private $verbosity;
  34750. private $formatter;
  34751. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  34752. {
  34753. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  34754. $this->formatter = $formatter ?: new OutputFormatter();
  34755. $this->formatter->setDecorated($decorated);
  34756. }
  34757. public function setFormatter(OutputFormatterInterface $formatter)
  34758. {
  34759. $this->formatter = $formatter;
  34760. }
  34761. public function getFormatter()
  34762. {
  34763. return $this->formatter;
  34764. }
  34765. public function setDecorated($decorated)
  34766. {
  34767. $this->formatter->setDecorated($decorated);
  34768. }
  34769. public function isDecorated()
  34770. {
  34771. return $this->formatter->isDecorated();
  34772. }
  34773. public function setVerbosity($level)
  34774. {
  34775. $this->verbosity = (int) $level;
  34776. }
  34777. public function getVerbosity()
  34778. {
  34779. return $this->verbosity;
  34780. }
  34781. public function isQuiet()
  34782. {
  34783. return self::VERBOSITY_QUIET === $this->verbosity;
  34784. }
  34785. public function isVerbose()
  34786. {
  34787. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  34788. }
  34789. public function isVeryVerbose()
  34790. {
  34791. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  34792. }
  34793. public function isDebug()
  34794. {
  34795. return self::VERBOSITY_DEBUG <= $this->verbosity;
  34796. }
  34797. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  34798. {
  34799. $this->write($messages, true, $options);
  34800. }
  34801. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  34802. {
  34803. $messages = (array) $messages;
  34804. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  34805. $type = $types & $options ?: self::OUTPUT_NORMAL;
  34806. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  34807. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  34808. if ($verbosity > $this->getVerbosity()) {
  34809. return;
  34810. }
  34811. foreach ($messages as $message) {
  34812. switch ($type) {
  34813. case OutputInterface::OUTPUT_NORMAL:
  34814. $message = $this->formatter->format($message);
  34815. break;
  34816. case OutputInterface::OUTPUT_RAW:
  34817. break;
  34818. case OutputInterface::OUTPUT_PLAIN:
  34819. $message = strip_tags($this->formatter->format($message));
  34820. break;
  34821. }
  34822. $this->doWrite($message, $newline);
  34823. }
  34824. }
  34825. abstract protected function doWrite($message, $newline);
  34826. }
  34827. <?php
  34828. namespace Symfony\Component\Console\Output;
  34829. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34830. interface OutputInterface
  34831. {
  34832. const VERBOSITY_QUIET = 16;
  34833. const VERBOSITY_NORMAL = 32;
  34834. const VERBOSITY_VERBOSE = 64;
  34835. const VERBOSITY_VERY_VERBOSE = 128;
  34836. const VERBOSITY_DEBUG = 256;
  34837. const OUTPUT_NORMAL = 1;
  34838. const OUTPUT_RAW = 2;
  34839. const OUTPUT_PLAIN = 4;
  34840. public function write($messages, $newline = false, $options = 0);
  34841. public function writeln($messages, $options = 0);
  34842. public function setVerbosity($level);
  34843. public function getVerbosity();
  34844. public function setDecorated($decorated);
  34845. public function isDecorated();
  34846. public function setFormatter(OutputFormatterInterface $formatter);
  34847. public function getFormatter();
  34848. }
  34849. <?php
  34850. namespace Symfony\Component\Console\Output;
  34851. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34852. use Symfony\Component\Console\Exception\RuntimeException;
  34853. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34854. class StreamOutput extends Output
  34855. {
  34856. private $stream;
  34857. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  34858. {
  34859. if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  34860. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  34861. }
  34862. $this->stream = $stream;
  34863. if (null === $decorated) {
  34864. $decorated = $this->hasColorSupport();
  34865. }
  34866. parent::__construct($verbosity, $decorated, $formatter);
  34867. }
  34868. public function getStream()
  34869. {
  34870. return $this->stream;
  34871. }
  34872. protected function doWrite($message, $newline)
  34873. {
  34874. if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
  34875. throw new RuntimeException('Unable to write output.');
  34876. }
  34877. fflush($this->stream);
  34878. }
  34879. protected function hasColorSupport()
  34880. {
  34881. if (DIRECTORY_SEPARATOR === '\\') {
  34882. return
  34883. '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
  34884. || false !== getenv('ANSICON')
  34885. || 'ON' === getenv('ConEmuANSI')
  34886. || 'xterm' === getenv('TERM');
  34887. }
  34888. return function_exists('posix_isatty') && @posix_isatty($this->stream);
  34889. }
  34890. }
  34891. <?php
  34892. namespace Symfony\Component\Console\Question;
  34893. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34894. class ChoiceQuestion extends Question
  34895. {
  34896. private $choices;
  34897. private $multiselect = false;
  34898. private $prompt = ' > ';
  34899. private $errorMessage = 'Value "%s" is invalid';
  34900. public function __construct($question, array $choices, $default = null)
  34901. {
  34902. parent::__construct($question, $default);
  34903. $this->choices = $choices;
  34904. $this->setValidator($this->getDefaultValidator());
  34905. $this->setAutocompleterValues($choices);
  34906. }
  34907. public function getChoices()
  34908. {
  34909. return $this->choices;
  34910. }
  34911. public function setMultiselect($multiselect)
  34912. {
  34913. $this->multiselect = $multiselect;
  34914. $this->setValidator($this->getDefaultValidator());
  34915. return $this;
  34916. }
  34917. public function isMultiselect()
  34918. {
  34919. return $this->multiselect;
  34920. }
  34921. public function getPrompt()
  34922. {
  34923. return $this->prompt;
  34924. }
  34925. public function setPrompt($prompt)
  34926. {
  34927. $this->prompt = $prompt;
  34928. return $this;
  34929. }
  34930. public function setErrorMessage($errorMessage)
  34931. {
  34932. $this->errorMessage = $errorMessage;
  34933. $this->setValidator($this->getDefaultValidator());
  34934. return $this;
  34935. }
  34936. private function getDefaultValidator()
  34937. {
  34938. $choices = $this->choices;
  34939. $errorMessage = $this->errorMessage;
  34940. $multiselect = $this->multiselect;
  34941. $isAssoc = $this->isAssoc($choices);
  34942. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  34943. $selectedChoices = str_replace(' ', '', $selected);
  34944. if ($multiselect) {
  34945. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  34946. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  34947. }
  34948. $selectedChoices = explode(',', $selectedChoices);
  34949. } else {
  34950. $selectedChoices = array($selected);
  34951. }
  34952. $multiselectChoices = array();
  34953. foreach ($selectedChoices as $value) {
  34954. $results = array();
  34955. foreach ($choices as $key => $choice) {
  34956. if ($choice === $value) {
  34957. $results[] = $key;
  34958. }
  34959. }
  34960. if (count($results) > 1) {
  34961. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  34962. }
  34963. $result = array_search($value, $choices);
  34964. if (!$isAssoc) {
  34965. if (false !== $result) {
  34966. $result = $choices[$result];
  34967. } elseif (isset($choices[$value])) {
  34968. $result = $choices[$value];
  34969. }
  34970. } elseif (false === $result && isset($choices[$value])) {
  34971. $result = $value;
  34972. }
  34973. if (false === $result) {
  34974. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  34975. }
  34976. $multiselectChoices[] = (string) $result;
  34977. }
  34978. if ($multiselect) {
  34979. return $multiselectChoices;
  34980. }
  34981. return current($multiselectChoices);
  34982. };
  34983. }
  34984. }
  34985. <?php
  34986. namespace Symfony\Component\Console\Question;
  34987. class ConfirmationQuestion extends Question
  34988. {
  34989. private $trueAnswerRegex;
  34990. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  34991. {
  34992. parent::__construct($question, (bool) $default);
  34993. $this->trueAnswerRegex = $trueAnswerRegex;
  34994. $this->setNormalizer($this->getDefaultNormalizer());
  34995. }
  34996. private function getDefaultNormalizer()
  34997. {
  34998. $default = $this->getDefault();
  34999. $regex = $this->trueAnswerRegex;
  35000. return function ($answer) use ($default, $regex) {
  35001. if (is_bool($answer)) {
  35002. return $answer;
  35003. }
  35004. $answerIsTrue = (bool) preg_match($regex, $answer);
  35005. if (false === $default) {
  35006. return $answer && $answerIsTrue;
  35007. }
  35008. return !$answer || $answerIsTrue;
  35009. };
  35010. }
  35011. }
  35012. <?php
  35013. namespace Symfony\Component\Console\Question;
  35014. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35015. use Symfony\Component\Console\Exception\LogicException;
  35016. class Question
  35017. {
  35018. private $question;
  35019. private $attempts;
  35020. private $hidden = false;
  35021. private $hiddenFallback = true;
  35022. private $autocompleterValues;
  35023. private $validator;
  35024. private $default;
  35025. private $normalizer;
  35026. public function __construct($question, $default = null)
  35027. {
  35028. $this->question = $question;
  35029. $this->default = $default;
  35030. }
  35031. public function getQuestion()
  35032. {
  35033. return $this->question;
  35034. }
  35035. public function getDefault()
  35036. {
  35037. return $this->default;
  35038. }
  35039. public function isHidden()
  35040. {
  35041. return $this->hidden;
  35042. }
  35043. public function setHidden($hidden)
  35044. {
  35045. if ($this->autocompleterValues) {
  35046. throw new LogicException('A hidden question cannot use the autocompleter.');
  35047. }
  35048. $this->hidden = (bool) $hidden;
  35049. return $this;
  35050. }
  35051. public function isHiddenFallback()
  35052. {
  35053. return $this->hiddenFallback;
  35054. }
  35055. public function setHiddenFallback($fallback)
  35056. {
  35057. $this->hiddenFallback = (bool) $fallback;
  35058. return $this;
  35059. }
  35060. public function getAutocompleterValues()
  35061. {
  35062. return $this->autocompleterValues;
  35063. }
  35064. public function setAutocompleterValues($values)
  35065. {
  35066. if (is_array($values)) {
  35067. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  35068. }
  35069. if (null !== $values && !is_array($values)) {
  35070. if (!$values instanceof \Traversable || !$values instanceof \Countable) {
  35071. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.');
  35072. }
  35073. }
  35074. if ($this->hidden) {
  35075. throw new LogicException('A hidden question cannot use the autocompleter.');
  35076. }
  35077. $this->autocompleterValues = $values;
  35078. return $this;
  35079. }
  35080. public function setValidator($validator)
  35081. {
  35082. $this->validator = $validator;
  35083. return $this;
  35084. }
  35085. public function getValidator()
  35086. {
  35087. return $this->validator;
  35088. }
  35089. public function setMaxAttempts($attempts)
  35090. {
  35091. if (null !== $attempts && $attempts < 1) {
  35092. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  35093. }
  35094. $this->attempts = $attempts;
  35095. return $this;
  35096. }
  35097. public function getMaxAttempts()
  35098. {
  35099. return $this->attempts;
  35100. }
  35101. public function setNormalizer($normalizer)
  35102. {
  35103. $this->normalizer = $normalizer;
  35104. return $this;
  35105. }
  35106. public function getNormalizer()
  35107. {
  35108. return $this->normalizer;
  35109. }
  35110. protected function isAssoc($array)
  35111. {
  35112. return (bool) count(array_filter(array_keys($array), 'is_string'));
  35113. }
  35114. }
  35115. <?php
  35116. namespace Symfony\Component\Console;
  35117. use Symfony\Component\Console\Exception\RuntimeException;
  35118. use Symfony\Component\Console\Input\StringInput;
  35119. use Symfony\Component\Console\Output\ConsoleOutput;
  35120. use Symfony\Component\Process\ProcessBuilder;
  35121. use Symfony\Component\Process\PhpExecutableFinder;
  35122. class Shell
  35123. {
  35124. private $application;
  35125. private $history;
  35126. private $output;
  35127. private $hasReadline;
  35128. private $processIsolation = false;
  35129. public function __construct(Application $application)
  35130. {
  35131. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  35132. $this->hasReadline = function_exists('readline');
  35133. $this->application = $application;
  35134. $this->history = getenv('HOME').'/.history_'.$application->getName();
  35135. $this->output = new ConsoleOutput();
  35136. }
  35137. public function run()
  35138. {
  35139. $this->application->setAutoExit(false);
  35140. $this->application->setCatchExceptions(true);
  35141. if ($this->hasReadline) {
  35142. readline_read_history($this->history);
  35143. readline_completion_function(array($this, 'autocompleter'));
  35144. }
  35145. $this->output->writeln($this->getHeader());
  35146. $php = null;
  35147. if ($this->processIsolation) {
  35148. $finder = new PhpExecutableFinder();
  35149. $php = $finder->find();
  35150. $this->output->writeln(<<<'EOF'
  35151. <info>Running with process isolation, you should consider this:</info>
  35152. * each command is executed as separate process,
  35153. * commands don't support interactivity, all params must be passed explicitly,
  35154. * commands output is not colorized.
  35155. EOF
  35156. );
  35157. }
  35158. while (true) {
  35159. $command = $this->readline();
  35160. if (false === $command) {
  35161. $this->output->writeln("\n");
  35162. break;
  35163. }
  35164. if ($this->hasReadline) {
  35165. readline_add_history($command);
  35166. readline_write_history($this->history);
  35167. }
  35168. if ($this->processIsolation) {
  35169. $pb = new ProcessBuilder();
  35170. $process = $pb
  35171. ->add($php)
  35172. ->add($_SERVER['argv'][0])
  35173. ->add($command)
  35174. ->inheritEnvironmentVariables(true)
  35175. ->getProcess()
  35176. ;
  35177. $output = $this->output;
  35178. $process->run(function ($type, $data) use ($output) {
  35179. $output->writeln($data);
  35180. });
  35181. $ret = $process->getExitCode();
  35182. } else {
  35183. $ret = $this->application->run(new StringInput($command), $this->output);
  35184. }
  35185. if (0 !== $ret) {
  35186. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  35187. }
  35188. }
  35189. }
  35190. protected function getHeader()
  35191. {
  35192. return <<<EOF
  35193. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  35194. At the prompt, type <comment>help</comment> for some help,
  35195. or <comment>list</comment> to get a list of available commands.
  35196. To exit the shell, type <comment>^D</comment>.
  35197. EOF;
  35198. }
  35199. protected function getPrompt()
  35200. {
  35201. return $this->output->getFormatter()->format($this->application->getName().' > ');
  35202. }
  35203. protected function getOutput()
  35204. {
  35205. return $this->output;
  35206. }
  35207. protected function getApplication()
  35208. {
  35209. return $this->application;
  35210. }
  35211. private function autocompleter($text)
  35212. {
  35213. $info = readline_info();
  35214. $text = substr($info['line_buffer'], 0, $info['end']);
  35215. if ($info['point'] !== $info['end']) {
  35216. return true;
  35217. }
  35218. if (false === strpos($text, ' ') || !$text) {
  35219. return array_keys($this->application->all());
  35220. }
  35221. try {
  35222. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  35223. } catch (\Exception $e) {
  35224. return true;
  35225. }
  35226. $list = array('--help');
  35227. foreach ($command->getDefinition()->getOptions() as $option) {
  35228. $list[] = '--'.$option->getName();
  35229. }
  35230. return $list;
  35231. }
  35232. private function readline()
  35233. {
  35234. if ($this->hasReadline) {
  35235. $line = readline($this->getPrompt());
  35236. } else {
  35237. $this->output->write($this->getPrompt());
  35238. $line = fgets(STDIN, 1024);
  35239. $line = (false === $line || '' === $line) ? false : rtrim($line);
  35240. }
  35241. return $line;
  35242. }
  35243. public function getProcessIsolation()
  35244. {
  35245. return $this->processIsolation;
  35246. }
  35247. public function setProcessIsolation($processIsolation)
  35248. {
  35249. $this->processIsolation = (bool) $processIsolation;
  35250. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  35251. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  35252. }
  35253. }
  35254. }
  35255. <?php
  35256. namespace Symfony\Component\Console\Style;
  35257. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35258. use Symfony\Component\Console\Helper\ProgressBar;
  35259. use Symfony\Component\Console\Output\OutputInterface;
  35260. abstract class OutputStyle implements OutputInterface, StyleInterface
  35261. {
  35262. private $output;
  35263. public function __construct(OutputInterface $output)
  35264. {
  35265. $this->output = $output;
  35266. }
  35267. public function newLine($count = 1)
  35268. {
  35269. $this->output->write(str_repeat(PHP_EOL, $count));
  35270. }
  35271. public function createProgressBar($max = 0)
  35272. {
  35273. return new ProgressBar($this->output, $max);
  35274. }
  35275. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  35276. {
  35277. $this->output->write($messages, $newline, $type);
  35278. }
  35279. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  35280. {
  35281. $this->output->writeln($messages, $type);
  35282. }
  35283. public function setVerbosity($level)
  35284. {
  35285. $this->output->setVerbosity($level);
  35286. }
  35287. public function getVerbosity()
  35288. {
  35289. return $this->output->getVerbosity();
  35290. }
  35291. public function setDecorated($decorated)
  35292. {
  35293. $this->output->setDecorated($decorated);
  35294. }
  35295. public function isDecorated()
  35296. {
  35297. return $this->output->isDecorated();
  35298. }
  35299. public function setFormatter(OutputFormatterInterface $formatter)
  35300. {
  35301. $this->output->setFormatter($formatter);
  35302. }
  35303. public function getFormatter()
  35304. {
  35305. return $this->output->getFormatter();
  35306. }
  35307. }
  35308. <?php
  35309. namespace Symfony\Component\Console\Style;
  35310. interface StyleInterface
  35311. {
  35312. public function title($message);
  35313. public function section($message);
  35314. public function listing(array $elements);
  35315. public function text($message);
  35316. public function success($message);
  35317. public function error($message);
  35318. public function warning($message);
  35319. public function note($message);
  35320. public function caution($message);
  35321. public function table(array $headers, array $rows);
  35322. public function ask($question, $default = null, $validator = null);
  35323. public function askHidden($question, $validator = null);
  35324. public function confirm($question, $default = true);
  35325. public function choice($question, array $choices, $default = null);
  35326. public function newLine($count = 1);
  35327. public function progressStart($max = 0);
  35328. public function progressAdvance($step = 1);
  35329. public function progressFinish();
  35330. }
  35331. <?php
  35332. namespace Symfony\Component\Console\Style;
  35333. use Symfony\Component\Console\Application;
  35334. use Symfony\Component\Console\Exception\RuntimeException;
  35335. use Symfony\Component\Console\Formatter\OutputFormatter;
  35336. use Symfony\Component\Console\Helper\Helper;
  35337. use Symfony\Component\Console\Helper\ProgressBar;
  35338. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  35339. use Symfony\Component\Console\Helper\Table;
  35340. use Symfony\Component\Console\Input\InputInterface;
  35341. use Symfony\Component\Console\Output\BufferedOutput;
  35342. use Symfony\Component\Console\Output\OutputInterface;
  35343. use Symfony\Component\Console\Question\ChoiceQuestion;
  35344. use Symfony\Component\Console\Question\ConfirmationQuestion;
  35345. use Symfony\Component\Console\Question\Question;
  35346. class SymfonyStyle extends OutputStyle
  35347. {
  35348. const MAX_LINE_LENGTH = 120;
  35349. private $input;
  35350. private $questionHelper;
  35351. private $progressBar;
  35352. private $lineLength;
  35353. private $bufferedOutput;
  35354. public function __construct(InputInterface $input, OutputInterface $output)
  35355. {
  35356. $this->input = $input;
  35357. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  35358. $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  35359. parent::__construct($output);
  35360. }
  35361. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  35362. {
  35363. $messages = is_array($messages) ? array_values($messages) : array($messages);
  35364. $this->autoPrependBlock();
  35365. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  35366. $this->newLine();
  35367. }
  35368. public function title($message)
  35369. {
  35370. $this->autoPrependBlock();
  35371. $this->writeln(array(
  35372. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  35373. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  35374. ));
  35375. $this->newLine();
  35376. }
  35377. public function section($message)
  35378. {
  35379. $this->autoPrependBlock();
  35380. $this->writeln(array(
  35381. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  35382. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  35383. ));
  35384. $this->newLine();
  35385. }
  35386. public function listing(array $elements)
  35387. {
  35388. $this->autoPrependText();
  35389. $elements = array_map(function ($element) {
  35390. return sprintf(' * %s', $element);
  35391. }, $elements);
  35392. $this->writeln($elements);
  35393. $this->newLine();
  35394. }
  35395. public function text($message)
  35396. {
  35397. $this->autoPrependText();
  35398. $messages = is_array($message) ? array_values($message) : array($message);
  35399. foreach ($messages as $message) {
  35400. $this->writeln(sprintf(' %s', $message));
  35401. }
  35402. }
  35403. public function comment($message)
  35404. {
  35405. $messages = is_array($message) ? array_values($message) : array($message);
  35406. $this->autoPrependBlock();
  35407. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  35408. $this->newLine();
  35409. }
  35410. public function success($message)
  35411. {
  35412. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  35413. }
  35414. public function error($message)
  35415. {
  35416. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  35417. }
  35418. public function warning($message)
  35419. {
  35420. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  35421. }
  35422. public function note($message)
  35423. {
  35424. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  35425. }
  35426. public function caution($message)
  35427. {
  35428. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  35429. }
  35430. public function table(array $headers, array $rows)
  35431. {
  35432. $style = clone Table::getStyleDefinition('symfony-style-guide');
  35433. $style->setCellHeaderFormat('<info>%s</info>');
  35434. $table = new Table($this);
  35435. $table->setHeaders($headers);
  35436. $table->setRows($rows);
  35437. $table->setStyle($style);
  35438. $table->render();
  35439. $this->newLine();
  35440. }
  35441. public function ask($question, $default = null, $validator = null)
  35442. {
  35443. $question = new Question($question, $default);
  35444. $question->setValidator($validator);
  35445. return $this->askQuestion($question);
  35446. }
  35447. public function askHidden($question, $validator = null)
  35448. {
  35449. $question = new Question($question);
  35450. $question->setHidden(true);
  35451. $question->setValidator($validator);
  35452. return $this->askQuestion($question);
  35453. }
  35454. public function confirm($question, $default = true)
  35455. {
  35456. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  35457. }
  35458. public function choice($question, array $choices, $default = null)
  35459. {
  35460. if (null !== $default) {
  35461. $values = array_flip($choices);
  35462. $default = $values[$default];
  35463. }
  35464. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  35465. }
  35466. public function progressStart($max = 0)
  35467. {
  35468. $this->progressBar = $this->createProgressBar($max);
  35469. $this->progressBar->start();
  35470. }
  35471. public function progressAdvance($step = 1)
  35472. {
  35473. $this->getProgressBar()->advance($step);
  35474. }
  35475. public function progressFinish()
  35476. {
  35477. $this->getProgressBar()->finish();
  35478. $this->newLine(2);
  35479. $this->progressBar = null;
  35480. }
  35481. public function createProgressBar($max = 0)
  35482. {
  35483. $progressBar = parent::createProgressBar($max);
  35484. if ('\\' !== DIRECTORY_SEPARATOR) {
  35485. $progressBar->setEmptyBarCharacter('â–‘');
  35486. $progressBar->setProgressCharacter('');
  35487. $progressBar->setBarCharacter('â–“');
  35488. }
  35489. return $progressBar;
  35490. }
  35491. public function askQuestion(Question $question)
  35492. {
  35493. if ($this->input->isInteractive()) {
  35494. $this->autoPrependBlock();
  35495. }
  35496. if (!$this->questionHelper) {
  35497. $this->questionHelper = new SymfonyQuestionHelper();
  35498. }
  35499. $answer = $this->questionHelper->ask($this->input, $this, $question);
  35500. if ($this->input->isInteractive()) {
  35501. $this->newLine();
  35502. $this->bufferedOutput->write("\n");
  35503. }
  35504. return $answer;
  35505. }
  35506. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  35507. {
  35508. parent::writeln($messages, $type);
  35509. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  35510. }
  35511. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  35512. {
  35513. parent::write($messages, $newline, $type);
  35514. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  35515. }
  35516. public function newLine($count = 1)
  35517. {
  35518. parent::newLine($count);
  35519. $this->bufferedOutput->write(str_repeat("\n", $count));
  35520. }
  35521. private function getProgressBar()
  35522. {
  35523. if (!$this->progressBar) {
  35524. throw new RuntimeException('The ProgressBar is not started.');
  35525. }
  35526. return $this->progressBar;
  35527. }
  35528. private function getTerminalWidth()
  35529. {
  35530. $application = new Application();
  35531. $dimensions = $application->getTerminalDimensions();
  35532. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  35533. }
  35534. private function autoPrependBlock()
  35535. {
  35536. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  35537. if (!isset($chars[0])) {
  35538. return $this->newLine();
  35539. }
  35540. $this->newLine(2 - substr_count($chars, "\n"));
  35541. }
  35542. private function autoPrependText()
  35543. {
  35544. $fetched = $this->bufferedOutput->fetch();
  35545. if ("\n" !== substr($fetched, -1)) {
  35546. $this->newLine();
  35547. }
  35548. }
  35549. private function reduceBuffer($messages)
  35550. {
  35551. return array_map(function ($value) {
  35552. return substr($value, -4);
  35553. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  35554. }
  35555. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  35556. {
  35557. $indentLength = 0;
  35558. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  35559. $lines = array();
  35560. if (null !== $type) {
  35561. $type = sprintf('[%s] ', $type);
  35562. $indentLength = strlen($type);
  35563. $lineIndentation = str_repeat(' ', $indentLength);
  35564. }
  35565. foreach ($messages as $key => $message) {
  35566. if ($escape) {
  35567. $message = OutputFormatter::escape($message);
  35568. }
  35569. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  35570. if (count($messages) > 1 && $key < count($messages) - 1) {
  35571. $lines[] = '';
  35572. }
  35573. }
  35574. $firstLineIndex = 0;
  35575. if ($padding && $this->isDecorated()) {
  35576. $firstLineIndex = 1;
  35577. array_unshift($lines, '');
  35578. $lines[] = '';
  35579. }
  35580. foreach ($lines as $i => &$line) {
  35581. if (null !== $type) {
  35582. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  35583. }
  35584. $line = $prefix.$line;
  35585. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  35586. if ($style) {
  35587. $line = sprintf('<%s>%s</>', $style, $line);
  35588. }
  35589. }
  35590. return $lines;
  35591. }
  35592. }
  35593. <?php
  35594. namespace Symfony\Component\Console\Tester;
  35595. use Symfony\Component\Console\Application;
  35596. use Symfony\Component\Console\Input\ArrayInput;
  35597. use Symfony\Component\Console\Input\InputInterface;
  35598. use Symfony\Component\Console\Output\OutputInterface;
  35599. use Symfony\Component\Console\Output\StreamOutput;
  35600. class ApplicationTester
  35601. {
  35602. private $application;
  35603. private $input;
  35604. private $output;
  35605. private $statusCode;
  35606. public function __construct(Application $application)
  35607. {
  35608. $this->application = $application;
  35609. }
  35610. public function run(array $input, $options = array())
  35611. {
  35612. $this->input = new ArrayInput($input);
  35613. if (isset($options['interactive'])) {
  35614. $this->input->setInteractive($options['interactive']);
  35615. }
  35616. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  35617. if (isset($options['decorated'])) {
  35618. $this->output->setDecorated($options['decorated']);
  35619. }
  35620. if (isset($options['verbosity'])) {
  35621. $this->output->setVerbosity($options['verbosity']);
  35622. }
  35623. return $this->statusCode = $this->application->run($this->input, $this->output);
  35624. }
  35625. public function getDisplay($normalize = false)
  35626. {
  35627. rewind($this->output->getStream());
  35628. $display = stream_get_contents($this->output->getStream());
  35629. if ($normalize) {
  35630. $display = str_replace(PHP_EOL, "\n", $display);
  35631. }
  35632. return $display;
  35633. }
  35634. public function getInput()
  35635. {
  35636. return $this->input;
  35637. }
  35638. public function getOutput()
  35639. {
  35640. return $this->output;
  35641. }
  35642. public function getStatusCode()
  35643. {
  35644. return $this->statusCode;
  35645. }
  35646. }
  35647. <?php
  35648. namespace Symfony\Component\Console\Tester;
  35649. use Symfony\Component\Console\Command\Command;
  35650. use Symfony\Component\Console\Input\ArrayInput;
  35651. use Symfony\Component\Console\Output\StreamOutput;
  35652. use Symfony\Component\Console\Input\InputInterface;
  35653. use Symfony\Component\Console\Output\OutputInterface;
  35654. class CommandTester
  35655. {
  35656. private $command;
  35657. private $input;
  35658. private $output;
  35659. private $statusCode;
  35660. public function __construct(Command $command)
  35661. {
  35662. $this->command = $command;
  35663. }
  35664. public function execute(array $input, array $options = array())
  35665. {
  35666. if (!isset($input['command'])
  35667. && (null !== $application = $this->command->getApplication())
  35668. && $application->getDefinition()->hasArgument('command')
  35669. ) {
  35670. $input = array_merge(array('command' => $this->command->getName()), $input);
  35671. }
  35672. $this->input = new ArrayInput($input);
  35673. if (isset($options['interactive'])) {
  35674. $this->input->setInteractive($options['interactive']);
  35675. }
  35676. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  35677. if (isset($options['decorated'])) {
  35678. $this->output->setDecorated($options['decorated']);
  35679. }
  35680. if (isset($options['verbosity'])) {
  35681. $this->output->setVerbosity($options['verbosity']);
  35682. }
  35683. return $this->statusCode = $this->command->run($this->input, $this->output);
  35684. }
  35685. public function getDisplay($normalize = false)
  35686. {
  35687. rewind($this->output->getStream());
  35688. $display = stream_get_contents($this->output->getStream());
  35689. if ($normalize) {
  35690. $display = str_replace(PHP_EOL, "\n", $display);
  35691. }
  35692. return $display;
  35693. }
  35694. public function getInput()
  35695. {
  35696. return $this->input;
  35697. }
  35698. public function getOutput()
  35699. {
  35700. return $this->output;
  35701. }
  35702. public function getStatusCode()
  35703. {
  35704. return $this->statusCode;
  35705. }
  35706. }
  35707. <?php
  35708. namespace Symfony\Component\Debug;
  35709. use Psr\Log\AbstractLogger;
  35710. class BufferingLogger extends AbstractLogger
  35711. {
  35712. private $logs = array();
  35713. public function log($level, $message, array $context = array())
  35714. {
  35715. $this->logs[] = array($level, $message, $context);
  35716. }
  35717. public function cleanLogs()
  35718. {
  35719. $logs = $this->logs;
  35720. $this->logs = array();
  35721. return $logs;
  35722. }
  35723. }
  35724. <?php
  35725. namespace Symfony\Component\Debug;
  35726. class Debug
  35727. {
  35728. private static $enabled = false;
  35729. public static function enable($errorReportingLevel = null, $displayErrors = true)
  35730. {
  35731. if (static::$enabled) {
  35732. return;
  35733. }
  35734. static::$enabled = true;
  35735. if (null !== $errorReportingLevel) {
  35736. error_reporting($errorReportingLevel);
  35737. } else {
  35738. error_reporting(-1);
  35739. }
  35740. if ('cli' !== PHP_SAPI) {
  35741. ini_set('display_errors', 0);
  35742. ExceptionHandler::register();
  35743. } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
  35744. ini_set('display_errors', 1);
  35745. }
  35746. if ($displayErrors) {
  35747. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  35748. } else {
  35749. ErrorHandler::register()->throwAt(0, true);
  35750. }
  35751. DebugClassLoader::enable();
  35752. }
  35753. }
  35754. <?php
  35755. namespace Symfony\Component\Debug;
  35756. class DebugClassLoader
  35757. {
  35758. private $classLoader;
  35759. private $isFinder;
  35760. private $wasFinder;
  35761. private static $caseCheck;
  35762. private static $deprecated = array();
  35763. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  35764. private static $darwinCache = array('/' => array('/', array()));
  35765. public function __construct($classLoader)
  35766. {
  35767. $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
  35768. if ($this->wasFinder) {
  35769. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  35770. $this->classLoader = array($classLoader, 'loadClass');
  35771. $this->isFinder = true;
  35772. } else {
  35773. $this->classLoader = $classLoader;
  35774. $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  35775. }
  35776. if (!isset(self::$caseCheck)) {
  35777. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
  35778. $i = strrpos($file, DIRECTORY_SEPARATOR);
  35779. $dir = substr($file, 0, 1 + $i);
  35780. $file = substr($file, 1 + $i);
  35781. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  35782. $test = realpath($dir.$test);
  35783. if (false === $test || false === $i) {
  35784. self::$caseCheck = 0;
  35785. } elseif (substr($test, -strlen($file)) === $file) {
  35786. self::$caseCheck = 1;
  35787. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  35788. self::$caseCheck = 2;
  35789. } else {
  35790. self::$caseCheck = 0;
  35791. }
  35792. }
  35793. }
  35794. public function getClassLoader()
  35795. {
  35796. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  35797. }
  35798. public static function enable()
  35799. {
  35800. class_exists('Symfony\Component\Debug\ErrorHandler');
  35801. class_exists('Psr\Log\LogLevel');
  35802. if (!is_array($functions = spl_autoload_functions())) {
  35803. return;
  35804. }
  35805. foreach ($functions as $function) {
  35806. spl_autoload_unregister($function);
  35807. }
  35808. foreach ($functions as $function) {
  35809. if (!is_array($function) || !$function[0] instanceof self) {
  35810. $function = array(new static($function), 'loadClass');
  35811. }
  35812. spl_autoload_register($function);
  35813. }
  35814. }
  35815. public static function disable()
  35816. {
  35817. if (!is_array($functions = spl_autoload_functions())) {
  35818. return;
  35819. }
  35820. foreach ($functions as $function) {
  35821. spl_autoload_unregister($function);
  35822. }
  35823. foreach ($functions as $function) {
  35824. if (is_array($function) && $function[0] instanceof self) {
  35825. $function = $function[0]->getClassLoader();
  35826. }
  35827. spl_autoload_register($function);
  35828. }
  35829. }
  35830. public function findFile($class)
  35831. {
  35832. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  35833. if ($this->wasFinder) {
  35834. return $this->classLoader[0]->findFile($class);
  35835. }
  35836. }
  35837. public function loadClass($class)
  35838. {
  35839. ErrorHandler::stackErrors();
  35840. try {
  35841. if ($this->isFinder) {
  35842. if ($file = $this->classLoader[0]->findFile($class)) {
  35843. require_once $file;
  35844. }
  35845. } else {
  35846. call_user_func($this->classLoader, $class);
  35847. $file = false;
  35848. }
  35849. } catch (\Exception $e) {
  35850. ErrorHandler::unstackErrors();
  35851. throw $e;
  35852. } catch (\Throwable $e) {
  35853. ErrorHandler::unstackErrors();
  35854. throw $e;
  35855. }
  35856. ErrorHandler::unstackErrors();
  35857. $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  35858. if ('\\' === $class[0]) {
  35859. $class = substr($class, 1);
  35860. }
  35861. if ($exists) {
  35862. $refl = new \ReflectionClass($class);
  35863. $name = $refl->getName();
  35864. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  35865. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  35866. }
  35867. if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  35868. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  35869. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  35870. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  35871. } else {
  35872. if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) {
  35873. $len = 0;
  35874. $ns = '';
  35875. } else {
  35876. switch ($ns = substr($name, 0, $len)) {
  35877. case 'Symfony\Bridge\\':
  35878. case 'Symfony\Bundle\\':
  35879. case 'Symfony\Component\\':
  35880. $ns = 'Symfony\\';
  35881. $len = strlen($ns);
  35882. break;
  35883. }
  35884. }
  35885. $parent = get_parent_class($class);
  35886. if (!$parent || strncmp($ns, $parent, $len)) {
  35887. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  35888. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  35889. }
  35890. $parentInterfaces = array();
  35891. $deprecatedInterfaces = array();
  35892. if ($parent) {
  35893. foreach (class_implements($parent) as $interface) {
  35894. $parentInterfaces[$interface] = 1;
  35895. }
  35896. }
  35897. foreach ($refl->getInterfaceNames() as $interface) {
  35898. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  35899. $deprecatedInterfaces[] = $interface;
  35900. }
  35901. foreach (class_implements($interface) as $interface) {
  35902. $parentInterfaces[$interface] = 1;
  35903. }
  35904. }
  35905. foreach ($deprecatedInterfaces as $interface) {
  35906. if (!isset($parentInterfaces[$interface])) {
  35907. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  35908. }
  35909. }
  35910. }
  35911. }
  35912. }
  35913. if ($file) {
  35914. if (!$exists) {
  35915. if (false !== strpos($class, '/')) {
  35916. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  35917. }
  35918. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  35919. }
  35920. if (self::$caseCheck) {
  35921. $real = explode('\\', $class.strrchr($file, '.'));
  35922. $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));
  35923. $i = count($tail) - 1;
  35924. $j = count($real) - 1;
  35925. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  35926. --$i;
  35927. --$j;
  35928. }
  35929. array_splice($tail, 0, $i + 1);
  35930. }
  35931. if (self::$caseCheck && $tail) {
  35932. $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
  35933. $tailLen = strlen($tail);
  35934. $real = $refl->getFileName();
  35935. if (2 === self::$caseCheck) {
  35936. $i = 1 + strrpos($real, '/');
  35937. $file = substr($real, $i);
  35938. $real = substr($real, 0, $i);
  35939. if (isset(self::$darwinCache[$real])) {
  35940. $kDir = $real;
  35941. } else {
  35942. $kDir = strtolower($real);
  35943. if (isset(self::$darwinCache[$kDir])) {
  35944. $real = self::$darwinCache[$kDir][0];
  35945. } else {
  35946. $dir = getcwd();
  35947. chdir($real);
  35948. $real = getcwd().'/';
  35949. chdir($dir);
  35950. $dir = $real;
  35951. $k = $kDir;
  35952. $i = strlen($dir) - 1;
  35953. while (!isset(self::$darwinCache[$k])) {
  35954. self::$darwinCache[$k] = array($dir, array());
  35955. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  35956. while ('/' !== $dir[--$i]) {
  35957. }
  35958. $k = substr($k, 0, ++$i);
  35959. $dir = substr($dir, 0, $i--);
  35960. }
  35961. }
  35962. }
  35963. $dirFiles = self::$darwinCache[$kDir][1];
  35964. if (isset($dirFiles[$file])) {
  35965. $kFile = $file;
  35966. } else {
  35967. $kFile = strtolower($file);
  35968. if (!isset($dirFiles[$kFile])) {
  35969. foreach (scandir($real, 2) as $f) {
  35970. if ('.' !== $f[0]) {
  35971. $dirFiles[$f] = $f;
  35972. if ($f === $file) {
  35973. $kFile = $k = $file;
  35974. } elseif ($f !== $k = strtolower($f)) {
  35975. $dirFiles[$k] = $f;
  35976. }
  35977. }
  35978. }
  35979. self::$darwinCache[$kDir][1] = $dirFiles;
  35980. }
  35981. }
  35982. $real .= $dirFiles[$kFile];
  35983. }
  35984. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  35985. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  35986. ) {
  35987. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  35988. }
  35989. }
  35990. return true;
  35991. }
  35992. }
  35993. }
  35994. <?php
  35995. namespace Symfony\Component\Debug;
  35996. use Psr\Log\LogLevel;
  35997. use Psr\Log\LoggerInterface;
  35998. use Symfony\Component\Debug\Exception\ContextErrorException;
  35999. use Symfony\Component\Debug\Exception\FatalErrorException;
  36000. use Symfony\Component\Debug\Exception\FatalThrowableError;
  36001. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  36002. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  36003. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  36004. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  36005. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  36006. class ErrorHandler
  36007. {
  36008. const TYPE_DEPRECATION = -100;
  36009. private $levels = array(
  36010. E_DEPRECATED => 'Deprecated',
  36011. E_USER_DEPRECATED => 'User Deprecated',
  36012. E_NOTICE => 'Notice',
  36013. E_USER_NOTICE => 'User Notice',
  36014. E_STRICT => 'Runtime Notice',
  36015. E_WARNING => 'Warning',
  36016. E_USER_WARNING => 'User Warning',
  36017. E_COMPILE_WARNING => 'Compile Warning',
  36018. E_CORE_WARNING => 'Core Warning',
  36019. E_USER_ERROR => 'User Error',
  36020. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  36021. E_COMPILE_ERROR => 'Compile Error',
  36022. E_PARSE => 'Parse Error',
  36023. E_ERROR => 'Error',
  36024. E_CORE_ERROR => 'Core Error',
  36025. );
  36026. private $loggers = array(
  36027. E_DEPRECATED => array(null, LogLevel::INFO),
  36028. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  36029. E_NOTICE => array(null, LogLevel::WARNING),
  36030. E_USER_NOTICE => array(null, LogLevel::WARNING),
  36031. E_STRICT => array(null, LogLevel::WARNING),
  36032. E_WARNING => array(null, LogLevel::WARNING),
  36033. E_USER_WARNING => array(null, LogLevel::WARNING),
  36034. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  36035. E_CORE_WARNING => array(null, LogLevel::WARNING),
  36036. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  36037. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  36038. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  36039. E_PARSE => array(null, LogLevel::CRITICAL),
  36040. E_ERROR => array(null, LogLevel::CRITICAL),
  36041. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  36042. );
  36043. private $thrownErrors = 0x1FFF;
  36044. private $scopedErrors = 0x1FFF;
  36045. private $tracedErrors = 0x77FB;
  36046. private $screamedErrors = 0x55;
  36047. private $loggedErrors = 0;
  36048. private $loggedTraces = array();
  36049. private $isRecursive = 0;
  36050. private $isRoot = false;
  36051. private $exceptionHandler;
  36052. private $bootstrappingLogger;
  36053. private static $reservedMemory;
  36054. private static $stackedErrors = array();
  36055. private static $stackedErrorLevels = array();
  36056. private static $toStringException = null;
  36057. private $displayErrors = 0x1FFF;
  36058. public static function register($handler = null, $replace = true)
  36059. {
  36060. if (null === self::$reservedMemory) {
  36061. self::$reservedMemory = str_repeat('x', 10240);
  36062. register_shutdown_function(__CLASS__.'::handleFatalError');
  36063. }
  36064. $levels = -1;
  36065. if ($handlerIsNew = !$handler instanceof self) {
  36066. if (null !== $handler) {
  36067. $levels = $replace ? $handler : 0;
  36068. $replace = true;
  36069. }
  36070. $handler = new static();
  36071. }
  36072. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  36073. restore_error_handler();
  36074. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  36075. $handler->isRoot = true;
  36076. }
  36077. if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) {
  36078. $handler = $prev[0];
  36079. $replace = false;
  36080. }
  36081. if ($replace || !$prev) {
  36082. $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException')));
  36083. } else {
  36084. restore_error_handler();
  36085. }
  36086. $handler->throwAt($levels & $handler->thrownErrors, true);
  36087. return $handler;
  36088. }
  36089. public function __construct(BufferingLogger $bootstrappingLogger = null)
  36090. {
  36091. if ($bootstrappingLogger) {
  36092. $this->bootstrappingLogger = $bootstrappingLogger;
  36093. $this->setDefaultLogger($bootstrappingLogger);
  36094. }
  36095. }
  36096. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  36097. {
  36098. $loggers = array();
  36099. if (is_array($levels)) {
  36100. foreach ($levels as $type => $logLevel) {
  36101. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  36102. $loggers[$type] = array($logger, $logLevel);
  36103. }
  36104. }
  36105. } else {
  36106. if (null === $levels) {
  36107. $levels = E_ALL | E_STRICT;
  36108. }
  36109. foreach ($this->loggers as $type => $log) {
  36110. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  36111. $log[0] = $logger;
  36112. $loggers[$type] = $log;
  36113. }
  36114. }
  36115. }
  36116. $this->setLoggers($loggers);
  36117. }
  36118. public function setLoggers(array $loggers)
  36119. {
  36120. $prevLogged = $this->loggedErrors;
  36121. $prev = $this->loggers;
  36122. $flush = array();
  36123. foreach ($loggers as $type => $log) {
  36124. if (!isset($prev[$type])) {
  36125. throw new \InvalidArgumentException('Unknown error type: '.$type);
  36126. }
  36127. if (!is_array($log)) {
  36128. $log = array($log);
  36129. } elseif (!array_key_exists(0, $log)) {
  36130. throw new \InvalidArgumentException('No logger provided');
  36131. }
  36132. if (null === $log[0]) {
  36133. $this->loggedErrors &= ~$type;
  36134. } elseif ($log[0] instanceof LoggerInterface) {
  36135. $this->loggedErrors |= $type;
  36136. } else {
  36137. throw new \InvalidArgumentException('Invalid logger provided');
  36138. }
  36139. $this->loggers[$type] = $log + $prev[$type];
  36140. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  36141. $flush[$type] = $type;
  36142. }
  36143. }
  36144. $this->reRegister($prevLogged | $this->thrownErrors);
  36145. if ($flush) {
  36146. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  36147. $type = $log[2]['type'];
  36148. if (!isset($flush[$type])) {
  36149. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  36150. } elseif ($this->loggers[$type][0]) {
  36151. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  36152. }
  36153. }
  36154. }
  36155. return $prev;
  36156. }
  36157. public function setExceptionHandler($handler)
  36158. {
  36159. if (null !== $handler && !is_callable($handler)) {
  36160. throw new \LogicException('The exception handler must be a valid PHP callable.');
  36161. }
  36162. $prev = $this->exceptionHandler;
  36163. $this->exceptionHandler = $handler;
  36164. return $prev;
  36165. }
  36166. public function throwAt($levels, $replace = false)
  36167. {
  36168. $prev = $this->thrownErrors;
  36169. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  36170. if (!$replace) {
  36171. $this->thrownErrors |= $prev;
  36172. }
  36173. $this->reRegister($prev | $this->loggedErrors);
  36174. $this->displayErrors = $this->thrownErrors;
  36175. return $prev;
  36176. }
  36177. public function scopeAt($levels, $replace = false)
  36178. {
  36179. $prev = $this->scopedErrors;
  36180. $this->scopedErrors = (int) $levels;
  36181. if (!$replace) {
  36182. $this->scopedErrors |= $prev;
  36183. }
  36184. return $prev;
  36185. }
  36186. public function traceAt($levels, $replace = false)
  36187. {
  36188. $prev = $this->tracedErrors;
  36189. $this->tracedErrors = (int) $levels;
  36190. if (!$replace) {
  36191. $this->tracedErrors |= $prev;
  36192. }
  36193. return $prev;
  36194. }
  36195. public function screamAt($levels, $replace = false)
  36196. {
  36197. $prev = $this->screamedErrors;
  36198. $this->screamedErrors = (int) $levels;
  36199. if (!$replace) {
  36200. $this->screamedErrors |= $prev;
  36201. }
  36202. return $prev;
  36203. }
  36204. private function reRegister($prev)
  36205. {
  36206. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  36207. $handler = set_error_handler('var_dump');
  36208. $handler = is_array($handler) ? $handler[0] : null;
  36209. restore_error_handler();
  36210. if ($handler === $this) {
  36211. restore_error_handler();
  36212. if ($this->isRoot) {
  36213. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  36214. } else {
  36215. set_error_handler(array($this, 'handleError'));
  36216. }
  36217. }
  36218. }
  36219. }
  36220. public function handleError($type, $message, $file, $line)
  36221. {
  36222. $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  36223. $log = $this->loggedErrors & $type;
  36224. $throw = $this->thrownErrors & $type & $level;
  36225. $type &= $level | $this->screamedErrors;
  36226. if (!$type || (!$log && !$throw)) {
  36227. return $type && $log;
  36228. }
  36229. $scope = $this->scopedErrors & $type;
  36230. if (4 < $numArgs = func_num_args()) {
  36231. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  36232. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  36233. } else {
  36234. $context = array();
  36235. $backtrace = null;
  36236. }
  36237. if (isset($context['GLOBALS']) && $scope) {
  36238. $e = $context;
  36239. unset($e['GLOBALS'], $context);
  36240. $context = $e;
  36241. }
  36242. if (null !== $backtrace && $type & E_ERROR) {
  36243. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  36244. return true;
  36245. }
  36246. if ($throw) {
  36247. if (null !== self::$toStringException) {
  36248. $throw = self::$toStringException;
  36249. self::$toStringException = null;
  36250. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  36251. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  36252. } else {
  36253. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  36254. }
  36255. if (PHP_VERSION_ID <= 50407 && (PHP_VERSION_ID >= 50400 || PHP_VERSION_ID <= 50317)) {
  36256. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  36257. }
  36258. if (E_USER_ERROR & $type) {
  36259. $backtrace = $backtrace ?: $throw->getTrace();
  36260. for ($i = 1; isset($backtrace[$i]); ++$i) {
  36261. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  36262. && '__toString' === $backtrace[$i]['function']
  36263. && '->' === $backtrace[$i]['type']
  36264. && !isset($backtrace[$i - 1]['class'])
  36265. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  36266. ) {
  36267. foreach ($context as $e) {
  36268. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  36269. if (1 === $i) {
  36270. $throw = $e;
  36271. break;
  36272. }
  36273. self::$toStringException = $e;
  36274. return true;
  36275. }
  36276. }
  36277. if (1 < $i) {
  36278. $this->handleException($throw);
  36279. return false;
  36280. }
  36281. }
  36282. }
  36283. }
  36284. throw $throw;
  36285. }
  36286. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  36287. $trace = true;
  36288. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  36289. $trace = false;
  36290. } else {
  36291. $this->loggedTraces[$e] = 1;
  36292. }
  36293. $e = compact('type', 'file', 'line', 'level');
  36294. if ($type & $level) {
  36295. if ($scope) {
  36296. $e['scope_vars'] = $context;
  36297. if ($trace) {
  36298. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  36299. }
  36300. } elseif ($trace) {
  36301. if (null === $backtrace) {
  36302. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  36303. } else {
  36304. foreach ($backtrace as &$frame) {
  36305. unset($frame['args'], $frame);
  36306. }
  36307. $e['stack'] = $backtrace;
  36308. }
  36309. }
  36310. }
  36311. if ($this->isRecursive) {
  36312. $log = 0;
  36313. } elseif (self::$stackedErrorLevels) {
  36314. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  36315. } else {
  36316. try {
  36317. $this->isRecursive = true;
  36318. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  36319. $this->isRecursive = false;
  36320. } catch (\Exception $e) {
  36321. $this->isRecursive = false;
  36322. throw $e;
  36323. } catch (\Throwable $e) {
  36324. $this->isRecursive = false;
  36325. throw $e;
  36326. }
  36327. }
  36328. return $type && $log;
  36329. }
  36330. public function handleException($exception, array $error = null)
  36331. {
  36332. if (!$exception instanceof \Exception) {
  36333. $exception = new FatalThrowableError($exception);
  36334. }
  36335. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  36336. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  36337. $e = array(
  36338. 'type' => $type,
  36339. 'file' => $exception->getFile(),
  36340. 'line' => $exception->getLine(),
  36341. 'level' => error_reporting(),
  36342. 'stack' => $exception->getTrace(),
  36343. );
  36344. if ($exception instanceof FatalErrorException) {
  36345. if ($exception instanceof FatalThrowableError) {
  36346. $error = array(
  36347. 'type' => $type,
  36348. 'message' => $message = $exception->getMessage(),
  36349. 'file' => $e['file'],
  36350. 'line' => $e['line'],
  36351. );
  36352. } else {
  36353. $message = 'Fatal '.$exception->getMessage();
  36354. }
  36355. } elseif ($exception instanceof \ErrorException) {
  36356. $message = 'Uncaught '.$exception->getMessage();
  36357. if ($exception instanceof ContextErrorException) {
  36358. $e['context'] = $exception->getContext();
  36359. }
  36360. } else {
  36361. $message = 'Uncaught Exception: '.$exception->getMessage();
  36362. }
  36363. }
  36364. if ($this->loggedErrors & $type) {
  36365. try {
  36366. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  36367. } catch (\Exception $handlerException) {
  36368. } catch (\Throwable $handlerException) {
  36369. }
  36370. }
  36371. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  36372. foreach ($this->getFatalErrorHandlers() as $handler) {
  36373. if ($e = $handler->handleError($error, $exception)) {
  36374. $exception = $e;
  36375. break;
  36376. }
  36377. }
  36378. }
  36379. if (empty($this->exceptionHandler)) {
  36380. throw $exception;
  36381. }
  36382. try {
  36383. call_user_func($this->exceptionHandler, $exception);
  36384. } catch (\Exception $handlerException) {
  36385. } catch (\Throwable $handlerException) {
  36386. }
  36387. if (isset($handlerException)) {
  36388. $this->exceptionHandler = null;
  36389. $this->handleException($handlerException);
  36390. }
  36391. }
  36392. public static function handleFatalError(array $error = null)
  36393. {
  36394. if (null === self::$reservedMemory) {
  36395. return;
  36396. }
  36397. self::$reservedMemory = null;
  36398. $handler = set_error_handler('var_dump');
  36399. $handler = is_array($handler) ? $handler[0] : null;
  36400. restore_error_handler();
  36401. if (!$handler instanceof self) {
  36402. return;
  36403. }
  36404. if (null === $error) {
  36405. $error = error_get_last();
  36406. }
  36407. try {
  36408. while (self::$stackedErrorLevels) {
  36409. static::unstackErrors();
  36410. }
  36411. } catch (\Exception $exception) {
  36412. } catch (\Throwable $exception) {
  36413. }
  36414. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  36415. $handler->throwAt(0, true);
  36416. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  36417. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  36418. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  36419. } else {
  36420. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  36421. }
  36422. } elseif (!isset($exception)) {
  36423. return;
  36424. }
  36425. try {
  36426. $handler->handleException($exception, $error);
  36427. } catch (FatalErrorException $e) {
  36428. }
  36429. }
  36430. public static function stackErrors()
  36431. {
  36432. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  36433. }
  36434. public static function unstackErrors()
  36435. {
  36436. $level = array_pop(self::$stackedErrorLevels);
  36437. if (null !== $level) {
  36438. $e = error_reporting($level);
  36439. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  36440. error_reporting($e);
  36441. }
  36442. }
  36443. if (empty(self::$stackedErrorLevels)) {
  36444. $errors = self::$stackedErrors;
  36445. self::$stackedErrors = array();
  36446. foreach ($errors as $e) {
  36447. $e[0]->log($e[1], $e[2], $e[3]);
  36448. }
  36449. }
  36450. }
  36451. protected function getFatalErrorHandlers()
  36452. {
  36453. return array(
  36454. new UndefinedFunctionFatalErrorHandler(),
  36455. new UndefinedMethodFatalErrorHandler(),
  36456. new ClassNotFoundFatalErrorHandler(),
  36457. );
  36458. }
  36459. public function setLevel($level)
  36460. {
  36461. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  36462. $level = null === $level ? error_reporting() : $level;
  36463. $this->throwAt($level, true);
  36464. }
  36465. public function setDisplayErrors($displayErrors)
  36466. {
  36467. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  36468. if ($displayErrors) {
  36469. $this->throwAt($this->displayErrors, true);
  36470. } else {
  36471. $displayErrors = $this->displayErrors;
  36472. $this->throwAt(0, true);
  36473. $this->displayErrors = $displayErrors;
  36474. }
  36475. }
  36476. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  36477. {
  36478. @trigger_error('The '.__METHOD__.' static method is deprecated since version 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  36479. $handler = set_error_handler('var_dump');
  36480. $handler = is_array($handler) ? $handler[0] : null;
  36481. restore_error_handler();
  36482. if (!$handler instanceof self) {
  36483. return;
  36484. }
  36485. if ('deprecation' === $channel) {
  36486. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  36487. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  36488. } elseif ('scream' === $channel) {
  36489. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  36490. $handler->screamAt(E_ALL | E_STRICT);
  36491. } elseif ('emergency' === $channel) {
  36492. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  36493. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  36494. }
  36495. }
  36496. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  36497. {
  36498. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  36499. return $this->handleError($level, $message, $file, $line, (array) $context);
  36500. }
  36501. public function handleFatal()
  36502. {
  36503. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  36504. static::handleFatalError();
  36505. }
  36506. }
  36507. class ErrorHandlerCanary
  36508. {
  36509. private static $displayErrors = null;
  36510. public function __construct()
  36511. {
  36512. if (null === self::$displayErrors) {
  36513. self::$displayErrors = ini_set('display_errors', 1);
  36514. }
  36515. }
  36516. public function __destruct()
  36517. {
  36518. if (null !== self::$displayErrors) {
  36519. ini_set('display_errors', self::$displayErrors);
  36520. self::$displayErrors = null;
  36521. }
  36522. }
  36523. }
  36524. <?php
  36525. namespace Symfony\Component\Debug\Exception;
  36526. class ClassNotFoundException extends FatalErrorException
  36527. {
  36528. public function __construct($message, \ErrorException $previous)
  36529. {
  36530. parent::__construct(
  36531. $message,
  36532. $previous->getCode(),
  36533. $previous->getSeverity(),
  36534. $previous->getFile(),
  36535. $previous->getLine(),
  36536. $previous->getPrevious()
  36537. );
  36538. $this->setTrace($previous->getTrace());
  36539. }
  36540. }
  36541. <?php
  36542. namespace Symfony\Component\Debug\Exception;
  36543. class ContextErrorException extends \ErrorException
  36544. {
  36545. private $context = array();
  36546. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  36547. {
  36548. parent::__construct($message, $code, $severity, $filename, $lineno);
  36549. $this->context = $context;
  36550. }
  36551. public function getContext()
  36552. {
  36553. return $this->context;
  36554. }
  36555. }
  36556. <?php
  36557. namespace Symfony\Component\Debug\Exception;
  36558. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  36559. class DummyException extends \ErrorException
  36560. {
  36561. }
  36562. <?php
  36563. namespace Symfony\Component\HttpKernel\Exception;
  36564. class FatalErrorException extends \ErrorException
  36565. {
  36566. }
  36567. namespace Symfony\Component\Debug\Exception;
  36568. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  36569. class FatalErrorException extends LegacyFatalErrorException
  36570. {
  36571. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
  36572. {
  36573. parent::__construct($message, $code, $severity, $filename, $lineno);
  36574. if (null !== $trace) {
  36575. if (!$traceArgs) {
  36576. foreach ($trace as &$frame) {
  36577. unset($frame['args'], $frame['this'], $frame);
  36578. }
  36579. }
  36580. $this->setTrace($trace);
  36581. } elseif (null !== $traceOffset) {
  36582. if (function_exists('xdebug_get_function_stack')) {
  36583. $trace = xdebug_get_function_stack();
  36584. if (0 < $traceOffset) {
  36585. array_splice($trace, -$traceOffset);
  36586. }
  36587. foreach ($trace as &$frame) {
  36588. if (!isset($frame['type'])) {
  36589. if (isset($frame['class'])) {
  36590. $frame['type'] = '::';
  36591. }
  36592. } elseif ('dynamic' === $frame['type']) {
  36593. $frame['type'] = '->';
  36594. } elseif ('static' === $frame['type']) {
  36595. $frame['type'] = '::';
  36596. }
  36597. if (!$traceArgs) {
  36598. unset($frame['params'], $frame['args']);
  36599. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  36600. $frame['args'] = $frame['params'];
  36601. unset($frame['params']);
  36602. }
  36603. }
  36604. unset($frame);
  36605. $trace = array_reverse($trace);
  36606. } elseif (function_exists('symfony_debug_backtrace')) {
  36607. $trace = symfony_debug_backtrace();
  36608. if (0 < $traceOffset) {
  36609. array_splice($trace, 0, $traceOffset);
  36610. }
  36611. } else {
  36612. $trace = array();
  36613. }
  36614. $this->setTrace($trace);
  36615. }
  36616. }
  36617. protected function setTrace($trace)
  36618. {
  36619. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  36620. $traceReflector->setAccessible(true);
  36621. $traceReflector->setValue($this, $trace);
  36622. }
  36623. }
  36624. <?php
  36625. namespace Symfony\Component\Debug\Exception;
  36626. class FatalThrowableError extends FatalErrorException
  36627. {
  36628. public function __construct(\Throwable $e)
  36629. {
  36630. if ($e instanceof \ParseError) {
  36631. $message = 'Parse error: '.$e->getMessage();
  36632. $severity = E_PARSE;
  36633. } elseif ($e instanceof \TypeError) {
  36634. $message = 'Type error: '.$e->getMessage();
  36635. $severity = E_RECOVERABLE_ERROR;
  36636. } else {
  36637. $message = $e->getMessage();
  36638. $severity = E_ERROR;
  36639. }
  36640. \ErrorException::__construct(
  36641. $message,
  36642. $e->getCode(),
  36643. $severity,
  36644. $e->getFile(),
  36645. $e->getLine()
  36646. );
  36647. $this->setTrace($e->getTrace());
  36648. }
  36649. }
  36650. <?php
  36651. namespace Symfony\Component\HttpKernel\Exception;
  36652. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  36653. class FlattenException
  36654. {
  36655. private $handler;
  36656. public static function __callStatic($method, $args)
  36657. {
  36658. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  36659. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
  36660. }
  36661. return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  36662. }
  36663. public function __call($method, $args)
  36664. {
  36665. if (!isset($this->handler)) {
  36666. $this->handler = new DebugFlattenException();
  36667. }
  36668. if (!method_exists($this->handler, $method)) {
  36669. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
  36670. }
  36671. return call_user_func_array(array($this->handler, $method), $args);
  36672. }
  36673. }
  36674. namespace Symfony\Component\Debug\Exception;
  36675. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  36676. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  36677. class FlattenException extends LegacyFlattenException
  36678. {
  36679. private $message;
  36680. private $code;
  36681. private $previous;
  36682. private $trace;
  36683. private $class;
  36684. private $statusCode;
  36685. private $headers;
  36686. private $file;
  36687. private $line;
  36688. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  36689. {
  36690. $e = new static();
  36691. $e->setMessage($exception->getMessage());
  36692. $e->setCode($exception->getCode());
  36693. if ($exception instanceof HttpExceptionInterface) {
  36694. $statusCode = $exception->getStatusCode();
  36695. $headers = array_merge($headers, $exception->getHeaders());
  36696. }
  36697. if (null === $statusCode) {
  36698. $statusCode = 500;
  36699. }
  36700. $e->setStatusCode($statusCode);
  36701. $e->setHeaders($headers);
  36702. $e->setTraceFromException($exception);
  36703. $e->setClass(get_class($exception));
  36704. $e->setFile($exception->getFile());
  36705. $e->setLine($exception->getLine());
  36706. $previous = $exception->getPrevious();
  36707. if ($previous instanceof \Exception) {
  36708. $e->setPrevious(static::create($previous));
  36709. } elseif ($previous instanceof \Throwable) {
  36710. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  36711. }
  36712. return $e;
  36713. }
  36714. public function toArray()
  36715. {
  36716. $exceptions = array();
  36717. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  36718. $exceptions[] = array(
  36719. 'message' => $exception->getMessage(),
  36720. 'class' => $exception->getClass(),
  36721. 'trace' => $exception->getTrace(),
  36722. );
  36723. }
  36724. return $exceptions;
  36725. }
  36726. public function getStatusCode()
  36727. {
  36728. return $this->statusCode;
  36729. }
  36730. public function setStatusCode($code)
  36731. {
  36732. $this->statusCode = $code;
  36733. }
  36734. public function getHeaders()
  36735. {
  36736. return $this->headers;
  36737. }
  36738. public function setHeaders(array $headers)
  36739. {
  36740. $this->headers = $headers;
  36741. }
  36742. public function getClass()
  36743. {
  36744. return $this->class;
  36745. }
  36746. public function setClass($class)
  36747. {
  36748. $this->class = $class;
  36749. }
  36750. public function getFile()
  36751. {
  36752. return $this->file;
  36753. }
  36754. public function setFile($file)
  36755. {
  36756. $this->file = $file;
  36757. }
  36758. public function getLine()
  36759. {
  36760. return $this->line;
  36761. }
  36762. public function setLine($line)
  36763. {
  36764. $this->line = $line;
  36765. }
  36766. public function getMessage()
  36767. {
  36768. return $this->message;
  36769. }
  36770. public function setMessage($message)
  36771. {
  36772. $this->message = $message;
  36773. }
  36774. public function getCode()
  36775. {
  36776. return $this->code;
  36777. }
  36778. public function setCode($code)
  36779. {
  36780. $this->code = $code;
  36781. }
  36782. public function getPrevious()
  36783. {
  36784. return $this->previous;
  36785. }
  36786. public function setPrevious(FlattenException $previous)
  36787. {
  36788. $this->previous = $previous;
  36789. }
  36790. public function getAllPrevious()
  36791. {
  36792. $exceptions = array();
  36793. $e = $this;
  36794. while ($e = $e->getPrevious()) {
  36795. $exceptions[] = $e;
  36796. }
  36797. return $exceptions;
  36798. }
  36799. public function getTrace()
  36800. {
  36801. return $this->trace;
  36802. }
  36803. public function setTraceFromException(\Exception $exception)
  36804. {
  36805. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  36806. }
  36807. public function setTrace($trace, $file, $line)
  36808. {
  36809. $this->trace = array();
  36810. $this->trace[] = array(
  36811. 'namespace' => '',
  36812. 'short_class' => '',
  36813. 'class' => '',
  36814. 'type' => '',
  36815. 'function' => '',
  36816. 'file' => $file,
  36817. 'line' => $line,
  36818. 'args' => array(),
  36819. );
  36820. foreach ($trace as $entry) {
  36821. $class = '';
  36822. $namespace = '';
  36823. if (isset($entry['class'])) {
  36824. $parts = explode('\\', $entry['class']);
  36825. $class = array_pop($parts);
  36826. $namespace = implode('\\', $parts);
  36827. }
  36828. $this->trace[] = array(
  36829. 'namespace' => $namespace,
  36830. 'short_class' => $class,
  36831. 'class' => isset($entry['class']) ? $entry['class'] : '',
  36832. 'type' => isset($entry['type']) ? $entry['type'] : '',
  36833. 'function' => isset($entry['function']) ? $entry['function'] : null,
  36834. 'file' => isset($entry['file']) ? $entry['file'] : null,
  36835. 'line' => isset($entry['line']) ? $entry['line'] : null,
  36836. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  36837. );
  36838. }
  36839. }
  36840. private function flattenArgs($args, $level = 0, &$count = 0)
  36841. {
  36842. $result = array();
  36843. foreach ($args as $key => $value) {
  36844. if (++$count > 1e4) {
  36845. return array('array', '*SKIPPED over 10000 entries*');
  36846. }
  36847. if ($value instanceof \__PHP_Incomplete_Class) {
  36848. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  36849. } elseif (is_object($value)) {
  36850. $result[$key] = array('object', get_class($value));
  36851. } elseif (is_array($value)) {
  36852. if ($level > 10) {
  36853. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  36854. } else {
  36855. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  36856. }
  36857. } elseif (null === $value) {
  36858. $result[$key] = array('null', null);
  36859. } elseif (is_bool($value)) {
  36860. $result[$key] = array('boolean', $value);
  36861. } elseif (is_resource($value)) {
  36862. $result[$key] = array('resource', get_resource_type($value));
  36863. } else {
  36864. $result[$key] = array('string', (string) $value);
  36865. }
  36866. }
  36867. return $result;
  36868. }
  36869. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  36870. {
  36871. $array = new \ArrayObject($value);
  36872. return $array['__PHP_Incomplete_Class_Name'];
  36873. }
  36874. }
  36875. <?php
  36876. namespace Symfony\Component\Debug\Exception;
  36877. class OutOfMemoryException extends FatalErrorException
  36878. {
  36879. }
  36880. <?php
  36881. namespace Symfony\Component\Debug\Exception;
  36882. class UndefinedFunctionException extends FatalErrorException
  36883. {
  36884. public function __construct($message, \ErrorException $previous)
  36885. {
  36886. parent::__construct(
  36887. $message,
  36888. $previous->getCode(),
  36889. $previous->getSeverity(),
  36890. $previous->getFile(),
  36891. $previous->getLine(),
  36892. $previous->getPrevious()
  36893. );
  36894. $this->setTrace($previous->getTrace());
  36895. }
  36896. }
  36897. <?php
  36898. namespace Symfony\Component\Debug\Exception;
  36899. class UndefinedMethodException extends FatalErrorException
  36900. {
  36901. public function __construct($message, \ErrorException $previous)
  36902. {
  36903. parent::__construct(
  36904. $message,
  36905. $previous->getCode(),
  36906. $previous->getSeverity(),
  36907. $previous->getFile(),
  36908. $previous->getLine(),
  36909. $previous->getPrevious()
  36910. );
  36911. $this->setTrace($previous->getTrace());
  36912. }
  36913. }
  36914. <?php
  36915. namespace Symfony\Component\Debug;
  36916. use Symfony\Component\HttpFoundation\Response;
  36917. use Symfony\Component\Debug\Exception\FlattenException;
  36918. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  36919. class ExceptionHandler
  36920. {
  36921. private $debug;
  36922. private $charset;
  36923. private $handler;
  36924. private $caughtBuffer;
  36925. private $caughtLength;
  36926. private $fileLinkFormat;
  36927. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  36928. {
  36929. if (false !== strpos($charset, '%')) {
  36930. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since version 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  36931. $pivot = $fileLinkFormat;
  36932. $fileLinkFormat = $charset;
  36933. $charset = $pivot;
  36934. }
  36935. $this->debug = $debug;
  36936. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  36937. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  36938. }
  36939. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  36940. {
  36941. $handler = new static($debug, $charset, $fileLinkFormat);
  36942. $prev = set_exception_handler(array($handler, 'handle'));
  36943. if (is_array($prev) && $prev[0] instanceof ErrorHandler) {
  36944. restore_exception_handler();
  36945. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  36946. }
  36947. return $handler;
  36948. }
  36949. public function setHandler($handler)
  36950. {
  36951. if (null !== $handler && !is_callable($handler)) {
  36952. throw new \LogicException('The exception handler must be a valid PHP callable.');
  36953. }
  36954. $old = $this->handler;
  36955. $this->handler = $handler;
  36956. return $old;
  36957. }
  36958. public function setFileLinkFormat($format)
  36959. {
  36960. $old = $this->fileLinkFormat;
  36961. $this->fileLinkFormat = $format;
  36962. return $old;
  36963. }
  36964. public function handle(\Exception $exception)
  36965. {
  36966. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  36967. $this->failSafeHandle($exception);
  36968. return;
  36969. }
  36970. $caughtLength = $this->caughtLength = 0;
  36971. ob_start(array($this, 'catchOutput'));
  36972. $this->failSafeHandle($exception);
  36973. while (null === $this->caughtBuffer && ob_end_flush()) {
  36974. }
  36975. if (isset($this->caughtBuffer[0])) {
  36976. ob_start(array($this, 'cleanOutput'));
  36977. echo $this->caughtBuffer;
  36978. $caughtLength = ob_get_length();
  36979. }
  36980. $this->caughtBuffer = null;
  36981. try {
  36982. call_user_func($this->handler, $exception);
  36983. $this->caughtLength = $caughtLength;
  36984. } catch (\Exception $e) {
  36985. if (!$caughtLength) {
  36986. throw $exception;
  36987. }
  36988. }
  36989. }
  36990. private function failSafeHandle(\Exception $exception)
  36991. {
  36992. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  36993. && __CLASS__ !== get_class($this)
  36994. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  36995. && __CLASS__ !== $reflector->class
  36996. ) {
  36997. $response = $this->createResponse($exception);
  36998. $response->sendHeaders();
  36999. $response->sendContent();
  37000. @trigger_error(sprintf("The %s::createResponse method is deprecated since 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  37001. return;
  37002. }
  37003. $this->sendPhpResponse($exception);
  37004. }
  37005. public function sendPhpResponse($exception)
  37006. {
  37007. if (!$exception instanceof FlattenException) {
  37008. $exception = FlattenException::create($exception);
  37009. }
  37010. if (!headers_sent()) {
  37011. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  37012. foreach ($exception->getHeaders() as $name => $value) {
  37013. header($name.': '.$value, false);
  37014. }
  37015. header('Content-Type: text/html; charset='.$this->charset);
  37016. }
  37017. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  37018. }
  37019. public function createResponse($exception)
  37020. {
  37021. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37022. if (!$exception instanceof FlattenException) {
  37023. $exception = FlattenException::create($exception);
  37024. }
  37025. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  37026. }
  37027. public function getHtml($exception)
  37028. {
  37029. if (!$exception instanceof FlattenException) {
  37030. $exception = FlattenException::create($exception);
  37031. }
  37032. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  37033. }
  37034. public function getContent(FlattenException $exception)
  37035. {
  37036. switch ($exception->getStatusCode()) {
  37037. case 404:
  37038. $title = 'Sorry, the page you are looking for could not be found.';
  37039. break;
  37040. default:
  37041. $title = 'Whoops, looks like something went wrong.';
  37042. }
  37043. $content = '';
  37044. if ($this->debug) {
  37045. try {
  37046. $count = count($exception->getAllPrevious());
  37047. $total = $count + 1;
  37048. foreach ($exception->toArray() as $position => $e) {
  37049. $ind = $count - $position + 1;
  37050. $class = $this->formatClass($e['class']);
  37051. $message = nl2br($this->escapeHtml($e['message']));
  37052. $content .= sprintf(<<<'EOF'
  37053. <h2 class="block_exception clear_fix">
  37054. <span class="exception_counter">%d/%d</span>
  37055. <span class="exception_title">%s%s:</span>
  37056. <span class="exception_message">%s</span>
  37057. </h2>
  37058. <div class="block">
  37059. <ol class="traces list_exception">
  37060. EOF
  37061. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  37062. foreach ($e['trace'] as $trace) {
  37063. $content .= ' <li>';
  37064. if ($trace['function']) {
  37065. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  37066. }
  37067. if (isset($trace['file']) && isset($trace['line'])) {
  37068. $content .= $this->formatPath($trace['file'], $trace['line']);
  37069. }
  37070. $content .= "</li>\n";
  37071. }
  37072. $content .= " </ol>\n</div>\n";
  37073. }
  37074. } catch (\Exception $e) {
  37075. if ($this->debug) {
  37076. $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
  37077. } else {
  37078. $title = 'Whoops, looks like something went wrong.';
  37079. }
  37080. }
  37081. }
  37082. return <<<EOF
  37083. <div id="sf-resetcontent" class="sf-reset">
  37084. <h1>$title</h1>
  37085. $content
  37086. </div>
  37087. EOF;
  37088. }
  37089. public function getStylesheet(FlattenException $exception)
  37090. {
  37091. return <<<'EOF'
  37092. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  37093. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  37094. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  37095. .sf-reset .clear_fix { display:inline-block; }
  37096. .sf-reset * html .clear_fix { height:1%; }
  37097. .sf-reset .clear_fix { display:block; }
  37098. .sf-reset, .sf-reset .block { margin: auto }
  37099. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  37100. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  37101. .sf-reset strong { font-weight:bold; }
  37102. .sf-reset a { color:#6c6159; cursor: default; }
  37103. .sf-reset a img { border:none; }
  37104. .sf-reset a:hover { text-decoration:underline; }
  37105. .sf-reset em { font-style:italic; }
  37106. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  37107. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  37108. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  37109. .sf-reset .exception_message { margin-left: 3em; display: block; }
  37110. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  37111. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  37112. -webkit-border-bottom-right-radius: 16px;
  37113. -webkit-border-bottom-left-radius: 16px;
  37114. -moz-border-radius-bottomright: 16px;
  37115. -moz-border-radius-bottomleft: 16px;
  37116. border-bottom-right-radius: 16px;
  37117. border-bottom-left-radius: 16px;
  37118. border-bottom:1px solid #ccc;
  37119. border-right:1px solid #ccc;
  37120. border-left:1px solid #ccc;
  37121. word-wrap: break-word;
  37122. }
  37123. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  37124. -webkit-border-top-left-radius: 16px;
  37125. -webkit-border-top-right-radius: 16px;
  37126. -moz-border-radius-topleft: 16px;
  37127. -moz-border-radius-topright: 16px;
  37128. border-top-left-radius: 16px;
  37129. border-top-right-radius: 16px;
  37130. border-top:1px solid #ccc;
  37131. border-right:1px solid #ccc;
  37132. border-left:1px solid #ccc;
  37133. overflow: hidden;
  37134. word-wrap: break-word;
  37135. }
  37136. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  37137. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  37138. .sf-reset ol { padding: 10px 0; }
  37139. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  37140. -webkit-border-radius: 10px;
  37141. -moz-border-radius: 10px;
  37142. border-radius: 10px;
  37143. border: 1px solid #ccc;
  37144. }
  37145. EOF;
  37146. }
  37147. private function decorate($content, $css)
  37148. {
  37149. return <<<EOF
  37150. <!DOCTYPE html>
  37151. <html>
  37152. <head>
  37153. <meta charset="{$this->charset}" />
  37154. <meta name="robots" content="noindex,nofollow" />
  37155. <style>
  37156. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  37157. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  37158. html { background: #eee; padding: 10px }
  37159. img { border: 0; }
  37160. #sf-resetcontent { width:970px; margin:0 auto; }
  37161. $css
  37162. </style>
  37163. </head>
  37164. <body>
  37165. $content
  37166. </body>
  37167. </html>
  37168. EOF;
  37169. }
  37170. private function formatClass($class)
  37171. {
  37172. $parts = explode('\\', $class);
  37173. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  37174. }
  37175. private function formatPath($path, $line)
  37176. {
  37177. $path = $this->escapeHtml($path);
  37178. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  37179. if ($linkFormat = $this->fileLinkFormat) {
  37180. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  37181. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  37182. }
  37183. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  37184. }
  37185. private function formatArgs(array $args)
  37186. {
  37187. $result = array();
  37188. foreach ($args as $key => $item) {
  37189. if ('object' === $item[0]) {
  37190. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  37191. } elseif ('array' === $item[0]) {
  37192. $formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  37193. } elseif ('string' === $item[0]) {
  37194. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  37195. } elseif ('null' === $item[0]) {
  37196. $formattedValue = '<em>null</em>';
  37197. } elseif ('boolean' === $item[0]) {
  37198. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  37199. } elseif ('resource' === $item[0]) {
  37200. $formattedValue = '<em>resource</em>';
  37201. } else {
  37202. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  37203. }
  37204. $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
  37205. }
  37206. return implode(', ', $result);
  37207. }
  37208. protected static function utf8Htmlize($str)
  37209. {
  37210. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  37211. return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  37212. }
  37213. private function escapeHtml($str)
  37214. {
  37215. return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  37216. }
  37217. public function catchOutput($buffer)
  37218. {
  37219. $this->caughtBuffer = $buffer;
  37220. return '';
  37221. }
  37222. public function cleanOutput($buffer)
  37223. {
  37224. if ($this->caughtLength) {
  37225. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  37226. if (isset($cleanBuffer[0])) {
  37227. $buffer = $cleanBuffer;
  37228. }
  37229. }
  37230. return $buffer;
  37231. }
  37232. }
  37233. <?php
  37234. namespace Symfony\Component\Debug\FatalErrorHandler;
  37235. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  37236. use Symfony\Component\Debug\Exception\FatalErrorException;
  37237. use Symfony\Component\Debug\DebugClassLoader;
  37238. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  37239. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  37240. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  37241. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  37242. {
  37243. public function handleError(array $error, FatalErrorException $exception)
  37244. {
  37245. $messageLen = strlen($error['message']);
  37246. $notFoundSuffix = '\' not found';
  37247. $notFoundSuffixLen = strlen($notFoundSuffix);
  37248. if ($notFoundSuffixLen > $messageLen) {
  37249. return;
  37250. }
  37251. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  37252. return;
  37253. }
  37254. foreach (array('class', 'interface', 'trait') as $typeName) {
  37255. $prefix = ucfirst($typeName).' \'';
  37256. $prefixLen = strlen($prefix);
  37257. if (0 !== strpos($error['message'], $prefix)) {
  37258. continue;
  37259. }
  37260. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  37261. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  37262. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  37263. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  37264. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  37265. $tail = ' for another namespace?';
  37266. } else {
  37267. $className = $fullyQualifiedClassName;
  37268. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  37269. $tail = '?';
  37270. }
  37271. if ($candidates = $this->getClassCandidates($className)) {
  37272. $tail = array_pop($candidates).'"?';
  37273. if ($candidates) {
  37274. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  37275. } else {
  37276. $tail = ' for "'.$tail;
  37277. }
  37278. }
  37279. $message .= "\nDid you forget a \"use\" statement".$tail;
  37280. return new ClassNotFoundException($message, $exception);
  37281. }
  37282. }
  37283. private function getClassCandidates($class)
  37284. {
  37285. if (!is_array($functions = spl_autoload_functions())) {
  37286. return array();
  37287. }
  37288. $classes = array();
  37289. foreach ($functions as $function) {
  37290. if (!is_array($function)) {
  37291. continue;
  37292. }
  37293. if ($function[0] instanceof DebugClassLoader) {
  37294. $function = $function[0]->getClassLoader();
  37295. if (is_object($function)) {
  37296. $function = array($function);
  37297. }
  37298. if (!is_array($function)) {
  37299. continue;
  37300. }
  37301. }
  37302. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  37303. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  37304. foreach ($paths as $path) {
  37305. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  37306. }
  37307. }
  37308. }
  37309. if ($function[0] instanceof ComposerClassLoader) {
  37310. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  37311. foreach ($paths as $path) {
  37312. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  37313. }
  37314. }
  37315. }
  37316. }
  37317. return array_unique($classes);
  37318. }
  37319. private function findClassInPath($path, $class, $prefix)
  37320. {
  37321. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  37322. return array();
  37323. }
  37324. $classes = array();
  37325. $filename = $class.'.php';
  37326. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  37327. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  37328. $classes[] = $class;
  37329. }
  37330. }
  37331. return $classes;
  37332. }
  37333. private function convertFileToClass($path, $file, $prefix)
  37334. {
  37335. $candidates = array(
  37336. $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  37337. $prefix.$namespacedClass,
  37338. $prefix.'\\'.$namespacedClass,
  37339. str_replace('\\', '_', $namespacedClass),
  37340. str_replace('\\', '_', $prefix.$namespacedClass),
  37341. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  37342. );
  37343. if ($prefix) {
  37344. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  37345. }
  37346. foreach ($candidates as $candidate) {
  37347. if ($this->classExists($candidate)) {
  37348. return $candidate;
  37349. }
  37350. }
  37351. require_once $file;
  37352. foreach ($candidates as $candidate) {
  37353. if ($this->classExists($candidate)) {
  37354. return $candidate;
  37355. }
  37356. }
  37357. }
  37358. private function classExists($class)
  37359. {
  37360. return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  37361. }
  37362. }
  37363. <?php
  37364. namespace Symfony\Component\Debug\FatalErrorHandler;
  37365. use Symfony\Component\Debug\Exception\FatalErrorException;
  37366. interface FatalErrorHandlerInterface
  37367. {
  37368. public function handleError(array $error, FatalErrorException $exception);
  37369. }
  37370. <?php
  37371. namespace Symfony\Component\Debug\FatalErrorHandler;
  37372. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  37373. use Symfony\Component\Debug\Exception\FatalErrorException;
  37374. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  37375. {
  37376. public function handleError(array $error, FatalErrorException $exception)
  37377. {
  37378. $messageLen = strlen($error['message']);
  37379. $notFoundSuffix = '()';
  37380. $notFoundSuffixLen = strlen($notFoundSuffix);
  37381. if ($notFoundSuffixLen > $messageLen) {
  37382. return;
  37383. }
  37384. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  37385. return;
  37386. }
  37387. $prefix = 'Call to undefined function ';
  37388. $prefixLen = strlen($prefix);
  37389. if (0 !== strpos($error['message'], $prefix)) {
  37390. return;
  37391. }
  37392. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  37393. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  37394. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  37395. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  37396. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  37397. } else {
  37398. $functionName = $fullyQualifiedFunctionName;
  37399. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  37400. }
  37401. $candidates = array();
  37402. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  37403. foreach ($definedFunctionNames as $definedFunctionName) {
  37404. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  37405. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  37406. } else {
  37407. $definedFunctionNameBasename = $definedFunctionName;
  37408. }
  37409. if ($definedFunctionNameBasename === $functionName) {
  37410. $candidates[] = '\\'.$definedFunctionName;
  37411. }
  37412. }
  37413. }
  37414. if ($candidates) {
  37415. sort($candidates);
  37416. $last = array_pop($candidates).'"?';
  37417. if ($candidates) {
  37418. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  37419. } else {
  37420. $candidates = '"'.$last;
  37421. }
  37422. $message .= "\nDid you mean to call ".$candidates;
  37423. }
  37424. return new UndefinedFunctionException($message, $exception);
  37425. }
  37426. }
  37427. <?php
  37428. namespace Symfony\Component\Debug\FatalErrorHandler;
  37429. use Symfony\Component\Debug\Exception\FatalErrorException;
  37430. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  37431. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  37432. {
  37433. public function handleError(array $error, FatalErrorException $exception)
  37434. {
  37435. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  37436. if (!$matches) {
  37437. return;
  37438. }
  37439. $className = $matches[1];
  37440. $methodName = $matches[2];
  37441. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  37442. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  37443. return new UndefinedMethodException($message, $exception);
  37444. }
  37445. $candidates = array();
  37446. foreach ($methods as $definedMethodName) {
  37447. $lev = levenshtein($methodName, $definedMethodName);
  37448. if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  37449. $candidates[] = $definedMethodName;
  37450. }
  37451. }
  37452. if ($candidates) {
  37453. sort($candidates);
  37454. $last = array_pop($candidates).'"?';
  37455. if ($candidates) {
  37456. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  37457. } else {
  37458. $candidates = '"'.$last;
  37459. }
  37460. $message .= "\nDid you mean to call ".$candidates;
  37461. }
  37462. return new UndefinedMethodException($message, $exception);
  37463. }
  37464. }
  37465. Copyright (c) 2004-2017 Fabien Potencier
  37466. Permission is hereby granted, free of charge, to any person obtaining a copy
  37467. of this software and associated documentation files (the "Software"), to deal
  37468. in the Software without restriction, including without limitation the rights
  37469. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  37470. copies of the Software, and to permit persons to whom the Software is furnished
  37471. to do so, subject to the following conditions:
  37472. The above copyright notice and this permission notice shall be included in all
  37473. copies or substantial portions of the Software.
  37474. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37475. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  37476. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37477. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  37478. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  37479. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  37480. THE SOFTWARE.
  37481. <?php
  37482. namespace Symfony\Component\Filesystem\Exception;
  37483. interface ExceptionInterface
  37484. {
  37485. }
  37486. <?php
  37487. namespace Symfony\Component\Filesystem\Exception;
  37488. class FileNotFoundException extends IOException
  37489. {
  37490. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  37491. {
  37492. if (null === $message) {
  37493. if (null === $path) {
  37494. $message = 'File could not be found.';
  37495. } else {
  37496. $message = sprintf('File "%s" could not be found.', $path);
  37497. }
  37498. }
  37499. parent::__construct($message, $code, $previous, $path);
  37500. }
  37501. }
  37502. <?php
  37503. namespace Symfony\Component\Filesystem\Exception;
  37504. class IOException extends \RuntimeException implements IOExceptionInterface
  37505. {
  37506. private $path;
  37507. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  37508. {
  37509. $this->path = $path;
  37510. parent::__construct($message, $code, $previous);
  37511. }
  37512. public function getPath()
  37513. {
  37514. return $this->path;
  37515. }
  37516. }
  37517. <?php
  37518. namespace Symfony\Component\Filesystem\Exception;
  37519. interface IOExceptionInterface extends ExceptionInterface
  37520. {
  37521. public function getPath();
  37522. }
  37523. <?php
  37524. namespace Symfony\Component\Filesystem;
  37525. use Symfony\Component\Filesystem\Exception\IOException;
  37526. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  37527. class Filesystem
  37528. {
  37529. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  37530. {
  37531. if (stream_is_local($originFile) && !is_file($originFile)) {
  37532. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  37533. }
  37534. $this->mkdir(dirname($targetFile));
  37535. $doCopy = true;
  37536. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  37537. $doCopy = filemtime($originFile) > filemtime($targetFile);
  37538. }
  37539. if ($doCopy) {
  37540. if (false === $source = @fopen($originFile, 'r')) {
  37541. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  37542. }
  37543. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  37544. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  37545. }
  37546. $bytesCopied = stream_copy_to_stream($source, $target);
  37547. fclose($source);
  37548. fclose($target);
  37549. unset($source, $target);
  37550. if (!is_file($targetFile)) {
  37551. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  37552. }
  37553. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  37554. if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) {
  37555. 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);
  37556. }
  37557. }
  37558. }
  37559. public function mkdir($dirs, $mode = 0777)
  37560. {
  37561. foreach ($this->toIterator($dirs) as $dir) {
  37562. if (is_dir($dir)) {
  37563. continue;
  37564. }
  37565. if (true !== @mkdir($dir, $mode, true)) {
  37566. $error = error_get_last();
  37567. if (!is_dir($dir)) {
  37568. if ($error) {
  37569. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir);
  37570. }
  37571. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  37572. }
  37573. }
  37574. }
  37575. }
  37576. public function exists($files)
  37577. {
  37578. foreach ($this->toIterator($files) as $file) {
  37579. if ('\\' === DIRECTORY_SEPARATOR && strlen($file) > 258) {
  37580. throw new IOException('Could not check if file exist because path length exceeds 258 characters.', 0, null, $file);
  37581. }
  37582. if (!file_exists($file)) {
  37583. return false;
  37584. }
  37585. }
  37586. return true;
  37587. }
  37588. public function touch($files, $time = null, $atime = null)
  37589. {
  37590. foreach ($this->toIterator($files) as $file) {
  37591. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  37592. if (true !== $touch) {
  37593. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  37594. }
  37595. }
  37596. }
  37597. public function remove($files)
  37598. {
  37599. if ($files instanceof \Traversable) {
  37600. $files = iterator_to_array($files, false);
  37601. } elseif (!is_array($files)) {
  37602. $files = array($files);
  37603. }
  37604. $files = array_reverse($files);
  37605. foreach ($files as $file) {
  37606. if (is_link($file)) {
  37607. if (!@(unlink($file) || '\\' !== DIRECTORY_SEPARATOR || rmdir($file)) && file_exists($file)) {
  37608. $error = error_get_last();
  37609. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, $error['message']));
  37610. }
  37611. } elseif (is_dir($file)) {
  37612. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  37613. if (!@rmdir($file) && file_exists($file)) {
  37614. $error = error_get_last();
  37615. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, $error['message']));
  37616. }
  37617. } elseif (!@unlink($file) && file_exists($file)) {
  37618. $error = error_get_last();
  37619. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, $error['message']));
  37620. }
  37621. }
  37622. }
  37623. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  37624. {
  37625. foreach ($this->toIterator($files) as $file) {
  37626. if (true !== @chmod($file, $mode & ~$umask)) {
  37627. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  37628. }
  37629. if ($recursive && is_dir($file) && !is_link($file)) {
  37630. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  37631. }
  37632. }
  37633. }
  37634. public function chown($files, $user, $recursive = false)
  37635. {
  37636. foreach ($this->toIterator($files) as $file) {
  37637. if ($recursive && is_dir($file) && !is_link($file)) {
  37638. $this->chown(new \FilesystemIterator($file), $user, true);
  37639. }
  37640. if (is_link($file) && function_exists('lchown')) {
  37641. if (true !== @lchown($file, $user)) {
  37642. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  37643. }
  37644. } else {
  37645. if (true !== @chown($file, $user)) {
  37646. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  37647. }
  37648. }
  37649. }
  37650. }
  37651. public function chgrp($files, $group, $recursive = false)
  37652. {
  37653. foreach ($this->toIterator($files) as $file) {
  37654. if ($recursive && is_dir($file) && !is_link($file)) {
  37655. $this->chgrp(new \FilesystemIterator($file), $group, true);
  37656. }
  37657. if (is_link($file) && function_exists('lchgrp')) {
  37658. if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  37659. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  37660. }
  37661. } else {
  37662. if (true !== @chgrp($file, $group)) {
  37663. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  37664. }
  37665. }
  37666. }
  37667. }
  37668. public function rename($origin, $target, $overwrite = false)
  37669. {
  37670. if (!$overwrite && $this->isReadable($target)) {
  37671. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  37672. }
  37673. if (true !== @rename($origin, $target)) {
  37674. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  37675. }
  37676. }
  37677. private function isReadable($filename)
  37678. {
  37679. if ('\\' === DIRECTORY_SEPARATOR && strlen($filename) > 258) {
  37680. throw new IOException('Could not check if file is readable because path length exceeds 258 characters.', 0, null, $filename);
  37681. }
  37682. return is_readable($filename);
  37683. }
  37684. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  37685. {
  37686. if ('\\' === DIRECTORY_SEPARATOR) {
  37687. $originDir = strtr($originDir, '/', '\\');
  37688. $targetDir = strtr($targetDir, '/', '\\');
  37689. if ($copyOnWindows) {
  37690. $this->mirror($originDir, $targetDir);
  37691. return;
  37692. }
  37693. }
  37694. $this->mkdir(dirname($targetDir));
  37695. $ok = false;
  37696. if (is_link($targetDir)) {
  37697. if (readlink($targetDir) != $originDir) {
  37698. $this->remove($targetDir);
  37699. } else {
  37700. $ok = true;
  37701. }
  37702. }
  37703. if (!$ok && true !== @symlink($originDir, $targetDir)) {
  37704. $report = error_get_last();
  37705. if (is_array($report)) {
  37706. if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) {
  37707. 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);
  37708. }
  37709. }
  37710. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  37711. }
  37712. }
  37713. public function makePathRelative($endPath, $startPath)
  37714. {
  37715. if ('\\' === DIRECTORY_SEPARATOR) {
  37716. $endPath = str_replace('\\', '/', $endPath);
  37717. $startPath = str_replace('\\', '/', $startPath);
  37718. }
  37719. $startPathArr = explode('/', trim($startPath, '/'));
  37720. $endPathArr = explode('/', trim($endPath, '/'));
  37721. $index = 0;
  37722. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  37723. ++$index;
  37724. }
  37725. if (count($startPathArr) === 1 && $startPathArr[0] === '') {
  37726. $depth = 0;
  37727. } else {
  37728. $depth = count($startPathArr) - $index;
  37729. }
  37730. if ('/' === $startPath[0] && 0 === $index && 0 === $depth) {
  37731. $traverser = '';
  37732. } else {
  37733. $traverser = str_repeat('../', $depth);
  37734. }
  37735. $endPathRemainder = implode('/', array_slice($endPathArr, $index));
  37736. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  37737. return '' === $relativePath ? './' : $relativePath;
  37738. }
  37739. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  37740. {
  37741. $targetDir = rtrim($targetDir, '/\\');
  37742. $originDir = rtrim($originDir, '/\\');
  37743. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  37744. $deleteIterator = $iterator;
  37745. if (null === $deleteIterator) {
  37746. $flags = \FilesystemIterator::SKIP_DOTS;
  37747. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  37748. }
  37749. foreach ($deleteIterator as $file) {
  37750. $origin = str_replace($targetDir, $originDir, $file->getPathname());
  37751. if (!$this->exists($origin)) {
  37752. $this->remove($file);
  37753. }
  37754. }
  37755. }
  37756. $copyOnWindows = false;
  37757. if (isset($options['copy_on_windows'])) {
  37758. $copyOnWindows = $options['copy_on_windows'];
  37759. }
  37760. if (null === $iterator) {
  37761. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  37762. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  37763. }
  37764. if ($this->exists($originDir)) {
  37765. $this->mkdir($targetDir);
  37766. }
  37767. foreach ($iterator as $file) {
  37768. $target = str_replace($originDir, $targetDir, $file->getPathname());
  37769. if ($copyOnWindows) {
  37770. if (is_file($file)) {
  37771. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  37772. } elseif (is_dir($file)) {
  37773. $this->mkdir($target);
  37774. } else {
  37775. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  37776. }
  37777. } else {
  37778. if (is_link($file)) {
  37779. $this->symlink($file->getLinkTarget(), $target);
  37780. } elseif (is_dir($file)) {
  37781. $this->mkdir($target);
  37782. } elseif (is_file($file)) {
  37783. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  37784. } else {
  37785. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  37786. }
  37787. }
  37788. }
  37789. }
  37790. public function isAbsolutePath($file)
  37791. {
  37792. return strspn($file, '/\\', 0, 1)
  37793. || (strlen($file) > 3 && ctype_alpha($file[0])
  37794. && substr($file, 1, 1) === ':'
  37795. && strspn($file, '/\\', 2, 1)
  37796. )
  37797. || null !== parse_url($file, PHP_URL_SCHEME)
  37798. ;
  37799. }
  37800. public function tempnam($dir, $prefix)
  37801. {
  37802. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  37803. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  37804. $tmpFile = @tempnam($hierarchy, $prefix);
  37805. if (false !== $tmpFile) {
  37806. if (null !== $scheme && 'gs' !== $scheme) {
  37807. return $scheme.'://'.$tmpFile;
  37808. }
  37809. return $tmpFile;
  37810. }
  37811. throw new IOException('A temporary file could not be created.');
  37812. }
  37813. for ($i = 0; $i < 10; ++$i) {
  37814. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  37815. $handle = @fopen($tmpFile, 'x+');
  37816. if (false === $handle) {
  37817. continue;
  37818. }
  37819. @fclose($handle);
  37820. return $tmpFile;
  37821. }
  37822. throw new IOException('A temporary file could not be created.');
  37823. }
  37824. public function dumpFile($filename, $content, $mode = 0666)
  37825. {
  37826. $dir = dirname($filename);
  37827. if (!is_dir($dir)) {
  37828. $this->mkdir($dir);
  37829. }
  37830. if (!is_writable($dir)) {
  37831. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  37832. }
  37833. $tmpFile = $this->tempnam($dir, basename($filename));
  37834. if (false === @file_put_contents($tmpFile, $content)) {
  37835. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  37836. }
  37837. if (null !== $mode) {
  37838. if (func_num_args() > 2) {
  37839. @trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  37840. }
  37841. $this->chmod($tmpFile, $mode);
  37842. }
  37843. $this->rename($tmpFile, $filename, true);
  37844. }
  37845. private function toIterator($files)
  37846. {
  37847. if (!$files instanceof \Traversable) {
  37848. $files = new \ArrayObject(is_array($files) ? $files : array($files));
  37849. }
  37850. return $files;
  37851. }
  37852. private function getSchemeAndHierarchy($filename)
  37853. {
  37854. $components = explode('://', $filename, 2);
  37855. return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  37856. }
  37857. }
  37858. Copyright (c) 2004-2017 Fabien Potencier
  37859. Permission is hereby granted, free of charge, to any person obtaining a copy
  37860. of this software and associated documentation files (the "Software"), to deal
  37861. in the Software without restriction, including without limitation the rights
  37862. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  37863. copies of the Software, and to permit persons to whom the Software is furnished
  37864. to do so, subject to the following conditions:
  37865. The above copyright notice and this permission notice shall be included in all
  37866. copies or substantial portions of the Software.
  37867. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37868. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  37869. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37870. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  37871. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  37872. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  37873. THE SOFTWARE.
  37874. <?php
  37875. namespace Symfony\Component\Filesystem;
  37876. use Symfony\Component\Filesystem\Exception\IOException;
  37877. class LockHandler
  37878. {
  37879. private $file;
  37880. private $handle;
  37881. public function __construct($name, $lockPath = null)
  37882. {
  37883. $lockPath = $lockPath ?: sys_get_temp_dir();
  37884. if (!is_dir($lockPath)) {
  37885. $fs = new Filesystem();
  37886. $fs->mkdir($lockPath);
  37887. }
  37888. if (!is_writable($lockPath)) {
  37889. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  37890. }
  37891. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  37892. }
  37893. public function lock($blocking = false)
  37894. {
  37895. if ($this->handle) {
  37896. return true;
  37897. }
  37898. set_error_handler(function () {});
  37899. if (!$this->handle = fopen($this->file, 'r')) {
  37900. if ($this->handle = fopen($this->file, 'x')) {
  37901. chmod($this->file, 0444);
  37902. } elseif (!$this->handle = fopen($this->file, 'r')) {
  37903. usleep(100);
  37904. $this->handle = fopen($this->file, 'r');
  37905. }
  37906. }
  37907. restore_error_handler();
  37908. if (!$this->handle) {
  37909. $error = error_get_last();
  37910. throw new IOException($error['message'], 0, null, $this->file);
  37911. }
  37912. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  37913. fclose($this->handle);
  37914. $this->handle = null;
  37915. return false;
  37916. }
  37917. return true;
  37918. }
  37919. public function release()
  37920. {
  37921. if ($this->handle) {
  37922. flock($this->handle, LOCK_UN | LOCK_NB);
  37923. fclose($this->handle);
  37924. $this->handle = null;
  37925. }
  37926. }
  37927. }
  37928. <?php
  37929. namespace Symfony\Component\Finder\Adapter;
  37930. @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);
  37931. abstract class AbstractAdapter implements AdapterInterface
  37932. {
  37933. protected $followLinks = false;
  37934. protected $mode = 0;
  37935. protected $minDepth = 0;
  37936. protected $maxDepth = PHP_INT_MAX;
  37937. protected $exclude = array();
  37938. protected $names = array();
  37939. protected $notNames = array();
  37940. protected $contains = array();
  37941. protected $notContains = array();
  37942. protected $sizes = array();
  37943. protected $dates = array();
  37944. protected $filters = array();
  37945. protected $sort = false;
  37946. protected $paths = array();
  37947. protected $notPaths = array();
  37948. protected $ignoreUnreadableDirs = false;
  37949. private static $areSupported = array();
  37950. public function isSupported()
  37951. {
  37952. $name = $this->getName();
  37953. if (!array_key_exists($name, self::$areSupported)) {
  37954. self::$areSupported[$name] = $this->canBeUsed();
  37955. }
  37956. return self::$areSupported[$name];
  37957. }
  37958. public function setFollowLinks($followLinks)
  37959. {
  37960. $this->followLinks = $followLinks;
  37961. return $this;
  37962. }
  37963. public function setMode($mode)
  37964. {
  37965. $this->mode = $mode;
  37966. return $this;
  37967. }
  37968. public function setDepths(array $depths)
  37969. {
  37970. $this->minDepth = 0;
  37971. $this->maxDepth = PHP_INT_MAX;
  37972. foreach ($depths as $comparator) {
  37973. switch ($comparator->getOperator()) {
  37974. case '>':
  37975. $this->minDepth = $comparator->getTarget() + 1;
  37976. break;
  37977. case '>=':
  37978. $this->minDepth = $comparator->getTarget();
  37979. break;
  37980. case '<':
  37981. $this->maxDepth = $comparator->getTarget() - 1;
  37982. break;
  37983. case '<=':
  37984. $this->maxDepth = $comparator->getTarget();
  37985. break;
  37986. default:
  37987. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  37988. }
  37989. }
  37990. return $this;
  37991. }
  37992. public function setExclude(array $exclude)
  37993. {
  37994. $this->exclude = $exclude;
  37995. return $this;
  37996. }
  37997. public function setNames(array $names)
  37998. {
  37999. $this->names = $names;
  38000. return $this;
  38001. }
  38002. public function setNotNames(array $notNames)
  38003. {
  38004. $this->notNames = $notNames;
  38005. return $this;
  38006. }
  38007. public function setContains(array $contains)
  38008. {
  38009. $this->contains = $contains;
  38010. return $this;
  38011. }
  38012. public function setNotContains(array $notContains)
  38013. {
  38014. $this->notContains = $notContains;
  38015. return $this;
  38016. }
  38017. public function setSizes(array $sizes)
  38018. {
  38019. $this->sizes = $sizes;
  38020. return $this;
  38021. }
  38022. public function setDates(array $dates)
  38023. {
  38024. $this->dates = $dates;
  38025. return $this;
  38026. }
  38027. public function setFilters(array $filters)
  38028. {
  38029. $this->filters = $filters;
  38030. return $this;
  38031. }
  38032. public function setSort($sort)
  38033. {
  38034. $this->sort = $sort;
  38035. return $this;
  38036. }
  38037. public function setPath(array $paths)
  38038. {
  38039. $this->paths = $paths;
  38040. return $this;
  38041. }
  38042. public function setNotPath(array $notPaths)
  38043. {
  38044. $this->notPaths = $notPaths;
  38045. return $this;
  38046. }
  38047. public function ignoreUnreadableDirs($ignore = true)
  38048. {
  38049. $this->ignoreUnreadableDirs = (bool) $ignore;
  38050. return $this;
  38051. }
  38052. abstract protected function canBeUsed();
  38053. }
  38054. <?php
  38055. namespace Symfony\Component\Finder\Adapter;
  38056. @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);
  38057. use Symfony\Component\Finder\Exception\AccessDeniedException;
  38058. use Symfony\Component\Finder\Iterator;
  38059. use Symfony\Component\Finder\Shell\Shell;
  38060. use Symfony\Component\Finder\Expression\Expression;
  38061. use Symfony\Component\Finder\Shell\Command;
  38062. use Symfony\Component\Finder\Comparator\NumberComparator;
  38063. use Symfony\Component\Finder\Comparator\DateComparator;
  38064. abstract class AbstractFindAdapter extends AbstractAdapter
  38065. {
  38066. protected $shell;
  38067. public function __construct()
  38068. {
  38069. $this->shell = new Shell();
  38070. }
  38071. public function searchInDirectory($dir)
  38072. {
  38073. $dir = realpath($dir);
  38074. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  38075. return new Iterator\FilePathsIterator(array(), $dir);
  38076. }
  38077. $command = Command::create();
  38078. $find = $this->buildFindCommand($command, $dir);
  38079. if ($this->followLinks) {
  38080. $find->add('-follow');
  38081. }
  38082. $find->add('-mindepth')->add($this->minDepth + 1);
  38083. if (PHP_INT_MAX !== $this->maxDepth) {
  38084. $find->add('-maxdepth')->add($this->maxDepth + 1);
  38085. }
  38086. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  38087. $find->add('-type d');
  38088. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  38089. $find->add('-type f');
  38090. }
  38091. $this->buildNamesFiltering($find, $this->names);
  38092. $this->buildNamesFiltering($find, $this->notNames, true);
  38093. $this->buildPathsFiltering($find, $dir, $this->paths);
  38094. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  38095. $this->buildSizesFiltering($find, $this->sizes);
  38096. $this->buildDatesFiltering($find, $this->dates);
  38097. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  38098. $useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  38099. if ($useGrep && ($this->contains || $this->notContains)) {
  38100. $grep = $command->ins('grep');
  38101. $this->buildContentFiltering($grep, $this->contains);
  38102. $this->buildContentFiltering($grep, $this->notContains, true);
  38103. }
  38104. if ($useSort) {
  38105. $this->buildSorting($command, $this->sort);
  38106. }
  38107. $command->setErrorHandler(
  38108. $this->ignoreUnreadableDirs
  38109. ? function ($stderr) { }
  38110. : function ($stderr) { throw new AccessDeniedException($stderr); }
  38111. );
  38112. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  38113. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  38114. if ($this->exclude) {
  38115. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  38116. }
  38117. if (!$useGrep && ($this->contains || $this->notContains)) {
  38118. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  38119. }
  38120. if ($this->filters) {
  38121. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  38122. }
  38123. if (!$useSort && $this->sort) {
  38124. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  38125. $iterator = $iteratorAggregate->getIterator();
  38126. }
  38127. return $iterator;
  38128. }
  38129. protected function canBeUsed()
  38130. {
  38131. return $this->shell->testCommand('find');
  38132. }
  38133. protected function buildFindCommand(Command $command, $dir)
  38134. {
  38135. return $command
  38136. ->ins('find')
  38137. ->add('find ')
  38138. ->arg($dir)
  38139. ->add('-noleaf');
  38140. }
  38141. private function buildNamesFiltering(Command $command, array $names, $not = false)
  38142. {
  38143. if (0 === count($names)) {
  38144. return;
  38145. }
  38146. $command->add($not ? '-not' : null)->cmd('(');
  38147. foreach ($names as $i => $name) {
  38148. $expr = Expression::create($name);
  38149. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  38150. $expr = Expression::create($expr->getGlob()->toRegex(false));
  38151. }
  38152. if ($expr->isRegex()) {
  38153. $regex = $expr->getRegex();
  38154. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  38155. ->setStartFlag(false)
  38156. ->setStartJoker(true)
  38157. ->replaceJokers('[^/]');
  38158. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  38159. $regex->setEndJoker(false)->append('[^/]*');
  38160. }
  38161. }
  38162. $command
  38163. ->add($i > 0 ? '-or' : null)
  38164. ->add($expr->isRegex()
  38165. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  38166. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  38167. )
  38168. ->arg($expr->renderPattern());
  38169. }
  38170. $command->cmd(')');
  38171. }
  38172. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  38173. {
  38174. if (0 === count($paths)) {
  38175. return;
  38176. }
  38177. $command->add($not ? '-not' : null)->cmd('(');
  38178. foreach ($paths as $i => $path) {
  38179. $expr = Expression::create($path);
  38180. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  38181. $expr = Expression::create($expr->getGlob()->toRegex(false));
  38182. }
  38183. if ($expr->isRegex()) {
  38184. $regex = $expr->getRegex();
  38185. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  38186. } else {
  38187. $expr->prepend('*')->append('*');
  38188. }
  38189. $command
  38190. ->add($i > 0 ? '-or' : null)
  38191. ->add($expr->isRegex()
  38192. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  38193. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  38194. )
  38195. ->arg($expr->renderPattern());
  38196. }
  38197. $command->cmd(')');
  38198. }
  38199. private function buildSizesFiltering(Command $command, array $sizes)
  38200. {
  38201. foreach ($sizes as $i => $size) {
  38202. $command->add($i > 0 ? '-and' : null);
  38203. switch ($size->getOperator()) {
  38204. case '<=':
  38205. $command->add('-size -'.($size->getTarget() + 1).'c');
  38206. break;
  38207. case '>=':
  38208. $command->add('-size +'.($size->getTarget() - 1).'c');
  38209. break;
  38210. case '>':
  38211. $command->add('-size +'.$size->getTarget().'c');
  38212. break;
  38213. case '!=':
  38214. $command->add('-size -'.$size->getTarget().'c');
  38215. $command->add('-size +'.$size->getTarget().'c');
  38216. break;
  38217. case '<':
  38218. default:
  38219. $command->add('-size -'.$size->getTarget().'c');
  38220. }
  38221. }
  38222. }
  38223. private function buildDatesFiltering(Command $command, array $dates)
  38224. {
  38225. foreach ($dates as $i => $date) {
  38226. $command->add($i > 0 ? '-and' : null);
  38227. $mins = (int) round((time() - $date->getTarget()) / 60);
  38228. if (0 > $mins) {
  38229. $command->add(' -mmin -0');
  38230. return;
  38231. }
  38232. switch ($date->getOperator()) {
  38233. case '<=':
  38234. $command->add('-mmin +'.($mins - 1));
  38235. break;
  38236. case '>=':
  38237. $command->add('-mmin -'.($mins + 1));
  38238. break;
  38239. case '>':
  38240. $command->add('-mmin -'.$mins);
  38241. break;
  38242. case '!=':
  38243. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  38244. break;
  38245. case '<':
  38246. default:
  38247. $command->add('-mmin +'.$mins);
  38248. }
  38249. }
  38250. }
  38251. private function buildSorting(Command $command, $sort)
  38252. {
  38253. $this->buildFormatSorting($command, $sort);
  38254. }
  38255. abstract protected function buildFormatSorting(Command $command, $sort);
  38256. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  38257. }
  38258. <?php
  38259. namespace Symfony\Component\Finder\Adapter;
  38260. interface AdapterInterface
  38261. {
  38262. public function setFollowLinks($followLinks);
  38263. public function setMode($mode);
  38264. public function setExclude(array $exclude);
  38265. public function setDepths(array $depths);
  38266. public function setNames(array $names);
  38267. public function setNotNames(array $notNames);
  38268. public function setContains(array $contains);
  38269. public function setNotContains(array $notContains);
  38270. public function setSizes(array $sizes);
  38271. public function setDates(array $dates);
  38272. public function setFilters(array $filters);
  38273. public function setSort($sort);
  38274. public function setPath(array $paths);
  38275. public function setNotPath(array $notPaths);
  38276. public function ignoreUnreadableDirs($ignore = true);
  38277. public function searchInDirectory($dir);
  38278. public function isSupported();
  38279. public function getName();
  38280. }
  38281. <?php
  38282. namespace Symfony\Component\Finder\Adapter;
  38283. @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);
  38284. use Symfony\Component\Finder\Shell\Shell;
  38285. use Symfony\Component\Finder\Shell\Command;
  38286. use Symfony\Component\Finder\Iterator\SortableIterator;
  38287. use Symfony\Component\Finder\Expression\Expression;
  38288. class BsdFindAdapter extends AbstractFindAdapter
  38289. {
  38290. public function getName()
  38291. {
  38292. return 'bsd_find';
  38293. }
  38294. protected function canBeUsed()
  38295. {
  38296. return in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  38297. }
  38298. protected function buildFormatSorting(Command $command, $sort)
  38299. {
  38300. switch ($sort) {
  38301. case SortableIterator::SORT_BY_NAME:
  38302. $command->ins('sort')->add('| sort');
  38303. return;
  38304. case SortableIterator::SORT_BY_TYPE:
  38305. $format = '%HT';
  38306. break;
  38307. case SortableIterator::SORT_BY_ACCESSED_TIME:
  38308. $format = '%a';
  38309. break;
  38310. case SortableIterator::SORT_BY_CHANGED_TIME:
  38311. $format = '%c';
  38312. break;
  38313. case SortableIterator::SORT_BY_MODIFIED_TIME:
  38314. $format = '%m';
  38315. break;
  38316. default:
  38317. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  38318. }
  38319. $command
  38320. ->add('-print0 | xargs -0 stat -f')
  38321. ->arg($format.'%t%N')
  38322. ->add('| sort | cut -f 2');
  38323. }
  38324. protected function buildFindCommand(Command $command, $dir)
  38325. {
  38326. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  38327. return $command;
  38328. }
  38329. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  38330. {
  38331. foreach ($contains as $contain) {
  38332. $expr = Expression::create($contain);
  38333. $command
  38334. ->add('| grep -v \'^$\'')
  38335. ->add('| xargs -I{} grep -I')
  38336. ->add($expr->isCaseSensitive() ? null : '-i')
  38337. ->add($not ? '-L' : '-l')
  38338. ->add('-Ee')->arg($expr->renderPattern())
  38339. ->add('{}')
  38340. ;
  38341. }
  38342. }
  38343. }
  38344. <?php
  38345. namespace Symfony\Component\Finder\Adapter;
  38346. @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);
  38347. use Symfony\Component\Finder\Shell\Shell;
  38348. use Symfony\Component\Finder\Shell\Command;
  38349. use Symfony\Component\Finder\Iterator\SortableIterator;
  38350. use Symfony\Component\Finder\Expression\Expression;
  38351. class GnuFindAdapter extends AbstractFindAdapter
  38352. {
  38353. public function getName()
  38354. {
  38355. return 'gnu_find';
  38356. }
  38357. protected function buildFormatSorting(Command $command, $sort)
  38358. {
  38359. switch ($sort) {
  38360. case SortableIterator::SORT_BY_NAME:
  38361. $command->ins('sort')->add('| sort');
  38362. return;
  38363. case SortableIterator::SORT_BY_TYPE:
  38364. $format = '%y';
  38365. break;
  38366. case SortableIterator::SORT_BY_ACCESSED_TIME:
  38367. $format = '%A@';
  38368. break;
  38369. case SortableIterator::SORT_BY_CHANGED_TIME:
  38370. $format = '%C@';
  38371. break;
  38372. case SortableIterator::SORT_BY_MODIFIED_TIME:
  38373. $format = '%T@';
  38374. break;
  38375. default:
  38376. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  38377. }
  38378. $command
  38379. ->get('find')
  38380. ->add('-printf')
  38381. ->arg($format.' %h/%f\\n')
  38382. ->add('| sort | cut')
  38383. ->arg('-d ')
  38384. ->arg('-f2-')
  38385. ;
  38386. }
  38387. protected function canBeUsed()
  38388. {
  38389. return $this->shell->getType() === Shell::TYPE_UNIX && parent::canBeUsed();
  38390. }
  38391. protected function buildFindCommand(Command $command, $dir)
  38392. {
  38393. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  38394. }
  38395. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  38396. {
  38397. foreach ($contains as $contain) {
  38398. $expr = Expression::create($contain);
  38399. $command
  38400. ->add('| xargs -I{} -r grep -I')
  38401. ->add($expr->isCaseSensitive() ? null : '-i')
  38402. ->add($not ? '-L' : '-l')
  38403. ->add('-Ee')->arg($expr->renderPattern())
  38404. ->add('{}')
  38405. ;
  38406. }
  38407. }
  38408. }
  38409. <?php
  38410. namespace Symfony\Component\Finder\Adapter;
  38411. @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);
  38412. use Symfony\Component\Finder\Iterator;
  38413. class PhpAdapter extends AbstractAdapter
  38414. {
  38415. public function searchInDirectory($dir)
  38416. {
  38417. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  38418. if ($this->followLinks) {
  38419. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  38420. }
  38421. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  38422. if ($this->exclude) {
  38423. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  38424. }
  38425. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  38426. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  38427. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  38428. }
  38429. if ($this->mode) {
  38430. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  38431. }
  38432. if ($this->names || $this->notNames) {
  38433. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  38434. }
  38435. if ($this->contains || $this->notContains) {
  38436. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  38437. }
  38438. if ($this->sizes) {
  38439. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  38440. }
  38441. if ($this->dates) {
  38442. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  38443. }
  38444. if ($this->filters) {
  38445. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  38446. }
  38447. if ($this->paths || $this->notPaths) {
  38448. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  38449. }
  38450. if ($this->sort) {
  38451. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  38452. $iterator = $iteratorAggregate->getIterator();
  38453. }
  38454. return $iterator;
  38455. }
  38456. public function getName()
  38457. {
  38458. return 'php';
  38459. }
  38460. protected function canBeUsed()
  38461. {
  38462. return true;
  38463. }
  38464. }
  38465. <?php
  38466. namespace Symfony\Component\Finder\Comparator;
  38467. class Comparator
  38468. {
  38469. private $target;
  38470. private $operator = '==';
  38471. public function getTarget()
  38472. {
  38473. return $this->target;
  38474. }
  38475. public function setTarget($target)
  38476. {
  38477. $this->target = $target;
  38478. }
  38479. public function getOperator()
  38480. {
  38481. return $this->operator;
  38482. }
  38483. public function setOperator($operator)
  38484. {
  38485. if (!$operator) {
  38486. $operator = '==';
  38487. }
  38488. if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  38489. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  38490. }
  38491. $this->operator = $operator;
  38492. }
  38493. public function test($test)
  38494. {
  38495. switch ($this->operator) {
  38496. case '>':
  38497. return $test > $this->target;
  38498. case '>=':
  38499. return $test >= $this->target;
  38500. case '<':
  38501. return $test < $this->target;
  38502. case '<=':
  38503. return $test <= $this->target;
  38504. case '!=':
  38505. return $test != $this->target;
  38506. }
  38507. return $test == $this->target;
  38508. }
  38509. }
  38510. <?php
  38511. namespace Symfony\Component\Finder\Comparator;
  38512. class DateComparator extends Comparator
  38513. {
  38514. public function __construct($test)
  38515. {
  38516. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  38517. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  38518. }
  38519. try {
  38520. $date = new \DateTime($matches[2]);
  38521. $target = $date->format('U');
  38522. } catch (\Exception $e) {
  38523. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  38524. }
  38525. $operator = isset($matches[1]) ? $matches[1] : '==';
  38526. if ('since' === $operator || 'after' === $operator) {
  38527. $operator = '>';
  38528. }
  38529. if ('until' === $operator || 'before' === $operator) {
  38530. $operator = '<';
  38531. }
  38532. $this->setOperator($operator);
  38533. $this->setTarget($target);
  38534. }
  38535. }
  38536. <?php
  38537. namespace Symfony\Component\Finder\Comparator;
  38538. class NumberComparator extends Comparator
  38539. {
  38540. public function __construct($test)
  38541. {
  38542. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  38543. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  38544. }
  38545. $target = $matches[2];
  38546. if (!is_numeric($target)) {
  38547. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  38548. }
  38549. if (isset($matches[3])) {
  38550. switch (strtolower($matches[3])) {
  38551. case 'k':
  38552. $target *= 1000;
  38553. break;
  38554. case 'ki':
  38555. $target *= 1024;
  38556. break;
  38557. case 'm':
  38558. $target *= 1000000;
  38559. break;
  38560. case 'mi':
  38561. $target *= 1024 * 1024;
  38562. break;
  38563. case 'g':
  38564. $target *= 1000000000;
  38565. break;
  38566. case 'gi':
  38567. $target *= 1024 * 1024 * 1024;
  38568. break;
  38569. }
  38570. }
  38571. $this->setTarget($target);
  38572. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  38573. }
  38574. }
  38575. <?php
  38576. namespace Symfony\Component\Finder\Exception;
  38577. class AccessDeniedException extends \UnexpectedValueException
  38578. {
  38579. }
  38580. <?php
  38581. namespace Symfony\Component\Finder\Exception;
  38582. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38583. use Symfony\Component\Finder\Adapter\AdapterInterface;
  38584. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  38585. {
  38586. private $adapter;
  38587. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  38588. {
  38589. $this->adapter = $adapter;
  38590. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  38591. }
  38592. public function getAdapter()
  38593. {
  38594. return $this->adapter;
  38595. }
  38596. }
  38597. <?php
  38598. namespace Symfony\Component\Finder\Exception;
  38599. interface ExceptionInterface
  38600. {
  38601. public function getAdapter();
  38602. }
  38603. <?php
  38604. namespace Symfony\Component\Finder\Exception;
  38605. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38606. class OperationNotPermitedException extends AdapterFailureException
  38607. {
  38608. }
  38609. <?php
  38610. namespace Symfony\Component\Finder\Exception;
  38611. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38612. use Symfony\Component\Finder\Adapter\AdapterInterface;
  38613. use Symfony\Component\Finder\Shell\Command;
  38614. class ShellCommandFailureException extends AdapterFailureException
  38615. {
  38616. private $command;
  38617. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  38618. {
  38619. $this->command = $command;
  38620. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  38621. }
  38622. public function getCommand()
  38623. {
  38624. return $this->command;
  38625. }
  38626. }
  38627. <?php
  38628. namespace Symfony\Component\Finder\Expression;
  38629. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38630. class Expression implements ValueInterface
  38631. {
  38632. const TYPE_REGEX = 1;
  38633. const TYPE_GLOB = 2;
  38634. private $value;
  38635. public static function create($expr)
  38636. {
  38637. return new self($expr);
  38638. }
  38639. public function __construct($expr)
  38640. {
  38641. try {
  38642. $this->value = Regex::create($expr);
  38643. } catch (\InvalidArgumentException $e) {
  38644. $this->value = new Glob($expr);
  38645. }
  38646. }
  38647. public function __toString()
  38648. {
  38649. return $this->render();
  38650. }
  38651. public function render()
  38652. {
  38653. return $this->value->render();
  38654. }
  38655. public function renderPattern()
  38656. {
  38657. return $this->value->renderPattern();
  38658. }
  38659. public function isCaseSensitive()
  38660. {
  38661. return $this->value->isCaseSensitive();
  38662. }
  38663. public function getType()
  38664. {
  38665. return $this->value->getType();
  38666. }
  38667. public function prepend($expr)
  38668. {
  38669. $this->value->prepend($expr);
  38670. return $this;
  38671. }
  38672. public function append($expr)
  38673. {
  38674. $this->value->append($expr);
  38675. return $this;
  38676. }
  38677. public function isRegex()
  38678. {
  38679. return self::TYPE_REGEX === $this->value->getType();
  38680. }
  38681. public function isGlob()
  38682. {
  38683. return self::TYPE_GLOB === $this->value->getType();
  38684. }
  38685. public function getGlob()
  38686. {
  38687. if (self::TYPE_GLOB !== $this->value->getType()) {
  38688. throw new \LogicException('Regex can\'t be transformed to glob.');
  38689. }
  38690. return $this->value;
  38691. }
  38692. public function getRegex()
  38693. {
  38694. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  38695. }
  38696. }
  38697. <?php
  38698. namespace Symfony\Component\Finder\Expression;
  38699. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38700. use Symfony\Component\Finder\Glob as FinderGlob;
  38701. class Glob implements ValueInterface
  38702. {
  38703. private $pattern;
  38704. public function __construct($pattern)
  38705. {
  38706. $this->pattern = $pattern;
  38707. }
  38708. public function render()
  38709. {
  38710. return $this->pattern;
  38711. }
  38712. public function renderPattern()
  38713. {
  38714. return $this->pattern;
  38715. }
  38716. public function getType()
  38717. {
  38718. return Expression::TYPE_GLOB;
  38719. }
  38720. public function isCaseSensitive()
  38721. {
  38722. return true;
  38723. }
  38724. public function prepend($expr)
  38725. {
  38726. $this->pattern = $expr.$this->pattern;
  38727. return $this;
  38728. }
  38729. public function append($expr)
  38730. {
  38731. $this->pattern .= $expr;
  38732. return $this;
  38733. }
  38734. public function isExpandable()
  38735. {
  38736. return false !== strpos($this->pattern, '{')
  38737. && false !== strpos($this->pattern, '}');
  38738. }
  38739. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  38740. {
  38741. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  38742. return new Regex($regex);
  38743. }
  38744. }
  38745. <?php
  38746. namespace Symfony\Component\Finder\Expression;
  38747. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38748. class Regex implements ValueInterface
  38749. {
  38750. const START_FLAG = '^';
  38751. const END_FLAG = '$';
  38752. const BOUNDARY = '~';
  38753. const JOKER = '.*';
  38754. const ESCAPING = '\\';
  38755. private $pattern;
  38756. private $options;
  38757. private $startFlag;
  38758. private $endFlag;
  38759. private $startJoker;
  38760. private $endJoker;
  38761. public static function create($expr)
  38762. {
  38763. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  38764. $start = substr($m[1], 0, 1);
  38765. $end = substr($m[1], -1);
  38766. if (
  38767. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  38768. || ($start === '{' && $end === '}')
  38769. || ($start === '(' && $end === ')')
  38770. ) {
  38771. return new self(substr($m[1], 1, -1), $m[2], $end);
  38772. }
  38773. }
  38774. throw new \InvalidArgumentException('Given expression is not a regex.');
  38775. }
  38776. public function __construct($pattern, $options = '', $delimiter = null)
  38777. {
  38778. if (null !== $delimiter) {
  38779. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  38780. }
  38781. $this->parsePattern($pattern);
  38782. $this->options = $options;
  38783. }
  38784. public function __toString()
  38785. {
  38786. return $this->render();
  38787. }
  38788. public function render()
  38789. {
  38790. return self::BOUNDARY
  38791. .$this->renderPattern()
  38792. .self::BOUNDARY
  38793. .$this->options;
  38794. }
  38795. public function renderPattern()
  38796. {
  38797. return ($this->startFlag ? self::START_FLAG : '')
  38798. .($this->startJoker ? self::JOKER : '')
  38799. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  38800. .($this->endJoker ? self::JOKER : '')
  38801. .($this->endFlag ? self::END_FLAG : '');
  38802. }
  38803. public function isCaseSensitive()
  38804. {
  38805. return !$this->hasOption('i');
  38806. }
  38807. public function getType()
  38808. {
  38809. return Expression::TYPE_REGEX;
  38810. }
  38811. public function prepend($expr)
  38812. {
  38813. $this->pattern = $expr.$this->pattern;
  38814. return $this;
  38815. }
  38816. public function append($expr)
  38817. {
  38818. $this->pattern .= $expr;
  38819. return $this;
  38820. }
  38821. public function hasOption($option)
  38822. {
  38823. return false !== strpos($this->options, $option);
  38824. }
  38825. public function addOption($option)
  38826. {
  38827. if (!$this->hasOption($option)) {
  38828. $this->options .= $option;
  38829. }
  38830. return $this;
  38831. }
  38832. public function removeOption($option)
  38833. {
  38834. $this->options = str_replace($option, '', $this->options);
  38835. return $this;
  38836. }
  38837. public function setStartFlag($startFlag)
  38838. {
  38839. $this->startFlag = $startFlag;
  38840. return $this;
  38841. }
  38842. public function hasStartFlag()
  38843. {
  38844. return $this->startFlag;
  38845. }
  38846. public function setEndFlag($endFlag)
  38847. {
  38848. $this->endFlag = (bool) $endFlag;
  38849. return $this;
  38850. }
  38851. public function hasEndFlag()
  38852. {
  38853. return $this->endFlag;
  38854. }
  38855. public function setStartJoker($startJoker)
  38856. {
  38857. $this->startJoker = $startJoker;
  38858. return $this;
  38859. }
  38860. public function hasStartJoker()
  38861. {
  38862. return $this->startJoker;
  38863. }
  38864. public function setEndJoker($endJoker)
  38865. {
  38866. $this->endJoker = (bool) $endJoker;
  38867. return $this;
  38868. }
  38869. public function hasEndJoker()
  38870. {
  38871. return $this->endJoker;
  38872. }
  38873. public function replaceJokers($replacement)
  38874. {
  38875. $replace = function ($subject) use ($replacement) {
  38876. $subject = $subject[0];
  38877. $replace = 0 === substr_count($subject, '\\') % 2;
  38878. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  38879. };
  38880. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  38881. return $this;
  38882. }
  38883. private function parsePattern($pattern)
  38884. {
  38885. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  38886. $pattern = substr($pattern, 1);
  38887. }
  38888. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  38889. $pattern = substr($pattern, 2);
  38890. }
  38891. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  38892. $pattern = substr($pattern, 0, -1);
  38893. }
  38894. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  38895. $pattern = substr($pattern, 0, -2);
  38896. }
  38897. $this->pattern = $pattern;
  38898. }
  38899. }
  38900. <?php
  38901. namespace Symfony\Component\Finder\Expression;
  38902. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38903. interface ValueInterface
  38904. {
  38905. public function render();
  38906. public function renderPattern();
  38907. public function isCaseSensitive();
  38908. public function getType();
  38909. public function prepend($expr);
  38910. public function append($expr);
  38911. }
  38912. <?php
  38913. namespace Symfony\Component\Finder;
  38914. use Symfony\Component\Finder\Adapter\AdapterInterface;
  38915. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  38916. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  38917. use Symfony\Component\Finder\Adapter\PhpAdapter;
  38918. use Symfony\Component\Finder\Comparator\DateComparator;
  38919. use Symfony\Component\Finder\Comparator\NumberComparator;
  38920. use Symfony\Component\Finder\Exception\ExceptionInterface;
  38921. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  38922. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  38923. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  38924. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  38925. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  38926. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  38927. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  38928. use Symfony\Component\Finder\Iterator\SortableIterator;
  38929. class Finder implements \IteratorAggregate, \Countable
  38930. {
  38931. const IGNORE_VCS_FILES = 1;
  38932. const IGNORE_DOT_FILES = 2;
  38933. private $mode = 0;
  38934. private $names = array();
  38935. private $notNames = array();
  38936. private $exclude = array();
  38937. private $filters = array();
  38938. private $depths = array();
  38939. private $sizes = array();
  38940. private $followLinks = false;
  38941. private $sort = false;
  38942. private $ignore = 0;
  38943. private $dirs = array();
  38944. private $dates = array();
  38945. private $iterators = array();
  38946. private $contains = array();
  38947. private $notContains = array();
  38948. private $adapters = null;
  38949. private $paths = array();
  38950. private $notPaths = array();
  38951. private $ignoreUnreadableDirs = false;
  38952. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  38953. public function __construct()
  38954. {
  38955. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  38956. }
  38957. public static function create()
  38958. {
  38959. return new static();
  38960. }
  38961. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  38962. {
  38963. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38964. $this->initDefaultAdapters();
  38965. $this->adapters[$adapter->getName()] = array(
  38966. 'adapter' => $adapter,
  38967. 'priority' => $priority,
  38968. 'selected' => false,
  38969. );
  38970. return $this->sortAdapters();
  38971. }
  38972. public function useBestAdapter()
  38973. {
  38974. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38975. $this->initDefaultAdapters();
  38976. $this->resetAdapterSelection();
  38977. return $this->sortAdapters();
  38978. }
  38979. public function setAdapter($name)
  38980. {
  38981. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38982. $this->initDefaultAdapters();
  38983. if (!isset($this->adapters[$name])) {
  38984. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  38985. }
  38986. $this->resetAdapterSelection();
  38987. $this->adapters[$name]['selected'] = true;
  38988. return $this->sortAdapters();
  38989. }
  38990. public function removeAdapters()
  38991. {
  38992. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38993. $this->adapters = array();
  38994. return $this;
  38995. }
  38996. public function getAdapters()
  38997. {
  38998. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38999. $this->initDefaultAdapters();
  39000. return array_values(array_map(function (array $adapter) {
  39001. return $adapter['adapter'];
  39002. }, $this->adapters));
  39003. }
  39004. public function directories()
  39005. {
  39006. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  39007. return $this;
  39008. }
  39009. public function files()
  39010. {
  39011. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  39012. return $this;
  39013. }
  39014. public function depth($level)
  39015. {
  39016. $this->depths[] = new Comparator\NumberComparator($level);
  39017. return $this;
  39018. }
  39019. public function date($date)
  39020. {
  39021. $this->dates[] = new Comparator\DateComparator($date);
  39022. return $this;
  39023. }
  39024. public function name($pattern)
  39025. {
  39026. $this->names[] = $pattern;
  39027. return $this;
  39028. }
  39029. public function notName($pattern)
  39030. {
  39031. $this->notNames[] = $pattern;
  39032. return $this;
  39033. }
  39034. public function contains($pattern)
  39035. {
  39036. $this->contains[] = $pattern;
  39037. return $this;
  39038. }
  39039. public function notContains($pattern)
  39040. {
  39041. $this->notContains[] = $pattern;
  39042. return $this;
  39043. }
  39044. public function path($pattern)
  39045. {
  39046. $this->paths[] = $pattern;
  39047. return $this;
  39048. }
  39049. public function notPath($pattern)
  39050. {
  39051. $this->notPaths[] = $pattern;
  39052. return $this;
  39053. }
  39054. public function size($size)
  39055. {
  39056. $this->sizes[] = new Comparator\NumberComparator($size);
  39057. return $this;
  39058. }
  39059. public function exclude($dirs)
  39060. {
  39061. $this->exclude = array_merge($this->exclude, (array) $dirs);
  39062. return $this;
  39063. }
  39064. public function ignoreDotFiles($ignoreDotFiles)
  39065. {
  39066. if ($ignoreDotFiles) {
  39067. $this->ignore |= static::IGNORE_DOT_FILES;
  39068. } else {
  39069. $this->ignore &= ~static::IGNORE_DOT_FILES;
  39070. }
  39071. return $this;
  39072. }
  39073. public function ignoreVCS($ignoreVCS)
  39074. {
  39075. if ($ignoreVCS) {
  39076. $this->ignore |= static::IGNORE_VCS_FILES;
  39077. } else {
  39078. $this->ignore &= ~static::IGNORE_VCS_FILES;
  39079. }
  39080. return $this;
  39081. }
  39082. public static function addVCSPattern($pattern)
  39083. {
  39084. foreach ((array) $pattern as $p) {
  39085. self::$vcsPatterns[] = $p;
  39086. }
  39087. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  39088. }
  39089. public function sort(\Closure $closure)
  39090. {
  39091. $this->sort = $closure;
  39092. return $this;
  39093. }
  39094. public function sortByName()
  39095. {
  39096. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  39097. return $this;
  39098. }
  39099. public function sortByType()
  39100. {
  39101. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  39102. return $this;
  39103. }
  39104. public function sortByAccessedTime()
  39105. {
  39106. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  39107. return $this;
  39108. }
  39109. public function sortByChangedTime()
  39110. {
  39111. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  39112. return $this;
  39113. }
  39114. public function sortByModifiedTime()
  39115. {
  39116. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  39117. return $this;
  39118. }
  39119. public function filter(\Closure $closure)
  39120. {
  39121. $this->filters[] = $closure;
  39122. return $this;
  39123. }
  39124. public function followLinks()
  39125. {
  39126. $this->followLinks = true;
  39127. return $this;
  39128. }
  39129. public function ignoreUnreadableDirs($ignore = true)
  39130. {
  39131. $this->ignoreUnreadableDirs = (bool) $ignore;
  39132. return $this;
  39133. }
  39134. public function in($dirs)
  39135. {
  39136. $resolvedDirs = array();
  39137. foreach ((array) $dirs as $dir) {
  39138. if (is_dir($dir)) {
  39139. $resolvedDirs[] = $dir;
  39140. } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  39141. $resolvedDirs = array_merge($resolvedDirs, $glob);
  39142. } else {
  39143. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  39144. }
  39145. }
  39146. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  39147. return $this;
  39148. }
  39149. public function getIterator()
  39150. {
  39151. if (0 === count($this->dirs) && 0 === count($this->iterators)) {
  39152. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  39153. }
  39154. if (1 === count($this->dirs) && 0 === count($this->iterators)) {
  39155. return $this->searchInDirectory($this->dirs[0]);
  39156. }
  39157. $iterator = new \AppendIterator();
  39158. foreach ($this->dirs as $dir) {
  39159. $iterator->append($this->searchInDirectory($dir));
  39160. }
  39161. foreach ($this->iterators as $it) {
  39162. $iterator->append($it);
  39163. }
  39164. return $iterator;
  39165. }
  39166. public function append($iterator)
  39167. {
  39168. if ($iterator instanceof \IteratorAggregate) {
  39169. $this->iterators[] = $iterator->getIterator();
  39170. } elseif ($iterator instanceof \Iterator) {
  39171. $this->iterators[] = $iterator;
  39172. } elseif ($iterator instanceof \Traversable || is_array($iterator)) {
  39173. $it = new \ArrayIterator();
  39174. foreach ($iterator as $file) {
  39175. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  39176. }
  39177. $this->iterators[] = $it;
  39178. } else {
  39179. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  39180. }
  39181. return $this;
  39182. }
  39183. public function count()
  39184. {
  39185. return iterator_count($this->getIterator());
  39186. }
  39187. private function sortAdapters()
  39188. {
  39189. uasort($this->adapters, function (array $a, array $b) {
  39190. if ($a['selected'] || $b['selected']) {
  39191. return $a['selected'] ? -1 : 1;
  39192. }
  39193. return $a['priority'] > $b['priority'] ? -1 : 1;
  39194. });
  39195. return $this;
  39196. }
  39197. private function searchInDirectory($dir)
  39198. {
  39199. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  39200. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  39201. }
  39202. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  39203. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  39204. }
  39205. if ($this->adapters) {
  39206. foreach ($this->adapters as $adapter) {
  39207. if ($adapter['adapter']->isSupported()) {
  39208. try {
  39209. return $this
  39210. ->buildAdapter($adapter['adapter'])
  39211. ->searchInDirectory($dir);
  39212. } catch (ExceptionInterface $e) {
  39213. }
  39214. }
  39215. }
  39216. }
  39217. $minDepth = 0;
  39218. $maxDepth = PHP_INT_MAX;
  39219. foreach ($this->depths as $comparator) {
  39220. switch ($comparator->getOperator()) {
  39221. case '>':
  39222. $minDepth = $comparator->getTarget() + 1;
  39223. break;
  39224. case '>=':
  39225. $minDepth = $comparator->getTarget();
  39226. break;
  39227. case '<':
  39228. $maxDepth = $comparator->getTarget() - 1;
  39229. break;
  39230. case '<=':
  39231. $maxDepth = $comparator->getTarget();
  39232. break;
  39233. default:
  39234. $minDepth = $maxDepth = $comparator->getTarget();
  39235. }
  39236. }
  39237. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  39238. if ($this->followLinks) {
  39239. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  39240. }
  39241. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  39242. if ($this->exclude) {
  39243. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  39244. }
  39245. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  39246. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  39247. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  39248. }
  39249. if ($this->mode) {
  39250. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  39251. }
  39252. if ($this->names || $this->notNames) {
  39253. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  39254. }
  39255. if ($this->contains || $this->notContains) {
  39256. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  39257. }
  39258. if ($this->sizes) {
  39259. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  39260. }
  39261. if ($this->dates) {
  39262. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  39263. }
  39264. if ($this->filters) {
  39265. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  39266. }
  39267. if ($this->paths || $this->notPaths) {
  39268. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  39269. }
  39270. if ($this->sort) {
  39271. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  39272. $iterator = $iteratorAggregate->getIterator();
  39273. }
  39274. return $iterator;
  39275. }
  39276. private function buildAdapter(AdapterInterface $adapter)
  39277. {
  39278. return $adapter
  39279. ->setFollowLinks($this->followLinks)
  39280. ->setDepths($this->depths)
  39281. ->setMode($this->mode)
  39282. ->setExclude($this->exclude)
  39283. ->setNames($this->names)
  39284. ->setNotNames($this->notNames)
  39285. ->setContains($this->contains)
  39286. ->setNotContains($this->notContains)
  39287. ->setSizes($this->sizes)
  39288. ->setDates($this->dates)
  39289. ->setFilters($this->filters)
  39290. ->setSort($this->sort)
  39291. ->setPath($this->paths)
  39292. ->setNotPath($this->notPaths)
  39293. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  39294. }
  39295. private function resetAdapterSelection()
  39296. {
  39297. $this->adapters = array_map(function (array $properties) {
  39298. $properties['selected'] = false;
  39299. return $properties;
  39300. }, $this->adapters);
  39301. }
  39302. private function initDefaultAdapters()
  39303. {
  39304. if (null === $this->adapters) {
  39305. $this->adapters = array();
  39306. $this
  39307. ->addAdapter(new GnuFindAdapter())
  39308. ->addAdapter(new BsdFindAdapter())
  39309. ->addAdapter(new PhpAdapter(), -50)
  39310. ->setAdapter('php')
  39311. ;
  39312. }
  39313. }
  39314. }
  39315. <?php
  39316. namespace Symfony\Component\Finder;
  39317. class Glob
  39318. {
  39319. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  39320. {
  39321. $firstByte = true;
  39322. $escaping = false;
  39323. $inCurlies = 0;
  39324. $regex = '';
  39325. $sizeGlob = strlen($glob);
  39326. for ($i = 0; $i < $sizeGlob; ++$i) {
  39327. $car = $glob[$i];
  39328. if ($firstByte) {
  39329. if ($strictLeadingDot && '.' !== $car) {
  39330. $regex .= '(?=[^\.])';
  39331. }
  39332. $firstByte = false;
  39333. }
  39334. if ('/' === $car) {
  39335. $firstByte = true;
  39336. }
  39337. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  39338. $regex .= "\\$car";
  39339. } elseif ('*' === $car) {
  39340. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  39341. } elseif ('?' === $car) {
  39342. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  39343. } elseif ('{' === $car) {
  39344. $regex .= $escaping ? '\\{' : '(';
  39345. if (!$escaping) {
  39346. ++$inCurlies;
  39347. }
  39348. } elseif ('}' === $car && $inCurlies) {
  39349. $regex .= $escaping ? '}' : ')';
  39350. if (!$escaping) {
  39351. --$inCurlies;
  39352. }
  39353. } elseif (',' === $car && $inCurlies) {
  39354. $regex .= $escaping ? ',' : '|';
  39355. } elseif ('\\' === $car) {
  39356. if ($escaping) {
  39357. $regex .= '\\\\';
  39358. $escaping = false;
  39359. } else {
  39360. $escaping = true;
  39361. }
  39362. continue;
  39363. } else {
  39364. $regex .= $car;
  39365. }
  39366. $escaping = false;
  39367. }
  39368. return $delimiter.'^'.$regex.'$'.$delimiter;
  39369. }
  39370. }
  39371. <?php
  39372. namespace Symfony\Component\Finder\Iterator;
  39373. class CustomFilterIterator extends FilterIterator
  39374. {
  39375. private $filters = array();
  39376. public function __construct(\Iterator $iterator, array $filters)
  39377. {
  39378. foreach ($filters as $filter) {
  39379. if (!is_callable($filter)) {
  39380. throw new \InvalidArgumentException('Invalid PHP callback.');
  39381. }
  39382. }
  39383. $this->filters = $filters;
  39384. parent::__construct($iterator);
  39385. }
  39386. public function accept()
  39387. {
  39388. $fileinfo = $this->current();
  39389. foreach ($this->filters as $filter) {
  39390. if (false === call_user_func($filter, $fileinfo)) {
  39391. return false;
  39392. }
  39393. }
  39394. return true;
  39395. }
  39396. }
  39397. <?php
  39398. namespace Symfony\Component\Finder\Iterator;
  39399. use Symfony\Component\Finder\Comparator\DateComparator;
  39400. class DateRangeFilterIterator extends FilterIterator
  39401. {
  39402. private $comparators = array();
  39403. public function __construct(\Iterator $iterator, array $comparators)
  39404. {
  39405. $this->comparators = $comparators;
  39406. parent::__construct($iterator);
  39407. }
  39408. public function accept()
  39409. {
  39410. $fileinfo = $this->current();
  39411. if (!file_exists($fileinfo->getPathname())) {
  39412. return false;
  39413. }
  39414. $filedate = $fileinfo->getMTime();
  39415. foreach ($this->comparators as $compare) {
  39416. if (!$compare->test($filedate)) {
  39417. return false;
  39418. }
  39419. }
  39420. return true;
  39421. }
  39422. }
  39423. <?php
  39424. namespace Symfony\Component\Finder\Iterator;
  39425. class DepthRangeFilterIterator extends FilterIterator
  39426. {
  39427. private $minDepth = 0;
  39428. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  39429. {
  39430. $this->minDepth = $minDepth;
  39431. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  39432. parent::__construct($iterator);
  39433. }
  39434. public function accept()
  39435. {
  39436. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  39437. }
  39438. }
  39439. <?php
  39440. namespace Symfony\Component\Finder\Iterator;
  39441. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  39442. {
  39443. private $iterator;
  39444. private $isRecursive;
  39445. private $excludedDirs = array();
  39446. private $excludedPattern;
  39447. public function __construct(\Iterator $iterator, array $directories)
  39448. {
  39449. $this->iterator = $iterator;
  39450. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  39451. $patterns = array();
  39452. foreach ($directories as $directory) {
  39453. $directory = rtrim($directory, '/');
  39454. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  39455. $patterns[] = preg_quote($directory, '#');
  39456. } else {
  39457. $this->excludedDirs[$directory] = true;
  39458. }
  39459. }
  39460. if ($patterns) {
  39461. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  39462. }
  39463. parent::__construct($iterator);
  39464. }
  39465. public function accept()
  39466. {
  39467. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  39468. return false;
  39469. }
  39470. if ($this->excludedPattern) {
  39471. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  39472. $path = str_replace('\\', '/', $path);
  39473. return !preg_match($this->excludedPattern, $path);
  39474. }
  39475. return true;
  39476. }
  39477. public function hasChildren()
  39478. {
  39479. return $this->isRecursive && $this->iterator->hasChildren();
  39480. }
  39481. public function getChildren()
  39482. {
  39483. $children = new self($this->iterator->getChildren(), array());
  39484. $children->excludedDirs = $this->excludedDirs;
  39485. $children->excludedPattern = $this->excludedPattern;
  39486. return $children;
  39487. }
  39488. }
  39489. <?php
  39490. namespace Symfony\Component\Finder\Iterator;
  39491. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39492. use Symfony\Component\Finder\SplFileInfo;
  39493. class FilePathsIterator extends \ArrayIterator
  39494. {
  39495. private $baseDir;
  39496. private $baseDirLength;
  39497. private $subPath;
  39498. private $subPathname;
  39499. private $current;
  39500. public function __construct(array $paths, $baseDir)
  39501. {
  39502. $this->baseDir = $baseDir;
  39503. $this->baseDirLength = strlen($baseDir);
  39504. parent::__construct($paths);
  39505. }
  39506. public function __call($name, array $arguments)
  39507. {
  39508. return call_user_func_array(array($this->current(), $name), $arguments);
  39509. }
  39510. public function current()
  39511. {
  39512. return $this->current;
  39513. }
  39514. public function key()
  39515. {
  39516. return $this->current->getPathname();
  39517. }
  39518. public function next()
  39519. {
  39520. parent::next();
  39521. $this->buildProperties();
  39522. }
  39523. public function rewind()
  39524. {
  39525. parent::rewind();
  39526. $this->buildProperties();
  39527. }
  39528. public function getSubPath()
  39529. {
  39530. return $this->subPath;
  39531. }
  39532. public function getSubPathname()
  39533. {
  39534. return $this->subPathname;
  39535. }
  39536. private function buildProperties()
  39537. {
  39538. $absolutePath = parent::current();
  39539. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  39540. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  39541. $dir = dirname($this->subPathname);
  39542. $this->subPath = '.' === $dir ? '' : $dir;
  39543. } else {
  39544. $this->subPath = $this->subPathname = '';
  39545. }
  39546. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  39547. }
  39548. }
  39549. <?php
  39550. namespace Symfony\Component\Finder\Iterator;
  39551. class FileTypeFilterIterator extends FilterIterator
  39552. {
  39553. const ONLY_FILES = 1;
  39554. const ONLY_DIRECTORIES = 2;
  39555. private $mode;
  39556. public function __construct(\Iterator $iterator, $mode)
  39557. {
  39558. $this->mode = $mode;
  39559. parent::__construct($iterator);
  39560. }
  39561. public function accept()
  39562. {
  39563. $fileinfo = $this->current();
  39564. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  39565. return false;
  39566. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  39567. return false;
  39568. }
  39569. return true;
  39570. }
  39571. }
  39572. <?php
  39573. namespace Symfony\Component\Finder\Iterator;
  39574. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  39575. {
  39576. public function accept()
  39577. {
  39578. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  39579. return true;
  39580. }
  39581. $fileinfo = $this->current();
  39582. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  39583. return false;
  39584. }
  39585. $content = $fileinfo->getContents();
  39586. if (!$content) {
  39587. return false;
  39588. }
  39589. return $this->isAccepted($content);
  39590. }
  39591. protected function toRegex($str)
  39592. {
  39593. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  39594. }
  39595. }
  39596. <?php
  39597. namespace Symfony\Component\Finder\Iterator;
  39598. use Symfony\Component\Finder\Glob;
  39599. class FilenameFilterIterator extends MultiplePcreFilterIterator
  39600. {
  39601. public function accept()
  39602. {
  39603. return $this->isAccepted($this->current()->getFilename());
  39604. }
  39605. protected function toRegex($str)
  39606. {
  39607. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  39608. }
  39609. }
  39610. <?php
  39611. namespace Symfony\Component\Finder\Iterator;
  39612. abstract class FilterIterator extends \FilterIterator
  39613. {
  39614. public function rewind()
  39615. {
  39616. if (PHP_VERSION_ID > 50607 || (PHP_VERSION_ID > 50523 && PHP_VERSION_ID < 50600)) {
  39617. parent::rewind();
  39618. return;
  39619. }
  39620. $iterator = $this;
  39621. while ($iterator instanceof \OuterIterator) {
  39622. $innerIterator = $iterator->getInnerIterator();
  39623. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  39624. if ($innerIterator->isRewindable()) {
  39625. $innerIterator->next();
  39626. $innerIterator->rewind();
  39627. }
  39628. } elseif ($innerIterator instanceof \FilesystemIterator) {
  39629. $innerIterator->next();
  39630. $innerIterator->rewind();
  39631. }
  39632. $iterator = $innerIterator;
  39633. }
  39634. parent::rewind();
  39635. }
  39636. }
  39637. <?php
  39638. namespace Symfony\Component\Finder\Iterator;
  39639. abstract class MultiplePcreFilterIterator extends FilterIterator
  39640. {
  39641. protected $matchRegexps = array();
  39642. protected $noMatchRegexps = array();
  39643. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  39644. {
  39645. foreach ($matchPatterns as $pattern) {
  39646. $this->matchRegexps[] = $this->toRegex($pattern);
  39647. }
  39648. foreach ($noMatchPatterns as $pattern) {
  39649. $this->noMatchRegexps[] = $this->toRegex($pattern);
  39650. }
  39651. parent::__construct($iterator);
  39652. }
  39653. protected function isAccepted($string)
  39654. {
  39655. foreach ($this->noMatchRegexps as $regex) {
  39656. if (preg_match($regex, $string)) {
  39657. return false;
  39658. }
  39659. }
  39660. if ($this->matchRegexps) {
  39661. foreach ($this->matchRegexps as $regex) {
  39662. if (preg_match($regex, $string)) {
  39663. return true;
  39664. }
  39665. }
  39666. return false;
  39667. }
  39668. return true;
  39669. }
  39670. protected function isRegex($str)
  39671. {
  39672. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  39673. $start = substr($m[1], 0, 1);
  39674. $end = substr($m[1], -1);
  39675. if ($start === $end) {
  39676. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  39677. }
  39678. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  39679. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  39680. return true;
  39681. }
  39682. }
  39683. }
  39684. return false;
  39685. }
  39686. abstract protected function toRegex($str);
  39687. }
  39688. <?php
  39689. namespace Symfony\Component\Finder\Iterator;
  39690. class PathFilterIterator extends MultiplePcreFilterIterator
  39691. {
  39692. public function accept()
  39693. {
  39694. $filename = $this->current()->getRelativePathname();
  39695. if ('\\' === DIRECTORY_SEPARATOR) {
  39696. $filename = str_replace('\\', '/', $filename);
  39697. }
  39698. return $this->isAccepted($filename);
  39699. }
  39700. protected function toRegex($str)
  39701. {
  39702. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  39703. }
  39704. }
  39705. <?php
  39706. namespace Symfony\Component\Finder\Iterator;
  39707. use Symfony\Component\Finder\Exception\AccessDeniedException;
  39708. use Symfony\Component\Finder\SplFileInfo;
  39709. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  39710. {
  39711. private $ignoreUnreadableDirs;
  39712. private $rewindable;
  39713. private $rootPath;
  39714. private $subPath;
  39715. private $directorySeparator = '/';
  39716. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  39717. {
  39718. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  39719. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  39720. }
  39721. parent::__construct($path, $flags);
  39722. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  39723. $this->rootPath = (string) $path;
  39724. if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  39725. $this->directorySeparator = DIRECTORY_SEPARATOR;
  39726. }
  39727. }
  39728. public function current()
  39729. {
  39730. if (null === $subPathname = $this->subPath) {
  39731. $subPathname = $this->subPath = (string) $this->getSubPath();
  39732. }
  39733. if ('' !== $subPathname) {
  39734. $subPathname .= $this->directorySeparator;
  39735. }
  39736. $subPathname .= $this->getFilename();
  39737. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  39738. }
  39739. public function getChildren()
  39740. {
  39741. try {
  39742. $children = parent::getChildren();
  39743. if ($children instanceof self) {
  39744. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  39745. $children->rewindable = &$this->rewindable;
  39746. $children->rootPath = $this->rootPath;
  39747. }
  39748. return $children;
  39749. } catch (\UnexpectedValueException $e) {
  39750. if ($this->ignoreUnreadableDirs) {
  39751. return new \RecursiveArrayIterator(array());
  39752. } else {
  39753. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  39754. }
  39755. }
  39756. }
  39757. public function rewind()
  39758. {
  39759. if (false === $this->isRewindable()) {
  39760. return;
  39761. }
  39762. if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
  39763. parent::next();
  39764. }
  39765. parent::rewind();
  39766. }
  39767. public function isRewindable()
  39768. {
  39769. if (null !== $this->rewindable) {
  39770. return $this->rewindable;
  39771. }
  39772. if ('' === $this->getPath()) {
  39773. return $this->rewindable = false;
  39774. }
  39775. if (false !== $stream = @opendir($this->getPath())) {
  39776. $infos = stream_get_meta_data($stream);
  39777. closedir($stream);
  39778. if ($infos['seekable']) {
  39779. return $this->rewindable = true;
  39780. }
  39781. }
  39782. return $this->rewindable = false;
  39783. }
  39784. }
  39785. <?php
  39786. namespace Symfony\Component\Finder\Iterator;
  39787. use Symfony\Component\Finder\Comparator\NumberComparator;
  39788. class SizeRangeFilterIterator extends FilterIterator
  39789. {
  39790. private $comparators = array();
  39791. public function __construct(\Iterator $iterator, array $comparators)
  39792. {
  39793. $this->comparators = $comparators;
  39794. parent::__construct($iterator);
  39795. }
  39796. public function accept()
  39797. {
  39798. $fileinfo = $this->current();
  39799. if (!$fileinfo->isFile()) {
  39800. return true;
  39801. }
  39802. $filesize = $fileinfo->getSize();
  39803. foreach ($this->comparators as $compare) {
  39804. if (!$compare->test($filesize)) {
  39805. return false;
  39806. }
  39807. }
  39808. return true;
  39809. }
  39810. }
  39811. <?php
  39812. namespace Symfony\Component\Finder\Iterator;
  39813. class SortableIterator implements \IteratorAggregate
  39814. {
  39815. const SORT_BY_NAME = 1;
  39816. const SORT_BY_TYPE = 2;
  39817. const SORT_BY_ACCESSED_TIME = 3;
  39818. const SORT_BY_CHANGED_TIME = 4;
  39819. const SORT_BY_MODIFIED_TIME = 5;
  39820. private $iterator;
  39821. private $sort;
  39822. public function __construct(\Traversable $iterator, $sort)
  39823. {
  39824. $this->iterator = $iterator;
  39825. if (self::SORT_BY_NAME === $sort) {
  39826. $this->sort = function ($a, $b) {
  39827. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  39828. };
  39829. } elseif (self::SORT_BY_TYPE === $sort) {
  39830. $this->sort = function ($a, $b) {
  39831. if ($a->isDir() && $b->isFile()) {
  39832. return -1;
  39833. } elseif ($a->isFile() && $b->isDir()) {
  39834. return 1;
  39835. }
  39836. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  39837. };
  39838. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  39839. $this->sort = function ($a, $b) {
  39840. return $a->getATime() - $b->getATime();
  39841. };
  39842. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  39843. $this->sort = function ($a, $b) {
  39844. return $a->getCTime() - $b->getCTime();
  39845. };
  39846. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  39847. $this->sort = function ($a, $b) {
  39848. return $a->getMTime() - $b->getMTime();
  39849. };
  39850. } elseif (is_callable($sort)) {
  39851. $this->sort = $sort;
  39852. } else {
  39853. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  39854. }
  39855. }
  39856. public function getIterator()
  39857. {
  39858. $array = iterator_to_array($this->iterator, true);
  39859. uasort($array, $this->sort);
  39860. return new \ArrayIterator($array);
  39861. }
  39862. }
  39863. Copyright (c) 2004-2017 Fabien Potencier
  39864. Permission is hereby granted, free of charge, to any person obtaining a copy
  39865. of this software and associated documentation files (the "Software"), to deal
  39866. in the Software without restriction, including without limitation the rights
  39867. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39868. copies of the Software, and to permit persons to whom the Software is furnished
  39869. to do so, subject to the following conditions:
  39870. The above copyright notice and this permission notice shall be included in all
  39871. copies or substantial portions of the Software.
  39872. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39873. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39874. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39875. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39876. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39877. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39878. THE SOFTWARE.
  39879. <?php
  39880. namespace Symfony\Component\Finder\Shell;
  39881. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39882. class Command
  39883. {
  39884. private $parent;
  39885. private $bits = array();
  39886. private $labels = array();
  39887. private $errorHandler;
  39888. public function __construct(Command $parent = null)
  39889. {
  39890. $this->parent = $parent;
  39891. }
  39892. public function __toString()
  39893. {
  39894. return $this->join();
  39895. }
  39896. public static function create(Command $parent = null)
  39897. {
  39898. return new self($parent);
  39899. }
  39900. public static function escape($input)
  39901. {
  39902. return escapeshellcmd($input);
  39903. }
  39904. public static function quote($input)
  39905. {
  39906. return escapeshellarg($input);
  39907. }
  39908. public function add($bit)
  39909. {
  39910. $this->bits[] = $bit;
  39911. return $this;
  39912. }
  39913. public function top($bit)
  39914. {
  39915. array_unshift($this->bits, $bit);
  39916. foreach ($this->labels as $label => $index) {
  39917. $this->labels[$label] += 1;
  39918. }
  39919. return $this;
  39920. }
  39921. public function arg($arg)
  39922. {
  39923. $this->bits[] = self::quote($arg);
  39924. return $this;
  39925. }
  39926. public function cmd($esc)
  39927. {
  39928. $this->bits[] = self::escape($esc);
  39929. return $this;
  39930. }
  39931. public function ins($label)
  39932. {
  39933. if (isset($this->labels[$label])) {
  39934. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  39935. }
  39936. $this->bits[] = self::create($this);
  39937. $this->labels[$label] = count($this->bits) - 1;
  39938. return $this->bits[$this->labels[$label]];
  39939. }
  39940. public function get($label)
  39941. {
  39942. if (!isset($this->labels[$label])) {
  39943. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  39944. }
  39945. return $this->bits[$this->labels[$label]];
  39946. }
  39947. public function end()
  39948. {
  39949. if (null === $this->parent) {
  39950. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  39951. }
  39952. return $this->parent;
  39953. }
  39954. public function length()
  39955. {
  39956. return count($this->bits);
  39957. }
  39958. public function setErrorHandler(\Closure $errorHandler)
  39959. {
  39960. $this->errorHandler = $errorHandler;
  39961. return $this;
  39962. }
  39963. public function getErrorHandler()
  39964. {
  39965. return $this->errorHandler;
  39966. }
  39967. public function execute()
  39968. {
  39969. if (null === $errorHandler = $this->errorHandler) {
  39970. exec($this->join(), $output);
  39971. } else {
  39972. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  39973. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  39974. if ($error = stream_get_contents($pipes[2])) {
  39975. $errorHandler($error);
  39976. }
  39977. proc_close($process);
  39978. }
  39979. return $output ?: array();
  39980. }
  39981. public function join()
  39982. {
  39983. return implode(' ', array_filter(
  39984. array_map(function ($bit) {
  39985. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  39986. }, $this->bits),
  39987. function ($bit) { return null !== $bit; }
  39988. ));
  39989. }
  39990. public function addAtIndex($bit, $index)
  39991. {
  39992. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  39993. return $this;
  39994. }
  39995. }
  39996. <?php
  39997. namespace Symfony\Component\Finder\Shell;
  39998. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39999. class Shell
  40000. {
  40001. const TYPE_UNIX = 1;
  40002. const TYPE_DARWIN = 2;
  40003. const TYPE_CYGWIN = 3;
  40004. const TYPE_WINDOWS = 4;
  40005. const TYPE_BSD = 5;
  40006. private $type;
  40007. public function getType()
  40008. {
  40009. if (null === $this->type) {
  40010. $this->type = $this->guessType();
  40011. }
  40012. return $this->type;
  40013. }
  40014. public function testCommand($command)
  40015. {
  40016. if (!function_exists('exec')) {
  40017. return false;
  40018. }
  40019. $testCommand = 'which ';
  40020. if (self::TYPE_WINDOWS === $this->type) {
  40021. $testCommand = 'where ';
  40022. }
  40023. $command = escapeshellcmd($command);
  40024. exec($testCommand.$command, $output, $code);
  40025. return 0 === $code && count($output) > 0;
  40026. }
  40027. private function guessType()
  40028. {
  40029. $os = strtolower(PHP_OS);
  40030. if (false !== strpos($os, 'cygwin')) {
  40031. return self::TYPE_CYGWIN;
  40032. }
  40033. if (false !== strpos($os, 'darwin')) {
  40034. return self::TYPE_DARWIN;
  40035. }
  40036. if (false !== strpos($os, 'bsd')) {
  40037. return self::TYPE_BSD;
  40038. }
  40039. if (0 === strpos($os, 'win')) {
  40040. return self::TYPE_WINDOWS;
  40041. }
  40042. return self::TYPE_UNIX;
  40043. }
  40044. }
  40045. <?php
  40046. namespace Symfony\Component\Finder;
  40047. class SplFileInfo extends \SplFileInfo
  40048. {
  40049. private $relativePath;
  40050. private $relativePathname;
  40051. public function __construct($file, $relativePath, $relativePathname)
  40052. {
  40053. parent::__construct($file);
  40054. $this->relativePath = $relativePath;
  40055. $this->relativePathname = $relativePathname;
  40056. }
  40057. public function getRelativePath()
  40058. {
  40059. return $this->relativePath;
  40060. }
  40061. public function getRelativePathname()
  40062. {
  40063. return $this->relativePathname;
  40064. }
  40065. public function getContents()
  40066. {
  40067. $level = error_reporting(0);
  40068. $content = file_get_contents($this->getPathname());
  40069. error_reporting($level);
  40070. if (false === $content) {
  40071. $error = error_get_last();
  40072. throw new \RuntimeException($error['message']);
  40073. }
  40074. return $content;
  40075. }
  40076. }
  40077. Copyright (c) 2014-2016 Fabien Potencier
  40078. Permission is hereby granted, free of charge, to any person obtaining a copy
  40079. of this software and associated documentation files (the "Software"), to deal
  40080. in the Software without restriction, including without limitation the rights
  40081. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40082. copies of the Software, and to permit persons to whom the Software is furnished
  40083. to do so, subject to the following conditions:
  40084. The above copyright notice and this permission notice shall be included in all
  40085. copies or substantial portions of the Software.
  40086. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40087. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40088. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40089. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40090. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40091. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40092. THE SOFTWARE.
  40093. <?php
  40094. namespace Symfony\Polyfill\Mbstring;
  40095. final class Mbstring
  40096. {
  40097. const MB_CASE_FOLD = PHP_INT_MAX;
  40098. private static $encodingList = array('ASCII', 'UTF-8');
  40099. private static $language = 'neutral';
  40100. private static $internalEncoding = 'UTF-8';
  40101. private static $caseFold = array(
  40102. array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
  40103. array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1",'ι'),
  40104. );
  40105. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  40106. {
  40107. if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  40108. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  40109. } else {
  40110. $fromEncoding = self::getEncoding($fromEncoding);
  40111. }
  40112. $toEncoding = self::getEncoding($toEncoding);
  40113. if ('BASE64' === $fromEncoding) {
  40114. $s = base64_decode($s);
  40115. $fromEncoding = $toEncoding;
  40116. }
  40117. if ('BASE64' === $toEncoding) {
  40118. return base64_encode($s);
  40119. }
  40120. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  40121. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  40122. $fromEncoding = 'Windows-1252';
  40123. }
  40124. if ('UTF-8' !== $fromEncoding) {
  40125. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  40126. }
  40127. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  40128. }
  40129. if ('HTML-ENTITIES' === $fromEncoding) {
  40130. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  40131. $fromEncoding = 'UTF-8';
  40132. }
  40133. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  40134. }
  40135. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  40136. {
  40137. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  40138. $ok = true;
  40139. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  40140. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  40141. $ok = false;
  40142. }
  40143. });
  40144. return $ok ? $fromEncoding : false;
  40145. }
  40146. public static function mb_decode_mimeheader($s)
  40147. {
  40148. return iconv_mime_decode($s, 2, self::$internalEncoding);
  40149. }
  40150. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  40151. {
  40152. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  40153. }
  40154. public static function mb_convert_case($s, $mode, $encoding = null)
  40155. {
  40156. if ('' === $s .= '') {
  40157. return '';
  40158. }
  40159. $encoding = self::getEncoding($encoding);
  40160. if ('UTF-8' === $encoding) {
  40161. $encoding = null;
  40162. } else {
  40163. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  40164. }
  40165. if (MB_CASE_TITLE == $mode) {
  40166. $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
  40167. $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
  40168. } else {
  40169. if (MB_CASE_UPPER == $mode) {
  40170. static $upper = null;
  40171. if (null === $upper) {
  40172. $upper = self::getData('upperCase');
  40173. }
  40174. $map = $upper;
  40175. } else {
  40176. if (self::MB_CASE_FOLD === $mode) {
  40177. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  40178. }
  40179. static $lower = null;
  40180. if (null === $lower) {
  40181. $lower = self::getData('lowerCase');
  40182. }
  40183. $map = $lower;
  40184. }
  40185. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  40186. $i = 0;
  40187. $len = strlen($s);
  40188. while ($i < $len) {
  40189. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  40190. $uchr = substr($s, $i, $ulen);
  40191. $i += $ulen;
  40192. if (isset($map[$uchr])) {
  40193. $uchr = $map[$uchr];
  40194. $nlen = strlen($uchr);
  40195. if ($nlen == $ulen) {
  40196. $nlen = $i;
  40197. do {
  40198. $s[--$nlen] = $uchr[--$ulen];
  40199. } while ($ulen);
  40200. } else {
  40201. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  40202. $len += $nlen - $ulen;
  40203. $i += $nlen - $ulen;
  40204. }
  40205. }
  40206. }
  40207. }
  40208. if (null === $encoding) {
  40209. return $s;
  40210. }
  40211. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  40212. }
  40213. public static function mb_internal_encoding($encoding = null)
  40214. {
  40215. if (null === $encoding) {
  40216. return self::$internalEncoding;
  40217. }
  40218. $encoding = self::getEncoding($encoding);
  40219. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  40220. self::$internalEncoding = $encoding;
  40221. return true;
  40222. }
  40223. return false;
  40224. }
  40225. public static function mb_language($lang = null)
  40226. {
  40227. if (null === $lang) {
  40228. return self::$language;
  40229. }
  40230. switch ($lang = strtolower($lang)) {
  40231. case 'uni':
  40232. case 'neutral':
  40233. self::$language = $lang;
  40234. return true;
  40235. }
  40236. return false;
  40237. }
  40238. public static function mb_list_encodings()
  40239. {
  40240. return array('UTF-8');
  40241. }
  40242. public static function mb_encoding_aliases($encoding)
  40243. {
  40244. switch (strtoupper($encoding)) {
  40245. case 'UTF8':
  40246. case 'UTF-8':
  40247. return array('utf8');
  40248. }
  40249. return false;
  40250. }
  40251. public static function mb_check_encoding($var = null, $encoding = null)
  40252. {
  40253. if (null === $encoding) {
  40254. if (null === $var) {
  40255. return false;
  40256. }
  40257. $encoding = self::$internalEncoding;
  40258. }
  40259. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  40260. }
  40261. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  40262. {
  40263. if (null === $encodingList) {
  40264. $encodingList = self::$encodingList;
  40265. } else {
  40266. if (!is_array($encodingList)) {
  40267. $encodingList = array_map('trim', explode(',', $encodingList));
  40268. }
  40269. $encodingList = array_map('strtoupper', $encodingList);
  40270. }
  40271. foreach ($encodingList as $enc) {
  40272. switch ($enc) {
  40273. case 'ASCII':
  40274. if (!preg_match('/[\x80-\xFF]/', $str)) {
  40275. return $enc;
  40276. }
  40277. break;
  40278. case 'UTF8':
  40279. case 'UTF-8':
  40280. if (preg_match('//u', $str)) {
  40281. return 'UTF-8';
  40282. }
  40283. break;
  40284. default:
  40285. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  40286. return $enc;
  40287. }
  40288. }
  40289. }
  40290. return false;
  40291. }
  40292. public static function mb_detect_order($encodingList = null)
  40293. {
  40294. if (null === $encodingList) {
  40295. return self::$encodingList;
  40296. }
  40297. if (!is_array($encodingList)) {
  40298. $encodingList = array_map('trim', explode(',', $encodingList));
  40299. }
  40300. $encodingList = array_map('strtoupper', $encodingList);
  40301. foreach ($encodingList as $enc) {
  40302. switch ($enc) {
  40303. default:
  40304. if (strncmp($enc, 'ISO-8859-', 9)) {
  40305. return false;
  40306. }
  40307. case 'ASCII':
  40308. case 'UTF8':
  40309. case 'UTF-8':
  40310. }
  40311. }
  40312. self::$encodingList = $encodingList;
  40313. return true;
  40314. }
  40315. public static function mb_strlen($s, $encoding = null)
  40316. {
  40317. switch ($encoding = self::getEncoding($encoding)) {
  40318. case 'ASCII':
  40319. case 'CP850':
  40320. return strlen($s);
  40321. }
  40322. return @iconv_strlen($s, $encoding);
  40323. }
  40324. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  40325. {
  40326. $encoding = self::getEncoding($encoding);
  40327. if ('' === $needle .= '') {
  40328. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  40329. return false;
  40330. }
  40331. return iconv_strpos($haystack, $needle, $offset, $encoding);
  40332. }
  40333. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  40334. {
  40335. $encoding = self::getEncoding($encoding);
  40336. if ($offset != (int) $offset) {
  40337. $offset = 0;
  40338. } elseif ($offset = (int) $offset) {
  40339. if ($offset < 0) {
  40340. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  40341. $offset = 0;
  40342. } else {
  40343. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  40344. }
  40345. }
  40346. $pos = iconv_strrpos($haystack, $needle, $encoding);
  40347. return false !== $pos ? $offset + $pos : false;
  40348. }
  40349. public static function mb_strtolower($s, $encoding = null)
  40350. {
  40351. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  40352. }
  40353. public static function mb_strtoupper($s, $encoding = null)
  40354. {
  40355. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  40356. }
  40357. public static function mb_substitute_character($c = null)
  40358. {
  40359. if (0 === strcasecmp($c, 'none')) {
  40360. return true;
  40361. }
  40362. return null !== $c ? false : 'none';
  40363. }
  40364. public static function mb_substr($s, $start, $length = null, $encoding = null)
  40365. {
  40366. $encoding = self::getEncoding($encoding);
  40367. if ($start < 0) {
  40368. $start = iconv_strlen($s, $encoding) + $start;
  40369. if ($start < 0) {
  40370. $start = 0;
  40371. }
  40372. }
  40373. if (null === $length) {
  40374. $length = 2147483647;
  40375. } elseif ($length < 0) {
  40376. $length = iconv_strlen($s, $encoding) + $length - $start;
  40377. if ($length < 0) {
  40378. return '';
  40379. }
  40380. }
  40381. return iconv_substr($s, $start, $length, $encoding).'';
  40382. }
  40383. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  40384. {
  40385. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  40386. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  40387. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  40388. }
  40389. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  40390. {
  40391. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  40392. return self::getSubpart($pos, $part, $haystack, $encoding);
  40393. }
  40394. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  40395. {
  40396. $encoding = self::getEncoding($encoding);
  40397. $needle = self::mb_substr($needle, 0, 1, $encoding);
  40398. $pos = iconv_strrpos($haystack, $needle, $encoding);
  40399. return self::getSubpart($pos, $part, $haystack, $encoding);
  40400. }
  40401. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  40402. {
  40403. $needle = self::mb_substr($needle, 0, 1, $encoding);
  40404. $pos = self::mb_strripos($haystack, $needle, $encoding);
  40405. return self::getSubpart($pos, $part, $haystack, $encoding);
  40406. }
  40407. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  40408. {
  40409. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  40410. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  40411. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  40412. }
  40413. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  40414. {
  40415. $pos = strpos($haystack, $needle);
  40416. if (false === $pos) {
  40417. return false;
  40418. }
  40419. if ($part) {
  40420. return substr($haystack, 0, $pos);
  40421. }
  40422. return substr($haystack, $pos);
  40423. }
  40424. public static function mb_get_info($type = 'all')
  40425. {
  40426. $info = array(
  40427. 'internal_encoding' => self::$internalEncoding,
  40428. 'http_output' => 'pass',
  40429. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  40430. 'func_overload' => 0,
  40431. 'func_overload_list' => 'no overload',
  40432. 'mail_charset' => 'UTF-8',
  40433. 'mail_header_encoding' => 'BASE64',
  40434. 'mail_body_encoding' => 'BASE64',
  40435. 'illegal_chars' => 0,
  40436. 'encoding_translation' => 'Off',
  40437. 'language' => self::$language,
  40438. 'detect_order' => self::$encodingList,
  40439. 'substitute_character' => 'none',
  40440. 'strict_detection' => 'Off',
  40441. );
  40442. if ('all' === $type) {
  40443. return $info;
  40444. }
  40445. if (isset($info[$type])) {
  40446. return $info[$type];
  40447. }
  40448. return false;
  40449. }
  40450. public static function mb_http_input($type = '')
  40451. {
  40452. return false;
  40453. }
  40454. public static function mb_http_output($encoding = null)
  40455. {
  40456. return null !== $encoding ? 'pass' === $encoding : 'pass';
  40457. }
  40458. public static function mb_strwidth($s, $encoding = null)
  40459. {
  40460. $encoding = self::getEncoding($encoding);
  40461. if ('UTF-8' !== $encoding) {
  40462. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  40463. }
  40464. $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);
  40465. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  40466. }
  40467. public static function mb_substr_count($haystack, $needle, $encoding = null)
  40468. {
  40469. return substr_count($haystack, $needle);
  40470. }
  40471. public static function mb_output_handler($contents, $status)
  40472. {
  40473. return $contents;
  40474. }
  40475. public static function mb_chr($code, $encoding = null)
  40476. {
  40477. if (0x80 > $code %= 0x200000) {
  40478. $s = chr($code);
  40479. } elseif (0x800 > $code) {
  40480. $s = chr(0xC0 | $code >> 6).chr(0x80 | $code & 0x3F);
  40481. } elseif (0x10000 > $code) {
  40482. $s = chr(0xE0 | $code >> 12).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  40483. } else {
  40484. $s = chr(0xF0 | $code >> 18).chr(0x80 | $code >> 12 & 0x3F).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  40485. }
  40486. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  40487. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  40488. }
  40489. return $s;
  40490. }
  40491. public static function mb_ord($s, $encoding = null)
  40492. {
  40493. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  40494. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  40495. }
  40496. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  40497. if (0xF0 <= $code) {
  40498. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  40499. }
  40500. if (0xE0 <= $code) {
  40501. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  40502. }
  40503. if (0xC0 <= $code) {
  40504. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  40505. }
  40506. return $code;
  40507. }
  40508. private static function getSubpart($pos, $part, $haystack, $encoding)
  40509. {
  40510. if (false === $pos) {
  40511. return false;
  40512. }
  40513. if ($part) {
  40514. return self::mb_substr($haystack, 0, $pos, $encoding);
  40515. }
  40516. return self::mb_substr($haystack, $pos, null, $encoding);
  40517. }
  40518. private static function html_encoding_callback($m)
  40519. {
  40520. $i = 1;
  40521. $entities = '';
  40522. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  40523. while (isset($m[$i])) {
  40524. if (0x80 > $m[$i]) {
  40525. $entities .= chr($m[$i++]);
  40526. continue;
  40527. }
  40528. if (0xF0 <= $m[$i]) {
  40529. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  40530. } elseif (0xE0 <= $m[$i]) {
  40531. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  40532. } else {
  40533. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  40534. }
  40535. $entities .= '&#'.$c.';';
  40536. }
  40537. return $entities;
  40538. }
  40539. private static function title_case_lower($s)
  40540. {
  40541. return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
  40542. }
  40543. private static function title_case_upper($s)
  40544. {
  40545. return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
  40546. }
  40547. private static function getData($file)
  40548. {
  40549. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  40550. return require $file;
  40551. }
  40552. return false;
  40553. }
  40554. private static function getEncoding($encoding)
  40555. {
  40556. if (null === $encoding) {
  40557. return self::$internalEncoding;
  40558. }
  40559. $encoding = strtoupper($encoding);
  40560. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  40561. return 'CP850';
  40562. }
  40563. if ('UTF8' === $encoding) {
  40564. return 'UTF-8';
  40565. }
  40566. return $encoding;
  40567. }
  40568. }
  40569. <?php
  40570. static $data = array (
  40571. 'A' => 'a',
  40572. 'B' => 'b',
  40573. 'C' => 'c',
  40574. 'D' => 'd',
  40575. 'E' => 'e',
  40576. 'F' => 'f',
  40577. 'G' => 'g',
  40578. 'H' => 'h',
  40579. 'I' => 'i',
  40580. 'J' => 'j',
  40581. 'K' => 'k',
  40582. 'L' => 'l',
  40583. 'M' => 'm',
  40584. 'N' => 'n',
  40585. 'O' => 'o',
  40586. 'P' => 'p',
  40587. 'Q' => 'q',
  40588. 'R' => 'r',
  40589. 'S' => 's',
  40590. 'T' => 't',
  40591. 'U' => 'u',
  40592. 'V' => 'v',
  40593. 'W' => 'w',
  40594. 'X' => 'x',
  40595. 'Y' => 'y',
  40596. 'Z' => 'z',
  40597. 'À' => 'à',
  40598. '�' => 'á',
  40599. 'Â' => 'â',
  40600. 'Ã' => 'ã',
  40601. 'Ä' => 'ä',
  40602. 'Ã…' => 'Ã¥',
  40603. 'Æ' => 'æ',
  40604. 'Ç' => 'ç',
  40605. 'È' => 'è',
  40606. 'É' => 'é',
  40607. 'Ê' => 'ê',
  40608. 'Ë' => 'ë',
  40609. 'Ì' => 'ì',
  40610. '�' => 'í',
  40611. 'Î' => 'î',
  40612. '�' => 'ï',
  40613. '�' => 'ð',
  40614. 'Ñ' => 'ñ',
  40615. 'Ò' => 'ò',
  40616. 'Ó' => 'ó',
  40617. 'Ô' => 'ô',
  40618. 'Õ' => 'õ',
  40619. 'Ö' => 'ö',
  40620. 'Ø' => 'ø',
  40621. 'Ù' => 'ù',
  40622. 'Ú' => 'ú',
  40623. 'Û' => 'û',
  40624. 'Ü' => 'ü',
  40625. '�' => 'ý',
  40626. 'Þ' => 'þ',
  40627. 'Ā' => '�',
  40628. 'Ă' => 'ă',
  40629. 'Ä„' => 'Ä…',
  40630. 'Ć' => 'ć',
  40631. 'Ĉ' => 'ĉ',
  40632. 'ÄŠ' => 'Ä‹',
  40633. 'Č' => '�',
  40634. 'Ď' => '�',
  40635. '�' => 'đ',
  40636. 'Ä’' => 'Ä“',
  40637. 'Ä”' => 'Ä•',
  40638. 'Ä–' => 'Ä—',
  40639. 'Ę' => 'ę',
  40640. 'Äš' => 'Ä›',
  40641. 'Ĝ' => '�',
  40642. 'Äž' => 'ÄŸ',
  40643. 'Ä ' => 'Ä¡',
  40644. 'Ä¢' => 'Ä£',
  40645. 'Ĥ' => 'ĥ',
  40646. 'Ħ' => 'ħ',
  40647. 'Ĩ' => 'ĩ',
  40648. 'Ī' => 'ī',
  40649. 'Ĭ' => 'ĭ',
  40650. 'Į' => 'į',
  40651. 'İ' => 'i',
  40652. 'IJ' => 'ij',
  40653. 'Ĵ' => 'ĵ',
  40654. 'Ķ' => 'ķ',
  40655. 'Ĺ' => 'ĺ',
  40656. 'Ļ' => 'ļ',
  40657. 'Ľ' => 'ľ',
  40658. 'Ä¿' => 'Å€',
  40659. '�' => 'ł',
  40660. 'Ń' => 'ń',
  40661. 'Ņ' => 'ņ',
  40662. 'Ň' => 'ň',
  40663. 'ÅŠ' => 'Å‹',
  40664. 'Ō' => '�',
  40665. 'Ŏ' => '�',
  40666. '�' => 'ő',
  40667. 'Å’' => 'Å“',
  40668. 'Å”' => 'Å•',
  40669. 'Å–' => 'Å—',
  40670. 'Ř' => 'ř',
  40671. 'Åš' => 'Å›',
  40672. 'Ŝ' => '�',
  40673. 'Åž' => 'ÅŸ',
  40674. 'Å ' => 'Å¡',
  40675. 'Å¢' => 'Å£',
  40676. 'Ť' => 'ť',
  40677. 'Ŧ' => 'ŧ',
  40678. 'Ũ' => 'ũ',
  40679. 'Ū' => 'ū',
  40680. 'Ŭ' => 'ŭ',
  40681. 'Ů' => 'ů',
  40682. 'Ű' => 'ű',
  40683. 'Ų' => 'ų',
  40684. 'Ŵ' => 'ŵ',
  40685. 'Ŷ' => 'ŷ',
  40686. 'Ÿ' => 'ÿ',
  40687. 'Ź' => 'ź',
  40688. 'Ż' => 'ż',
  40689. 'Ž' => 'ž',
  40690. '�' => 'ɓ',
  40691. 'Ƃ' => 'ƃ',
  40692. 'Æ„' => 'Æ…',
  40693. 'Ɔ' => 'ɔ',
  40694. 'Ƈ' => 'ƈ',
  40695. 'Ɖ' => 'ɖ',
  40696. 'ÆŠ' => 'É—',
  40697. 'Ƌ' => 'ƌ',
  40698. 'Ǝ' => '�',
  40699. '�' => 'ə',
  40700. '�' => 'ɛ',
  40701. 'Æ‘' => 'Æ’',
  40702. 'Æ“' => 'É ',
  40703. 'Æ”' => 'É£',
  40704. 'Æ–' => 'É©',
  40705. 'Ɨ' => 'ɨ',
  40706. 'Ƙ' => 'ƙ',
  40707. 'Ɯ' => 'ɯ',
  40708. '�' => 'ɲ',
  40709. 'Ɵ' => 'ɵ',
  40710. 'Æ ' => 'Æ¡',
  40711. 'Æ¢' => 'Æ£',
  40712. 'Ƥ' => 'ƥ',
  40713. 'Ʀ' => 'ʀ',
  40714. 'Ƨ' => 'ƨ',
  40715. 'Ʃ' => 'ʃ',
  40716. 'Ƭ' => 'ƭ',
  40717. 'Ʈ' => 'ʈ',
  40718. 'Ư' => 'ư',
  40719. 'Ʊ' => 'ʊ',
  40720. 'Ʋ' => 'ʋ',
  40721. 'Ƴ' => 'ƴ',
  40722. 'Ƶ' => 'ƶ',
  40723. 'Æ·' => 'Ê’',
  40724. 'Ƹ' => 'ƹ',
  40725. 'Ƽ' => 'ƽ',
  40726. 'DŽ' => 'dž',
  40727. 'Dž' => 'dž',
  40728. 'LJ' => 'lj',
  40729. 'Lj' => 'lj',
  40730. 'NJ' => 'nj',
  40731. 'Nj' => 'nj',
  40732. '�' => 'ǎ',
  40733. '�' => '�',
  40734. 'Ç‘' => 'Ç’',
  40735. 'Ç“' => 'Ç”',
  40736. 'Ç•' => 'Ç–',
  40737. 'Ǘ' => 'ǘ',
  40738. 'Ç™' => 'Çš',
  40739. 'Ǜ' => 'ǜ',
  40740. 'Çž' => 'ÇŸ',
  40741. 'Ç ' => 'Ç¡',
  40742. 'Ç¢' => 'Ç£',
  40743. 'Ǥ' => 'ǥ',
  40744. 'Ǧ' => 'ǧ',
  40745. 'Ǩ' => 'ǩ',
  40746. 'Ǫ' => 'ǫ',
  40747. 'Ǭ' => 'ǭ',
  40748. 'Ǯ' => 'ǯ',
  40749. 'DZ' => 'dz',
  40750. 'Dz' => 'dz',
  40751. 'Ǵ' => 'ǵ',
  40752. 'Ƕ' => 'ƕ',
  40753. 'Ç·' => 'Æ¿',
  40754. 'Ǹ' => 'ǹ',
  40755. 'Ǻ' => 'ǻ',
  40756. 'Ǽ' => 'ǽ',
  40757. 'Ǿ' => 'ǿ',
  40758. 'Ȁ' => '�',
  40759. 'Ȃ' => 'ȃ',
  40760. 'È„' => 'È…',
  40761. 'Ȇ' => 'ȇ',
  40762. 'Ȉ' => 'ȉ',
  40763. 'ÈŠ' => 'È‹',
  40764. 'Ȍ' => '�',
  40765. 'Ȏ' => '�',
  40766. '�' => 'ȑ',
  40767. 'È’' => 'È“',
  40768. 'È”' => 'È•',
  40769. 'È–' => 'È—',
  40770. 'Ș' => 'ș',
  40771. 'Èš' => 'È›',
  40772. 'Ȝ' => '�',
  40773. 'Èž' => 'ÈŸ',
  40774. 'È ' => 'Æž',
  40775. 'È¢' => 'È£',
  40776. 'Ȥ' => 'ȥ',
  40777. 'Ȧ' => 'ȧ',
  40778. 'Ȩ' => 'ȩ',
  40779. 'Ȫ' => 'ȫ',
  40780. 'Ȭ' => 'ȭ',
  40781. 'Ȯ' => 'ȯ',
  40782. 'Ȱ' => 'ȱ',
  40783. 'Ȳ' => 'ȳ',
  40784. 'Ⱥ' => 'ⱥ',
  40785. 'Ȼ' => 'ȼ',
  40786. 'Ƚ' => 'ƚ',
  40787. 'Ⱦ' => 'ⱦ',
  40788. '�' => 'ɂ',
  40789. 'Ƀ' => 'ƀ',
  40790. 'Ʉ' => 'ʉ',
  40791. 'Ʌ' => 'ʌ',
  40792. 'Ɇ' => 'ɇ',
  40793. 'Ɉ' => 'ɉ',
  40794. 'ÉŠ' => 'É‹',
  40795. 'Ɍ' => '�',
  40796. 'Ɏ' => '�',
  40797. 'Ͱ' => 'ͱ',
  40798. 'Ͳ' => 'ͳ',
  40799. 'Ͷ' => 'ͷ',
  40800. 'Ϳ' => 'ϳ',
  40801. 'Ά' => 'ά',
  40802. 'Έ' => 'έ',
  40803. 'Ή' => 'ή',
  40804. 'Ί' => 'ί',
  40805. 'Ό' => 'ό',
  40806. 'Ύ' => '�',
  40807. '�' => 'ώ',
  40808. 'Α' => 'α',
  40809. 'Β' => 'β',
  40810. 'Γ' => 'γ',
  40811. 'Δ' => 'δ',
  40812. 'Ε' => 'ε',
  40813. 'Ζ' => 'ζ',
  40814. 'Η' => 'η',
  40815. 'Θ' => 'θ',
  40816. 'Ι' => 'ι',
  40817. 'Κ' => 'κ',
  40818. 'Λ' => 'λ',
  40819. 'Μ' => 'μ',
  40820. '�' => 'ν',
  40821. 'Ξ' => 'ξ',
  40822. 'Ο' => 'ο',
  40823. 'Π' => 'π',
  40824. 'Ρ' => '�',
  40825. 'Σ' => 'σ',
  40826. 'Τ' => 'τ',
  40827. 'Î¥' => 'Ï…',
  40828. 'Φ' => 'φ',
  40829. 'Χ' => 'χ',
  40830. 'Ψ' => 'ψ',
  40831. 'Ω' => 'ω',
  40832. 'Ϊ' => 'ϊ',
  40833. 'Ϋ' => 'ϋ',
  40834. '�' => 'ϗ',
  40835. 'Ϙ' => 'ϙ',
  40836. 'Ïš' => 'Ï›',
  40837. 'Ϝ' => '�',
  40838. 'Ïž' => 'ÏŸ',
  40839. 'Ï ' => 'Ï¡',
  40840. 'Ï¢' => 'Ï£',
  40841. 'Ϥ' => 'ϥ',
  40842. 'Ϧ' => 'ϧ',
  40843. 'Ϩ' => 'ϩ',
  40844. 'Ϫ' => 'ϫ',
  40845. 'Ϭ' => 'ϭ',
  40846. 'Ϯ' => 'ϯ',
  40847. 'ϴ' => 'θ',
  40848. 'Ϸ' => 'ϸ',
  40849. 'Ϲ' => 'ϲ',
  40850. 'Ϻ' => 'ϻ',
  40851. 'Ͻ' => 'ͻ',
  40852. 'Ͼ' => 'ͼ',
  40853. 'Ͽ' => 'ͽ',
  40854. 'Ѐ' => '�',
  40855. '�' => 'ё',
  40856. 'Ђ' => 'ђ',
  40857. 'Ѓ' => 'ѓ',
  40858. 'Є' => 'є',
  40859. 'Ð…' => 'Ñ•',
  40860. 'І' => 'і',
  40861. 'Ї' => 'ї',
  40862. 'Ј' => 'ј',
  40863. 'Љ' => 'љ',
  40864. 'Њ' => 'њ',
  40865. 'Ћ' => 'ћ',
  40866. 'Ќ' => 'ќ',
  40867. '�' => '�',
  40868. 'ÐŽ' => 'Ñž',
  40869. '�' => 'џ',
  40870. '�' => 'а',
  40871. 'Б' => 'б',
  40872. 'В' => 'в',
  40873. 'Г' => 'г',
  40874. 'Д' => 'д',
  40875. 'Е' => 'е',
  40876. 'Ж' => 'ж',
  40877. 'З' => 'з',
  40878. 'И' => 'и',
  40879. 'Й' => 'й',
  40880. 'К' => 'к',
  40881. 'Л' => 'л',
  40882. 'М' => 'м',
  40883. '�' => 'н',
  40884. 'О' => 'о',
  40885. 'П' => 'п',
  40886. 'Р' => 'р',
  40887. 'С' => '�',
  40888. 'Т' => 'т',
  40889. 'У' => 'у',
  40890. 'Ф' => 'ф',
  40891. 'Ð¥' => 'Ñ…',
  40892. 'Ц' => 'ц',
  40893. 'Ч' => 'ч',
  40894. 'Ш' => 'ш',
  40895. 'Щ' => 'щ',
  40896. 'Ъ' => 'ъ',
  40897. 'Ы' => 'ы',
  40898. 'Ь' => 'ь',
  40899. 'Э' => '�',
  40900. 'Ю' => 'ю',
  40901. 'Я' => '�',
  40902. 'Ñ ' => 'Ñ¡',
  40903. 'Ñ¢' => 'Ñ£',
  40904. 'Ѥ' => 'ѥ',
  40905. 'Ѧ' => 'ѧ',
  40906. 'Ѩ' => 'ѩ',
  40907. 'Ѫ' => 'ѫ',
  40908. 'Ѭ' => 'ѭ',
  40909. 'Ѯ' => 'ѯ',
  40910. 'Ѱ' => 'ѱ',
  40911. 'Ѳ' => 'ѳ',
  40912. 'Ѵ' => 'ѵ',
  40913. 'Ѷ' => 'ѷ',
  40914. 'Ѹ' => 'ѹ',
  40915. 'Ѻ' => 'ѻ',
  40916. 'Ѽ' => 'ѽ',
  40917. 'Ѿ' => 'ѿ',
  40918. 'Ò€' => 'Ò�',
  40919. 'ÒŠ' => 'Ò‹',
  40920. 'Ҍ' => '�',
  40921. 'ÒŽ' => 'Ò�',
  40922. 'Ò�' => 'Ò‘',
  40923. 'Ò’' => 'Ò“',
  40924. 'Ò”' => 'Ò•',
  40925. 'Ò–' => 'Ò—',
  40926. 'Ò˜' => 'Ò™',
  40927. 'Òš' => 'Ò›',
  40928. 'Ҝ' => '�',
  40929. 'Òž' => 'ÒŸ',
  40930. 'Ò ' => 'Ò¡',
  40931. 'Ò¢' => 'Ò£',
  40932. 'Ò¤' => 'Ò¥',
  40933. 'Ò¦' => 'Ò§',
  40934. 'Ò¨' => 'Ò©',
  40935. 'Òª' => 'Ò«',
  40936. 'Ò¬' => 'Ò­',
  40937. 'Ò®' => 'Ò¯',
  40938. 'Ò°' => 'Ò±',
  40939. 'Ò²' => 'Ò³',
  40940. 'Ò´' => 'Òµ',
  40941. 'Ò¶' => 'Ò·',
  40942. 'Ò¸' => 'Ò¹',
  40943. 'Òº' => 'Ò»',
  40944. 'Ò¼' => 'Ò½',
  40945. 'Ò¾' => 'Ò¿',
  40946. 'Ó€' => 'Ó�',
  40947. 'Ó�' => 'Ó‚',
  40948. 'Óƒ' => 'Ó„',
  40949. 'Ó…' => 'Ó†',
  40950. 'Ó‡' => 'Óˆ',
  40951. 'Ó‰' => 'ÓŠ',
  40952. 'Ӌ' => 'ӌ',
  40953. 'Ó�' => 'ÓŽ',
  40954. 'Ó�' => 'Ó‘',
  40955. 'Ó’' => 'Ó“',
  40956. 'Ó”' => 'Ó•',
  40957. 'Ó–' => 'Ó—',
  40958. 'Ó˜' => 'Ó™',
  40959. 'Óš' => 'Ó›',
  40960. 'Ӝ' => '�',
  40961. 'Óž' => 'ÓŸ',
  40962. 'Ó ' => 'Ó¡',
  40963. 'Ó¢' => 'Ó£',
  40964. 'Ó¤' => 'Ó¥',
  40965. 'Ó¦' => 'Ó§',
  40966. 'Ó¨' => 'Ó©',
  40967. 'Óª' => 'Ó«',
  40968. 'Ó¬' => 'Ó­',
  40969. 'Ó®' => 'Ó¯',
  40970. 'Ó°' => 'Ó±',
  40971. 'Ó²' => 'Ó³',
  40972. 'Ó´' => 'Óµ',
  40973. 'Ó¶' => 'Ó·',
  40974. 'Ó¸' => 'Ó¹',
  40975. 'Óº' => 'Ó»',
  40976. 'Ó¼' => 'Ó½',
  40977. 'Ó¾' => 'Ó¿',
  40978. 'Ô€' => 'Ô�',
  40979. 'Ô‚' => 'Ôƒ',
  40980. 'Ô„' => 'Ô…',
  40981. 'Ô†' => 'Ô‡',
  40982. 'Ôˆ' => 'Ô‰',
  40983. 'ÔŠ' => 'Ô‹',
  40984. 'Ԍ' => '�',
  40985. 'ÔŽ' => 'Ô�',
  40986. 'Ô�' => 'Ô‘',
  40987. 'Ô’' => 'Ô“',
  40988. 'Ô”' => 'Ô•',
  40989. 'Ô–' => 'Ô—',
  40990. 'Ô˜' => 'Ô™',
  40991. 'Ôš' => 'Ô›',
  40992. 'Ԝ' => '�',
  40993. 'Ôž' => 'ÔŸ',
  40994. 'Ô ' => 'Ô¡',
  40995. 'Ô¢' => 'Ô£',
  40996. 'Ô¤' => 'Ô¥',
  40997. 'Ô¦' => 'Ô§',
  40998. 'Ô¨' => 'Ô©',
  40999. 'Ôª' => 'Ô«',
  41000. 'Ô¬' => 'Ô­',
  41001. 'Ô®' => 'Ô¯',
  41002. 'Ô±' => 'Õ¡',
  41003. 'Ô²' => 'Õ¢',
  41004. 'Ô³' => 'Õ£',
  41005. 'Ô´' => 'Õ¤',
  41006. 'Ôµ' => 'Õ¥',
  41007. 'Ô¶' => 'Õ¦',
  41008. 'Ô·' => 'Õ§',
  41009. 'Ô¸' => 'Õ¨',
  41010. 'Ô¹' => 'Õ©',
  41011. 'Ôº' => 'Õª',
  41012. 'Ô»' => 'Õ«',
  41013. 'Ô¼' => 'Õ¬',
  41014. 'Ô½' => 'Õ­',
  41015. 'Ô¾' => 'Õ®',
  41016. 'Ô¿' => 'Õ¯',
  41017. 'Õ€' => 'Õ°',
  41018. 'Õ�' => 'Õ±',
  41019. 'Õ‚' => 'Õ²',
  41020. 'Õƒ' => 'Õ³',
  41021. 'Õ„' => 'Õ´',
  41022. 'Õ…' => 'Õµ',
  41023. 'Õ†' => 'Õ¶',
  41024. 'Õ‡' => 'Õ·',
  41025. 'Õˆ' => 'Õ¸',
  41026. 'Õ‰' => 'Õ¹',
  41027. 'ÕŠ' => 'Õº',
  41028. 'Õ‹' => 'Õ»',
  41029. 'Ռ' => 'ռ',
  41030. 'Õ�' => 'Õ½',
  41031. 'ÕŽ' => 'Õ¾',
  41032. 'Õ�' => 'Õ¿',
  41033. 'Õ�' => 'Ö€',
  41034. 'Õ‘' => 'Ö�',
  41035. 'Õ’' => 'Ö‚',
  41036. 'Õ“' => 'Öƒ',
  41037. 'Õ”' => 'Ö„',
  41038. 'Õ•' => 'Ö…',
  41039. 'Õ–' => 'Ö†',
  41040. 'á‚ ' => 'â´€',
  41041. 'á‚¡' => 'â´�',
  41042. 'á‚¢' => 'â´‚',
  41043. 'á‚£' => 'â´ƒ',
  41044. 'Ⴄ' => 'ⴄ',
  41045. 'á‚¥' => 'â´…',
  41046. 'Ⴆ' => 'ⴆ',
  41047. 'á‚§' => 'â´‡',
  41048. 'Ⴈ' => 'ⴈ',
  41049. 'á‚©' => 'â´‰',
  41050. 'Ⴊ' => 'ⴊ',
  41051. 'á‚«' => 'â´‹',
  41052. 'Ⴌ' => 'ⴌ',
  41053. 'á‚­' => 'â´�',
  41054. 'á‚®' => 'â´Ž',
  41055. 'Ⴏ' => '�',
  41056. 'á‚°' => 'â´�',
  41057. 'Ⴑ' => 'ⴑ',
  41058. 'Ⴒ' => 'ⴒ',
  41059. 'Ⴓ' => 'ⴓ',
  41060. 'á‚´' => 'â´”',
  41061. 'Ⴕ' => 'ⴕ',
  41062. 'á‚¶' => 'â´–',
  41063. 'á‚·' => 'â´—',
  41064. 'Ⴘ' => 'ⴘ',
  41065. 'Ⴙ' => 'ⴙ',
  41066. 'Ⴚ' => 'ⴚ',
  41067. 'á‚»' => 'â´›',
  41068. 'Ⴜ' => 'ⴜ',
  41069. 'Ⴝ' => '�',
  41070. 'Ⴞ' => 'ⴞ',
  41071. 'á‚¿' => 'â´Ÿ',
  41072. 'Ⴠ' => 'ⴠ',
  41073. '�' => 'ⴡ',
  41074. 'Ⴢ' => 'ⴢ',
  41075. 'Ⴣ' => 'ⴣ',
  41076. 'Ⴤ' => 'ⴤ',
  41077. 'Ⴥ' => 'ⴥ',
  41078. 'Ⴧ' => 'ⴧ',
  41079. '�' => 'ⴭ',
  41080. 'Ḁ' => '�',
  41081. 'Ḃ' => 'ḃ',
  41082. 'Ḅ' => 'ḅ',
  41083. 'Ḇ' => 'ḇ',
  41084. 'Ḉ' => 'ḉ',
  41085. 'Ḋ' => 'ḋ',
  41086. 'Ḍ' => '�',
  41087. 'Ḏ' => '�',
  41088. '�' => 'ḑ',
  41089. 'Ḓ' => 'ḓ',
  41090. 'Ḕ' => 'ḕ',
  41091. 'Ḗ' => 'ḗ',
  41092. 'Ḙ' => 'ḙ',
  41093. 'Ḛ' => 'ḛ',
  41094. 'Ḝ' => '�',
  41095. 'Ḟ' => 'ḟ',
  41096. 'Ḡ' => 'ḡ',
  41097. 'Ḣ' => 'ḣ',
  41098. 'Ḥ' => 'ḥ',
  41099. 'Ḧ' => 'ḧ',
  41100. 'Ḩ' => 'ḩ',
  41101. 'Ḫ' => 'ḫ',
  41102. 'Ḭ' => 'ḭ',
  41103. 'Ḯ' => 'ḯ',
  41104. 'Ḱ' => 'ḱ',
  41105. 'Ḳ' => 'ḳ',
  41106. 'Ḵ' => 'ḵ',
  41107. 'Ḷ' => 'ḷ',
  41108. 'Ḹ' => 'ḹ',
  41109. 'Ḻ' => 'ḻ',
  41110. 'Ḽ' => 'ḽ',
  41111. 'Ḿ' => 'ḿ',
  41112. 'Ṁ' => '�',
  41113. 'Ṃ' => 'ṃ',
  41114. 'Ṅ' => 'ṅ',
  41115. 'Ṇ' => 'ṇ',
  41116. 'Ṉ' => 'ṉ',
  41117. 'Ṋ' => 'ṋ',
  41118. 'Ṍ' => '�',
  41119. 'Ṏ' => '�',
  41120. '�' => 'ṑ',
  41121. 'Ṓ' => 'ṓ',
  41122. 'Ṕ' => 'ṕ',
  41123. 'á¹–' => 'á¹—',
  41124. 'Ṙ' => 'ṙ',
  41125. 'Ṛ' => 'ṛ',
  41126. 'Ṝ' => '�',
  41127. 'Ṟ' => 'ṟ',
  41128. 'Ṡ' => 'ṡ',
  41129. 'á¹¢' => 'á¹£',
  41130. 'Ṥ' => 'ṥ',
  41131. 'Ṧ' => 'ṧ',
  41132. 'Ṩ' => 'ṩ',
  41133. 'Ṫ' => 'ṫ',
  41134. 'Ṭ' => 'ṭ',
  41135. 'Ṯ' => 'ṯ',
  41136. 'á¹°' => 'á¹±',
  41137. 'á¹²' => 'á¹³',
  41138. 'á¹´' => 'á¹µ',
  41139. 'á¹¶' => 'á¹·',
  41140. 'Ṹ' => 'ṹ',
  41141. 'Ṻ' => 'ṻ',
  41142. 'á¹¼' => 'á¹½',
  41143. 'Ṿ' => 'ṿ',
  41144. 'Ẁ' => '�',
  41145. 'Ẃ' => 'ẃ',
  41146. 'Ẅ' => 'ẅ',
  41147. 'Ẇ' => 'ẇ',
  41148. 'Ẉ' => 'ẉ',
  41149. 'Ẋ' => 'ẋ',
  41150. 'Ẍ' => '�',
  41151. 'Ẏ' => '�',
  41152. '�' => 'ẑ',
  41153. 'Ẓ' => 'ẓ',
  41154. 'Ẕ' => 'ẕ',
  41155. 'ẞ' => 'ß',
  41156. 'Ạ' => 'ạ',
  41157. 'Ả' => 'ả',
  41158. 'Ấ' => 'ấ',
  41159. 'Ầ' => 'ầ',
  41160. 'Ẩ' => 'ẩ',
  41161. 'Ẫ' => 'ẫ',
  41162. 'Ậ' => 'ậ',
  41163. 'Ắ' => 'ắ',
  41164. 'Ằ' => 'ằ',
  41165. 'Ẳ' => 'ẳ',
  41166. 'Ẵ' => 'ẵ',
  41167. 'Ặ' => 'ặ',
  41168. 'Ẹ' => 'ẹ',
  41169. 'Ẻ' => 'ẻ',
  41170. 'Ẽ' => 'ẽ',
  41171. 'Ế' => 'ế',
  41172. 'Ề' => '�',
  41173. 'Ể' => 'ể',
  41174. 'Ễ' => 'ễ',
  41175. 'Ệ' => 'ệ',
  41176. 'Ỉ' => 'ỉ',
  41177. 'Ị' => 'ị',
  41178. 'Ọ' => '�',
  41179. 'Ỏ' => '�',
  41180. '�' => 'ố',
  41181. 'Ồ' => 'ồ',
  41182. 'Ổ' => 'ổ',
  41183. 'á»–' => 'á»—',
  41184. 'Ộ' => 'ộ',
  41185. 'Ớ' => 'ớ',
  41186. 'Ờ' => '�',
  41187. 'Ở' => 'ở',
  41188. 'Ỡ' => 'ỡ',
  41189. 'Ợ' => 'ợ',
  41190. 'Ụ' => 'ụ',
  41191. 'Ủ' => 'ủ',
  41192. 'Ứ' => 'ứ',
  41193. 'Ừ' => 'ừ',
  41194. 'Ử' => 'ử',
  41195. 'Ữ' => 'ữ',
  41196. 'á»°' => 'á»±',
  41197. 'Ỳ' => 'ỳ',
  41198. 'Ỵ' => 'ỵ',
  41199. 'á»¶' => 'á»·',
  41200. 'Ỹ' => 'ỹ',
  41201. 'Ỻ' => 'ỻ',
  41202. 'Ỽ' => 'ỽ',
  41203. 'Ỿ' => 'ỿ',
  41204. 'Ἀ' => 'ἀ',
  41205. 'Ἁ' => '�',
  41206. 'Ἂ' => 'ἂ',
  41207. 'Ἃ' => 'ἃ',
  41208. 'Ἄ' => 'ἄ',
  41209. '�' => 'ἅ',
  41210. 'Ἆ' => 'ἆ',
  41211. '�' => 'ἇ',
  41212. 'Ἐ' => '�',
  41213. 'Ἑ' => 'ἑ',
  41214. 'Ἒ' => 'ἒ',
  41215. 'Ἓ' => 'ἓ',
  41216. 'Ἔ' => 'ἔ',
  41217. '�' => 'ἕ',
  41218. 'Ἠ' => 'ἠ',
  41219. 'Ἡ' => 'ἡ',
  41220. 'Ἢ' => 'ἢ',
  41221. 'Ἣ' => 'ἣ',
  41222. 'Ἤ' => 'ἤ',
  41223. 'á¼­' => 'á¼¥',
  41224. 'Ἦ' => 'ἦ',
  41225. 'Ἧ' => 'ἧ',
  41226. 'Ἰ' => 'ἰ',
  41227. 'á¼¹' => 'á¼±',
  41228. 'Ἲ' => 'ἲ',
  41229. 'á¼»' => 'á¼³',
  41230. 'á¼¼' => 'á¼´',
  41231. 'á¼½' => 'á¼µ',
  41232. 'á¼¾' => 'á¼¶',
  41233. 'Ἷ' => 'ἷ',
  41234. 'Ὀ' => 'ὀ',
  41235. 'Ὁ' => '�',
  41236. 'Ὂ' => 'ὂ',
  41237. 'Ὃ' => 'ὃ',
  41238. 'Ὄ' => 'ὄ',
  41239. '�' => 'ὅ',
  41240. 'Ὑ' => 'ὑ',
  41241. 'Ὓ' => 'ὓ',
  41242. '�' => 'ὕ',
  41243. 'Ὗ' => 'ὗ',
  41244. 'Ὠ' => 'ὠ',
  41245. 'Ὡ' => 'ὡ',
  41246. 'Ὢ' => 'ὢ',
  41247. 'Ὣ' => 'ὣ',
  41248. 'Ὤ' => 'ὤ',
  41249. 'á½­' => 'á½¥',
  41250. 'Ὦ' => 'ὦ',
  41251. 'Ὧ' => 'ὧ',
  41252. 'ᾈ' => 'ᾀ',
  41253. 'ᾉ' => '�',
  41254. 'ᾊ' => 'ᾂ',
  41255. 'ᾋ' => 'ᾃ',
  41256. 'ᾌ' => 'ᾄ',
  41257. '�' => 'ᾅ',
  41258. 'ᾎ' => 'ᾆ',
  41259. '�' => 'ᾇ',
  41260. 'ᾘ' => '�',
  41261. 'ᾙ' => 'ᾑ',
  41262. 'ᾚ' => 'ᾒ',
  41263. 'ᾛ' => 'ᾓ',
  41264. 'ᾜ' => 'ᾔ',
  41265. '�' => 'ᾕ',
  41266. 'ᾞ' => 'ᾖ',
  41267. 'ᾟ' => 'ᾗ',
  41268. 'ᾨ' => 'ᾠ',
  41269. 'ᾩ' => 'ᾡ',
  41270. 'ᾪ' => 'ᾢ',
  41271. 'ᾫ' => 'ᾣ',
  41272. 'ᾬ' => 'ᾤ',
  41273. 'á¾­' => 'á¾¥',
  41274. 'ᾮ' => 'ᾦ',
  41275. 'ᾯ' => 'ᾧ',
  41276. 'Ᾰ' => 'ᾰ',
  41277. 'á¾¹' => 'á¾±',
  41278. 'Ὰ' => 'ὰ',
  41279. 'á¾»' => 'á½±',
  41280. 'á¾¼' => 'á¾³',
  41281. 'Ὲ' => 'ὲ',
  41282. 'Έ' => 'έ',
  41283. 'Ὴ' => 'ὴ',
  41284. 'á¿‹' => 'á½µ',
  41285. 'ῌ' => 'ῃ',
  41286. 'Ῐ' => '�',
  41287. 'á¿™' => 'á¿‘',
  41288. 'Ὶ' => 'ὶ',
  41289. 'á¿›' => 'á½·',
  41290. 'Ῠ' => 'ῠ',
  41291. 'á¿©' => 'á¿¡',
  41292. 'Ὺ' => 'ὺ',
  41293. 'á¿«' => 'á½»',
  41294. 'Ῥ' => 'ῥ',
  41295. 'Ὸ' => 'ὸ',
  41296. 'Ό' => 'ό',
  41297. 'Ὼ' => 'ὼ',
  41298. 'á¿»' => 'á½½',
  41299. 'ῼ' => 'ῳ',
  41300. 'Ω' => 'ω',
  41301. 'K' => 'k',
  41302. 'â„«' => 'Ã¥',
  41303. 'Ⅎ' => 'ⅎ',
  41304. 'â… ' => 'â…°',
  41305. 'â…¡' => 'â…±',
  41306. 'â…¢' => 'â…²',
  41307. 'â…£' => 'â…³',
  41308. 'â…¤' => 'â…´',
  41309. 'â…¥' => 'â…µ',
  41310. 'â…¦' => 'â…¶',
  41311. 'â…§' => 'â…·',
  41312. 'â…¨' => 'â…¸',
  41313. 'â…©' => 'â…¹',
  41314. 'â…ª' => 'â…º',
  41315. 'â…«' => 'â…»',
  41316. 'â…¬' => 'â…¼',
  41317. 'â…­' => 'â…½',
  41318. 'â…®' => 'â…¾',
  41319. 'â…¯' => 'â…¿',
  41320. 'Ↄ' => 'ↄ',
  41321. 'Ⓐ' => '�',
  41322. 'â’·' => 'â“‘',
  41323. 'â’¸' => 'â“’',
  41324. 'â’¹' => 'â““',
  41325. 'â’º' => 'â“”',
  41326. 'â’»' => 'â“•',
  41327. 'â’¼' => 'â“–',
  41328. 'â’½' => 'â“—',
  41329. 'Ⓘ' => 'ⓘ',
  41330. 'â’¿' => 'â“™',
  41331. 'Ⓚ' => 'ⓚ',
  41332. '�' => 'ⓛ',
  41333. 'Ⓜ' => 'ⓜ',
  41334. 'Ⓝ' => '�',
  41335. 'Ⓞ' => 'ⓞ',
  41336. 'Ⓟ' => 'ⓟ',
  41337. 'Ⓠ' => 'ⓠ',
  41338. 'Ⓡ' => 'ⓡ',
  41339. 'Ⓢ' => 'ⓢ',
  41340. 'Ⓣ' => 'ⓣ',
  41341. 'Ⓤ' => 'ⓤ',
  41342. 'â“‹' => 'â“¥',
  41343. 'Ⓦ' => 'ⓦ',
  41344. '�' => 'ⓧ',
  41345. 'Ⓨ' => 'ⓨ',
  41346. '�' => 'ⓩ',
  41347. 'â°€' => 'â°°',
  41348. 'â°�' => 'â°±',
  41349. 'â°‚' => 'â°²',
  41350. 'â°ƒ' => 'â°³',
  41351. 'â°„' => 'â°´',
  41352. 'â°…' => 'â°µ',
  41353. 'â°†' => 'â°¶',
  41354. 'â°‡' => 'â°·',
  41355. 'â°ˆ' => 'â°¸',
  41356. 'â°‰' => 'â°¹',
  41357. 'â°Š' => 'â°º',
  41358. 'â°‹' => 'â°»',
  41359. 'Ⰼ' => 'ⰼ',
  41360. 'â°�' => 'â°½',
  41361. 'â°Ž' => 'â°¾',
  41362. 'â°�' => 'â°¿',
  41363. 'â°�' => 'â±€',
  41364. 'Ⱁ' => '�',
  41365. 'Ⱂ' => 'ⱂ',
  41366. 'Ⱃ' => 'ⱃ',
  41367. 'Ⱄ' => 'ⱄ',
  41368. 'â°•' => 'â±…',
  41369. 'Ⱆ' => 'ⱆ',
  41370. 'Ⱇ' => 'ⱇ',
  41371. 'Ⱈ' => 'ⱈ',
  41372. 'Ⱉ' => 'ⱉ',
  41373. 'Ⱊ' => 'ⱊ',
  41374. 'Ⱋ' => 'ⱋ',
  41375. 'Ⱌ' => 'ⱌ',
  41376. '�' => '�',
  41377. 'Ⱎ' => 'ⱎ',
  41378. 'Ⱏ' => '�',
  41379. 'Ⱐ' => '�',
  41380. 'Ⱑ' => 'ⱑ',
  41381. 'â°¢' => 'â±’',
  41382. 'Ⱓ' => 'ⱓ',
  41383. 'â°¤' => 'â±”',
  41384. 'Ⱕ' => 'ⱕ',
  41385. 'â°¦' => 'â±–',
  41386. 'â°§' => 'â±—',
  41387. 'Ⱘ' => 'ⱘ',
  41388. 'â°©' => 'â±™',
  41389. 'Ⱚ' => 'ⱚ',
  41390. 'â°«' => 'â±›',
  41391. 'Ⱜ' => 'ⱜ',
  41392. 'Ⱝ' => '�',
  41393. 'Ⱞ' => 'ⱞ',
  41394. 'Ⱡ' => 'ⱡ',
  41395. 'â±¢' => 'É«',
  41396. 'â±£' => 'áµ½',
  41397. 'Ɽ' => 'ɽ',
  41398. 'Ⱨ' => 'ⱨ',
  41399. 'Ⱪ' => 'ⱪ',
  41400. 'Ⱬ' => 'ⱬ',
  41401. 'â±­' => 'É‘',
  41402. 'Ɱ' => 'ɱ',
  41403. 'Ɐ' => '�',
  41404. 'â±°' => 'É’',
  41405. 'â±²' => 'â±³',
  41406. 'â±µ' => 'â±¶',
  41407. 'â±¾' => 'È¿',
  41408. 'Ɀ' => 'ɀ',
  41409. 'Ⲁ' => '�',
  41410. 'Ⲃ' => 'ⲃ',
  41411. 'Ⲅ' => 'ⲅ',
  41412. 'Ⲇ' => 'ⲇ',
  41413. 'Ⲉ' => 'ⲉ',
  41414. 'Ⲋ' => 'ⲋ',
  41415. 'Ⲍ' => '�',
  41416. 'Ⲏ' => '�',
  41417. '�' => 'ⲑ',
  41418. 'Ⲓ' => 'ⲓ',
  41419. 'Ⲕ' => 'ⲕ',
  41420. 'â²–' => 'â²—',
  41421. 'Ⲙ' => 'ⲙ',
  41422. 'Ⲛ' => 'ⲛ',
  41423. 'Ⲝ' => '�',
  41424. 'Ⲟ' => 'ⲟ',
  41425. 'Ⲡ' => 'ⲡ',
  41426. 'â²¢' => 'â²£',
  41427. 'Ⲥ' => 'ⲥ',
  41428. 'Ⲧ' => 'ⲧ',
  41429. 'Ⲩ' => 'ⲩ',
  41430. 'Ⲫ' => 'ⲫ',
  41431. 'Ⲭ' => 'ⲭ',
  41432. 'Ⲯ' => 'ⲯ',
  41433. 'â²°' => 'â²±',
  41434. 'â²²' => 'â²³',
  41435. 'â²´' => 'â²µ',
  41436. 'â²¶' => 'â²·',
  41437. 'Ⲹ' => 'ⲹ',
  41438. 'Ⲻ' => 'ⲻ',
  41439. 'â²¼' => 'â²½',
  41440. 'Ⲿ' => 'ⲿ',
  41441. 'Ⳁ' => '�',
  41442. 'Ⳃ' => 'ⳃ',
  41443. 'Ⳅ' => 'ⳅ',
  41444. 'Ⳇ' => 'ⳇ',
  41445. 'Ⳉ' => 'ⳉ',
  41446. 'Ⳋ' => 'ⳋ',
  41447. 'Ⳍ' => '�',
  41448. 'Ⳏ' => '�',
  41449. '�' => 'ⳑ',
  41450. 'Ⳓ' => 'ⳓ',
  41451. 'Ⳕ' => 'ⳕ',
  41452. 'â³–' => 'â³—',
  41453. 'Ⳙ' => 'ⳙ',
  41454. 'Ⳛ' => 'ⳛ',
  41455. 'Ⳝ' => '�',
  41456. 'Ⳟ' => 'ⳟ',
  41457. 'Ⳡ' => 'ⳡ',
  41458. 'â³¢' => 'â³£',
  41459. 'Ⳬ' => 'ⳬ',
  41460. 'â³­' => 'â³®',
  41461. 'â³²' => 'â³³',
  41462. 'Ꙁ' => '�',
  41463. 'Ꙃ' => 'ꙃ',
  41464. 'Ꙅ' => 'ꙅ',
  41465. 'Ꙇ' => 'ꙇ',
  41466. 'Ꙉ' => 'ꙉ',
  41467. 'Ꙋ' => 'ꙋ',
  41468. 'Ꙍ' => '�',
  41469. 'Ꙏ' => '�',
  41470. '�' => 'ꙑ',
  41471. 'Ꙓ' => 'ꙓ',
  41472. 'Ꙕ' => 'ꙕ',
  41473. 'ê™–' => 'ê™—',
  41474. 'Ꙙ' => 'ꙙ',
  41475. 'Ꙛ' => 'ꙛ',
  41476. 'Ꙝ' => '�',
  41477. 'Ꙟ' => 'ꙟ',
  41478. 'Ꙡ' => 'ꙡ',
  41479. 'Ꙣ' => 'ꙣ',
  41480. 'Ꙥ' => 'ꙥ',
  41481. 'Ꙧ' => 'ꙧ',
  41482. 'Ꙩ' => 'ꙩ',
  41483. 'Ꙫ' => 'ꙫ',
  41484. 'Ꙭ' => 'ꙭ',
  41485. 'Ꚁ' => '�',
  41486. 'Ꚃ' => 'ꚃ',
  41487. 'êš„' => 'êš…',
  41488. 'Ꚇ' => 'ꚇ',
  41489. 'Ꚉ' => 'ꚉ',
  41490. 'Ꚋ' => 'ꚋ',
  41491. 'Ꚍ' => '�',
  41492. 'Ꚏ' => '�',
  41493. '�' => 'ꚑ',
  41494. 'êš’' => 'êš“',
  41495. 'êš”' => 'êš•',
  41496. 'êš–' => 'êš—',
  41497. 'Ꚙ' => 'ꚙ',
  41498. 'êšš' => 'êš›',
  41499. 'Ꜣ' => 'ꜣ',
  41500. 'Ꜥ' => 'ꜥ',
  41501. 'Ꜧ' => 'ꜧ',
  41502. 'Ꜩ' => 'ꜩ',
  41503. 'Ꜫ' => 'ꜫ',
  41504. 'Ꜭ' => 'ꜭ',
  41505. 'Ꜯ' => 'ꜯ',
  41506. 'Ꜳ' => 'ꜳ',
  41507. 'Ꜵ' => 'ꜵ',
  41508. 'Ꜷ' => 'ꜷ',
  41509. 'Ꜹ' => 'ꜹ',
  41510. 'Ꜻ' => 'ꜻ',
  41511. 'Ꜽ' => 'ꜽ',
  41512. 'Ꜿ' => 'ꜿ',
  41513. '�' => '�',
  41514. '�' => '�',
  41515. '�' => '�',
  41516. '�' => '�',
  41517. '�' => '�',
  41518. '�' => '�',
  41519. '�' => '�',
  41520. '�' => '�',
  41521. '�' => '�',
  41522. '�' => '�',
  41523. '�' => '�',
  41524. '�' => '�',
  41525. '�' => '�',
  41526. '�' => '�',
  41527. '�' => '�',
  41528. '�' => '�',
  41529. '�' => '�',
  41530. '�' => '�',
  41531. '�' => '�',
  41532. '�' => '�',
  41533. '�' => '�',
  41534. '�' => '�',
  41535. '�' => '�',
  41536. '�' => '�',
  41537. '�' => '�',
  41538. '�' => '�',
  41539. '�' => 'ᵹ',
  41540. '�' => '�',
  41541. 'Ꞁ' => '�',
  41542. 'Ꞃ' => 'ꞃ',
  41543. 'êž„' => 'êž…',
  41544. 'Ꞇ' => 'ꞇ',
  41545. 'Ꞌ' => 'ꞌ',
  41546. '�' => 'ɥ',
  41547. '�' => 'ꞑ',
  41548. 'êž’' => 'êž“',
  41549. 'êž–' => 'êž—',
  41550. 'Ꞙ' => 'ꞙ',
  41551. 'êžš' => 'êž›',
  41552. 'Ꞝ' => '�',
  41553. 'Ꞟ' => 'ꞟ',
  41554. 'êž ' => 'êž¡',
  41555. 'Ꞣ' => 'ꞣ',
  41556. 'Ꞥ' => 'ꞥ',
  41557. 'Ꞧ' => 'ꞧ',
  41558. 'Ꞩ' => 'ꞩ',
  41559. 'Ɦ' => 'ɦ',
  41560. 'Ɜ' => 'ɜ',
  41561. 'Ɡ' => 'ɡ',
  41562. 'Ɬ' => 'ɬ',
  41563. 'êž°' => 'Êž',
  41564. 'Ʇ' => 'ʇ',
  41565. 'A' => '�',
  41566. 'B' => 'b',
  41567. 'C' => 'c',
  41568. 'D' => 'd',
  41569. 'ï¼¥' => 'ï½…',
  41570. 'F' => 'f',
  41571. 'G' => 'g',
  41572. 'H' => 'h',
  41573. 'I' => 'i',
  41574. 'J' => 'j',
  41575. 'K' => 'k',
  41576. 'L' => 'l',
  41577. 'M' => '�',
  41578. 'N' => 'n',
  41579. 'O' => '�',
  41580. 'P' => '�',
  41581. 'Q' => 'q',
  41582. 'ï¼²' => 'ï½’',
  41583. 'S' => 's',
  41584. 'ï¼´' => 'ï½”',
  41585. 'U' => 'u',
  41586. 'ï¼¶' => 'ï½–',
  41587. 'ï¼·' => 'ï½—',
  41588. 'X' => 'x',
  41589. 'ï¼¹' => 'ï½™',
  41590. 'Z' => 'z',
  41591. '�' => '�',
  41592. '�' => '�',
  41593. '�' => '�',
  41594. '�' => '�',
  41595. '�' => '�',
  41596. '�' => '�',
  41597. '�' => '�',
  41598. '�' => '�',
  41599. '�' => '�',
  41600. '�' => '�',
  41601. '�' => '�',
  41602. '�' => '�',
  41603. '�' => '�',
  41604. '�' => '�',
  41605. '�' => '�',
  41606. '�' => '�',
  41607. '�' => '�',
  41608. '�' => '�',
  41609. '�' => '�',
  41610. '�' => '�',
  41611. '�' => '�',
  41612. '�' => '�',
  41613. '�' => '�',
  41614. '�' => '�',
  41615. '�' => '�',
  41616. '�' => '�',
  41617. '�' => '�',
  41618. '�' => '�',
  41619. '�' => '�',
  41620. '�' => '�',
  41621. '�' => '�',
  41622. '�' => '�',
  41623. '�' => '�',
  41624. '�' => '�',
  41625. '�' => '�',
  41626. '�' => '�',
  41627. '�' => '�',
  41628. '�' => '�',
  41629. '�' => '�',
  41630. '�' => '�',
  41631. 'ð‘¢ ' => 'ð‘£€',
  41632. '𑢡' => '�',
  41633. '𑢢' => '𑣂',
  41634. '𑢣' => '𑣃',
  41635. '𑢤' => '𑣄',
  41636. 'ð‘¢¥' => 'ð‘£…',
  41637. '𑢦' => '𑣆',
  41638. '𑢧' => '𑣇',
  41639. '𑢨' => '𑣈',
  41640. '𑢩' => '𑣉',
  41641. '𑢪' => '𑣊',
  41642. '𑢫' => '𑣋',
  41643. '𑢬' => '𑣌',
  41644. '𑢭' => '�',
  41645. '𑢮' => '𑣎',
  41646. '𑢯' => '�',
  41647. '𑢰' => '�',
  41648. '𑢱' => '𑣑',
  41649. 'ð‘¢²' => 'ð‘£’',
  41650. '𑢳' => '𑣓',
  41651. 'ð‘¢´' => 'ð‘£”',
  41652. '𑢵' => '𑣕',
  41653. 'ð‘¢¶' => 'ð‘£–',
  41654. 'ð‘¢·' => 'ð‘£—',
  41655. '𑢸' => '𑣘',
  41656. 'ð‘¢¹' => 'ð‘£™',
  41657. '𑢺' => '𑣚',
  41658. 'ð‘¢»' => 'ð‘£›',
  41659. '𑢼' => '𑣜',
  41660. '𑢽' => '�',
  41661. '𑢾' => '𑣞',
  41662. '𑢿' => '𑣟',
  41663. );
  41664. $result =& $data;
  41665. unset($data);
  41666. return $result;
  41667. <?php
  41668. static $data = array (
  41669. 'a' => 'A',
  41670. 'b' => 'B',
  41671. 'c' => 'C',
  41672. 'd' => 'D',
  41673. 'e' => 'E',
  41674. 'f' => 'F',
  41675. 'g' => 'G',
  41676. 'h' => 'H',
  41677. 'i' => 'I',
  41678. 'j' => 'J',
  41679. 'k' => 'K',
  41680. 'l' => 'L',
  41681. 'm' => 'M',
  41682. 'n' => 'N',
  41683. 'o' => 'O',
  41684. 'p' => 'P',
  41685. 'q' => 'Q',
  41686. 'r' => 'R',
  41687. 's' => 'S',
  41688. 't' => 'T',
  41689. 'u' => 'U',
  41690. 'v' => 'V',
  41691. 'w' => 'W',
  41692. 'x' => 'X',
  41693. 'y' => 'Y',
  41694. 'z' => 'Z',
  41695. 'µ' => 'Μ',
  41696. 'à' => 'À',
  41697. 'á' => '�',
  41698. 'â' => 'Â',
  41699. 'ã' => 'Ã',
  41700. 'ä' => 'Ä',
  41701. 'Ã¥' => 'Ã…',
  41702. 'æ' => 'Æ',
  41703. 'ç' => 'Ç',
  41704. 'è' => 'È',
  41705. 'é' => 'É',
  41706. 'ê' => 'Ê',
  41707. 'ë' => 'Ë',
  41708. 'ì' => 'Ì',
  41709. 'í' => '�',
  41710. 'î' => 'Î',
  41711. 'ï' => '�',
  41712. 'ð' => '�',
  41713. 'ñ' => 'Ñ',
  41714. 'ò' => 'Ò',
  41715. 'ó' => 'Ó',
  41716. 'ô' => 'Ô',
  41717. 'õ' => 'Õ',
  41718. 'ö' => 'Ö',
  41719. 'ø' => 'Ø',
  41720. 'ù' => 'Ù',
  41721. 'ú' => 'Ú',
  41722. 'û' => 'Û',
  41723. 'ü' => 'Ü',
  41724. 'ý' => '�',
  41725. 'þ' => 'Þ',
  41726. 'ÿ' => 'Ÿ',
  41727. '�' => 'Ā',
  41728. 'ă' => 'Ă',
  41729. 'Ä…' => 'Ä„',
  41730. 'ć' => 'Ć',
  41731. 'ĉ' => 'Ĉ',
  41732. 'Ä‹' => 'ÄŠ',
  41733. '�' => 'Č',
  41734. '�' => 'Ď',
  41735. 'đ' => '�',
  41736. 'Ä“' => 'Ä’',
  41737. 'Ä•' => 'Ä”',
  41738. 'Ä—' => 'Ä–',
  41739. 'ę' => 'Ę',
  41740. 'Ä›' => 'Äš',
  41741. '�' => 'Ĝ',
  41742. 'ÄŸ' => 'Äž',
  41743. 'Ä¡' => 'Ä ',
  41744. 'Ä£' => 'Ä¢',
  41745. 'ĥ' => 'Ĥ',
  41746. 'ħ' => 'Ħ',
  41747. 'ĩ' => 'Ĩ',
  41748. 'ī' => 'Ī',
  41749. 'ĭ' => 'Ĭ',
  41750. 'į' => 'Į',
  41751. 'ı' => 'I',
  41752. 'ij' => 'IJ',
  41753. 'ĵ' => 'Ĵ',
  41754. 'ķ' => 'Ķ',
  41755. 'ĺ' => 'Ĺ',
  41756. 'ļ' => 'Ļ',
  41757. 'ľ' => 'Ľ',
  41758. 'Å€' => 'Ä¿',
  41759. 'ł' => '�',
  41760. 'ń' => 'Ń',
  41761. 'ņ' => 'Ņ',
  41762. 'ň' => 'Ň',
  41763. 'Å‹' => 'ÅŠ',
  41764. '�' => 'Ō',
  41765. '�' => 'Ŏ',
  41766. 'ő' => '�',
  41767. 'Å“' => 'Å’',
  41768. 'Å•' => 'Å”',
  41769. 'Å—' => 'Å–',
  41770. 'ř' => 'Ř',
  41771. 'Å›' => 'Åš',
  41772. '�' => 'Ŝ',
  41773. 'ÅŸ' => 'Åž',
  41774. 'Å¡' => 'Å ',
  41775. 'Å£' => 'Å¢',
  41776. 'ť' => 'Ť',
  41777. 'ŧ' => 'Ŧ',
  41778. 'ũ' => 'Ũ',
  41779. 'ū' => 'Ū',
  41780. 'ŭ' => 'Ŭ',
  41781. 'ů' => 'Ů',
  41782. 'ű' => 'Ű',
  41783. 'ų' => 'Ų',
  41784. 'ŵ' => 'Ŵ',
  41785. 'ŷ' => 'Ŷ',
  41786. 'ź' => 'Ź',
  41787. 'ż' => 'Ż',
  41788. 'ž' => 'Ž',
  41789. 'Å¿' => 'S',
  41790. 'ƀ' => 'Ƀ',
  41791. 'ƃ' => 'Ƃ',
  41792. 'Æ…' => 'Æ„',
  41793. 'ƈ' => 'Ƈ',
  41794. 'ƌ' => 'Ƌ',
  41795. 'Æ’' => 'Æ‘',
  41796. 'ƕ' => 'Ƕ',
  41797. 'ƙ' => 'Ƙ',
  41798. 'ƚ' => 'Ƚ',
  41799. 'Æž' => 'È ',
  41800. 'Æ¡' => 'Æ ',
  41801. 'Æ£' => 'Æ¢',
  41802. 'ƥ' => 'Ƥ',
  41803. 'ƨ' => 'Ƨ',
  41804. 'ƭ' => 'Ƭ',
  41805. 'ư' => 'Ư',
  41806. 'ƴ' => 'Ƴ',
  41807. 'ƶ' => 'Ƶ',
  41808. 'ƹ' => 'Ƹ',
  41809. 'ƽ' => 'Ƽ',
  41810. 'Æ¿' => 'Ç·',
  41811. 'Ç…' => 'Ç„',
  41812. 'dž' => 'DŽ',
  41813. 'Lj' => 'LJ',
  41814. 'lj' => 'LJ',
  41815. 'Ç‹' => 'ÇŠ',
  41816. 'nj' => 'NJ',
  41817. 'ǎ' => '�',
  41818. '�' => '�',
  41819. 'Ç’' => 'Ç‘',
  41820. 'Ç”' => 'Ç“',
  41821. 'Ç–' => 'Ç•',
  41822. 'ǘ' => 'Ǘ',
  41823. 'Çš' => 'Ç™',
  41824. 'ǜ' => 'Ǜ',
  41825. '�' => 'Ǝ',
  41826. 'ÇŸ' => 'Çž',
  41827. 'Ç¡' => 'Ç ',
  41828. 'Ç£' => 'Ç¢',
  41829. 'ǥ' => 'Ǥ',
  41830. 'ǧ' => 'Ǧ',
  41831. 'ǩ' => 'Ǩ',
  41832. 'ǫ' => 'Ǫ',
  41833. 'ǭ' => 'Ǭ',
  41834. 'ǯ' => 'Ǯ',
  41835. 'Dz' => 'DZ',
  41836. 'dz' => 'DZ',
  41837. 'ǵ' => 'Ǵ',
  41838. 'ǹ' => 'Ǹ',
  41839. 'ǻ' => 'Ǻ',
  41840. 'ǽ' => 'Ǽ',
  41841. 'ǿ' => 'Ǿ',
  41842. '�' => 'Ȁ',
  41843. 'ȃ' => 'Ȃ',
  41844. 'È…' => 'È„',
  41845. 'ȇ' => 'Ȇ',
  41846. 'ȉ' => 'Ȉ',
  41847. 'È‹' => 'ÈŠ',
  41848. '�' => 'Ȍ',
  41849. '�' => 'Ȏ',
  41850. 'ȑ' => '�',
  41851. 'È“' => 'È’',
  41852. 'È•' => 'È”',
  41853. 'È—' => 'È–',
  41854. 'ș' => 'Ș',
  41855. 'È›' => 'Èš',
  41856. '�' => 'Ȝ',
  41857. 'ÈŸ' => 'Èž',
  41858. 'È£' => 'È¢',
  41859. 'ȥ' => 'Ȥ',
  41860. 'ȧ' => 'Ȧ',
  41861. 'ȩ' => 'Ȩ',
  41862. 'ȫ' => 'Ȫ',
  41863. 'ȭ' => 'Ȭ',
  41864. 'ȯ' => 'Ȯ',
  41865. 'ȱ' => 'Ȱ',
  41866. 'ȳ' => 'Ȳ',
  41867. 'ȼ' => 'Ȼ',
  41868. 'È¿' => 'â±¾',
  41869. 'ɀ' => 'Ɀ',
  41870. 'ɂ' => '�',
  41871. 'ɇ' => 'Ɇ',
  41872. 'ɉ' => 'Ɉ',
  41873. 'É‹' => 'ÉŠ',
  41874. '�' => 'Ɍ',
  41875. '�' => 'Ɏ',
  41876. '�' => 'Ɐ',
  41877. 'É‘' => 'â±­',
  41878. 'É’' => 'â±°',
  41879. 'ɓ' => '�',
  41880. 'ɔ' => 'Ɔ',
  41881. 'ɖ' => 'Ɖ',
  41882. 'É—' => 'ÆŠ',
  41883. 'ə' => '�',
  41884. 'ɛ' => '�',
  41885. 'ɜ' => 'Ɜ',
  41886. 'É ' => 'Æ“',
  41887. 'ɡ' => 'Ɡ',
  41888. 'É£' => 'Æ”',
  41889. 'ɥ' => '�',
  41890. 'ɦ' => 'Ɦ',
  41891. 'ɨ' => 'Ɨ',
  41892. 'É©' => 'Æ–',
  41893. 'É«' => 'â±¢',
  41894. 'ɬ' => 'Ɬ',
  41895. 'ɯ' => 'Ɯ',
  41896. 'ɱ' => 'Ɱ',
  41897. 'ɲ' => '�',
  41898. 'ɵ' => 'Ɵ',
  41899. 'ɽ' => 'Ɽ',
  41900. 'ʀ' => 'Ʀ',
  41901. 'ʃ' => 'Ʃ',
  41902. 'ʇ' => 'Ʇ',
  41903. 'ʈ' => 'Ʈ',
  41904. 'ʉ' => 'Ʉ',
  41905. 'ʊ' => 'Ʊ',
  41906. 'ʋ' => 'Ʋ',
  41907. 'ʌ' => 'Ʌ',
  41908. 'Ê’' => 'Æ·',
  41909. 'Êž' => 'êž°',
  41910. 'ͅ' => 'Ι',
  41911. 'ͱ' => 'Ͱ',
  41912. 'ͳ' => 'Ͳ',
  41913. 'ͷ' => 'Ͷ',
  41914. 'ͻ' => 'Ͻ',
  41915. 'ͼ' => 'Ͼ',
  41916. 'ͽ' => 'Ͽ',
  41917. 'ά' => 'Ά',
  41918. 'έ' => 'Έ',
  41919. 'ή' => 'Ή',
  41920. 'ί' => 'Ί',
  41921. 'α' => 'Α',
  41922. 'β' => 'Β',
  41923. 'γ' => 'Γ',
  41924. 'δ' => 'Δ',
  41925. 'ε' => 'Ε',
  41926. 'ζ' => 'Ζ',
  41927. 'η' => 'Η',
  41928. 'θ' => 'Θ',
  41929. 'ι' => 'Ι',
  41930. 'κ' => 'Κ',
  41931. 'λ' => 'Λ',
  41932. 'μ' => 'Μ',
  41933. 'ν' => '�',
  41934. 'ξ' => 'Ξ',
  41935. 'ο' => 'Ο',
  41936. 'π' => 'Π',
  41937. '�' => 'Ρ',
  41938. 'ς' => 'Σ',
  41939. 'σ' => 'Σ',
  41940. 'τ' => 'Τ',
  41941. 'Ï…' => 'Î¥',
  41942. 'φ' => 'Φ',
  41943. 'χ' => 'Χ',
  41944. 'ψ' => 'Ψ',
  41945. 'ω' => 'Ω',
  41946. 'ϊ' => 'Ϊ',
  41947. 'ϋ' => 'Ϋ',
  41948. 'ό' => 'Ό',
  41949. '�' => 'Ύ',
  41950. 'ώ' => '�',
  41951. '�' => 'Β',
  41952. 'ϑ' => 'Θ',
  41953. 'ϕ' => 'Φ',
  41954. 'ϖ' => 'Π',
  41955. 'ϗ' => '�',
  41956. 'ϙ' => 'Ϙ',
  41957. 'Ï›' => 'Ïš',
  41958. '�' => 'Ϝ',
  41959. 'ÏŸ' => 'Ïž',
  41960. 'Ï¡' => 'Ï ',
  41961. 'Ï£' => 'Ï¢',
  41962. 'ϥ' => 'Ϥ',
  41963. 'ϧ' => 'Ϧ',
  41964. 'ϩ' => 'Ϩ',
  41965. 'ϫ' => 'Ϫ',
  41966. 'ϭ' => 'Ϭ',
  41967. 'ϯ' => 'Ϯ',
  41968. 'ϰ' => 'Κ',
  41969. 'ϱ' => 'Ρ',
  41970. 'ϲ' => 'Ϲ',
  41971. 'ϳ' => 'Ϳ',
  41972. 'ϵ' => 'Ε',
  41973. 'ϸ' => 'Ϸ',
  41974. 'ϻ' => 'Ϻ',
  41975. 'а' => '�',
  41976. 'б' => 'Б',
  41977. 'в' => 'В',
  41978. 'г' => 'Г',
  41979. 'д' => 'Д',
  41980. 'е' => 'Е',
  41981. 'ж' => 'Ж',
  41982. 'з' => 'З',
  41983. 'и' => 'И',
  41984. 'й' => 'Й',
  41985. 'к' => 'К',
  41986. 'л' => 'Л',
  41987. 'м' => 'М',
  41988. 'н' => '�',
  41989. 'о' => 'О',
  41990. 'п' => 'П',
  41991. 'р' => 'Р',
  41992. '�' => 'С',
  41993. 'т' => 'Т',
  41994. 'у' => 'У',
  41995. 'ф' => 'Ф',
  41996. 'Ñ…' => 'Ð¥',
  41997. 'ц' => 'Ц',
  41998. 'ч' => 'Ч',
  41999. 'ш' => 'Ш',
  42000. 'щ' => 'Щ',
  42001. 'ъ' => 'Ъ',
  42002. 'ы' => 'Ы',
  42003. 'ь' => 'Ь',
  42004. '�' => 'Э',
  42005. 'ю' => 'Ю',
  42006. '�' => 'Я',
  42007. '�' => 'Ѐ',
  42008. 'ё' => '�',
  42009. 'ђ' => 'Ђ',
  42010. 'ѓ' => 'Ѓ',
  42011. 'є' => 'Є',
  42012. 'Ñ•' => 'Ð…',
  42013. 'і' => 'І',
  42014. 'ї' => 'Ї',
  42015. 'ј' => 'Ј',
  42016. 'љ' => 'Љ',
  42017. 'њ' => 'Њ',
  42018. 'ћ' => 'Ћ',
  42019. 'ќ' => 'Ќ',
  42020. '�' => '�',
  42021. 'Ñž' => 'ÐŽ',
  42022. 'џ' => '�',
  42023. 'Ñ¡' => 'Ñ ',
  42024. 'Ñ£' => 'Ñ¢',
  42025. 'ѥ' => 'Ѥ',
  42026. 'ѧ' => 'Ѧ',
  42027. 'ѩ' => 'Ѩ',
  42028. 'ѫ' => 'Ѫ',
  42029. 'ѭ' => 'Ѭ',
  42030. 'ѯ' => 'Ѯ',
  42031. 'ѱ' => 'Ѱ',
  42032. 'ѳ' => 'Ѳ',
  42033. 'ѵ' => 'Ѵ',
  42034. 'ѷ' => 'Ѷ',
  42035. 'ѹ' => 'Ѹ',
  42036. 'ѻ' => 'Ѻ',
  42037. 'ѽ' => 'Ѽ',
  42038. 'ѿ' => 'Ѿ',
  42039. 'Ò�' => 'Ò€',
  42040. 'Ò‹' => 'ÒŠ',
  42041. '�' => 'Ҍ',
  42042. 'Ò�' => 'ÒŽ',
  42043. 'Ò‘' => 'Ò�',
  42044. 'Ò“' => 'Ò’',
  42045. 'Ò•' => 'Ò”',
  42046. 'Ò—' => 'Ò–',
  42047. 'Ò™' => 'Ò˜',
  42048. 'Ò›' => 'Òš',
  42049. '�' => 'Ҝ',
  42050. 'ÒŸ' => 'Òž',
  42051. 'Ò¡' => 'Ò ',
  42052. 'Ò£' => 'Ò¢',
  42053. 'Ò¥' => 'Ò¤',
  42054. 'Ò§' => 'Ò¦',
  42055. 'Ò©' => 'Ò¨',
  42056. 'Ò«' => 'Òª',
  42057. 'Ò­' => 'Ò¬',
  42058. 'Ò¯' => 'Ò®',
  42059. 'Ò±' => 'Ò°',
  42060. 'Ò³' => 'Ò²',
  42061. 'Òµ' => 'Ò´',
  42062. 'Ò·' => 'Ò¶',
  42063. 'Ò¹' => 'Ò¸',
  42064. 'Ò»' => 'Òº',
  42065. 'Ò½' => 'Ò¼',
  42066. 'Ò¿' => 'Ò¾',
  42067. 'Ó‚' => 'Ó�',
  42068. 'Ó„' => 'Óƒ',
  42069. 'Ó†' => 'Ó…',
  42070. 'Óˆ' => 'Ó‡',
  42071. 'ÓŠ' => 'Ó‰',
  42072. 'ӌ' => 'Ӌ',
  42073. 'ÓŽ' => 'Ó�',
  42074. 'Ó�' => 'Ó€',
  42075. 'Ó‘' => 'Ó�',
  42076. 'Ó“' => 'Ó’',
  42077. 'Ó•' => 'Ó”',
  42078. 'Ó—' => 'Ó–',
  42079. 'Ó™' => 'Ó˜',
  42080. 'Ó›' => 'Óš',
  42081. '�' => 'Ӝ',
  42082. 'ÓŸ' => 'Óž',
  42083. 'Ó¡' => 'Ó ',
  42084. 'Ó£' => 'Ó¢',
  42085. 'Ó¥' => 'Ó¤',
  42086. 'Ó§' => 'Ó¦',
  42087. 'Ó©' => 'Ó¨',
  42088. 'Ó«' => 'Óª',
  42089. 'Ó­' => 'Ó¬',
  42090. 'Ó¯' => 'Ó®',
  42091. 'Ó±' => 'Ó°',
  42092. 'Ó³' => 'Ó²',
  42093. 'Óµ' => 'Ó´',
  42094. 'Ó·' => 'Ó¶',
  42095. 'Ó¹' => 'Ó¸',
  42096. 'Ó»' => 'Óº',
  42097. 'Ó½' => 'Ó¼',
  42098. 'Ó¿' => 'Ó¾',
  42099. 'Ô�' => 'Ô€',
  42100. 'Ôƒ' => 'Ô‚',
  42101. 'Ô…' => 'Ô„',
  42102. 'Ô‡' => 'Ô†',
  42103. 'Ô‰' => 'Ôˆ',
  42104. 'Ô‹' => 'ÔŠ',
  42105. '�' => 'Ԍ',
  42106. 'Ô�' => 'ÔŽ',
  42107. 'Ô‘' => 'Ô�',
  42108. 'Ô“' => 'Ô’',
  42109. 'Ô•' => 'Ô”',
  42110. 'Ô—' => 'Ô–',
  42111. 'Ô™' => 'Ô˜',
  42112. 'Ô›' => 'Ôš',
  42113. '�' => 'Ԝ',
  42114. 'ÔŸ' => 'Ôž',
  42115. 'Ô¡' => 'Ô ',
  42116. 'Ô£' => 'Ô¢',
  42117. 'Ô¥' => 'Ô¤',
  42118. 'Ô§' => 'Ô¦',
  42119. 'Ô©' => 'Ô¨',
  42120. 'Ô«' => 'Ôª',
  42121. 'Ô­' => 'Ô¬',
  42122. 'Ô¯' => 'Ô®',
  42123. 'Õ¡' => 'Ô±',
  42124. 'Õ¢' => 'Ô²',
  42125. 'Õ£' => 'Ô³',
  42126. 'Õ¤' => 'Ô´',
  42127. 'Õ¥' => 'Ôµ',
  42128. 'Õ¦' => 'Ô¶',
  42129. 'Õ§' => 'Ô·',
  42130. 'Õ¨' => 'Ô¸',
  42131. 'Õ©' => 'Ô¹',
  42132. 'Õª' => 'Ôº',
  42133. 'Õ«' => 'Ô»',
  42134. 'Õ¬' => 'Ô¼',
  42135. 'Õ­' => 'Ô½',
  42136. 'Õ®' => 'Ô¾',
  42137. 'Õ¯' => 'Ô¿',
  42138. 'Õ°' => 'Õ€',
  42139. 'Õ±' => 'Õ�',
  42140. 'Õ²' => 'Õ‚',
  42141. 'Õ³' => 'Õƒ',
  42142. 'Õ´' => 'Õ„',
  42143. 'Õµ' => 'Õ…',
  42144. 'Õ¶' => 'Õ†',
  42145. 'Õ·' => 'Õ‡',
  42146. 'Õ¸' => 'Õˆ',
  42147. 'Õ¹' => 'Õ‰',
  42148. 'Õº' => 'ÕŠ',
  42149. 'Õ»' => 'Õ‹',
  42150. 'ռ' => 'Ռ',
  42151. 'Õ½' => 'Õ�',
  42152. 'Õ¾' => 'ÕŽ',
  42153. 'Õ¿' => 'Õ�',
  42154. 'Ö€' => 'Õ�',
  42155. 'Ö�' => 'Õ‘',
  42156. 'Ö‚' => 'Õ’',
  42157. 'Öƒ' => 'Õ“',
  42158. 'Ö„' => 'Õ”',
  42159. 'Ö…' => 'Õ•',
  42160. 'Ö†' => 'Õ–',
  42161. 'ᵹ' => '�',
  42162. 'áµ½' => 'â±£',
  42163. '�' => 'Ḁ',
  42164. 'ḃ' => 'Ḃ',
  42165. 'ḅ' => 'Ḅ',
  42166. 'ḇ' => 'Ḇ',
  42167. 'ḉ' => 'Ḉ',
  42168. 'ḋ' => 'Ḋ',
  42169. '�' => 'Ḍ',
  42170. '�' => 'Ḏ',
  42171. 'ḑ' => '�',
  42172. 'ḓ' => 'Ḓ',
  42173. 'ḕ' => 'Ḕ',
  42174. 'ḗ' => 'Ḗ',
  42175. 'ḙ' => 'Ḙ',
  42176. 'ḛ' => 'Ḛ',
  42177. '�' => 'Ḝ',
  42178. 'ḟ' => 'Ḟ',
  42179. 'ḡ' => 'Ḡ',
  42180. 'ḣ' => 'Ḣ',
  42181. 'ḥ' => 'Ḥ',
  42182. 'ḧ' => 'Ḧ',
  42183. 'ḩ' => 'Ḩ',
  42184. 'ḫ' => 'Ḫ',
  42185. 'ḭ' => 'Ḭ',
  42186. 'ḯ' => 'Ḯ',
  42187. 'ḱ' => 'Ḱ',
  42188. 'ḳ' => 'Ḳ',
  42189. 'ḵ' => 'Ḵ',
  42190. 'ḷ' => 'Ḷ',
  42191. 'ḹ' => 'Ḹ',
  42192. 'ḻ' => 'Ḻ',
  42193. 'ḽ' => 'Ḽ',
  42194. 'ḿ' => 'Ḿ',
  42195. '�' => 'Ṁ',
  42196. 'ṃ' => 'Ṃ',
  42197. 'ṅ' => 'Ṅ',
  42198. 'ṇ' => 'Ṇ',
  42199. 'ṉ' => 'Ṉ',
  42200. 'ṋ' => 'Ṋ',
  42201. '�' => 'Ṍ',
  42202. '�' => 'Ṏ',
  42203. 'ṑ' => '�',
  42204. 'ṓ' => 'Ṓ',
  42205. 'ṕ' => 'Ṕ',
  42206. 'á¹—' => 'á¹–',
  42207. 'ṙ' => 'Ṙ',
  42208. 'ṛ' => 'Ṛ',
  42209. '�' => 'Ṝ',
  42210. 'ṟ' => 'Ṟ',
  42211. 'ṡ' => 'Ṡ',
  42212. 'á¹£' => 'á¹¢',
  42213. 'ṥ' => 'Ṥ',
  42214. 'ṧ' => 'Ṧ',
  42215. 'ṩ' => 'Ṩ',
  42216. 'ṫ' => 'Ṫ',
  42217. 'ṭ' => 'Ṭ',
  42218. 'ṯ' => 'Ṯ',
  42219. 'á¹±' => 'á¹°',
  42220. 'á¹³' => 'á¹²',
  42221. 'á¹µ' => 'á¹´',
  42222. 'á¹·' => 'á¹¶',
  42223. 'ṹ' => 'Ṹ',
  42224. 'ṻ' => 'Ṻ',
  42225. 'á¹½' => 'á¹¼',
  42226. 'ṿ' => 'Ṿ',
  42227. '�' => 'Ẁ',
  42228. 'ẃ' => 'Ẃ',
  42229. 'ẅ' => 'Ẅ',
  42230. 'ẇ' => 'Ẇ',
  42231. 'ẉ' => 'Ẉ',
  42232. 'ẋ' => 'Ẋ',
  42233. '�' => 'Ẍ',
  42234. '�' => 'Ẏ',
  42235. 'ẑ' => '�',
  42236. 'ẓ' => 'Ẓ',
  42237. 'ẕ' => 'Ẕ',
  42238. 'ẛ' => 'Ṡ',
  42239. 'ạ' => 'Ạ',
  42240. 'ả' => 'Ả',
  42241. 'ấ' => 'Ấ',
  42242. 'ầ' => 'Ầ',
  42243. 'ẩ' => 'Ẩ',
  42244. 'ẫ' => 'Ẫ',
  42245. 'ậ' => 'Ậ',
  42246. 'ắ' => 'Ắ',
  42247. 'ằ' => 'Ằ',
  42248. 'ẳ' => 'Ẳ',
  42249. 'ẵ' => 'Ẵ',
  42250. 'ặ' => 'Ặ',
  42251. 'ẹ' => 'Ẹ',
  42252. 'ẻ' => 'Ẻ',
  42253. 'ẽ' => 'Ẽ',
  42254. 'ế' => 'Ế',
  42255. '�' => 'Ề',
  42256. 'ể' => 'Ể',
  42257. 'ễ' => 'Ễ',
  42258. 'ệ' => 'Ệ',
  42259. 'ỉ' => 'Ỉ',
  42260. 'ị' => 'Ị',
  42261. '�' => 'Ọ',
  42262. '�' => 'Ỏ',
  42263. 'ố' => '�',
  42264. 'ồ' => 'Ồ',
  42265. 'ổ' => 'Ổ',
  42266. 'á»—' => 'á»–',
  42267. 'ộ' => 'Ộ',
  42268. 'ớ' => 'Ớ',
  42269. '�' => 'Ờ',
  42270. 'ở' => 'Ở',
  42271. 'ỡ' => 'Ỡ',
  42272. 'ợ' => 'Ợ',
  42273. 'ụ' => 'Ụ',
  42274. 'ủ' => 'Ủ',
  42275. 'ứ' => 'Ứ',
  42276. 'ừ' => 'Ừ',
  42277. 'ử' => 'Ử',
  42278. 'ữ' => 'Ữ',
  42279. 'á»±' => 'á»°',
  42280. 'ỳ' => 'Ỳ',
  42281. 'ỵ' => 'Ỵ',
  42282. 'á»·' => 'á»¶',
  42283. 'ỹ' => 'Ỹ',
  42284. 'ỻ' => 'Ỻ',
  42285. 'ỽ' => 'Ỽ',
  42286. 'ỿ' => 'Ỿ',
  42287. 'ἀ' => 'Ἀ',
  42288. '�' => 'Ἁ',
  42289. 'ἂ' => 'Ἂ',
  42290. 'ἃ' => 'Ἃ',
  42291. 'ἄ' => 'Ἄ',
  42292. 'ἅ' => '�',
  42293. 'ἆ' => 'Ἆ',
  42294. 'ἇ' => '�',
  42295. '�' => 'Ἐ',
  42296. 'ἑ' => 'Ἑ',
  42297. 'ἒ' => 'Ἒ',
  42298. 'ἓ' => 'Ἓ',
  42299. 'ἔ' => 'Ἔ',
  42300. 'ἕ' => '�',
  42301. 'ἠ' => 'Ἠ',
  42302. 'ἡ' => 'Ἡ',
  42303. 'ἢ' => 'Ἢ',
  42304. 'ἣ' => 'Ἣ',
  42305. 'ἤ' => 'Ἤ',
  42306. 'á¼¥' => 'á¼­',
  42307. 'ἦ' => 'Ἦ',
  42308. 'ἧ' => 'Ἧ',
  42309. 'ἰ' => 'Ἰ',
  42310. 'á¼±' => 'á¼¹',
  42311. 'ἲ' => 'Ἲ',
  42312. 'á¼³' => 'á¼»',
  42313. 'á¼´' => 'á¼¼',
  42314. 'á¼µ' => 'á¼½',
  42315. 'á¼¶' => 'á¼¾',
  42316. 'ἷ' => 'Ἷ',
  42317. 'ὀ' => 'Ὀ',
  42318. '�' => 'Ὁ',
  42319. 'ὂ' => 'Ὂ',
  42320. 'ὃ' => 'Ὃ',
  42321. 'ὄ' => 'Ὄ',
  42322. 'ὅ' => '�',
  42323. 'ὑ' => 'Ὑ',
  42324. 'ὓ' => 'Ὓ',
  42325. 'ὕ' => '�',
  42326. 'ὗ' => 'Ὗ',
  42327. 'ὠ' => 'Ὠ',
  42328. 'ὡ' => 'Ὡ',
  42329. 'ὢ' => 'Ὢ',
  42330. 'ὣ' => 'Ὣ',
  42331. 'ὤ' => 'Ὤ',
  42332. 'á½¥' => 'á½­',
  42333. 'ὦ' => 'Ὦ',
  42334. 'ὧ' => 'Ὧ',
  42335. 'ὰ' => 'Ὰ',
  42336. 'á½±' => 'á¾»',
  42337. 'ὲ' => 'Ὲ',
  42338. 'έ' => 'Έ',
  42339. 'ὴ' => 'Ὴ',
  42340. 'á½µ' => 'á¿‹',
  42341. 'ὶ' => 'Ὶ',
  42342. 'á½·' => 'á¿›',
  42343. 'ὸ' => 'Ὸ',
  42344. 'ό' => 'Ό',
  42345. 'ὺ' => 'Ὺ',
  42346. 'á½»' => 'á¿«',
  42347. 'ὼ' => 'Ὼ',
  42348. 'á½½' => 'á¿»',
  42349. 'ᾀ' => 'ᾈ',
  42350. '�' => 'ᾉ',
  42351. 'ᾂ' => 'ᾊ',
  42352. 'ᾃ' => 'ᾋ',
  42353. 'ᾄ' => 'ᾌ',
  42354. 'ᾅ' => '�',
  42355. 'ᾆ' => 'ᾎ',
  42356. 'ᾇ' => '�',
  42357. '�' => 'ᾘ',
  42358. 'ᾑ' => 'ᾙ',
  42359. 'ᾒ' => 'ᾚ',
  42360. 'ᾓ' => 'ᾛ',
  42361. 'ᾔ' => 'ᾜ',
  42362. 'ᾕ' => '�',
  42363. 'ᾖ' => 'ᾞ',
  42364. 'ᾗ' => 'ᾟ',
  42365. 'ᾠ' => 'ᾨ',
  42366. 'ᾡ' => 'ᾩ',
  42367. 'ᾢ' => 'ᾪ',
  42368. 'ᾣ' => 'ᾫ',
  42369. 'ᾤ' => 'ᾬ',
  42370. 'á¾¥' => 'á¾­',
  42371. 'ᾦ' => 'ᾮ',
  42372. 'ᾧ' => 'ᾯ',
  42373. 'ᾰ' => 'Ᾰ',
  42374. 'á¾±' => 'á¾¹',
  42375. 'á¾³' => 'á¾¼',
  42376. 'ι' => 'Ι',
  42377. 'ῃ' => 'ῌ',
  42378. '�' => 'Ῐ',
  42379. 'á¿‘' => 'á¿™',
  42380. 'ῠ' => 'Ῠ',
  42381. 'á¿¡' => 'á¿©',
  42382. 'ῥ' => 'Ῥ',
  42383. 'ῳ' => 'ῼ',
  42384. 'ⅎ' => 'Ⅎ',
  42385. 'â…°' => 'â… ',
  42386. 'â…±' => 'â…¡',
  42387. 'â…²' => 'â…¢',
  42388. 'â…³' => 'â…£',
  42389. 'â…´' => 'â…¤',
  42390. 'â…µ' => 'â…¥',
  42391. 'â…¶' => 'â…¦',
  42392. 'â…·' => 'â…§',
  42393. 'â…¸' => 'â…¨',
  42394. 'â…¹' => 'â…©',
  42395. 'â…º' => 'â…ª',
  42396. 'â…»' => 'â…«',
  42397. 'â…¼' => 'â…¬',
  42398. 'â…½' => 'â…­',
  42399. 'â…¾' => 'â…®',
  42400. 'â…¿' => 'â…¯',
  42401. 'ↄ' => 'Ↄ',
  42402. '�' => 'Ⓐ',
  42403. 'â“‘' => 'â’·',
  42404. 'â“’' => 'â’¸',
  42405. 'â““' => 'â’¹',
  42406. 'â“”' => 'â’º',
  42407. 'â“•' => 'â’»',
  42408. 'â“–' => 'â’¼',
  42409. 'â“—' => 'â’½',
  42410. 'ⓘ' => 'Ⓘ',
  42411. 'â“™' => 'â’¿',
  42412. 'ⓚ' => 'Ⓚ',
  42413. 'ⓛ' => '�',
  42414. 'ⓜ' => 'Ⓜ',
  42415. '�' => 'Ⓝ',
  42416. 'ⓞ' => 'Ⓞ',
  42417. 'ⓟ' => 'Ⓟ',
  42418. 'ⓠ' => 'Ⓠ',
  42419. 'ⓡ' => 'Ⓡ',
  42420. 'ⓢ' => 'Ⓢ',
  42421. 'ⓣ' => 'Ⓣ',
  42422. 'ⓤ' => 'Ⓤ',
  42423. 'â“¥' => 'â“‹',
  42424. 'ⓦ' => 'Ⓦ',
  42425. 'ⓧ' => '�',
  42426. 'ⓨ' => 'Ⓨ',
  42427. 'ⓩ' => '�',
  42428. 'â°°' => 'â°€',
  42429. 'â°±' => 'â°�',
  42430. 'â°²' => 'â°‚',
  42431. 'â°³' => 'â°ƒ',
  42432. 'â°´' => 'â°„',
  42433. 'â°µ' => 'â°…',
  42434. 'â°¶' => 'â°†',
  42435. 'â°·' => 'â°‡',
  42436. 'â°¸' => 'â°ˆ',
  42437. 'â°¹' => 'â°‰',
  42438. 'â°º' => 'â°Š',
  42439. 'â°»' => 'â°‹',
  42440. 'ⰼ' => 'Ⰼ',
  42441. 'â°½' => 'â°�',
  42442. 'â°¾' => 'â°Ž',
  42443. 'â°¿' => 'â°�',
  42444. 'â±€' => 'â°�',
  42445. '�' => 'Ⱁ',
  42446. 'ⱂ' => 'Ⱂ',
  42447. 'ⱃ' => 'Ⱃ',
  42448. 'ⱄ' => 'Ⱄ',
  42449. 'â±…' => 'â°•',
  42450. 'ⱆ' => 'Ⱆ',
  42451. 'ⱇ' => 'Ⱇ',
  42452. 'ⱈ' => 'Ⱈ',
  42453. 'ⱉ' => 'Ⱉ',
  42454. 'ⱊ' => 'Ⱊ',
  42455. 'ⱋ' => 'Ⱋ',
  42456. 'ⱌ' => 'Ⱌ',
  42457. '�' => '�',
  42458. 'ⱎ' => 'Ⱎ',
  42459. '�' => 'Ⱏ',
  42460. '�' => 'Ⱐ',
  42461. 'ⱑ' => 'Ⱑ',
  42462. 'â±’' => 'â°¢',
  42463. 'ⱓ' => 'Ⱓ',
  42464. 'â±”' => 'â°¤',
  42465. 'ⱕ' => 'Ⱕ',
  42466. 'â±–' => 'â°¦',
  42467. 'â±—' => 'â°§',
  42468. 'ⱘ' => 'Ⱘ',
  42469. 'â±™' => 'â°©',
  42470. 'ⱚ' => 'Ⱚ',
  42471. 'â±›' => 'â°«',
  42472. 'ⱜ' => 'Ⱜ',
  42473. '�' => 'Ⱝ',
  42474. 'ⱞ' => 'Ⱞ',
  42475. 'ⱡ' => 'Ⱡ',
  42476. 'ⱥ' => 'Ⱥ',
  42477. 'ⱦ' => 'Ⱦ',
  42478. 'ⱨ' => 'Ⱨ',
  42479. 'ⱪ' => 'Ⱪ',
  42480. 'ⱬ' => 'Ⱬ',
  42481. 'â±³' => 'â±²',
  42482. 'â±¶' => 'â±µ',
  42483. '�' => 'Ⲁ',
  42484. 'ⲃ' => 'Ⲃ',
  42485. 'ⲅ' => 'Ⲅ',
  42486. 'ⲇ' => 'Ⲇ',
  42487. 'ⲉ' => 'Ⲉ',
  42488. 'ⲋ' => 'Ⲋ',
  42489. '�' => 'Ⲍ',
  42490. '�' => 'Ⲏ',
  42491. 'ⲑ' => '�',
  42492. 'ⲓ' => 'Ⲓ',
  42493. 'ⲕ' => 'Ⲕ',
  42494. 'â²—' => 'â²–',
  42495. 'ⲙ' => 'Ⲙ',
  42496. 'ⲛ' => 'Ⲛ',
  42497. '�' => 'Ⲝ',
  42498. 'ⲟ' => 'Ⲟ',
  42499. 'ⲡ' => 'Ⲡ',
  42500. 'â²£' => 'â²¢',
  42501. 'ⲥ' => 'Ⲥ',
  42502. 'ⲧ' => 'Ⲧ',
  42503. 'ⲩ' => 'Ⲩ',
  42504. 'ⲫ' => 'Ⲫ',
  42505. 'ⲭ' => 'Ⲭ',
  42506. 'ⲯ' => 'Ⲯ',
  42507. 'â²±' => 'â²°',
  42508. 'â²³' => 'â²²',
  42509. 'â²µ' => 'â²´',
  42510. 'â²·' => 'â²¶',
  42511. 'ⲹ' => 'Ⲹ',
  42512. 'ⲻ' => 'Ⲻ',
  42513. 'â²½' => 'â²¼',
  42514. 'ⲿ' => 'Ⲿ',
  42515. '�' => 'Ⳁ',
  42516. 'ⳃ' => 'Ⳃ',
  42517. 'ⳅ' => 'Ⳅ',
  42518. 'ⳇ' => 'Ⳇ',
  42519. 'ⳉ' => 'Ⳉ',
  42520. 'ⳋ' => 'Ⳋ',
  42521. '�' => 'Ⳍ',
  42522. '�' => 'Ⳏ',
  42523. 'ⳑ' => '�',
  42524. 'ⳓ' => 'Ⳓ',
  42525. 'ⳕ' => 'Ⳕ',
  42526. 'â³—' => 'â³–',
  42527. 'ⳙ' => 'Ⳙ',
  42528. 'ⳛ' => 'Ⳛ',
  42529. '�' => 'Ⳝ',
  42530. 'ⳟ' => 'Ⳟ',
  42531. 'ⳡ' => 'Ⳡ',
  42532. 'â³£' => 'â³¢',
  42533. 'ⳬ' => 'Ⳬ',
  42534. 'â³®' => 'â³­',
  42535. 'â³³' => 'â³²',
  42536. 'â´€' => 'á‚ ',
  42537. 'â´�' => 'á‚¡',
  42538. 'â´‚' => 'á‚¢',
  42539. 'â´ƒ' => 'á‚£',
  42540. 'ⴄ' => 'Ⴄ',
  42541. 'â´…' => 'á‚¥',
  42542. 'ⴆ' => 'Ⴆ',
  42543. 'â´‡' => 'á‚§',
  42544. 'ⴈ' => 'Ⴈ',
  42545. 'â´‰' => 'á‚©',
  42546. 'ⴊ' => 'Ⴊ',
  42547. 'â´‹' => 'á‚«',
  42548. 'ⴌ' => 'Ⴌ',
  42549. 'â´�' => 'á‚­',
  42550. 'â´Ž' => 'á‚®',
  42551. '�' => 'Ⴏ',
  42552. 'â´�' => 'á‚°',
  42553. 'ⴑ' => 'Ⴑ',
  42554. 'ⴒ' => 'Ⴒ',
  42555. 'ⴓ' => 'Ⴓ',
  42556. 'â´”' => 'á‚´',
  42557. 'ⴕ' => 'Ⴕ',
  42558. 'â´–' => 'á‚¶',
  42559. 'â´—' => 'á‚·',
  42560. 'ⴘ' => 'Ⴘ',
  42561. 'ⴙ' => 'Ⴙ',
  42562. 'ⴚ' => 'Ⴚ',
  42563. 'â´›' => 'á‚»',
  42564. 'ⴜ' => 'Ⴜ',
  42565. '�' => 'Ⴝ',
  42566. 'ⴞ' => 'Ⴞ',
  42567. 'â´Ÿ' => 'á‚¿',
  42568. 'ⴠ' => 'Ⴠ',
  42569. 'ⴡ' => '�',
  42570. 'ⴢ' => 'Ⴢ',
  42571. 'ⴣ' => 'Ⴣ',
  42572. 'ⴤ' => 'Ⴤ',
  42573. 'ⴥ' => 'Ⴥ',
  42574. 'ⴧ' => 'Ⴧ',
  42575. 'ⴭ' => '�',
  42576. '�' => 'Ꙁ',
  42577. 'ꙃ' => 'Ꙃ',
  42578. 'ꙅ' => 'Ꙅ',
  42579. 'ꙇ' => 'Ꙇ',
  42580. 'ꙉ' => 'Ꙉ',
  42581. 'ꙋ' => 'Ꙋ',
  42582. '�' => 'Ꙍ',
  42583. '�' => 'Ꙏ',
  42584. 'ꙑ' => '�',
  42585. 'ꙓ' => 'Ꙓ',
  42586. 'ꙕ' => 'Ꙕ',
  42587. 'ê™—' => 'ê™–',
  42588. 'ꙙ' => 'Ꙙ',
  42589. 'ꙛ' => 'Ꙛ',
  42590. '�' => 'Ꙝ',
  42591. 'ꙟ' => 'Ꙟ',
  42592. 'ꙡ' => 'Ꙡ',
  42593. 'ꙣ' => 'Ꙣ',
  42594. 'ꙥ' => 'Ꙥ',
  42595. 'ꙧ' => 'Ꙧ',
  42596. 'ꙩ' => 'Ꙩ',
  42597. 'ꙫ' => 'Ꙫ',
  42598. 'ꙭ' => 'Ꙭ',
  42599. '�' => 'Ꚁ',
  42600. 'ꚃ' => 'Ꚃ',
  42601. 'êš…' => 'êš„',
  42602. 'ꚇ' => 'Ꚇ',
  42603. 'ꚉ' => 'Ꚉ',
  42604. 'ꚋ' => 'Ꚋ',
  42605. '�' => 'Ꚍ',
  42606. '�' => 'Ꚏ',
  42607. 'ꚑ' => '�',
  42608. 'êš“' => 'êš’',
  42609. 'êš•' => 'êš”',
  42610. 'êš—' => 'êš–',
  42611. 'ꚙ' => 'Ꚙ',
  42612. 'êš›' => 'êšš',
  42613. 'ꜣ' => 'Ꜣ',
  42614. 'ꜥ' => 'Ꜥ',
  42615. 'ꜧ' => 'Ꜧ',
  42616. 'ꜩ' => 'Ꜩ',
  42617. 'ꜫ' => 'Ꜫ',
  42618. 'ꜭ' => 'Ꜭ',
  42619. 'ꜯ' => 'Ꜯ',
  42620. 'ꜳ' => 'Ꜳ',
  42621. 'ꜵ' => 'Ꜵ',
  42622. 'ꜷ' => 'Ꜷ',
  42623. 'ꜹ' => 'Ꜹ',
  42624. 'ꜻ' => 'Ꜻ',
  42625. 'ꜽ' => 'Ꜽ',
  42626. 'ꜿ' => 'Ꜿ',
  42627. '�' => '�',
  42628. '�' => '�',
  42629. '�' => '�',
  42630. '�' => '�',
  42631. '�' => '�',
  42632. '�' => '�',
  42633. '�' => '�',
  42634. '�' => '�',
  42635. '�' => '�',
  42636. '�' => '�',
  42637. '�' => '�',
  42638. '�' => '�',
  42639. '�' => '�',
  42640. '�' => '�',
  42641. '�' => '�',
  42642. '�' => '�',
  42643. '�' => '�',
  42644. '�' => '�',
  42645. '�' => '�',
  42646. '�' => '�',
  42647. '�' => '�',
  42648. '�' => '�',
  42649. '�' => '�',
  42650. '�' => '�',
  42651. '�' => '�',
  42652. '�' => '�',
  42653. '�' => '�',
  42654. '�' => 'Ꞁ',
  42655. 'ꞃ' => 'Ꞃ',
  42656. 'êž…' => 'êž„',
  42657. 'ꞇ' => 'Ꞇ',
  42658. 'ꞌ' => 'Ꞌ',
  42659. 'ꞑ' => '�',
  42660. 'êž“' => 'êž’',
  42661. 'êž—' => 'êž–',
  42662. 'ꞙ' => 'Ꞙ',
  42663. 'êž›' => 'êžš',
  42664. '�' => 'Ꞝ',
  42665. 'ꞟ' => 'Ꞟ',
  42666. 'êž¡' => 'êž ',
  42667. 'ꞣ' => 'Ꞣ',
  42668. 'ꞥ' => 'Ꞥ',
  42669. 'ꞧ' => 'Ꞧ',
  42670. 'ꞩ' => 'Ꞩ',
  42671. '�' => 'A',
  42672. 'b' => 'B',
  42673. 'c' => 'C',
  42674. 'd' => 'D',
  42675. 'ï½…' => 'ï¼¥',
  42676. 'f' => 'F',
  42677. 'g' => 'G',
  42678. 'h' => 'H',
  42679. 'i' => 'I',
  42680. 'j' => 'J',
  42681. 'k' => 'K',
  42682. 'l' => 'L',
  42683. '�' => 'M',
  42684. 'n' => 'N',
  42685. '�' => 'O',
  42686. '�' => 'P',
  42687. 'q' => 'Q',
  42688. 'ï½’' => 'ï¼²',
  42689. 's' => 'S',
  42690. 'ï½”' => 'ï¼´',
  42691. 'u' => 'U',
  42692. 'ï½–' => 'ï¼¶',
  42693. 'ï½—' => 'ï¼·',
  42694. 'x' => 'X',
  42695. 'ï½™' => 'ï¼¹',
  42696. 'z' => 'Z',
  42697. '�' => '�',
  42698. '�' => '�',
  42699. '�' => '�',
  42700. '�' => '�',
  42701. '�' => '�',
  42702. '�' => '�',
  42703. '�' => '�',
  42704. '�' => '�',
  42705. '�' => '�',
  42706. '�' => '�',
  42707. '�' => '�',
  42708. '�' => '�',
  42709. '�' => '�',
  42710. '�' => '�',
  42711. '�' => '�',
  42712. '�' => '�',
  42713. '�' => '�',
  42714. '�' => '�',
  42715. '�' => '�',
  42716. '�' => '�',
  42717. '�' => '�',
  42718. '�' => '�',
  42719. '�' => '�',
  42720. '�' => '�',
  42721. '�' => '�',
  42722. '�' => '�',
  42723. '�' => '�',
  42724. '�' => '�',
  42725. '�' => '�',
  42726. '�' => '�',
  42727. '�' => '�',
  42728. '�' => '�',
  42729. '�' => '�',
  42730. '�' => '�',
  42731. '�' => '�',
  42732. '�' => '�',
  42733. '�' => '�',
  42734. '�' => '�',
  42735. '�' => '�',
  42736. '�' => '�',
  42737. 'ð‘£€' => 'ð‘¢ ',
  42738. '�' => '𑢡',
  42739. '𑣂' => '𑢢',
  42740. '𑣃' => '𑢣',
  42741. '𑣄' => '𑢤',
  42742. 'ð‘£…' => 'ð‘¢¥',
  42743. '𑣆' => '𑢦',
  42744. '𑣇' => '𑢧',
  42745. '𑣈' => '𑢨',
  42746. '𑣉' => '𑢩',
  42747. '𑣊' => '𑢪',
  42748. '𑣋' => '𑢫',
  42749. '𑣌' => '𑢬',
  42750. '�' => '𑢭',
  42751. '𑣎' => '𑢮',
  42752. '�' => '𑢯',
  42753. '�' => '𑢰',
  42754. '𑣑' => '𑢱',
  42755. 'ð‘£’' => 'ð‘¢²',
  42756. '𑣓' => '𑢳',
  42757. 'ð‘£”' => 'ð‘¢´',
  42758. '𑣕' => '𑢵',
  42759. 'ð‘£–' => 'ð‘¢¶',
  42760. 'ð‘£—' => 'ð‘¢·',
  42761. '𑣘' => '𑢸',
  42762. 'ð‘£™' => 'ð‘¢¹',
  42763. '𑣚' => '𑢺',
  42764. 'ð‘£›' => 'ð‘¢»',
  42765. '𑣜' => '𑢼',
  42766. '�' => '𑢽',
  42767. '𑣞' => '𑢾',
  42768. '𑣟' => '𑢿',
  42769. );
  42770. $result =& $data;
  42771. unset($data);
  42772. return $result;
  42773. <?php
  42774. use Symfony\Polyfill\Mbstring as p;
  42775. if (!function_exists('mb_strlen')) {
  42776. define('MB_CASE_UPPER', 0);
  42777. define('MB_CASE_LOWER', 1);
  42778. define('MB_CASE_TITLE', 2);
  42779. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  42780. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  42781. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  42782. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  42783. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  42784. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  42785. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  42786. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  42787. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  42788. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  42789. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  42790. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  42791. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  42792. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  42793. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  42794. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  42795. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  42796. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  42797. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  42798. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  42799. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  42800. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  42801. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  42802. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  42803. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  42804. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  42805. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  42806. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  42807. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  42808. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  42809. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  42810. 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, $a, $b, $c, $d, $e, $f); }
  42811. }
  42812. if (!function_exists('mb_chr')) {
  42813. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  42814. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  42815. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  42816. }
  42817. <?php
  42818. namespace Symfony\Component\Process\Exception;
  42819. interface ExceptionInterface
  42820. {
  42821. }
  42822. <?php
  42823. namespace Symfony\Component\Process\Exception;
  42824. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  42825. {
  42826. }
  42827. <?php
  42828. namespace Symfony\Component\Process\Exception;
  42829. class LogicException extends \LogicException implements ExceptionInterface
  42830. {
  42831. }
  42832. <?php
  42833. namespace Symfony\Component\Process\Exception;
  42834. use Symfony\Component\Process\Process;
  42835. class ProcessFailedException extends RuntimeException
  42836. {
  42837. private $process;
  42838. public function __construct(Process $process)
  42839. {
  42840. if ($process->isSuccessful()) {
  42841. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  42842. }
  42843. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  42844. $process->getCommandLine(),
  42845. $process->getExitCode(),
  42846. $process->getExitCodeText(),
  42847. $process->getWorkingDirectory()
  42848. );
  42849. if (!$process->isOutputDisabled()) {
  42850. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  42851. $process->getOutput(),
  42852. $process->getErrorOutput()
  42853. );
  42854. }
  42855. parent::__construct($error);
  42856. $this->process = $process;
  42857. }
  42858. public function getProcess()
  42859. {
  42860. return $this->process;
  42861. }
  42862. }
  42863. <?php
  42864. namespace Symfony\Component\Process\Exception;
  42865. use Symfony\Component\Process\Process;
  42866. class ProcessTimedOutException extends RuntimeException
  42867. {
  42868. const TYPE_GENERAL = 1;
  42869. const TYPE_IDLE = 2;
  42870. private $process;
  42871. private $timeoutType;
  42872. public function __construct(Process $process, $timeoutType)
  42873. {
  42874. $this->process = $process;
  42875. $this->timeoutType = $timeoutType;
  42876. parent::__construct(sprintf(
  42877. 'The process "%s" exceeded the timeout of %s seconds.',
  42878. $process->getCommandLine(),
  42879. $this->getExceededTimeout()
  42880. ));
  42881. }
  42882. public function getProcess()
  42883. {
  42884. return $this->process;
  42885. }
  42886. public function isGeneralTimeout()
  42887. {
  42888. return $this->timeoutType === self::TYPE_GENERAL;
  42889. }
  42890. public function isIdleTimeout()
  42891. {
  42892. return $this->timeoutType === self::TYPE_IDLE;
  42893. }
  42894. public function getExceededTimeout()
  42895. {
  42896. switch ($this->timeoutType) {
  42897. case self::TYPE_GENERAL:
  42898. return $this->process->getTimeout();
  42899. case self::TYPE_IDLE:
  42900. return $this->process->getIdleTimeout();
  42901. default:
  42902. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  42903. }
  42904. }
  42905. }
  42906. <?php
  42907. namespace Symfony\Component\Process\Exception;
  42908. class RuntimeException extends \RuntimeException implements ExceptionInterface
  42909. {
  42910. }
  42911. <?php
  42912. namespace Symfony\Component\Process;
  42913. class ExecutableFinder
  42914. {
  42915. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  42916. public function setSuffixes(array $suffixes)
  42917. {
  42918. $this->suffixes = $suffixes;
  42919. }
  42920. public function addSuffix($suffix)
  42921. {
  42922. $this->suffixes[] = $suffix;
  42923. }
  42924. public function find($name, $default = null, array $extraDirs = array())
  42925. {
  42926. if (ini_get('open_basedir')) {
  42927. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  42928. $dirs = array();
  42929. foreach ($searchPath as $path) {
  42930. if (@is_dir($path)) {
  42931. $dirs[] = $path;
  42932. } else {
  42933. if (basename($path) == $name && @is_executable($path)) {
  42934. return $path;
  42935. }
  42936. }
  42937. }
  42938. } else {
  42939. $dirs = array_merge(
  42940. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  42941. $extraDirs
  42942. );
  42943. }
  42944. $suffixes = array('');
  42945. if ('\\' === DIRECTORY_SEPARATOR) {
  42946. $pathExt = getenv('PATHEXT');
  42947. $suffixes = array_merge($suffixes, $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes);
  42948. }
  42949. foreach ($suffixes as $suffix) {
  42950. foreach ($dirs as $dir) {
  42951. if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
  42952. return $file;
  42953. }
  42954. }
  42955. }
  42956. return $default;
  42957. }
  42958. }
  42959. Copyright (c) 2004-2017 Fabien Potencier
  42960. Permission is hereby granted, free of charge, to any person obtaining a copy
  42961. of this software and associated documentation files (the "Software"), to deal
  42962. in the Software without restriction, including without limitation the rights
  42963. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42964. copies of the Software, and to permit persons to whom the Software is furnished
  42965. to do so, subject to the following conditions:
  42966. The above copyright notice and this permission notice shall be included in all
  42967. copies or substantial portions of the Software.
  42968. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42969. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42970. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42971. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42972. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42973. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42974. THE SOFTWARE.
  42975. <?php
  42976. namespace Symfony\Component\Process;
  42977. class PhpExecutableFinder
  42978. {
  42979. private $executableFinder;
  42980. public function __construct()
  42981. {
  42982. $this->executableFinder = new ExecutableFinder();
  42983. }
  42984. public function find($includeArgs = true)
  42985. {
  42986. $args = $this->findArguments();
  42987. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  42988. if (defined('HHVM_VERSION')) {
  42989. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  42990. }
  42991. if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
  42992. return PHP_BINARY.$args;
  42993. }
  42994. if ($php = getenv('PHP_PATH')) {
  42995. if (!is_executable($php)) {
  42996. return false;
  42997. }
  42998. return $php;
  42999. }
  43000. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  43001. if (is_executable($php)) {
  43002. return $php;
  43003. }
  43004. }
  43005. $dirs = array(PHP_BINDIR);
  43006. if ('\\' === DIRECTORY_SEPARATOR) {
  43007. $dirs[] = 'C:\xampp\php\\';
  43008. }
  43009. return $this->executableFinder->find('php', false, $dirs);
  43010. }
  43011. public function findArguments()
  43012. {
  43013. $arguments = array();
  43014. if (defined('HHVM_VERSION')) {
  43015. $arguments[] = '--php';
  43016. } elseif ('phpdbg' === PHP_SAPI) {
  43017. $arguments[] = '-qrr';
  43018. }
  43019. return $arguments;
  43020. }
  43021. }
  43022. <?php
  43023. namespace Symfony\Component\Process;
  43024. use Symfony\Component\Process\Exception\RuntimeException;
  43025. class PhpProcess extends Process
  43026. {
  43027. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  43028. {
  43029. $executableFinder = new PhpExecutableFinder();
  43030. if (false === $php = $executableFinder->find()) {
  43031. $php = null;
  43032. }
  43033. if ('phpdbg' === PHP_SAPI) {
  43034. $file = tempnam(sys_get_temp_dir(), 'dbg');
  43035. file_put_contents($file, $script);
  43036. register_shutdown_function('unlink', $file);
  43037. $php .= ' '.ProcessUtils::escapeArgument($file);
  43038. $script = null;
  43039. }
  43040. if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
  43041. $php = 'exec '.$php;
  43042. }
  43043. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  43044. }
  43045. public function setPhpBinary($php)
  43046. {
  43047. $this->setCommandLine($php);
  43048. }
  43049. public function start($callback = null)
  43050. {
  43051. if (null === $this->getCommandLine()) {
  43052. throw new RuntimeException('Unable to find the PHP executable.');
  43053. }
  43054. parent::start($callback);
  43055. }
  43056. }
  43057. <?php
  43058. namespace Symfony\Component\Process\Pipes;
  43059. abstract class AbstractPipes implements PipesInterface
  43060. {
  43061. public $pipes = array();
  43062. private $inputBuffer = '';
  43063. private $input;
  43064. private $blocked = true;
  43065. public function __construct($input)
  43066. {
  43067. if (is_resource($input)) {
  43068. $this->input = $input;
  43069. } elseif (is_string($input)) {
  43070. $this->inputBuffer = $input;
  43071. } else {
  43072. $this->inputBuffer = (string) $input;
  43073. }
  43074. }
  43075. public function close()
  43076. {
  43077. foreach ($this->pipes as $pipe) {
  43078. fclose($pipe);
  43079. }
  43080. $this->pipes = array();
  43081. }
  43082. protected function hasSystemCallBeenInterrupted()
  43083. {
  43084. $lastError = error_get_last();
  43085. return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
  43086. }
  43087. protected function unblock()
  43088. {
  43089. if (!$this->blocked) {
  43090. return;
  43091. }
  43092. foreach ($this->pipes as $pipe) {
  43093. stream_set_blocking($pipe, 0);
  43094. }
  43095. if (null !== $this->input) {
  43096. stream_set_blocking($this->input, 0);
  43097. }
  43098. $this->blocked = false;
  43099. }
  43100. protected function write()
  43101. {
  43102. if (!isset($this->pipes[0])) {
  43103. return;
  43104. }
  43105. $input = $this->input;
  43106. $r = $e = array();
  43107. $w = array($this->pipes[0]);
  43108. if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
  43109. return;
  43110. }
  43111. foreach ($w as $stdin) {
  43112. if (isset($this->inputBuffer[0])) {
  43113. $written = fwrite($stdin, $this->inputBuffer);
  43114. $this->inputBuffer = substr($this->inputBuffer, $written);
  43115. if (isset($this->inputBuffer[0])) {
  43116. return array($this->pipes[0]);
  43117. }
  43118. }
  43119. if ($input) {
  43120. for (;;) {
  43121. $data = fread($input, self::CHUNK_SIZE);
  43122. if (!isset($data[0])) {
  43123. break;
  43124. }
  43125. $written = fwrite($stdin, $data);
  43126. $data = substr($data, $written);
  43127. if (isset($data[0])) {
  43128. $this->inputBuffer = $data;
  43129. return array($this->pipes[0]);
  43130. }
  43131. }
  43132. if (feof($input)) {
  43133. $this->input = null;
  43134. }
  43135. }
  43136. }
  43137. if (null === $this->input && !isset($this->inputBuffer[0])) {
  43138. fclose($this->pipes[0]);
  43139. unset($this->pipes[0]);
  43140. } elseif (!$w) {
  43141. return array($this->pipes[0]);
  43142. }
  43143. }
  43144. }
  43145. <?php
  43146. namespace Symfony\Component\Process\Pipes;
  43147. interface PipesInterface
  43148. {
  43149. const CHUNK_SIZE = 16384;
  43150. public function getDescriptors();
  43151. public function getFiles();
  43152. public function readAndWrite($blocking, $close = false);
  43153. public function areOpen();
  43154. public function close();
  43155. }
  43156. <?php
  43157. namespace Symfony\Component\Process\Pipes;
  43158. use Symfony\Component\Process\Process;
  43159. class UnixPipes extends AbstractPipes
  43160. {
  43161. private $ttyMode;
  43162. private $ptyMode;
  43163. private $disableOutput;
  43164. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  43165. {
  43166. $this->ttyMode = (bool) $ttyMode;
  43167. $this->ptyMode = (bool) $ptyMode;
  43168. $this->disableOutput = (bool) $disableOutput;
  43169. parent::__construct($input);
  43170. }
  43171. public function __destruct()
  43172. {
  43173. $this->close();
  43174. }
  43175. public function getDescriptors()
  43176. {
  43177. if ($this->disableOutput) {
  43178. $nullstream = fopen('/dev/null', 'c');
  43179. return array(
  43180. array('pipe', 'r'),
  43181. $nullstream,
  43182. $nullstream,
  43183. );
  43184. }
  43185. if ($this->ttyMode) {
  43186. return array(
  43187. array('file', '/dev/tty', 'r'),
  43188. array('file', '/dev/tty', 'w'),
  43189. array('file', '/dev/tty', 'w'),
  43190. );
  43191. }
  43192. if ($this->ptyMode && Process::isPtySupported()) {
  43193. return array(
  43194. array('pty'),
  43195. array('pty'),
  43196. array('pty'),
  43197. );
  43198. }
  43199. return array(
  43200. array('pipe', 'r'),
  43201. array('pipe', 'w'),
  43202. array('pipe', 'w'),
  43203. );
  43204. }
  43205. public function getFiles()
  43206. {
  43207. return array();
  43208. }
  43209. public function readAndWrite($blocking, $close = false)
  43210. {
  43211. $this->unblock();
  43212. $w = $this->write();
  43213. $read = $e = array();
  43214. $r = $this->pipes;
  43215. unset($r[0]);
  43216. if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  43217. if (!$this->hasSystemCallBeenInterrupted()) {
  43218. $this->pipes = array();
  43219. }
  43220. return $read;
  43221. }
  43222. foreach ($r as $pipe) {
  43223. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  43224. do {
  43225. $data = fread($pipe, self::CHUNK_SIZE);
  43226. $read[$type] .= $data;
  43227. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  43228. if (!isset($read[$type][0])) {
  43229. unset($read[$type]);
  43230. }
  43231. if ($close && feof($pipe)) {
  43232. fclose($pipe);
  43233. unset($this->pipes[$type]);
  43234. }
  43235. }
  43236. return $read;
  43237. }
  43238. public function areOpen()
  43239. {
  43240. return (bool) $this->pipes;
  43241. }
  43242. public static function create(Process $process, $input)
  43243. {
  43244. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  43245. }
  43246. }
  43247. <?php
  43248. namespace Symfony\Component\Process\Pipes;
  43249. use Symfony\Component\Process\Process;
  43250. use Symfony\Component\Process\Exception\RuntimeException;
  43251. class WindowsPipes extends AbstractPipes
  43252. {
  43253. private $files = array();
  43254. private $fileHandles = array();
  43255. private $readBytes = array(
  43256. Process::STDOUT => 0,
  43257. Process::STDERR => 0,
  43258. );
  43259. private $disableOutput;
  43260. public function __construct($disableOutput, $input)
  43261. {
  43262. $this->disableOutput = (bool) $disableOutput;
  43263. if (!$this->disableOutput) {
  43264. $pipes = array(
  43265. Process::STDOUT => Process::OUT,
  43266. Process::STDERR => Process::ERR,
  43267. );
  43268. $tmpCheck = false;
  43269. $tmpDir = sys_get_temp_dir();
  43270. $lastError = 'unknown reason';
  43271. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  43272. for ($i = 0;; ++$i) {
  43273. foreach ($pipes as $pipe => $name) {
  43274. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  43275. if (file_exists($file) && !unlink($file)) {
  43276. continue 2;
  43277. }
  43278. $h = fopen($file, 'xb');
  43279. if (!$h) {
  43280. $error = $lastError;
  43281. if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
  43282. continue;
  43283. }
  43284. restore_error_handler();
  43285. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
  43286. }
  43287. if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
  43288. continue 2;
  43289. }
  43290. if (isset($this->files[$pipe])) {
  43291. unlink($this->files[$pipe]);
  43292. }
  43293. $this->files[$pipe] = $file;
  43294. }
  43295. break;
  43296. }
  43297. restore_error_handler();
  43298. }
  43299. parent::__construct($input);
  43300. }
  43301. public function __destruct()
  43302. {
  43303. $this->close();
  43304. $this->removeFiles();
  43305. }
  43306. public function getDescriptors()
  43307. {
  43308. if ($this->disableOutput) {
  43309. $nullstream = fopen('NUL', 'c');
  43310. return array(
  43311. array('pipe', 'r'),
  43312. $nullstream,
  43313. $nullstream,
  43314. );
  43315. }
  43316. return array(
  43317. array('pipe', 'r'),
  43318. array('file', 'NUL', 'w'),
  43319. array('file', 'NUL', 'w'),
  43320. );
  43321. }
  43322. public function getFiles()
  43323. {
  43324. return $this->files;
  43325. }
  43326. public function readAndWrite($blocking, $close = false)
  43327. {
  43328. $this->unblock();
  43329. $w = $this->write();
  43330. $read = $r = $e = array();
  43331. if ($blocking) {
  43332. if ($w) {
  43333. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  43334. } elseif ($this->fileHandles) {
  43335. usleep(Process::TIMEOUT_PRECISION * 1E6);
  43336. }
  43337. }
  43338. foreach ($this->fileHandles as $type => $fileHandle) {
  43339. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  43340. if (isset($data[0])) {
  43341. $this->readBytes[$type] += strlen($data);
  43342. $read[$type] = $data;
  43343. }
  43344. if ($close) {
  43345. fclose($fileHandle);
  43346. unset($this->fileHandles[$type]);
  43347. }
  43348. }
  43349. return $read;
  43350. }
  43351. public function areOpen()
  43352. {
  43353. return $this->pipes && $this->fileHandles;
  43354. }
  43355. public function close()
  43356. {
  43357. parent::close();
  43358. foreach ($this->fileHandles as $handle) {
  43359. fclose($handle);
  43360. }
  43361. $this->fileHandles = array();
  43362. }
  43363. public static function create(Process $process, $input)
  43364. {
  43365. return new static($process->isOutputDisabled(), $input);
  43366. }
  43367. private function removeFiles()
  43368. {
  43369. foreach ($this->files as $filename) {
  43370. if (file_exists($filename)) {
  43371. @unlink($filename);
  43372. }
  43373. }
  43374. $this->files = array();
  43375. }
  43376. }
  43377. <?php
  43378. namespace Symfony\Component\Process;
  43379. use Symfony\Component\Process\Exception\InvalidArgumentException;
  43380. use Symfony\Component\Process\Exception\LogicException;
  43381. use Symfony\Component\Process\Exception\ProcessFailedException;
  43382. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  43383. use Symfony\Component\Process\Exception\RuntimeException;
  43384. use Symfony\Component\Process\Pipes\PipesInterface;
  43385. use Symfony\Component\Process\Pipes\UnixPipes;
  43386. use Symfony\Component\Process\Pipes\WindowsPipes;
  43387. class Process
  43388. {
  43389. const ERR = 'err';
  43390. const OUT = 'out';
  43391. const STATUS_READY = 'ready';
  43392. const STATUS_STARTED = 'started';
  43393. const STATUS_TERMINATED = 'terminated';
  43394. const STDIN = 0;
  43395. const STDOUT = 1;
  43396. const STDERR = 2;
  43397. const TIMEOUT_PRECISION = 0.2;
  43398. private $callback;
  43399. private $commandline;
  43400. private $cwd;
  43401. private $env;
  43402. private $input;
  43403. private $starttime;
  43404. private $lastOutputTime;
  43405. private $timeout;
  43406. private $idleTimeout;
  43407. private $options;
  43408. private $exitcode;
  43409. private $fallbackStatus = array();
  43410. private $processInformation;
  43411. private $outputDisabled = false;
  43412. private $stdout;
  43413. private $stderr;
  43414. private $enhanceWindowsCompatibility = true;
  43415. private $enhanceSigchildCompatibility;
  43416. private $process;
  43417. private $status = self::STATUS_READY;
  43418. private $incrementalOutputOffset = 0;
  43419. private $incrementalErrorOutputOffset = 0;
  43420. private $tty;
  43421. private $pty;
  43422. private $useFileHandles = false;
  43423. private $processPipes;
  43424. private $latestSignal;
  43425. private static $sigchild;
  43426. public static $exitCodes = array(
  43427. 0 => 'OK',
  43428. 1 => 'General error',
  43429. 2 => 'Misuse of shell builtins',
  43430. 126 => 'Invoked command cannot execute',
  43431. 127 => 'Command not found',
  43432. 128 => 'Invalid exit argument',
  43433. 129 => 'Hangup',
  43434. 130 => 'Interrupt',
  43435. 131 => 'Quit and dump core',
  43436. 132 => 'Illegal instruction',
  43437. 133 => 'Trace/breakpoint trap',
  43438. 134 => 'Process aborted',
  43439. 135 => 'Bus error: "access to undefined portion of memory object"',
  43440. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  43441. 137 => 'Kill (terminate immediately)',
  43442. 138 => 'User-defined 1',
  43443. 139 => 'Segmentation violation',
  43444. 140 => 'User-defined 2',
  43445. 141 => 'Write to pipe with no one reading',
  43446. 142 => 'Signal raised by alarm',
  43447. 143 => 'Termination (request to terminate)',
  43448. 145 => 'Child process terminated, stopped (or continued*)',
  43449. 146 => 'Continue if stopped',
  43450. 147 => 'Stop executing temporarily',
  43451. 148 => 'Terminal stop signal',
  43452. 149 => 'Background process attempting to read from tty ("in")',
  43453. 150 => 'Background process attempting to write to tty ("out")',
  43454. 151 => 'Urgent data available on socket',
  43455. 152 => 'CPU time limit exceeded',
  43456. 153 => 'File size limit exceeded',
  43457. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  43458. 155 => 'Profiling timer expired',
  43459. 157 => 'Pollable event',
  43460. 159 => 'Bad syscall',
  43461. );
  43462. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  43463. {
  43464. if (!function_exists('proc_open')) {
  43465. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  43466. }
  43467. $this->commandline = $commandline;
  43468. $this->cwd = $cwd;
  43469. if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
  43470. $this->cwd = getcwd();
  43471. }
  43472. if (null !== $env) {
  43473. $this->setEnv($env);
  43474. }
  43475. $this->setInput($input);
  43476. $this->setTimeout($timeout);
  43477. $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  43478. $this->pty = false;
  43479. $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  43480. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  43481. }
  43482. public function __destruct()
  43483. {
  43484. $this->stop(0);
  43485. }
  43486. public function __clone()
  43487. {
  43488. $this->resetProcessData();
  43489. }
  43490. public function run($callback = null)
  43491. {
  43492. $this->start($callback);
  43493. return $this->wait();
  43494. }
  43495. public function mustRun($callback = null)
  43496. {
  43497. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  43498. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  43499. }
  43500. if (0 !== $this->run($callback)) {
  43501. throw new ProcessFailedException($this);
  43502. }
  43503. return $this;
  43504. }
  43505. public function start($callback = null)
  43506. {
  43507. if ($this->isRunning()) {
  43508. throw new RuntimeException('Process is already running');
  43509. }
  43510. if ($this->outputDisabled && null !== $callback) {
  43511. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  43512. }
  43513. $this->resetProcessData();
  43514. $this->starttime = $this->lastOutputTime = microtime(true);
  43515. $this->callback = $this->buildCallback($callback);
  43516. $descriptors = $this->getDescriptors();
  43517. $commandline = $this->commandline;
  43518. if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  43519. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  43520. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  43521. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  43522. }
  43523. $commandline .= '"';
  43524. if (!isset($this->options['bypass_shell'])) {
  43525. $this->options['bypass_shell'] = true;
  43526. }
  43527. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  43528. $descriptors[3] = array('pipe', 'w');
  43529. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  43530. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  43531. $ptsWorkaround = fopen(__FILE__, 'r');
  43532. }
  43533. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  43534. if (!is_resource($this->process)) {
  43535. throw new RuntimeException('Unable to launch a new process.');
  43536. }
  43537. $this->status = self::STATUS_STARTED;
  43538. if (isset($descriptors[3])) {
  43539. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  43540. }
  43541. if ($this->tty) {
  43542. return;
  43543. }
  43544. $this->updateStatus(false);
  43545. $this->checkTimeout();
  43546. }
  43547. public function restart($callback = null)
  43548. {
  43549. if ($this->isRunning()) {
  43550. throw new RuntimeException('Process is already running');
  43551. }
  43552. $process = clone $this;
  43553. $process->start($callback);
  43554. return $process;
  43555. }
  43556. public function wait($callback = null)
  43557. {
  43558. $this->requireProcessIsStarted(__FUNCTION__);
  43559. $this->updateStatus(false);
  43560. if (null !== $callback) {
  43561. $this->callback = $this->buildCallback($callback);
  43562. }
  43563. do {
  43564. $this->checkTimeout();
  43565. $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  43566. $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
  43567. } while ($running);
  43568. while ($this->isRunning()) {
  43569. usleep(1000);
  43570. }
  43571. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  43572. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  43573. }
  43574. return $this->exitcode;
  43575. }
  43576. public function getPid()
  43577. {
  43578. return $this->isRunning() ? $this->processInformation['pid'] : null;
  43579. }
  43580. public function signal($signal)
  43581. {
  43582. $this->doSignal($signal, true);
  43583. return $this;
  43584. }
  43585. public function disableOutput()
  43586. {
  43587. if ($this->isRunning()) {
  43588. throw new RuntimeException('Disabling output while the process is running is not possible.');
  43589. }
  43590. if (null !== $this->idleTimeout) {
  43591. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  43592. }
  43593. $this->outputDisabled = true;
  43594. return $this;
  43595. }
  43596. public function enableOutput()
  43597. {
  43598. if ($this->isRunning()) {
  43599. throw new RuntimeException('Enabling output while the process is running is not possible.');
  43600. }
  43601. $this->outputDisabled = false;
  43602. return $this;
  43603. }
  43604. public function isOutputDisabled()
  43605. {
  43606. return $this->outputDisabled;
  43607. }
  43608. public function getOutput()
  43609. {
  43610. $this->readPipesForOutput(__FUNCTION__);
  43611. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  43612. return '';
  43613. }
  43614. return $ret;
  43615. }
  43616. public function getIncrementalOutput()
  43617. {
  43618. $this->readPipesForOutput(__FUNCTION__);
  43619. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  43620. $this->incrementalOutputOffset = ftell($this->stdout);
  43621. if (false === $latest) {
  43622. return '';
  43623. }
  43624. return $latest;
  43625. }
  43626. public function clearOutput()
  43627. {
  43628. ftruncate($this->stdout, 0);
  43629. fseek($this->stdout, 0);
  43630. $this->incrementalOutputOffset = 0;
  43631. return $this;
  43632. }
  43633. public function getErrorOutput()
  43634. {
  43635. $this->readPipesForOutput(__FUNCTION__);
  43636. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  43637. return '';
  43638. }
  43639. return $ret;
  43640. }
  43641. public function getIncrementalErrorOutput()
  43642. {
  43643. $this->readPipesForOutput(__FUNCTION__);
  43644. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  43645. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  43646. if (false === $latest) {
  43647. return '';
  43648. }
  43649. return $latest;
  43650. }
  43651. public function clearErrorOutput()
  43652. {
  43653. ftruncate($this->stderr, 0);
  43654. fseek($this->stderr, 0);
  43655. $this->incrementalErrorOutputOffset = 0;
  43656. return $this;
  43657. }
  43658. public function getExitCode()
  43659. {
  43660. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  43661. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  43662. }
  43663. $this->updateStatus(false);
  43664. return $this->exitcode;
  43665. }
  43666. public function getExitCodeText()
  43667. {
  43668. if (null === $exitcode = $this->getExitCode()) {
  43669. return;
  43670. }
  43671. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  43672. }
  43673. public function isSuccessful()
  43674. {
  43675. return 0 === $this->getExitCode();
  43676. }
  43677. public function hasBeenSignaled()
  43678. {
  43679. $this->requireProcessIsTerminated(__FUNCTION__);
  43680. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  43681. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  43682. }
  43683. return $this->processInformation['signaled'];
  43684. }
  43685. public function getTermSignal()
  43686. {
  43687. $this->requireProcessIsTerminated(__FUNCTION__);
  43688. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  43689. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  43690. }
  43691. return $this->processInformation['termsig'];
  43692. }
  43693. public function hasBeenStopped()
  43694. {
  43695. $this->requireProcessIsTerminated(__FUNCTION__);
  43696. return $this->processInformation['stopped'];
  43697. }
  43698. public function getStopSignal()
  43699. {
  43700. $this->requireProcessIsTerminated(__FUNCTION__);
  43701. return $this->processInformation['stopsig'];
  43702. }
  43703. public function isRunning()
  43704. {
  43705. if (self::STATUS_STARTED !== $this->status) {
  43706. return false;
  43707. }
  43708. $this->updateStatus(false);
  43709. return $this->processInformation['running'];
  43710. }
  43711. public function isStarted()
  43712. {
  43713. return $this->status != self::STATUS_READY;
  43714. }
  43715. public function isTerminated()
  43716. {
  43717. $this->updateStatus(false);
  43718. return $this->status == self::STATUS_TERMINATED;
  43719. }
  43720. public function getStatus()
  43721. {
  43722. $this->updateStatus(false);
  43723. return $this->status;
  43724. }
  43725. public function stop($timeout = 10, $signal = null)
  43726. {
  43727. $timeoutMicro = microtime(true) + $timeout;
  43728. if ($this->isRunning()) {
  43729. $this->doSignal(15, false);
  43730. do {
  43731. usleep(1000);
  43732. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  43733. if ($this->isRunning()) {
  43734. $this->doSignal($signal ?: 9, false);
  43735. }
  43736. }
  43737. if ($this->isRunning()) {
  43738. if (isset($this->fallbackStatus['pid'])) {
  43739. unset($this->fallbackStatus['pid']);
  43740. return $this->stop(0, $signal);
  43741. }
  43742. $this->close();
  43743. }
  43744. return $this->exitcode;
  43745. }
  43746. public function addOutput($line)
  43747. {
  43748. $this->lastOutputTime = microtime(true);
  43749. fseek($this->stdout, 0, SEEK_END);
  43750. fwrite($this->stdout, $line);
  43751. fseek($this->stdout, $this->incrementalOutputOffset);
  43752. }
  43753. public function addErrorOutput($line)
  43754. {
  43755. $this->lastOutputTime = microtime(true);
  43756. fseek($this->stderr, 0, SEEK_END);
  43757. fwrite($this->stderr, $line);
  43758. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  43759. }
  43760. public function getCommandLine()
  43761. {
  43762. return $this->commandline;
  43763. }
  43764. public function setCommandLine($commandline)
  43765. {
  43766. $this->commandline = $commandline;
  43767. return $this;
  43768. }
  43769. public function getTimeout()
  43770. {
  43771. return $this->timeout;
  43772. }
  43773. public function getIdleTimeout()
  43774. {
  43775. return $this->idleTimeout;
  43776. }
  43777. public function setTimeout($timeout)
  43778. {
  43779. $this->timeout = $this->validateTimeout($timeout);
  43780. return $this;
  43781. }
  43782. public function setIdleTimeout($timeout)
  43783. {
  43784. if (null !== $timeout && $this->outputDisabled) {
  43785. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  43786. }
  43787. $this->idleTimeout = $this->validateTimeout($timeout);
  43788. return $this;
  43789. }
  43790. public function setTty($tty)
  43791. {
  43792. if ('\\' === DIRECTORY_SEPARATOR && $tty) {
  43793. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  43794. }
  43795. if ($tty) {
  43796. static $isTtySupported;
  43797. if (null === $isTtySupported) {
  43798. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  43799. }
  43800. if (!$isTtySupported) {
  43801. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  43802. }
  43803. }
  43804. $this->tty = (bool) $tty;
  43805. return $this;
  43806. }
  43807. public function isTty()
  43808. {
  43809. return $this->tty;
  43810. }
  43811. public function setPty($bool)
  43812. {
  43813. $this->pty = (bool) $bool;
  43814. return $this;
  43815. }
  43816. public function isPty()
  43817. {
  43818. return $this->pty;
  43819. }
  43820. public function getWorkingDirectory()
  43821. {
  43822. if (null === $this->cwd) {
  43823. return getcwd() ?: null;
  43824. }
  43825. return $this->cwd;
  43826. }
  43827. public function setWorkingDirectory($cwd)
  43828. {
  43829. $this->cwd = $cwd;
  43830. return $this;
  43831. }
  43832. public function getEnv()
  43833. {
  43834. return $this->env;
  43835. }
  43836. public function setEnv(array $env)
  43837. {
  43838. $env = array_filter($env, function ($value) {
  43839. return !is_array($value);
  43840. });
  43841. $this->env = array();
  43842. foreach ($env as $key => $value) {
  43843. $this->env[$key] = (string) $value;
  43844. }
  43845. return $this;
  43846. }
  43847. public function getStdin()
  43848. {
  43849. @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);
  43850. return $this->getInput();
  43851. }
  43852. public function getInput()
  43853. {
  43854. return $this->input;
  43855. }
  43856. public function setStdin($stdin)
  43857. {
  43858. @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);
  43859. return $this->setInput($stdin);
  43860. }
  43861. public function setInput($input)
  43862. {
  43863. if ($this->isRunning()) {
  43864. throw new LogicException('Input can not be set while the process is running.');
  43865. }
  43866. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  43867. return $this;
  43868. }
  43869. public function getOptions()
  43870. {
  43871. return $this->options;
  43872. }
  43873. public function setOptions(array $options)
  43874. {
  43875. $this->options = $options;
  43876. return $this;
  43877. }
  43878. public function getEnhanceWindowsCompatibility()
  43879. {
  43880. return $this->enhanceWindowsCompatibility;
  43881. }
  43882. public function setEnhanceWindowsCompatibility($enhance)
  43883. {
  43884. $this->enhanceWindowsCompatibility = (bool) $enhance;
  43885. return $this;
  43886. }
  43887. public function getEnhanceSigchildCompatibility()
  43888. {
  43889. return $this->enhanceSigchildCompatibility;
  43890. }
  43891. public function setEnhanceSigchildCompatibility($enhance)
  43892. {
  43893. $this->enhanceSigchildCompatibility = (bool) $enhance;
  43894. return $this;
  43895. }
  43896. public function checkTimeout()
  43897. {
  43898. if ($this->status !== self::STATUS_STARTED) {
  43899. return;
  43900. }
  43901. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  43902. $this->stop(0);
  43903. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  43904. }
  43905. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  43906. $this->stop(0);
  43907. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  43908. }
  43909. }
  43910. public static function isPtySupported()
  43911. {
  43912. static $result;
  43913. if (null !== $result) {
  43914. return $result;
  43915. }
  43916. if ('\\' === DIRECTORY_SEPARATOR) {
  43917. return $result = false;
  43918. }
  43919. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  43920. }
  43921. private function getDescriptors()
  43922. {
  43923. if ('\\' === DIRECTORY_SEPARATOR) {
  43924. $this->processPipes = WindowsPipes::create($this, $this->input);
  43925. } else {
  43926. $this->processPipes = UnixPipes::create($this, $this->input);
  43927. }
  43928. return $this->processPipes->getDescriptors();
  43929. }
  43930. protected function buildCallback($callback)
  43931. {
  43932. $that = $this;
  43933. $out = self::OUT;
  43934. $callback = function ($type, $data) use ($that, $callback, $out) {
  43935. if ($out == $type) {
  43936. $that->addOutput($data);
  43937. } else {
  43938. $that->addErrorOutput($data);
  43939. }
  43940. if (null !== $callback) {
  43941. call_user_func($callback, $type, $data);
  43942. }
  43943. };
  43944. return $callback;
  43945. }
  43946. protected function updateStatus($blocking)
  43947. {
  43948. if (self::STATUS_STARTED !== $this->status) {
  43949. return;
  43950. }
  43951. $this->processInformation = proc_get_status($this->process);
  43952. $running = $this->processInformation['running'];
  43953. $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
  43954. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  43955. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  43956. }
  43957. if (!$running) {
  43958. $this->close();
  43959. }
  43960. }
  43961. protected function isSigchildEnabled()
  43962. {
  43963. if (null !== self::$sigchild) {
  43964. return self::$sigchild;
  43965. }
  43966. if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
  43967. return self::$sigchild = false;
  43968. }
  43969. ob_start();
  43970. phpinfo(INFO_GENERAL);
  43971. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  43972. }
  43973. private function readPipesForOutput($caller)
  43974. {
  43975. if ($this->outputDisabled) {
  43976. throw new LogicException('Output has been disabled.');
  43977. }
  43978. $this->requireProcessIsStarted($caller);
  43979. $this->updateStatus(false);
  43980. }
  43981. private function validateTimeout($timeout)
  43982. {
  43983. $timeout = (float) $timeout;
  43984. if (0.0 === $timeout) {
  43985. $timeout = null;
  43986. } elseif ($timeout < 0) {
  43987. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  43988. }
  43989. return $timeout;
  43990. }
  43991. private function readPipes($blocking, $close)
  43992. {
  43993. $result = $this->processPipes->readAndWrite($blocking, $close);
  43994. $callback = $this->callback;
  43995. foreach ($result as $type => $data) {
  43996. if (3 !== $type) {
  43997. $callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
  43998. } elseif (!isset($this->fallbackStatus['signaled'])) {
  43999. $this->fallbackStatus['exitcode'] = (int) $data;
  44000. }
  44001. }
  44002. }
  44003. private function close()
  44004. {
  44005. $this->processPipes->close();
  44006. if (is_resource($this->process)) {
  44007. proc_close($this->process);
  44008. }
  44009. $this->exitcode = $this->processInformation['exitcode'];
  44010. $this->status = self::STATUS_TERMINATED;
  44011. if (-1 === $this->exitcode) {
  44012. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  44013. $this->exitcode = 128 + $this->processInformation['termsig'];
  44014. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  44015. $this->processInformation['signaled'] = true;
  44016. $this->processInformation['termsig'] = -1;
  44017. }
  44018. }
  44019. $this->callback = null;
  44020. return $this->exitcode;
  44021. }
  44022. private function resetProcessData()
  44023. {
  44024. $this->starttime = null;
  44025. $this->callback = null;
  44026. $this->exitcode = null;
  44027. $this->fallbackStatus = array();
  44028. $this->processInformation = null;
  44029. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  44030. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  44031. $this->process = null;
  44032. $this->latestSignal = null;
  44033. $this->status = self::STATUS_READY;
  44034. $this->incrementalOutputOffset = 0;
  44035. $this->incrementalErrorOutputOffset = 0;
  44036. }
  44037. private function doSignal($signal, $throwException)
  44038. {
  44039. if (null === $pid = $this->getPid()) {
  44040. if ($throwException) {
  44041. throw new LogicException('Can not send signal on a non running process.');
  44042. }
  44043. return false;
  44044. }
  44045. if ('\\' === DIRECTORY_SEPARATOR) {
  44046. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  44047. if ($exitCode && $this->isRunning()) {
  44048. if ($throwException) {
  44049. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  44050. }
  44051. return false;
  44052. }
  44053. } else {
  44054. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  44055. $ok = @proc_terminate($this->process, $signal);
  44056. } elseif (function_exists('posix_kill')) {
  44057. $ok = @posix_kill($pid, $signal);
  44058. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  44059. $ok = false === fgets($pipes[2]);
  44060. }
  44061. if (!$ok) {
  44062. if ($throwException) {
  44063. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  44064. }
  44065. return false;
  44066. }
  44067. }
  44068. $this->latestSignal = (int) $signal;
  44069. $this->fallbackStatus['signaled'] = true;
  44070. $this->fallbackStatus['exitcode'] = -1;
  44071. $this->fallbackStatus['termsig'] = $this->latestSignal;
  44072. return true;
  44073. }
  44074. private function requireProcessIsStarted($functionName)
  44075. {
  44076. if (!$this->isStarted()) {
  44077. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  44078. }
  44079. }
  44080. private function requireProcessIsTerminated($functionName)
  44081. {
  44082. if (!$this->isTerminated()) {
  44083. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  44084. }
  44085. }
  44086. }
  44087. <?php
  44088. namespace Symfony\Component\Process;
  44089. use Symfony\Component\Process\Exception\InvalidArgumentException;
  44090. use Symfony\Component\Process\Exception\LogicException;
  44091. class ProcessBuilder
  44092. {
  44093. private $arguments;
  44094. private $cwd;
  44095. private $env = array();
  44096. private $input;
  44097. private $timeout = 60;
  44098. private $options = array();
  44099. private $inheritEnv = true;
  44100. private $prefix = array();
  44101. private $outputDisabled = false;
  44102. public function __construct(array $arguments = array())
  44103. {
  44104. $this->arguments = $arguments;
  44105. }
  44106. public static function create(array $arguments = array())
  44107. {
  44108. return new static($arguments);
  44109. }
  44110. public function add($argument)
  44111. {
  44112. $this->arguments[] = $argument;
  44113. return $this;
  44114. }
  44115. public function setPrefix($prefix)
  44116. {
  44117. $this->prefix = is_array($prefix) ? $prefix : array($prefix);
  44118. return $this;
  44119. }
  44120. public function setArguments(array $arguments)
  44121. {
  44122. $this->arguments = $arguments;
  44123. return $this;
  44124. }
  44125. public function setWorkingDirectory($cwd)
  44126. {
  44127. $this->cwd = $cwd;
  44128. return $this;
  44129. }
  44130. public function inheritEnvironmentVariables($inheritEnv = true)
  44131. {
  44132. $this->inheritEnv = $inheritEnv;
  44133. return $this;
  44134. }
  44135. public function setEnv($name, $value)
  44136. {
  44137. $this->env[$name] = $value;
  44138. return $this;
  44139. }
  44140. public function addEnvironmentVariables(array $variables)
  44141. {
  44142. $this->env = array_replace($this->env, $variables);
  44143. return $this;
  44144. }
  44145. public function setInput($input)
  44146. {
  44147. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  44148. return $this;
  44149. }
  44150. public function setTimeout($timeout)
  44151. {
  44152. if (null === $timeout) {
  44153. $this->timeout = null;
  44154. return $this;
  44155. }
  44156. $timeout = (float) $timeout;
  44157. if ($timeout < 0) {
  44158. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  44159. }
  44160. $this->timeout = $timeout;
  44161. return $this;
  44162. }
  44163. public function setOption($name, $value)
  44164. {
  44165. $this->options[$name] = $value;
  44166. return $this;
  44167. }
  44168. public function disableOutput()
  44169. {
  44170. $this->outputDisabled = true;
  44171. return $this;
  44172. }
  44173. public function enableOutput()
  44174. {
  44175. $this->outputDisabled = false;
  44176. return $this;
  44177. }
  44178. public function getProcess()
  44179. {
  44180. if (0 === count($this->prefix) && 0 === count($this->arguments)) {
  44181. throw new LogicException('You must add() command arguments before calling getProcess().');
  44182. }
  44183. $options = $this->options;
  44184. $arguments = array_merge($this->prefix, $this->arguments);
  44185. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  44186. if ($this->inheritEnv) {
  44187. $env = array_replace($_ENV, $_SERVER, $this->env);
  44188. } else {
  44189. $env = $this->env;
  44190. }
  44191. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  44192. if ($this->outputDisabled) {
  44193. $process->disableOutput();
  44194. }
  44195. return $process;
  44196. }
  44197. }
  44198. <?php
  44199. namespace Symfony\Component\Process;
  44200. use Symfony\Component\Process\Exception\InvalidArgumentException;
  44201. class ProcessUtils
  44202. {
  44203. private function __construct()
  44204. {
  44205. }
  44206. public static function escapeArgument($argument)
  44207. {
  44208. if ('\\' === DIRECTORY_SEPARATOR) {
  44209. if ('' === $argument) {
  44210. return escapeshellarg($argument);
  44211. }
  44212. $escapedArgument = '';
  44213. $quote = false;
  44214. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  44215. if ('"' === $part) {
  44216. $escapedArgument .= '\\"';
  44217. } elseif (self::isSurroundedBy($part, '%')) {
  44218. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  44219. } else {
  44220. if ('\\' === substr($part, -1)) {
  44221. $part .= '\\';
  44222. }
  44223. $quote = true;
  44224. $escapedArgument .= $part;
  44225. }
  44226. }
  44227. if ($quote) {
  44228. $escapedArgument = '"'.$escapedArgument.'"';
  44229. }
  44230. return $escapedArgument;
  44231. }
  44232. return "'".str_replace("'", "'\\''", $argument)."'";
  44233. }
  44234. public static function validateInput($caller, $input)
  44235. {
  44236. if (null !== $input) {
  44237. if (is_resource($input)) {
  44238. return $input;
  44239. }
  44240. if (is_string($input)) {
  44241. return $input;
  44242. }
  44243. if (is_scalar($input)) {
  44244. return (string) $input;
  44245. }
  44246. if (is_object($input) && method_exists($input, '__toString')) {
  44247. @trigger_error('Passing an object as an input is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  44248. return (string) $input;
  44249. }
  44250. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  44251. }
  44252. return $input;
  44253. }
  44254. private static function isSurroundedBy($arg, $char)
  44255. {
  44256. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  44257. }
  44258. }
  44259. Copyright (c) 2011 Jordi Boggiano
  44260. Permission is hereby granted, free of charge, to any person obtaining a copy
  44261. of this software and associated documentation files (the "Software"), to deal
  44262. in the Software without restriction, including without limitation the rights
  44263. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44264. copies of the Software, and to permit persons to whom the Software is furnished
  44265. to do so, subject to the following conditions:
  44266. The above copyright notice and this permission notice shall be included in all
  44267. copies or substantial portions of the Software.
  44268. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44269. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44270. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44271. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44272. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44273. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44274. THE SOFTWARE.
  44275. <?php
  44276. namespace Seld\JsonLint;
  44277. class DuplicateKeyException extends ParsingException
  44278. {
  44279. public function __construct($message, $key, array $details = array())
  44280. {
  44281. $details['key'] = $key;
  44282. parent::__construct($message, $details);
  44283. }
  44284. public function getKey()
  44285. {
  44286. return $this->details['key'];
  44287. }
  44288. }
  44289. <?php
  44290. namespace Seld\JsonLint;
  44291. use stdClass;
  44292. class JsonParser
  44293. {
  44294. const DETECT_KEY_CONFLICTS = 1;
  44295. const ALLOW_DUPLICATE_KEYS = 2;
  44296. const PARSE_TO_ASSOC = 4;
  44297. private $lexer;
  44298. private $flags;
  44299. private $stack;
  44300. private $vstack;
  44301. private $lstack;
  44302. private $symbols = array(
  44303. 'error' => 2,
  44304. 'JSONString' => 3,
  44305. 'STRING' => 4,
  44306. 'JSONNumber' => 5,
  44307. 'NUMBER' => 6,
  44308. 'JSONNullLiteral' => 7,
  44309. 'NULL' => 8,
  44310. 'JSONBooleanLiteral' => 9,
  44311. 'TRUE' => 10,
  44312. 'FALSE' => 11,
  44313. 'JSONText' => 12,
  44314. 'JSONValue' => 13,
  44315. 'EOF' => 14,
  44316. 'JSONObject' => 15,
  44317. 'JSONArray' => 16,
  44318. '{' => 17,
  44319. '}' => 18,
  44320. 'JSONMemberList' => 19,
  44321. 'JSONMember' => 20,
  44322. ':' => 21,
  44323. ',' => 22,
  44324. '[' => 23,
  44325. ']' => 24,
  44326. 'JSONElementList' => 25,
  44327. '$accept' => 0,
  44328. '$end' => 1,
  44329. );
  44330. private $terminals_ = array(
  44331. 2 => "error",
  44332. 4 => "STRING",
  44333. 6 => "NUMBER",
  44334. 8 => "NULL",
  44335. 10 => "TRUE",
  44336. 11 => "FALSE",
  44337. 14 => "EOF",
  44338. 17 => "{",
  44339. 18 => "}",
  44340. 21 => ":",
  44341. 22 => ",",
  44342. 23 => "[",
  44343. 24 => "]",
  44344. );
  44345. private $productions_ = array(
  44346. 0,
  44347. array(3, 1),
  44348. array(5, 1),
  44349. array(7, 1),
  44350. array(9, 1),
  44351. array(9, 1),
  44352. array(12, 2),
  44353. array(13, 1),
  44354. array(13, 1),
  44355. array(13, 1),
  44356. array(13, 1),
  44357. array(13, 1),
  44358. array(13, 1),
  44359. array(15, 2),
  44360. array(15, 3),
  44361. array(20, 3),
  44362. array(19, 1),
  44363. array(19, 3),
  44364. array(16, 2),
  44365. array(16, 3),
  44366. array(25, 1),
  44367. array(25, 3)
  44368. );
  44369. 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)),
  44370. );
  44371. private $defaultActions = array(
  44372. 16 => array(2, 6)
  44373. );
  44374. public function lint($input, $flags = 0)
  44375. {
  44376. try {
  44377. $this->parse($input, $flags);
  44378. } catch (ParsingException $e) {
  44379. return $e;
  44380. }
  44381. }
  44382. public function parse($input, $flags = 0)
  44383. {
  44384. $this->failOnBOM($input);
  44385. $this->flags = $flags;
  44386. $this->stack = array(0);
  44387. $this->vstack = array(null);
  44388. $this->lstack = array();
  44389. $yytext = '';
  44390. $yylineno = 0;
  44391. $yyleng = 0;
  44392. $recovering = 0;
  44393. $TERROR = 2;
  44394. $EOF = 1;
  44395. $this->lexer = new Lexer();
  44396. $this->lexer->setInput($input);
  44397. $yyloc = $this->lexer->yylloc;
  44398. $this->lstack[] = $yyloc;
  44399. $symbol = null;
  44400. $preErrorSymbol = null;
  44401. $state = null;
  44402. $action = null;
  44403. $a = null;
  44404. $r = null;
  44405. $yyval = new stdClass;
  44406. $p = null;
  44407. $len = null;
  44408. $newState = null;
  44409. $expected = null;
  44410. $errStr = null;
  44411. while (true) {
  44412. $state = $this->stack[count($this->stack)-1];
  44413. if (isset($this->defaultActions[$state])) {
  44414. $action = $this->defaultActions[$state];
  44415. } else {
  44416. if ($symbol == null) {
  44417. $symbol = $this->lex();
  44418. }
  44419. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  44420. }
  44421. if (!$action || !$action[0]) {
  44422. if (!$recovering) {
  44423. $expected = array();
  44424. foreach ($this->table[$state] as $p => $ignore) {
  44425. if (isset($this->terminals_[$p]) && $p > 2) {
  44426. $expected[] = "'" . $this->terminals_[$p] . "'";
  44427. }
  44428. }
  44429. $message = null;
  44430. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  44431. $message = "Invalid string";
  44432. if ("'" === substr($this->lexer->match, 0, 1)) {
  44433. $message .= ", it appears you used single quotes instead of double quotes";
  44434. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  44435. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  44436. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  44437. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  44438. }
  44439. }
  44440. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  44441. $errStr .= $this->lexer->showPosition() . "\n";
  44442. if ($message) {
  44443. $errStr .= $message;
  44444. } else {
  44445. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  44446. $errStr .= implode(', ', $expected);
  44447. }
  44448. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  44449. $errStr .= " - It appears you have an extra trailing comma";
  44450. }
  44451. $this->parseError($errStr, array(
  44452. 'text' => $this->lexer->match,
  44453. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  44454. 'line' => $this->lexer->yylineno,
  44455. 'loc' => $yyloc,
  44456. 'expected' => $expected,
  44457. ));
  44458. }
  44459. if ($recovering == 3) {
  44460. if ($symbol == $EOF) {
  44461. throw new ParsingException($errStr ?: 'Parsing halted.');
  44462. }
  44463. $yyleng = $this->lexer->yyleng;
  44464. $yytext = $this->lexer->yytext;
  44465. $yylineno = $this->lexer->yylineno;
  44466. $yyloc = $this->lexer->yylloc;
  44467. $symbol = $this->lex();
  44468. }
  44469. while (true) {
  44470. if (array_key_exists($TERROR, $this->table[$state])) {
  44471. break;
  44472. }
  44473. if ($state == 0) {
  44474. throw new ParsingException($errStr ?: 'Parsing halted.');
  44475. }
  44476. $this->popStack(1);
  44477. $state = $this->stack[count($this->stack)-1];
  44478. }
  44479. $preErrorSymbol = $symbol;
  44480. $symbol = $TERROR;
  44481. $state = $this->stack[count($this->stack)-1];
  44482. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  44483. $recovering = 3;
  44484. }
  44485. if (is_array($action[0]) && count($action) > 1) {
  44486. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  44487. }
  44488. switch ($action[0]) {
  44489. case 1:
  44490. $this->stack[] = $symbol;
  44491. $this->vstack[] = $this->lexer->yytext;
  44492. $this->lstack[] = $this->lexer->yylloc;
  44493. $this->stack[] = $action[1];
  44494. $symbol = null;
  44495. if (!$preErrorSymbol) {
  44496. $yyleng = $this->lexer->yyleng;
  44497. $yytext = $this->lexer->yytext;
  44498. $yylineno = $this->lexer->yylineno;
  44499. $yyloc = $this->lexer->yylloc;
  44500. if ($recovering > 0) {
  44501. $recovering--;
  44502. }
  44503. } else {
  44504. $symbol = $preErrorSymbol;
  44505. $preErrorSymbol = null;
  44506. }
  44507. break;
  44508. case 2:
  44509. $len = $this->productions_[$action[1]][1];
  44510. $yyval->token = $this->vstack[count($this->vstack) - $len];
  44511. $yyval->store = array(
  44512. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  44513. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  44514. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  44515. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  44516. );
  44517. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  44518. if (!$r instanceof Undefined) {
  44519. return $r;
  44520. }
  44521. if ($len) {
  44522. $this->popStack($len);
  44523. }
  44524. $this->stack[] = $this->productions_[$action[1]][0];
  44525. $this->vstack[] = $yyval->token;
  44526. $this->lstack[] = $yyval->store;
  44527. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  44528. $this->stack[] = $newState;
  44529. break;
  44530. case 3:
  44531. return true;
  44532. }
  44533. }
  44534. return true;
  44535. }
  44536. protected function parseError($str, $hash)
  44537. {
  44538. throw new ParsingException($str, $hash);
  44539. }
  44540. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  44541. {
  44542. $len = count($tokens) - 1;
  44543. switch ($yystate) {
  44544. case 1:
  44545. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  44546. $yyval->token = $yytext;
  44547. break;
  44548. case 2:
  44549. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  44550. $yyval->token = floatval($yytext);
  44551. } else {
  44552. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  44553. }
  44554. break;
  44555. case 3:
  44556. $yyval->token = null;
  44557. break;
  44558. case 4:
  44559. $yyval->token = true;
  44560. break;
  44561. case 5:
  44562. $yyval->token = false;
  44563. break;
  44564. case 6:
  44565. return $yyval->token = $tokens[$len-1];
  44566. case 13:
  44567. if ($this->flags & self::PARSE_TO_ASSOC) {
  44568. $yyval->token = array();
  44569. } else {
  44570. $yyval->token = new stdClass;
  44571. }
  44572. break;
  44573. case 14:
  44574. $yyval->token = $tokens[$len-1];
  44575. break;
  44576. case 15:
  44577. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  44578. break;
  44579. case 16:
  44580. if (PHP_VERSION_ID < 70100) {
  44581. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  44582. } else {
  44583. $property = $tokens[$len][0];
  44584. }
  44585. if ($this->flags & self::PARSE_TO_ASSOC) {
  44586. $yyval->token = array();
  44587. $yyval->token[$property] = $tokens[$len][1];
  44588. } else {
  44589. $yyval->token = new stdClass;
  44590. $yyval->token->$property = $tokens[$len][1];
  44591. }
  44592. break;
  44593. case 17:
  44594. if ($this->flags & self::PARSE_TO_ASSOC) {
  44595. $yyval->token =& $tokens[$len-2];
  44596. $key = $tokens[$len][0];
  44597. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  44598. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  44599. $errStr .= $this->lexer->showPosition() . "\n";
  44600. $errStr .= "Duplicate key: ".$tokens[$len][0];
  44601. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  44602. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  44603. $duplicateCount = 1;
  44604. do {
  44605. $duplicateKey = $key . '.' . $duplicateCount++;
  44606. } while (isset($tokens[$len-2][$duplicateKey]));
  44607. $key = $duplicateKey;
  44608. }
  44609. $tokens[$len-2][$key] = $tokens[$len][1];
  44610. } else {
  44611. $yyval->token = $tokens[$len-2];
  44612. if (PHP_VERSION_ID < 70100) {
  44613. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  44614. } else {
  44615. $key = $tokens[$len][0];
  44616. }
  44617. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  44618. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  44619. $errStr .= $this->lexer->showPosition() . "\n";
  44620. $errStr .= "Duplicate key: ".$tokens[$len][0];
  44621. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  44622. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  44623. $duplicateCount = 1;
  44624. do {
  44625. $duplicateKey = $key . '.' . $duplicateCount++;
  44626. } while (isset($tokens[$len-2]->$duplicateKey));
  44627. $key = $duplicateKey;
  44628. }
  44629. $tokens[$len-2]->$key = $tokens[$len][1];
  44630. }
  44631. break;
  44632. case 18:
  44633. $yyval->token = array();
  44634. break;
  44635. case 19:
  44636. $yyval->token = $tokens[$len-1];
  44637. break;
  44638. case 20:
  44639. $yyval->token = array($tokens[$len]);
  44640. break;
  44641. case 21:
  44642. $tokens[$len-2][] = $tokens[$len];
  44643. $yyval->token = $tokens[$len-2];
  44644. break;
  44645. }
  44646. return new Undefined();
  44647. }
  44648. private function stringInterpolation($match)
  44649. {
  44650. switch ($match[0]) {
  44651. case '\\\\':
  44652. return '\\';
  44653. case '\"':
  44654. return '"';
  44655. case '\b':
  44656. return chr(8);
  44657. case '\f':
  44658. return chr(12);
  44659. case '\n':
  44660. return "\n";
  44661. case '\r':
  44662. return "\r";
  44663. case '\t':
  44664. return "\t";
  44665. case '\/':
  44666. return "/";
  44667. default:
  44668. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  44669. }
  44670. }
  44671. private function popStack($n)
  44672. {
  44673. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  44674. $this->vstack = array_slice($this->vstack, 0, - $n);
  44675. $this->lstack = array_slice($this->lstack, 0, - $n);
  44676. }
  44677. private function lex()
  44678. {
  44679. $token = $this->lexer->lex() ?: 1;
  44680. if (!is_numeric($token)) {
  44681. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  44682. }
  44683. return $token;
  44684. }
  44685. private function failOnBOM($input)
  44686. {
  44687. $bom = "\xEF\xBB\xBF";
  44688. if (substr($input, 0, 3) === $bom) {
  44689. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  44690. }
  44691. }
  44692. }
  44693. <?php
  44694. namespace Seld\JsonLint;
  44695. class Lexer
  44696. {
  44697. private $EOF = 1;
  44698. private $rules = array(
  44699. 0 => '/^\s+/',
  44700. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  44701. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  44702. 3 => '/^\{/',
  44703. 4 => '/^\}/',
  44704. 5 => '/^\[/',
  44705. 6 => '/^\]/',
  44706. 7 => '/^,/',
  44707. 8 => '/^:/',
  44708. 9 => '/^true\b/',
  44709. 10 => '/^false\b/',
  44710. 11 => '/^null\b/',
  44711. 12 => '/^$/',
  44712. 13 => '/^./',
  44713. );
  44714. private $conditions = array(
  44715. "INITIAL" => array(
  44716. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  44717. "inclusive" => true,
  44718. ),
  44719. );
  44720. private $conditionStack;
  44721. private $input;
  44722. private $more;
  44723. private $done;
  44724. private $matched;
  44725. public $match;
  44726. public $yylineno;
  44727. public $yyleng;
  44728. public $yytext;
  44729. public $yylloc;
  44730. public function lex()
  44731. {
  44732. $r = $this->next();
  44733. if (!$r instanceof Undefined) {
  44734. return $r;
  44735. }
  44736. return $this->lex();
  44737. }
  44738. public function setInput($input)
  44739. {
  44740. $this->input = $input;
  44741. $this->more = false;
  44742. $this->done = false;
  44743. $this->yylineno = $this->yyleng = 0;
  44744. $this->yytext = $this->matched = $this->match = '';
  44745. $this->conditionStack = array('INITIAL');
  44746. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  44747. return $this;
  44748. }
  44749. public function showPosition()
  44750. {
  44751. $pre = str_replace("\n", '', $this->getPastInput());
  44752. $c = str_repeat('-', max(0, strlen($pre) - 1));
  44753. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  44754. }
  44755. public function getPastInput()
  44756. {
  44757. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  44758. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  44759. }
  44760. public function getUpcomingInput()
  44761. {
  44762. $next = $this->match;
  44763. if (strlen($next) < 20) {
  44764. $next .= substr($this->input, 0, 20 - strlen($next));
  44765. }
  44766. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  44767. }
  44768. protected function parseError($str, $hash)
  44769. {
  44770. throw new \Exception($str);
  44771. }
  44772. private function next()
  44773. {
  44774. if ($this->done) {
  44775. return $this->EOF;
  44776. }
  44777. if (!$this->input) {
  44778. $this->done = true;
  44779. }
  44780. $token = null;
  44781. $match = null;
  44782. $col = null;
  44783. $lines = null;
  44784. if (!$this->more) {
  44785. $this->yytext = '';
  44786. $this->match = '';
  44787. }
  44788. $rules = $this->getCurrentRules();
  44789. $rulesLen = count($rules);
  44790. for ($i=0; $i < $rulesLen; $i++) {
  44791. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  44792. preg_match_all('/\n.*/', $match[0], $lines);
  44793. $lines = $lines[0];
  44794. if ($lines) {
  44795. $this->yylineno += count($lines);
  44796. }
  44797. $this->yylloc = array(
  44798. 'first_line' => $this->yylloc['last_line'],
  44799. 'last_line' => $this->yylineno+1,
  44800. 'first_column' => $this->yylloc['last_column'],
  44801. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  44802. );
  44803. $this->yytext .= $match[0];
  44804. $this->match .= $match[0];
  44805. $this->yyleng = strlen($this->yytext);
  44806. $this->more = false;
  44807. $this->input = substr($this->input, strlen($match[0]));
  44808. $this->matched .= $match[0];
  44809. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  44810. if ($token) {
  44811. return $token;
  44812. }
  44813. return new Undefined();
  44814. }
  44815. }
  44816. if ($this->input === "") {
  44817. return $this->EOF;
  44818. }
  44819. $this->parseError(
  44820. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  44821. array(
  44822. 'text' => "",
  44823. 'token' => null,
  44824. 'line' => $this->yylineno,
  44825. )
  44826. );
  44827. }
  44828. private function getCurrentRules()
  44829. {
  44830. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  44831. }
  44832. private function performAction($avoiding_name_collisions, $YY_START)
  44833. {
  44834. switch ($avoiding_name_collisions) {
  44835. case 0:
  44836. break;
  44837. case 1:
  44838. return 6;
  44839. break;
  44840. case 2:
  44841. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  44842. return 4;
  44843. case 3:
  44844. return 17;
  44845. case 4:
  44846. return 18;
  44847. case 5:
  44848. return 23;
  44849. case 6:
  44850. return 24;
  44851. case 7:
  44852. return 22;
  44853. case 8:
  44854. return 21;
  44855. case 9:
  44856. return 10;
  44857. case 10:
  44858. return 11;
  44859. case 11:
  44860. return 8;
  44861. case 12:
  44862. return 14;
  44863. case 13:
  44864. return 'INVALID';
  44865. }
  44866. }
  44867. }
  44868. <?php
  44869. namespace Seld\JsonLint;
  44870. class ParsingException extends \Exception
  44871. {
  44872. protected $details;
  44873. public function __construct($message, $details = array())
  44874. {
  44875. $this->details = $details;
  44876. parent::__construct($message);
  44877. }
  44878. public function getDetails()
  44879. {
  44880. return $this->details;
  44881. }
  44882. }
  44883. <?php
  44884. namespace Seld\JsonLint;
  44885. class Undefined
  44886. {
  44887. }
  44888. Copyright (c) 2015 Jordi Boggiano
  44889. Permission is hereby granted, free of charge, to any person obtaining a copy
  44890. of this software and associated documentation files (the "Software"), to deal
  44891. in the Software without restriction, including without limitation the rights
  44892. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44893. copies of the Software, and to permit persons to whom the Software is furnished
  44894. to do so, subject to the following conditions:
  44895. The above copyright notice and this permission notice shall be included in all
  44896. copies or substantial portions of the Software.
  44897. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44898. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44899. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44900. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44901. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44902. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44903. THE SOFTWARE.
  44904. <?php
  44905. require __DIR__.'/../vendor/autoload.php';
  44906. echo 'Say hello (visible): ';
  44907. $answer = Seld\CliPrompt\CliPrompt::prompt();
  44908. echo 'You answered: '.$answer . PHP_EOL;
  44909. echo 'Say hello (hidden): ';
  44910. $answer = Seld\CliPrompt\CliPrompt::hiddenPrompt();
  44911. echo 'You answered: '.$answer . PHP_EOL;
  44912. <?php
  44913. namespace Seld\CliPrompt;
  44914. class CliPrompt
  44915. {
  44916. public static function prompt()
  44917. {
  44918. $stdin = fopen('php://stdin', 'r');
  44919. $answer = self::trimAnswer(fgets($stdin, 4096));
  44920. fclose($stdin);
  44921. return $answer;
  44922. }
  44923. public static function hiddenPrompt($allowFallback = false)
  44924. {
  44925. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  44926. $exe = __DIR__.'\\..\\res\\hiddeninput.exe';
  44927. if ('phar:' === substr(__FILE__, 0, 5)) {
  44928. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  44929. $source = fopen($exe, 'r');
  44930. $target = fopen($tmpExe, 'w+');
  44931. stream_copy_to_stream($source, $target);
  44932. fclose($source);
  44933. fclose($target);
  44934. unset($source, $target);
  44935. $exe = $tmpExe;
  44936. }
  44937. $output = shell_exec($exe);
  44938. if (isset($tmpExe)) {
  44939. unlink($tmpExe);
  44940. }
  44941. if ($output !== null) {
  44942. echo PHP_EOL;
  44943. return self::trimAnswer($output);
  44944. }
  44945. }
  44946. if (file_exists('/usr/bin/env')) {
  44947. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  44948. foreach (array('bash', 'zsh', 'ksh', 'csh', 'sh') as $sh) {
  44949. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  44950. $shell = $sh;
  44951. break;
  44952. }
  44953. }
  44954. if (isset($shell)) {
  44955. $readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read -r mypassword';
  44956. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  44957. $output = shell_exec($command);
  44958. if ($output !== null) {
  44959. echo PHP_EOL;
  44960. return self::trimAnswer($output);
  44961. }
  44962. }
  44963. }
  44964. if (!$allowFallback) {
  44965. throw new \RuntimeException('Could not prompt for input in a secure fashion, aborting');
  44966. }
  44967. return self::prompt();
  44968. }
  44969. private static function trimAnswer($str)
  44970. {
  44971. return preg_replace('{\r?\n$}D', '', $str);
  44972. }
  44973. }
  44974. MIT License
  44975. Copyright (c) 2016
  44976. Permission is hereby granted, free of charge, to any person obtaining a copy
  44977. of this software and associated documentation files (the "Software"), to deal
  44978. in the Software without restriction, including without limitation the rights
  44979. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44980. copies of the Software, and to permit persons to whom the Software is
  44981. furnished to do so, subject to the following conditions:
  44982. The above copyright notice and this permission notice shall be included in all
  44983. copies or substantial portions of the Software.
  44984. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44985. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44986. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44987. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44988. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44989. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  44990. SOFTWARE.
  44991. <?php
  44992. require __DIR__ . '/../vendor/autoload.php';
  44993. $data = json_decode(file_get_contents('data.json'));
  44994. $validator = new JsonSchema\Validator();
  44995. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  44996. if ($validator->isValid()) {
  44997. echo "The supplied JSON validates against the schema.\n";
  44998. } else {
  44999. echo "JSON does not validate. Violations:\n";
  45000. foreach ($validator->getErrors() as $error) {
  45001. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  45002. }
  45003. }
  45004. <?php
  45005. namespace JsonSchema\Constraints;
  45006. use JsonSchema\Entity\JsonPointer;
  45007. use JsonSchema\Exception\ValidationException;
  45008. class BaseConstraint
  45009. {
  45010. protected $errors = array();
  45011. protected $factory;
  45012. public function __construct(Factory $factory = null)
  45013. {
  45014. $this->factory = $factory ?: new Factory();
  45015. }
  45016. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  45017. {
  45018. $error = array(
  45019. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  45020. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  45021. 'message' => $message,
  45022. 'constraint' => $constraint,
  45023. );
  45024. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  45025. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  45026. }
  45027. if (is_array($more) && count($more) > 0) {
  45028. $error += $more;
  45029. }
  45030. $this->errors[] = $error;
  45031. }
  45032. public function addErrors(array $errors)
  45033. {
  45034. if ($errors) {
  45035. $this->errors = array_merge($this->errors, $errors);
  45036. }
  45037. }
  45038. public function getErrors()
  45039. {
  45040. return $this->errors;
  45041. }
  45042. public function isValid()
  45043. {
  45044. return !$this->getErrors();
  45045. }
  45046. public function reset()
  45047. {
  45048. $this->errors = array();
  45049. }
  45050. }
  45051. <?php
  45052. namespace JsonSchema\Constraints;
  45053. use JsonSchema\Entity\JsonPointer;
  45054. class CollectionConstraint extends Constraint
  45055. {
  45056. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  45057. {
  45058. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  45059. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  45060. }
  45061. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  45062. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  45063. }
  45064. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  45065. $unique = $value;
  45066. if (is_array($value) && count($value)) {
  45067. $unique = array_map(function ($e) {
  45068. return var_export($e, true);
  45069. }, $value);
  45070. }
  45071. if (count(array_unique($unique)) != count($value)) {
  45072. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  45073. }
  45074. }
  45075. if (isset($schema->items)) {
  45076. $this->validateItems($value, $schema, $path, $i);
  45077. }
  45078. }
  45079. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  45080. {
  45081. if (is_object($schema->items)) {
  45082. if (isset($schema->items->type)
  45083. && (
  45084. $schema->items->type == 'string'
  45085. || $schema->items->type == 'number'
  45086. || $schema->items->type == 'integer'
  45087. )
  45088. && !isset($schema->additionalItems)
  45089. ) {
  45090. $type = $schema->items->type;
  45091. $typeValidator = $this->factory->createInstanceFor('type');
  45092. $validator = $this->factory->createInstanceFor($type === 'integer' ? 'number' : $type);
  45093. foreach ($value as $k => &$v) {
  45094. $k_path = $this->incrementPath($path, $k);
  45095. $typeValidator->check($v, $schema->items, $k_path, $i);
  45096. $validator->check($v, $schema->items, $k_path, $i);
  45097. }
  45098. unset($v);
  45099. $this->addErrors($typeValidator->getErrors());
  45100. $this->addErrors($validator->getErrors());
  45101. } else {
  45102. foreach ($value as $k => &$v) {
  45103. $initErrors = $this->getErrors();
  45104. $this->checkUndefined($v, $schema->items, $path, $k);
  45105. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  45106. $secondErrors = $this->getErrors();
  45107. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  45108. }
  45109. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  45110. $this->errors = $secondErrors;
  45111. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  45112. $this->errors = $initErrors;
  45113. }
  45114. }
  45115. unset($v);
  45116. }
  45117. } else {
  45118. foreach ($value as $k => &$v) {
  45119. if (array_key_exists($k, $schema->items)) {
  45120. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  45121. } else {
  45122. if (property_exists($schema, 'additionalItems')) {
  45123. if ($schema->additionalItems !== false) {
  45124. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  45125. } else {
  45126. $this->addError(
  45127. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  45128. }
  45129. } else {
  45130. $this->checkUndefined($v, new \stdClass(), $path, $k);
  45131. }
  45132. }
  45133. }
  45134. unset($v);
  45135. if (count($value) > 0) {
  45136. for ($k = count($value); $k < count($schema->items); $k++) {
  45137. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  45138. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  45139. }
  45140. }
  45141. }
  45142. }
  45143. }
  45144. <?php
  45145. namespace JsonSchema\Constraints;
  45146. use JsonSchema\Entity\JsonPointer;
  45147. use JsonSchema\SchemaStorage;
  45148. use JsonSchema\Uri\UriRetriever;
  45149. use JsonSchema\UriRetrieverInterface;
  45150. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  45151. {
  45152. protected $inlineSchemaProperty = '$schema';
  45153. const CHECK_MODE_NONE = 0x00000000;
  45154. const CHECK_MODE_NORMAL = 0x00000001;
  45155. const CHECK_MODE_TYPE_CAST = 0x00000002;
  45156. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  45157. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  45158. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  45159. protected function incrementPath(JsonPointer $path = null, $i)
  45160. {
  45161. $path = $path ?: new JsonPointer('');
  45162. $path = $path->withPropertyPaths(
  45163. array_merge(
  45164. $path->getPropertyPaths(),
  45165. array_filter(array($i), 'strlen')
  45166. )
  45167. );
  45168. return $path;
  45169. }
  45170. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  45171. {
  45172. $validator = $this->factory->createInstanceFor('collection');
  45173. $validator->check($value, $schema, $path, $i);
  45174. $this->addErrors($validator->getErrors());
  45175. }
  45176. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $i = null, $patternProperties = null)
  45177. {
  45178. $validator = $this->factory->createInstanceFor('object');
  45179. $validator->check($value, $schema, $path, $i, $patternProperties);
  45180. $this->addErrors($validator->getErrors());
  45181. }
  45182. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  45183. {
  45184. $validator = $this->factory->createInstanceFor('type');
  45185. $validator->check($value, $schema, $path, $i);
  45186. $this->addErrors($validator->getErrors());
  45187. }
  45188. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null)
  45189. {
  45190. $validator = $this->factory->createInstanceFor('undefined');
  45191. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i);
  45192. $this->addErrors($validator->getErrors());
  45193. }
  45194. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  45195. {
  45196. $validator = $this->factory->createInstanceFor('string');
  45197. $validator->check($value, $schema, $path, $i);
  45198. $this->addErrors($validator->getErrors());
  45199. }
  45200. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  45201. {
  45202. $validator = $this->factory->createInstanceFor('number');
  45203. $validator->check($value, $schema, $path, $i);
  45204. $this->addErrors($validator->getErrors());
  45205. }
  45206. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  45207. {
  45208. $validator = $this->factory->createInstanceFor('enum');
  45209. $validator->check($value, $schema, $path, $i);
  45210. $this->addErrors($validator->getErrors());
  45211. }
  45212. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  45213. {
  45214. $validator = $this->factory->createInstanceFor('format');
  45215. $validator->check($value, $schema, $path, $i);
  45216. $this->addErrors($validator->getErrors());
  45217. }
  45218. protected function getTypeCheck()
  45219. {
  45220. return $this->factory->getTypeCheck();
  45221. }
  45222. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  45223. {
  45224. $result = array_map(
  45225. function ($path) {
  45226. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  45227. },
  45228. $pointer->getPropertyPaths()
  45229. );
  45230. return trim(implode('', $result), '.');
  45231. }
  45232. }
  45233. <?php
  45234. namespace JsonSchema\Constraints;
  45235. use JsonSchema\Entity\JsonPointer;
  45236. interface ConstraintInterface
  45237. {
  45238. public function getErrors();
  45239. public function addErrors(array $errors);
  45240. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  45241. public function isValid();
  45242. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  45243. }
  45244. <?php
  45245. namespace JsonSchema\Constraints;
  45246. use JsonSchema\Entity\JsonPointer;
  45247. class EnumConstraint extends Constraint
  45248. {
  45249. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  45250. {
  45251. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  45252. return;
  45253. }
  45254. $type = gettype($element);
  45255. foreach ($schema->enum as $enum) {
  45256. $enumType = gettype($enum);
  45257. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  45258. if ((object) $element == $enum) {
  45259. return;
  45260. }
  45261. }
  45262. if ($type === gettype($enum)) {
  45263. if ($type == 'object') {
  45264. if ($element == $enum) {
  45265. return;
  45266. }
  45267. } elseif ($element === $enum) {
  45268. return;
  45269. }
  45270. }
  45271. }
  45272. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  45273. }
  45274. }
  45275. <?php
  45276. namespace JsonSchema\Constraints;
  45277. use JsonSchema\Constraints\Constraint;
  45278. use JsonSchema\Exception\InvalidArgumentException;
  45279. use JsonSchema\Exception\InvalidConfigException;
  45280. use JsonSchema\SchemaStorage;
  45281. use JsonSchema\SchemaStorageInterface;
  45282. use JsonSchema\Uri\UriRetriever;
  45283. use JsonSchema\UriRetrieverInterface;
  45284. class Factory
  45285. {
  45286. protected $schemaStorage;
  45287. protected $uriRetriever;
  45288. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  45289. private $typeCheck = array();
  45290. protected $constraintMap = array(
  45291. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  45292. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  45293. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  45294. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  45295. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  45296. 'string' => 'JsonSchema\Constraints\StringConstraint',
  45297. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  45298. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  45299. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  45300. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  45301. 'validator' => 'JsonSchema\Validator'
  45302. );
  45303. private $instanceCache = array();
  45304. public function __construct(
  45305. SchemaStorageInterface $schemaStorage = null,
  45306. UriRetrieverInterface $uriRetriever = null,
  45307. $checkMode = Constraint::CHECK_MODE_NORMAL
  45308. ) {
  45309. $this->setConfig($checkMode);
  45310. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  45311. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  45312. }
  45313. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  45314. {
  45315. $this->checkMode = $checkMode;
  45316. }
  45317. public function addConfig($options)
  45318. {
  45319. $this->checkMode |= $options;
  45320. }
  45321. public function removeConfig($options)
  45322. {
  45323. $this->checkMode &= ~$options;
  45324. }
  45325. public function getConfig($options = null)
  45326. {
  45327. if ($options === null) {
  45328. return $this->checkMode;
  45329. }
  45330. return $this->checkMode & $options;
  45331. }
  45332. public function getUriRetriever()
  45333. {
  45334. return $this->uriRetriever;
  45335. }
  45336. public function getSchemaStorage()
  45337. {
  45338. return $this->schemaStorage;
  45339. }
  45340. public function getTypeCheck()
  45341. {
  45342. if (!isset($this->typeCheck[$this->checkMode])) {
  45343. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  45344. ? new TypeCheck\LooseTypeCheck()
  45345. : new TypeCheck\StrictTypeCheck();
  45346. }
  45347. return $this->typeCheck[$this->checkMode];
  45348. }
  45349. public function setConstraintClass($name, $class)
  45350. {
  45351. if (!class_exists($class)) {
  45352. throw new InvalidArgumentException('Unknown constraint ' . $name);
  45353. }
  45354. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  45355. throw new InvalidArgumentException('Invalid class ' . $name);
  45356. }
  45357. $this->constraintMap[$name] = $class;
  45358. return $this;
  45359. }
  45360. public function createInstanceFor($constraintName)
  45361. {
  45362. if (!isset($this->constraintMap[$constraintName])) {
  45363. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  45364. }
  45365. if (!isset($this->instanceCache[$constraintName])) {
  45366. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  45367. }
  45368. return clone $this->instanceCache[$constraintName];
  45369. }
  45370. }
  45371. <?php
  45372. namespace JsonSchema\Constraints;
  45373. use JsonSchema\Entity\JsonPointer;
  45374. use JsonSchema\Rfc3339;
  45375. class FormatConstraint extends Constraint
  45376. {
  45377. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  45378. {
  45379. if (!isset($schema->format)) {
  45380. return;
  45381. }
  45382. switch ($schema->format) {
  45383. case 'date':
  45384. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  45385. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  45386. }
  45387. break;
  45388. case 'time':
  45389. if (!$this->validateDateTime($element, 'H:i:s')) {
  45390. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  45391. }
  45392. break;
  45393. case 'date-time':
  45394. if (null === Rfc3339::createFromString($element)) {
  45395. $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));
  45396. }
  45397. break;
  45398. case 'utc-millisec':
  45399. if (!$this->validateDateTime($element, 'U')) {
  45400. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  45401. }
  45402. break;
  45403. case 'regex':
  45404. if (!$this->validateRegex($element)) {
  45405. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  45406. }
  45407. break;
  45408. case 'color':
  45409. if (!$this->validateColor($element)) {
  45410. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  45411. }
  45412. break;
  45413. case 'style':
  45414. if (!$this->validateStyle($element)) {
  45415. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  45416. }
  45417. break;
  45418. case 'phone':
  45419. if (!$this->validatePhone($element)) {
  45420. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  45421. }
  45422. break;
  45423. case 'uri':
  45424. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  45425. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  45426. }
  45427. break;
  45428. case 'email':
  45429. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE)) {
  45430. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  45431. }
  45432. break;
  45433. case 'ip-address':
  45434. case 'ipv4':
  45435. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  45436. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  45437. }
  45438. break;
  45439. case 'ipv6':
  45440. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  45441. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  45442. }
  45443. break;
  45444. case 'host-name':
  45445. case 'hostname':
  45446. if (!$this->validateHostname($element)) {
  45447. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  45448. }
  45449. break;
  45450. default:
  45451. break;
  45452. }
  45453. }
  45454. protected function validateDateTime($datetime, $format)
  45455. {
  45456. $dt = \DateTime::createFromFormat($format, $datetime);
  45457. if (!$dt) {
  45458. return false;
  45459. }
  45460. if ($datetime === $dt->format($format)) {
  45461. return true;
  45462. }
  45463. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  45464. return true;
  45465. }
  45466. return false;
  45467. }
  45468. protected function validateRegex($regex)
  45469. {
  45470. return false !== @preg_match('/' . $regex . '/u', '');
  45471. }
  45472. protected function validateColor($color)
  45473. {
  45474. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  45475. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  45476. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  45477. return true;
  45478. }
  45479. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  45480. }
  45481. protected function validateStyle($style)
  45482. {
  45483. $properties = explode(';', rtrim($style, ';'));
  45484. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  45485. return empty($invalidEntries);
  45486. }
  45487. protected function validatePhone($phone)
  45488. {
  45489. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  45490. }
  45491. protected function validateHostname($host)
  45492. {
  45493. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  45494. return preg_match($hostnameRegex, $host);
  45495. }
  45496. }
  45497. <?php
  45498. namespace JsonSchema\Constraints;
  45499. use JsonSchema\Entity\JsonPointer;
  45500. class NumberConstraint extends Constraint
  45501. {
  45502. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  45503. {
  45504. if (isset($schema->exclusiveMinimum)) {
  45505. if (isset($schema->minimum)) {
  45506. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  45507. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  45508. } elseif ($element < $schema->minimum) {
  45509. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  45510. }
  45511. } else {
  45512. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  45513. }
  45514. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  45515. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  45516. }
  45517. if (isset($schema->exclusiveMaximum)) {
  45518. if (isset($schema->maximum)) {
  45519. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  45520. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  45521. } elseif ($element > $schema->maximum) {
  45522. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  45523. }
  45524. } else {
  45525. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  45526. }
  45527. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  45528. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  45529. }
  45530. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  45531. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  45532. }
  45533. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  45534. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  45535. }
  45536. $this->checkFormat($element, $schema, $path, $i);
  45537. }
  45538. private function fmod($number1, $number2)
  45539. {
  45540. $number1 = abs($number1);
  45541. $modulus = fmod($number1, $number2);
  45542. $precision = abs(0.0000000001);
  45543. $diff = (float) ($modulus - $number2);
  45544. if (-$precision < $diff && $diff < $precision) {
  45545. return 0.0;
  45546. }
  45547. $decimals1 = mb_strpos($number1, '.') ? mb_strlen($number1) - mb_strpos($number1, '.') - 1 : 0;
  45548. $decimals2 = mb_strpos($number2, '.') ? mb_strlen($number2) - mb_strpos($number2, '.') - 1 : 0;
  45549. return (float) round($modulus, max($decimals1, $decimals2));
  45550. }
  45551. }
  45552. <?php
  45553. namespace JsonSchema\Constraints;
  45554. use JsonSchema\Entity\JsonPointer;
  45555. class ObjectConstraint extends Constraint
  45556. {
  45557. public function check(&$element, $definition = null, JsonPointer $path = null, $additionalProp = null, $patternProperties = null)
  45558. {
  45559. if ($element instanceof UndefinedConstraint) {
  45560. return;
  45561. }
  45562. $matches = array();
  45563. if ($patternProperties) {
  45564. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  45565. }
  45566. if ($definition) {
  45567. $this->validateDefinition($element, $definition, $path);
  45568. }
  45569. $this->validateElement($element, $matches, $definition, $path, $additionalProp);
  45570. }
  45571. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  45572. {
  45573. $try = array('/', '#', '+', '~', '%');
  45574. $matches = array();
  45575. foreach ($patternProperties as $pregex => $schema) {
  45576. $delimiter = '/';
  45577. foreach ($try as $delimiter) {
  45578. if (strpos($pregex, $delimiter) === false) {
  45579. break;
  45580. }
  45581. }
  45582. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  45583. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  45584. continue;
  45585. }
  45586. foreach ($element as $i => $value) {
  45587. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  45588. $matches[] = $i;
  45589. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i);
  45590. }
  45591. }
  45592. }
  45593. return $matches;
  45594. }
  45595. public function validateElement($element, $matches, $objectDefinition = null, JsonPointer $path = null, $additionalProp = null)
  45596. {
  45597. $this->validateMinMaxConstraint($element, $objectDefinition, $path);
  45598. foreach ($element as $i => $value) {
  45599. $definition = $this->getProperty($objectDefinition, $i);
  45600. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  45601. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  45602. }
  45603. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  45604. if ($additionalProp === true) {
  45605. $this->checkUndefined($value, null, $path, $i);
  45606. } else {
  45607. $this->checkUndefined($value, $additionalProp, $path, $i);
  45608. }
  45609. }
  45610. $require = $this->getProperty($definition, 'requires');
  45611. if ($require && !$this->getProperty($element, $require)) {
  45612. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  45613. }
  45614. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  45615. if (is_object($property)) {
  45616. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  45617. }
  45618. }
  45619. }
  45620. public function validateDefinition(&$element, $objectDefinition = null, JsonPointer $path = null)
  45621. {
  45622. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  45623. foreach ($objectDefinition as $i => $value) {
  45624. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  45625. $definition = $this->getProperty($objectDefinition, $i);
  45626. if (is_object($definition)) {
  45627. $this->checkUndefined($property, $definition, $path, $i);
  45628. }
  45629. }
  45630. }
  45631. protected function &getProperty(&$element, $property, $fallback = null)
  45632. {
  45633. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  45634. return $element[$property];
  45635. } elseif (is_object($element) && property_exists($element, $property)) {
  45636. return $element->$property;
  45637. }
  45638. return $fallback;
  45639. }
  45640. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  45641. {
  45642. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  45643. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  45644. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  45645. }
  45646. }
  45647. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  45648. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  45649. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  45650. }
  45651. }
  45652. }
  45653. }
  45654. <?php
  45655. namespace JsonSchema\Constraints;
  45656. use JsonSchema\Entity\JsonPointer;
  45657. use JsonSchema\Exception\InvalidArgumentException;
  45658. class SchemaConstraint extends Constraint
  45659. {
  45660. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  45661. {
  45662. if ($schema !== null) {
  45663. $this->checkUndefined($element, $schema, $path, $i);
  45664. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  45665. $inlineSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  45666. if (is_array($inlineSchema)) {
  45667. $inlineSchema = json_decode(json_encode($inlineSchema));
  45668. }
  45669. $this->checkUndefined($element, $inlineSchema, $path, $i);
  45670. } else {
  45671. throw new InvalidArgumentException('no schema found to verify against');
  45672. }
  45673. }
  45674. }
  45675. <?php
  45676. namespace JsonSchema\Constraints;
  45677. use JsonSchema\Entity\JsonPointer;
  45678. class StringConstraint extends Constraint
  45679. {
  45680. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  45681. {
  45682. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  45683. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  45684. 'maxLength' => $schema->maxLength,
  45685. ));
  45686. }
  45687. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  45688. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  45689. 'minLength' => $schema->minLength,
  45690. ));
  45691. }
  45692. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  45693. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  45694. 'pattern' => $schema->pattern,
  45695. ));
  45696. }
  45697. $this->checkFormat($element, $schema, $path, $i);
  45698. }
  45699. private function strlen($string)
  45700. {
  45701. if (extension_loaded('mbstring')) {
  45702. return mb_strlen($string, mb_detect_encoding($string));
  45703. }
  45704. return strlen($string);
  45705. }
  45706. }
  45707. <?php
  45708. namespace JsonSchema\Constraints\TypeCheck;
  45709. class LooseTypeCheck implements TypeCheckInterface
  45710. {
  45711. public static function isObject($value)
  45712. {
  45713. return
  45714. is_object($value) ||
  45715. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  45716. }
  45717. public static function isArray($value)
  45718. {
  45719. return
  45720. is_array($value) &&
  45721. (count($value) == 0 || !self::isAssociativeArray($value));
  45722. }
  45723. public static function propertyGet($value, $property)
  45724. {
  45725. if (is_object($value)) {
  45726. return $value->{$property};
  45727. }
  45728. return $value[$property];
  45729. }
  45730. public static function propertySet(&$value, $property, $data)
  45731. {
  45732. if (is_object($value)) {
  45733. $value->{$property} = $data;
  45734. } else {
  45735. $value[$property] = $data;
  45736. }
  45737. }
  45738. public static function propertyExists($value, $property)
  45739. {
  45740. if (is_object($value)) {
  45741. return property_exists($value, $property);
  45742. }
  45743. return array_key_exists($property, $value);
  45744. }
  45745. public static function propertyCount($value)
  45746. {
  45747. if (is_object($value)) {
  45748. return count(get_object_vars($value));
  45749. }
  45750. return count($value);
  45751. }
  45752. private static function isAssociativeArray($arr)
  45753. {
  45754. return array_keys($arr) !== range(0, count($arr) - 1);
  45755. }
  45756. }
  45757. <?php
  45758. namespace JsonSchema\Constraints\TypeCheck;
  45759. class StrictTypeCheck implements TypeCheckInterface
  45760. {
  45761. public static function isObject($value)
  45762. {
  45763. return is_object($value);
  45764. }
  45765. public static function isArray($value)
  45766. {
  45767. return is_array($value);
  45768. }
  45769. public static function propertyGet($value, $property)
  45770. {
  45771. return $value->{$property};
  45772. }
  45773. public static function propertySet(&$value, $property, $data)
  45774. {
  45775. $value->{$property} = $data;
  45776. }
  45777. public static function propertyExists($value, $property)
  45778. {
  45779. return property_exists($value, $property);
  45780. }
  45781. public static function propertyCount($value)
  45782. {
  45783. return count(get_object_vars($value));
  45784. }
  45785. }
  45786. <?php
  45787. namespace JsonSchema\Constraints\TypeCheck;
  45788. interface TypeCheckInterface
  45789. {
  45790. public static function isObject($value);
  45791. public static function isArray($value);
  45792. public static function propertyGet($value, $property);
  45793. public static function propertySet(&$value, $property, $data);
  45794. public static function propertyExists($value, $property);
  45795. public static function propertyCount($value);
  45796. }
  45797. <?php
  45798. namespace JsonSchema\Constraints;
  45799. use JsonSchema\Entity\JsonPointer;
  45800. use JsonSchema\Exception\InvalidArgumentException;
  45801. use UnexpectedValueException as StandardUnexpectedValueException;
  45802. class TypeConstraint extends Constraint
  45803. {
  45804. public static $wording = array(
  45805. 'integer' => 'an integer',
  45806. 'number' => 'a number',
  45807. 'boolean' => 'a boolean',
  45808. 'object' => 'an object',
  45809. 'array' => 'an array',
  45810. 'string' => 'a string',
  45811. 'null' => 'a null',
  45812. 'any' => null,
  45813. 0 => null,
  45814. );
  45815. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  45816. {
  45817. $type = isset($schema->type) ? $schema->type : null;
  45818. $isValid = false;
  45819. $wording = array();
  45820. if (is_array($type)) {
  45821. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  45822. } elseif (is_object($type)) {
  45823. $this->checkUndefined($value, $type, $path);
  45824. return;
  45825. } else {
  45826. $isValid = $this->validateType($value, $type);
  45827. }
  45828. if ($isValid === false) {
  45829. if (!is_array($type)) {
  45830. $this->validateTypeNameWording($type);
  45831. $wording[] = self::$wording[$type];
  45832. }
  45833. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  45834. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  45835. }
  45836. }
  45837. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  45838. {
  45839. foreach ($type as $tp) {
  45840. if (is_object($tp)) {
  45841. if (!$isValid) {
  45842. $validator = $this->factory->createInstanceFor('type');
  45843. $subSchema = new \stdClass();
  45844. $subSchema->type = $tp;
  45845. $validator->check($value, $subSchema, $path, null);
  45846. $error = $validator->getErrors();
  45847. $isValid = !(bool) $error;
  45848. $validTypesWording[] = self::$wording['object'];
  45849. }
  45850. } else {
  45851. $this->validateTypeNameWording($tp);
  45852. $validTypesWording[] = self::$wording[$tp];
  45853. if (!$isValid) {
  45854. $isValid = $this->validateType($value, $tp);
  45855. }
  45856. }
  45857. }
  45858. }
  45859. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  45860. {
  45861. if ($listEnd === false || !isset($elements[1])) {
  45862. return implode($delimiter, $elements);
  45863. }
  45864. $lastElement = array_slice($elements, -1);
  45865. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  45866. $implodedElements = array_merge(array($firsElements), $lastElement);
  45867. return join(" $listEnd ", $implodedElements);
  45868. }
  45869. protected function validateTypeNameWording($type)
  45870. {
  45871. if (!isset(self::$wording[$type])) {
  45872. throw new StandardUnexpectedValueException(
  45873. sprintf(
  45874. 'No wording for %s available, expected wordings are: [%s]',
  45875. var_export($type, true),
  45876. implode(', ', array_filter(self::$wording)))
  45877. );
  45878. }
  45879. }
  45880. protected function validateType(&$value, $type)
  45881. {
  45882. if (!$type) {
  45883. return true;
  45884. }
  45885. if ('any' === $type) {
  45886. return true;
  45887. }
  45888. if ('object' === $type) {
  45889. return $this->getTypeCheck()->isObject($value);
  45890. }
  45891. if ('array' === $type) {
  45892. return $this->getTypeCheck()->isArray($value);
  45893. }
  45894. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  45895. if ('integer' === $type) {
  45896. if ($coerce) {
  45897. $value = $this->toInteger($value);
  45898. }
  45899. return is_int($value);
  45900. }
  45901. if ('number' === $type) {
  45902. if ($coerce) {
  45903. $value = $this->toNumber($value);
  45904. }
  45905. return is_numeric($value) && !is_string($value);
  45906. }
  45907. if ('boolean' === $type) {
  45908. if ($coerce) {
  45909. $value = $this->toBoolean($value);
  45910. }
  45911. return is_bool($value);
  45912. }
  45913. if ('string' === $type) {
  45914. return is_string($value);
  45915. }
  45916. if ('email' === $type) {
  45917. return is_string($value);
  45918. }
  45919. if ('null' === $type) {
  45920. return is_null($value);
  45921. }
  45922. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  45923. }
  45924. protected function toBoolean($value)
  45925. {
  45926. if ($value === 'true') {
  45927. return true;
  45928. }
  45929. if ($value === 'false') {
  45930. return false;
  45931. }
  45932. return $value;
  45933. }
  45934. protected function toNumber($value)
  45935. {
  45936. if (is_numeric($value)) {
  45937. return $value + 0;
  45938. }
  45939. return $value;
  45940. }
  45941. protected function toInteger($value)
  45942. {
  45943. if (is_numeric($value) && (int) $value == $value) {
  45944. return (int) $value;
  45945. }
  45946. return $value;
  45947. }
  45948. }
  45949. <?php
  45950. namespace JsonSchema\Constraints;
  45951. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  45952. use JsonSchema\Entity\JsonPointer;
  45953. use JsonSchema\Uri\UriResolver;
  45954. class UndefinedConstraint extends Constraint
  45955. {
  45956. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  45957. {
  45958. if (is_null($schema) || !is_object($schema)) {
  45959. return;
  45960. }
  45961. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  45962. $this->validateCommonProperties($value, $schema, $path, $i);
  45963. $this->validateOfProperties($value, $schema, $path, '');
  45964. $this->validateTypes($value, $schema, $path, $i);
  45965. }
  45966. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  45967. {
  45968. if ($this->getTypeCheck()->isArray($value)) {
  45969. $this->checkArray($value, $schema, $path, $i);
  45970. }
  45971. if (LooseTypeCheck::isObject($value)) {
  45972. $this->checkObject(
  45973. $value,
  45974. isset($schema->properties) ? $this->factory->getSchemaStorage()->resolveRefSchema($schema->properties) : $schema,
  45975. $path,
  45976. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  45977. isset($schema->patternProperties) ? $schema->patternProperties : null
  45978. );
  45979. }
  45980. if (is_string($value)) {
  45981. $this->checkString($value, $schema, $path, $i);
  45982. }
  45983. if (is_numeric($value)) {
  45984. $this->checkNumber($value, $schema, $path, $i);
  45985. }
  45986. if (isset($schema->enum)) {
  45987. $this->checkEnum($value, $schema, $path, $i);
  45988. }
  45989. }
  45990. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  45991. {
  45992. if (isset($schema->extends)) {
  45993. if (is_string($schema->extends)) {
  45994. $schema->extends = $this->validateUri($schema, $schema->extends);
  45995. }
  45996. if (is_array($schema->extends)) {
  45997. foreach ($schema->extends as $extends) {
  45998. $this->checkUndefined($value, $extends, $path, $i);
  45999. }
  46000. } else {
  46001. $this->checkUndefined($value, $schema->extends, $path, $i);
  46002. }
  46003. }
  46004. if ($this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  46005. if ($this->getTypeCheck()->isObject($value) && isset($schema->properties)) {
  46006. foreach ($schema->properties as $i => $propertyDefinition) {
  46007. if (!$this->getTypeCheck()->propertyExists($value, $i) && isset($propertyDefinition->default)) {
  46008. if (is_object($propertyDefinition->default)) {
  46009. $this->getTypeCheck()->propertySet($value, $i, clone $propertyDefinition->default);
  46010. } else {
  46011. $this->getTypeCheck()->propertySet($value, $i, $propertyDefinition->default);
  46012. }
  46013. }
  46014. }
  46015. } elseif ($this->getTypeCheck()->isArray($value)) {
  46016. if (isset($schema->properties)) {
  46017. foreach ($schema->properties as $i => $propertyDefinition) {
  46018. if (!isset($value[$i]) && isset($propertyDefinition->default)) {
  46019. if (is_object($propertyDefinition->default)) {
  46020. $value[$i] = clone $propertyDefinition->default;
  46021. } else {
  46022. $value[$i] = $propertyDefinition->default;
  46023. }
  46024. }
  46025. }
  46026. } elseif (isset($schema->items)) {
  46027. foreach ($schema->items as $i => $itemDefinition) {
  46028. if (!isset($value[$i]) && isset($itemDefinition->default)) {
  46029. if (is_object($itemDefinition->default)) {
  46030. $value[$i] = clone $itemDefinition->default;
  46031. } else {
  46032. $value[$i] = $itemDefinition->default;
  46033. }
  46034. }
  46035. }
  46036. }
  46037. } elseif (($value instanceof self || $value === null) && isset($schema->default)) {
  46038. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  46039. }
  46040. }
  46041. if ($this->getTypeCheck()->isObject($value)) {
  46042. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  46043. foreach ($schema->required as $required) {
  46044. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  46045. $this->addError(
  46046. $this->incrementPath($path ?: new JsonPointer(''), $required),
  46047. 'The property ' . $required . ' is required',
  46048. 'required'
  46049. );
  46050. }
  46051. }
  46052. } elseif (isset($schema->required) && !is_array($schema->required)) {
  46053. if ($schema->required && $value instanceof self) {
  46054. $this->addError($path, 'Is missing and it is required', 'required');
  46055. }
  46056. }
  46057. }
  46058. if (!($value instanceof self)) {
  46059. $this->checkType($value, $schema, $path, $i);
  46060. }
  46061. if (isset($schema->disallow)) {
  46062. $initErrors = $this->getErrors();
  46063. $typeSchema = new \stdClass();
  46064. $typeSchema->type = $schema->disallow;
  46065. $this->checkType($value, $typeSchema, $path);
  46066. if (count($this->getErrors()) == count($initErrors)) {
  46067. $this->addError($path, 'Disallowed value was matched', 'disallow');
  46068. } else {
  46069. $this->errors = $initErrors;
  46070. }
  46071. }
  46072. if (isset($schema->not)) {
  46073. $initErrors = $this->getErrors();
  46074. $this->checkUndefined($value, $schema->not, $path, $i);
  46075. if (count($this->getErrors()) == count($initErrors)) {
  46076. $this->addError($path, 'Matched a schema which it should not', 'not');
  46077. } else {
  46078. $this->errors = $initErrors;
  46079. }
  46080. }
  46081. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  46082. $this->validateDependencies($value, $schema->dependencies, $path);
  46083. }
  46084. }
  46085. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  46086. {
  46087. if ($value instanceof self) {
  46088. return;
  46089. }
  46090. if (isset($schema->allOf)) {
  46091. $isValid = true;
  46092. foreach ($schema->allOf as $allOf) {
  46093. $initErrors = $this->getErrors();
  46094. $this->checkUndefined($value, $allOf, $path, $i);
  46095. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  46096. }
  46097. if (!$isValid) {
  46098. $this->addError($path, 'Failed to match all schemas', 'allOf');
  46099. }
  46100. }
  46101. if (isset($schema->anyOf)) {
  46102. $isValid = false;
  46103. $startErrors = $this->getErrors();
  46104. foreach ($schema->anyOf as $anyOf) {
  46105. $initErrors = $this->getErrors();
  46106. $this->checkUndefined($value, $anyOf, $path, $i);
  46107. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  46108. break;
  46109. }
  46110. }
  46111. if (!$isValid) {
  46112. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  46113. } else {
  46114. $this->errors = $startErrors;
  46115. }
  46116. }
  46117. if (isset($schema->oneOf)) {
  46118. $allErrors = array();
  46119. $matchedSchemas = 0;
  46120. $startErrors = $this->getErrors();
  46121. foreach ($schema->oneOf as $oneOf) {
  46122. $this->errors = array();
  46123. $this->checkUndefined($value, $oneOf, $path, $i);
  46124. if (count($this->getErrors()) == 0) {
  46125. $matchedSchemas++;
  46126. }
  46127. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  46128. }
  46129. if ($matchedSchemas !== 1) {
  46130. $this->addErrors(array_merge($allErrors, $startErrors));
  46131. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  46132. } else {
  46133. $this->errors = $startErrors;
  46134. }
  46135. }
  46136. }
  46137. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  46138. {
  46139. foreach ($dependencies as $key => $dependency) {
  46140. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  46141. if (is_string($dependency)) {
  46142. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  46143. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  46144. }
  46145. } elseif (is_array($dependency)) {
  46146. foreach ($dependency as $d) {
  46147. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  46148. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  46149. }
  46150. }
  46151. } elseif (is_object($dependency)) {
  46152. $this->checkUndefined($value, $dependency, $path, $i);
  46153. }
  46154. }
  46155. }
  46156. }
  46157. protected function validateUri($schema, $schemaUri = null)
  46158. {
  46159. $resolver = new UriResolver();
  46160. $retriever = $this->factory->getUriRetriever();
  46161. $jsonSchema = null;
  46162. if ($resolver->isValid($schemaUri)) {
  46163. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  46164. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  46165. }
  46166. return $jsonSchema;
  46167. }
  46168. }
  46169. <?php
  46170. namespace JsonSchema\Entity;
  46171. class JsonPointer
  46172. {
  46173. private $filename;
  46174. private $propertyPaths = array();
  46175. public function __construct($value)
  46176. {
  46177. if (!is_string($value)) {
  46178. throw new \InvalidArgumentException('Ref value must be a string');
  46179. }
  46180. $splitRef = explode('#', $value, 2);
  46181. $this->filename = $splitRef[0];
  46182. if (array_key_exists(1, $splitRef)) {
  46183. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  46184. }
  46185. }
  46186. private function decodePropertyPaths($propertyPathString)
  46187. {
  46188. $paths = array();
  46189. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  46190. $path = $this->decodePath($path);
  46191. if (is_string($path) && '' !== $path) {
  46192. $paths[] = $path;
  46193. }
  46194. }
  46195. return $paths;
  46196. }
  46197. private function encodePropertyPaths()
  46198. {
  46199. return array_map(
  46200. array($this, 'encodePath'),
  46201. $this->getPropertyPaths()
  46202. );
  46203. }
  46204. private function decodePath($path)
  46205. {
  46206. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  46207. }
  46208. private function encodePath($path)
  46209. {
  46210. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  46211. }
  46212. public function getFilename()
  46213. {
  46214. return $this->filename;
  46215. }
  46216. public function getPropertyPaths()
  46217. {
  46218. return $this->propertyPaths;
  46219. }
  46220. public function withPropertyPaths(array $propertyPaths)
  46221. {
  46222. $new = clone $this;
  46223. $new->propertyPaths = $propertyPaths;
  46224. return $new;
  46225. }
  46226. public function getPropertyPathAsString()
  46227. {
  46228. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  46229. }
  46230. public function __toString()
  46231. {
  46232. return $this->getFilename() . $this->getPropertyPathAsString();
  46233. }
  46234. }
  46235. <?php
  46236. namespace JsonSchema\Exception;
  46237. interface ExceptionInterface
  46238. {
  46239. }
  46240. <?php
  46241. namespace JsonSchema\Exception;
  46242. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  46243. {
  46244. }
  46245. <?php
  46246. namespace JsonSchema\Exception;
  46247. class InvalidConfigException extends RuntimeException
  46248. {
  46249. }
  46250. <?php
  46251. namespace JsonSchema\Exception;
  46252. class InvalidSchemaMediaTypeException extends RuntimeException
  46253. {
  46254. }
  46255. <?php
  46256. namespace JsonSchema\Exception;
  46257. class InvalidSourceUriException extends InvalidArgumentException
  46258. {
  46259. }
  46260. <?php
  46261. namespace JsonSchema\Exception;
  46262. class JsonDecodingException extends RuntimeException
  46263. {
  46264. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  46265. {
  46266. switch ($code) {
  46267. case JSON_ERROR_DEPTH:
  46268. $message = 'The maximum stack depth has been exceeded';
  46269. break;
  46270. case JSON_ERROR_STATE_MISMATCH:
  46271. $message = 'Invalid or malformed JSON';
  46272. break;
  46273. case JSON_ERROR_CTRL_CHAR:
  46274. $message = 'Control character error, possibly incorrectly encoded';
  46275. break;
  46276. case JSON_ERROR_UTF8:
  46277. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  46278. break;
  46279. case JSON_ERROR_SYNTAX:
  46280. $message = 'JSON syntax is malformed';
  46281. break;
  46282. default:
  46283. $message = 'Syntax error';
  46284. }
  46285. parent::__construct($message, $code, $previous);
  46286. }
  46287. }
  46288. <?php
  46289. namespace JsonSchema\Exception;
  46290. class ResourceNotFoundException extends RuntimeException
  46291. {
  46292. }
  46293. <?php
  46294. namespace JsonSchema\Exception;
  46295. class RuntimeException extends \RuntimeException implements ExceptionInterface
  46296. {
  46297. }
  46298. <?php
  46299. namespace JsonSchema\Exception;
  46300. class UnresolvableJsonPointerException extends InvalidArgumentException
  46301. {
  46302. }
  46303. <?php
  46304. namespace JsonSchema\Exception;
  46305. class UriResolverException extends RuntimeException
  46306. {
  46307. }
  46308. <?php
  46309. namespace JsonSchema\Exception;
  46310. class ValidationException extends RuntimeException
  46311. {
  46312. }
  46313. <?php
  46314. namespace JsonSchema\Iterator;
  46315. class ObjectIterator implements \Iterator, \Countable
  46316. {
  46317. private $object;
  46318. private $position = 0;
  46319. private $data = array();
  46320. private $initialized = false;
  46321. public function __construct($object)
  46322. {
  46323. $this->object = $object;
  46324. }
  46325. public function current()
  46326. {
  46327. $this->initialize();
  46328. return $this->data[$this->position];
  46329. }
  46330. public function next()
  46331. {
  46332. $this->initialize();
  46333. $this->position++;
  46334. }
  46335. public function key()
  46336. {
  46337. $this->initialize();
  46338. return $this->position;
  46339. }
  46340. public function valid()
  46341. {
  46342. $this->initialize();
  46343. return isset($this->data[$this->position]);
  46344. }
  46345. public function rewind()
  46346. {
  46347. $this->initialize();
  46348. $this->position = 0;
  46349. }
  46350. public function count()
  46351. {
  46352. $this->initialize();
  46353. return count($this->data);
  46354. }
  46355. private function initialize()
  46356. {
  46357. if (!$this->initialized) {
  46358. $this->data = $this->buildDataFromObject($this->object);
  46359. $this->initialized = true;
  46360. }
  46361. }
  46362. private function buildDataFromObject($object)
  46363. {
  46364. $result = array();
  46365. $stack = new \SplStack();
  46366. $stack->push($object);
  46367. while (!$stack->isEmpty()) {
  46368. $current = $stack->pop();
  46369. if (is_object($current)) {
  46370. array_push($result, $current);
  46371. }
  46372. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  46373. if (is_object($propertyValue) || is_array($propertyValue)) {
  46374. $stack->push($propertyValue);
  46375. }
  46376. }
  46377. }
  46378. return $result;
  46379. }
  46380. private function getDataFromItem($item)
  46381. {
  46382. if (!is_object($item) && !is_array($item)) {
  46383. return array();
  46384. }
  46385. return is_object($item) ? get_object_vars($item) : $item;
  46386. }
  46387. }
  46388. <?php
  46389. namespace JsonSchema;
  46390. class Rfc3339
  46391. {
  46392. const REGEX = '/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  46393. public static function createFromString($string)
  46394. {
  46395. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  46396. return null;
  46397. }
  46398. $dateAndTime = $matches[1];
  46399. $microseconds = $matches[2] ?: '.000000';
  46400. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  46401. $dateTime = \DateTime::createFromFormat('Y-m-d\TH:i:s.uP', $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  46402. return $dateTime ?: null;
  46403. }
  46404. }
  46405. <?php
  46406. namespace JsonSchema;
  46407. use JsonSchema\Entity\JsonPointer;
  46408. use JsonSchema\Exception\UnresolvableJsonPointerException;
  46409. use JsonSchema\Iterator\ObjectIterator;
  46410. use JsonSchema\Uri\UriResolver;
  46411. use JsonSchema\Uri\UriRetriever;
  46412. class SchemaStorage implements SchemaStorageInterface
  46413. {
  46414. protected $uriRetriever;
  46415. protected $uriResolver;
  46416. protected $schemas = array();
  46417. public function __construct(
  46418. UriRetrieverInterface $uriRetriever = null,
  46419. UriResolverInterface $uriResolver = null
  46420. ) {
  46421. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  46422. $this->uriResolver = $uriResolver ?: new UriResolver();
  46423. }
  46424. public function getUriRetriever()
  46425. {
  46426. return $this->uriRetriever;
  46427. }
  46428. public function getUriResolver()
  46429. {
  46430. return $this->uriResolver;
  46431. }
  46432. public function addSchema($id, $schema = null)
  46433. {
  46434. if (is_null($schema)) {
  46435. $schema = $this->uriRetriever->retrieve($id);
  46436. }
  46437. $objectIterator = new ObjectIterator($schema);
  46438. foreach ($objectIterator as $toResolveSchema) {
  46439. if (property_exists($toResolveSchema, '$ref') && is_string($toResolveSchema->{'$ref'})) {
  46440. $jsonPointer = new JsonPointer($this->uriResolver->resolve($toResolveSchema->{'$ref'}, $id));
  46441. $toResolveSchema->{'$ref'} = (string) $jsonPointer;
  46442. }
  46443. }
  46444. $this->schemas[$id] = $schema;
  46445. }
  46446. public function getSchema($id)
  46447. {
  46448. if (!array_key_exists($id, $this->schemas)) {
  46449. $this->addSchema($id);
  46450. }
  46451. return $this->schemas[$id];
  46452. }
  46453. public function resolveRef($ref)
  46454. {
  46455. $jsonPointer = new JsonPointer($ref);
  46456. $refSchema = $this->getSchema($jsonPointer->getFilename());
  46457. foreach ($jsonPointer->getPropertyPaths() as $path) {
  46458. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  46459. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  46460. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  46461. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  46462. } else {
  46463. throw new UnresolvableJsonPointerException(sprintf(
  46464. 'File: %s is found, but could not resolve fragment: %s',
  46465. $jsonPointer->getFilename(),
  46466. $jsonPointer->getPropertyPathAsString()
  46467. ));
  46468. }
  46469. }
  46470. return $refSchema;
  46471. }
  46472. public function resolveRefSchema($refSchema)
  46473. {
  46474. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  46475. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  46476. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  46477. unset($refSchema->{'$ref'});
  46478. }
  46479. return $refSchema;
  46480. }
  46481. }
  46482. <?php
  46483. namespace JsonSchema;
  46484. interface SchemaStorageInterface
  46485. {
  46486. public function addSchema($id, $schema = null);
  46487. public function getSchema($id);
  46488. public function resolveRef($ref);
  46489. public function resolveRefSchema($refSchema);
  46490. }
  46491. <?php
  46492. namespace JsonSchema\Uri\Retrievers;
  46493. abstract class AbstractRetriever implements UriRetrieverInterface
  46494. {
  46495. protected $contentType;
  46496. public function getContentType()
  46497. {
  46498. return $this->contentType;
  46499. }
  46500. }
  46501. <?php
  46502. namespace JsonSchema\Uri\Retrievers;
  46503. use JsonSchema\Validator;
  46504. class Curl extends AbstractRetriever
  46505. {
  46506. protected $messageBody;
  46507. public function __construct()
  46508. {
  46509. if (!function_exists('curl_init')) {
  46510. throw new \RuntimeException('cURL not installed');
  46511. }
  46512. }
  46513. public function retrieve($uri)
  46514. {
  46515. $ch = curl_init();
  46516. curl_setopt($ch, CURLOPT_URL, $uri);
  46517. curl_setopt($ch, CURLOPT_HEADER, true);
  46518. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  46519. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  46520. $response = curl_exec($ch);
  46521. if (false === $response) {
  46522. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  46523. }
  46524. $this->fetchMessageBody($response);
  46525. $this->fetchContentType($response);
  46526. curl_close($ch);
  46527. return $this->messageBody;
  46528. }
  46529. private function fetchMessageBody($response)
  46530. {
  46531. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  46532. $this->messageBody = $match[1];
  46533. }
  46534. protected function fetchContentType($response)
  46535. {
  46536. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  46537. $this->contentType = trim($match[1]);
  46538. return true;
  46539. }
  46540. return false;
  46541. }
  46542. }
  46543. <?php
  46544. namespace JsonSchema\Uri\Retrievers;
  46545. use JsonSchema\Exception\ResourceNotFoundException;
  46546. class FileGetContents extends AbstractRetriever
  46547. {
  46548. protected $messageBody;
  46549. public function retrieve($uri)
  46550. {
  46551. $errorMessage = null;
  46552. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  46553. $errorMessage = $errstr;
  46554. });
  46555. $response = file_get_contents($uri);
  46556. restore_error_handler();
  46557. if ($errorMessage) {
  46558. throw new ResourceNotFoundException($errorMessage);
  46559. }
  46560. if (false === $response) {
  46561. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  46562. }
  46563. if ($response == ''
  46564. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  46565. ) {
  46566. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  46567. }
  46568. $this->messageBody = $response;
  46569. if (!empty($http_response_header)) {
  46570. $this->fetchContentType($http_response_header);
  46571. } else {
  46572. $this->contentType = null;
  46573. }
  46574. return $this->messageBody;
  46575. }
  46576. private function fetchContentType(array $headers)
  46577. {
  46578. foreach ($headers as $header) {
  46579. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  46580. return true;
  46581. }
  46582. }
  46583. return false;
  46584. }
  46585. protected static function getContentTypeMatchInHeader($header)
  46586. {
  46587. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  46588. return trim($match[1]);
  46589. }
  46590. return null;
  46591. }
  46592. }
  46593. <?php
  46594. namespace JsonSchema\Uri\Retrievers;
  46595. use JsonSchema\Validator;
  46596. class PredefinedArray extends AbstractRetriever
  46597. {
  46598. private $schemas;
  46599. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  46600. {
  46601. $this->schemas = $schemas;
  46602. $this->contentType = $contentType;
  46603. }
  46604. public function retrieve($uri)
  46605. {
  46606. if (!array_key_exists($uri, $this->schemas)) {
  46607. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  46608. 'The JSON schema "%s" was not found.',
  46609. $uri
  46610. ));
  46611. }
  46612. return $this->schemas[$uri];
  46613. }
  46614. }
  46615. <?php
  46616. namespace JsonSchema\Uri\Retrievers;
  46617. interface UriRetrieverInterface
  46618. {
  46619. public function retrieve($uri);
  46620. public function getContentType();
  46621. }
  46622. <?php
  46623. namespace JsonSchema\Uri;
  46624. use JsonSchema\Exception\UriResolverException;
  46625. use JsonSchema\UriResolverInterface;
  46626. class UriResolver implements UriResolverInterface
  46627. {
  46628. public function parse($uri)
  46629. {
  46630. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  46631. $components = array();
  46632. if (5 < count($match)) {
  46633. $components = array(
  46634. 'scheme' => $match[2],
  46635. 'authority' => $match[4],
  46636. 'path' => $match[5]
  46637. );
  46638. }
  46639. if (7 < count($match)) {
  46640. $components['query'] = $match[7];
  46641. }
  46642. if (9 < count($match)) {
  46643. $components['fragment'] = $match[9];
  46644. }
  46645. return $components;
  46646. }
  46647. public function generate(array $components)
  46648. {
  46649. $uri = $components['scheme'] . '://'
  46650. . $components['authority']
  46651. . $components['path'];
  46652. if (array_key_exists('query', $components)) {
  46653. $uri .= $components['query'];
  46654. }
  46655. if (array_key_exists('fragment', $components)) {
  46656. $uri .= '#' . $components['fragment'];
  46657. }
  46658. return $uri;
  46659. }
  46660. public function resolve($uri, $baseUri = null)
  46661. {
  46662. if ($uri == '') {
  46663. return $baseUri;
  46664. }
  46665. $components = $this->parse($uri);
  46666. $path = $components['path'];
  46667. if (!empty($components['scheme'])) {
  46668. return $uri;
  46669. }
  46670. $baseComponents = $this->parse($baseUri);
  46671. $basePath = $baseComponents['path'];
  46672. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  46673. if (isset($components['fragment'])) {
  46674. $baseComponents['fragment'] = $components['fragment'];
  46675. }
  46676. return $this->generate($baseComponents);
  46677. }
  46678. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  46679. {
  46680. $relativePath = self::normalizePath($relativePath);
  46681. if ($relativePath == '') {
  46682. return $basePath;
  46683. }
  46684. if ($relativePath[0] == '/') {
  46685. return $relativePath;
  46686. }
  46687. $basePathSegments = explode('/', $basePath);
  46688. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  46689. $numLevelUp = strlen($match[0]) /3 + 1;
  46690. if ($numLevelUp >= count($basePathSegments)) {
  46691. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  46692. }
  46693. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  46694. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  46695. return implode('/', $basePathSegments) . '/' . $path;
  46696. }
  46697. private static function normalizePath($path)
  46698. {
  46699. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  46700. $path = preg_replace('|//|', '/', $path);
  46701. return $path;
  46702. }
  46703. public function isValid($uri)
  46704. {
  46705. $components = $this->parse($uri);
  46706. return !empty($components);
  46707. }
  46708. }
  46709. <?php
  46710. namespace JsonSchema\Uri;
  46711. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  46712. use JsonSchema\Exception\JsonDecodingException;
  46713. use JsonSchema\Exception\ResourceNotFoundException;
  46714. use JsonSchema\Uri\Retrievers\FileGetContents;
  46715. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  46716. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  46717. use JsonSchema\Validator;
  46718. class UriRetriever implements BaseUriRetrieverInterface
  46719. {
  46720. protected $uriRetriever = null;
  46721. private $schemaCache = array();
  46722. public function confirmMediaType($uriRetriever, $uri)
  46723. {
  46724. $contentType = $uriRetriever->getContentType();
  46725. if (is_null($contentType)) {
  46726. return;
  46727. }
  46728. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  46729. return;
  46730. }
  46731. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  46732. return true;
  46733. }
  46734. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  46735. }
  46736. public function getUriRetriever()
  46737. {
  46738. if (is_null($this->uriRetriever)) {
  46739. $this->setUriRetriever(new FileGetContents());
  46740. }
  46741. return $this->uriRetriever;
  46742. }
  46743. public function resolvePointer($jsonSchema, $uri)
  46744. {
  46745. $resolver = new UriResolver();
  46746. $parsed = $resolver->parse($uri);
  46747. if (empty($parsed['fragment'])) {
  46748. return $jsonSchema;
  46749. }
  46750. $path = explode('/', $parsed['fragment']);
  46751. while ($path) {
  46752. $pathElement = array_shift($path);
  46753. if (!empty($pathElement)) {
  46754. $pathElement = str_replace('~1', '/', $pathElement);
  46755. $pathElement = str_replace('~0', '~', $pathElement);
  46756. if (!empty($jsonSchema->$pathElement)) {
  46757. $jsonSchema = $jsonSchema->$pathElement;
  46758. } else {
  46759. throw new ResourceNotFoundException(
  46760. 'Fragment "' . $parsed['fragment'] . '" not found'
  46761. . ' in ' . $uri
  46762. );
  46763. }
  46764. if (!is_object($jsonSchema)) {
  46765. throw new ResourceNotFoundException(
  46766. 'Fragment part "' . $pathElement . '" is no object '
  46767. . ' in ' . $uri
  46768. );
  46769. }
  46770. }
  46771. }
  46772. return $jsonSchema;
  46773. }
  46774. public function retrieve($uri, $baseUri = null)
  46775. {
  46776. $resolver = new UriResolver();
  46777. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  46778. $arParts = $resolver->parse($resolvedUri);
  46779. if (isset($arParts['fragment'])) {
  46780. unset($arParts['fragment']);
  46781. $fetchUri = $resolver->generate($arParts);
  46782. }
  46783. $jsonSchema = $this->loadSchema($fetchUri);
  46784. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  46785. if ($jsonSchema instanceof \stdClass) {
  46786. $jsonSchema->id = $resolvedUri;
  46787. }
  46788. return $jsonSchema;
  46789. }
  46790. protected function loadSchema($fetchUri)
  46791. {
  46792. if (isset($this->schemaCache[$fetchUri])) {
  46793. return $this->schemaCache[$fetchUri];
  46794. }
  46795. $uriRetriever = $this->getUriRetriever();
  46796. $contents = $this->uriRetriever->retrieve($fetchUri);
  46797. $this->confirmMediaType($uriRetriever, $fetchUri);
  46798. $jsonSchema = json_decode($contents);
  46799. if (JSON_ERROR_NONE < $error = json_last_error()) {
  46800. throw new JsonDecodingException($error);
  46801. }
  46802. $this->schemaCache[$fetchUri] = $jsonSchema;
  46803. return $jsonSchema;
  46804. }
  46805. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  46806. {
  46807. $this->uriRetriever = $uriRetriever;
  46808. return $this;
  46809. }
  46810. public function parse($uri)
  46811. {
  46812. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  46813. $components = array();
  46814. if (5 < count($match)) {
  46815. $components = array(
  46816. 'scheme' => $match[2],
  46817. 'authority' => $match[4],
  46818. 'path' => $match[5]
  46819. );
  46820. }
  46821. if (7 < count($match)) {
  46822. $components['query'] = $match[7];
  46823. }
  46824. if (9 < count($match)) {
  46825. $components['fragment'] = $match[9];
  46826. }
  46827. return $components;
  46828. }
  46829. public function generate(array $components)
  46830. {
  46831. $uri = $components['scheme'] . '://'
  46832. . $components['authority']
  46833. . $components['path'];
  46834. if (array_key_exists('query', $components)) {
  46835. $uri .= $components['query'];
  46836. }
  46837. if (array_key_exists('fragment', $components)) {
  46838. $uri .= $components['fragment'];
  46839. }
  46840. return $uri;
  46841. }
  46842. public function resolve($uri, $baseUri = null)
  46843. {
  46844. $components = $this->parse($uri);
  46845. $path = $components['path'];
  46846. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  46847. return $uri;
  46848. }
  46849. $baseComponents = $this->parse($baseUri);
  46850. $basePath = $baseComponents['path'];
  46851. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  46852. return $this->generate($baseComponents);
  46853. }
  46854. public function isValid($uri)
  46855. {
  46856. $components = $this->parse($uri);
  46857. return !empty($components);
  46858. }
  46859. }
  46860. <?php
  46861. namespace JsonSchema;
  46862. interface UriResolverInterface
  46863. {
  46864. public function resolve($uri, $baseUri = null);
  46865. }
  46866. <?php
  46867. namespace JsonSchema;
  46868. interface UriRetrieverInterface
  46869. {
  46870. public function retrieve($uri, $baseUri = null);
  46871. }
  46872. <?php
  46873. namespace JsonSchema;
  46874. use JsonSchema\Constraints\BaseConstraint;
  46875. use JsonSchema\Constraints\Constraint;
  46876. use JsonSchema\Exception\InvalidConfigException;
  46877. class Validator extends BaseConstraint
  46878. {
  46879. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  46880. public function validate(&$value, $schema = null, $checkMode = null)
  46881. {
  46882. $initialCheckMode = $this->factory->getConfig();
  46883. if ($checkMode !== null) {
  46884. $this->factory->setConfig($checkMode);
  46885. }
  46886. $validator = $this->factory->createInstanceFor('schema');
  46887. $validator->check($value, $schema);
  46888. $this->factory->setConfig($initialCheckMode);
  46889. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  46890. }
  46891. public function check($value, $schema)
  46892. {
  46893. return $this->validate($value, $schema);
  46894. }
  46895. public function coerce(&$value, $schema)
  46896. {
  46897. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  46898. }
  46899. }
  46900. Copyright (C) 2015 Composer
  46901. Permission is hereby granted, free of charge, to any person obtaining a copy of
  46902. this software and associated documentation files (the "Software"), to deal in
  46903. the Software without restriction, including without limitation the rights to
  46904. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  46905. of the Software, and to permit persons to whom the Software is furnished to do
  46906. so, subject to the following conditions:
  46907. The above copyright notice and this permission notice shall be included in all
  46908. copies or substantial portions of the Software.
  46909. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46910. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46911. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46912. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46913. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46914. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  46915. SOFTWARE.
  46916. <?php
  46917. namespace Composer\Spdx;
  46918. class SpdxLicenses
  46919. {
  46920. const LICENSES_FILE = 'spdx-licenses.json';
  46921. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  46922. private $licenses;
  46923. private $licensesExpression;
  46924. private $exceptions;
  46925. private $exceptionsExpression;
  46926. public function __construct()
  46927. {
  46928. $this->loadLicenses();
  46929. $this->loadExceptions();
  46930. }
  46931. public function getLicenseByIdentifier($identifier)
  46932. {
  46933. if (!isset($this->licenses[$identifier])) {
  46934. return;
  46935. }
  46936. $license = $this->licenses[$identifier];
  46937. $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseText';
  46938. return $license;
  46939. }
  46940. public function getExceptionByIdentifier($identifier)
  46941. {
  46942. if (!isset($this->exceptions[$identifier])) {
  46943. return;
  46944. }
  46945. $license = $this->exceptions[$identifier];
  46946. $license[] = 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText';
  46947. return $license;
  46948. }
  46949. public function getIdentifierByName($name)
  46950. {
  46951. foreach ($this->licenses as $identifier => $licenseData) {
  46952. if ($licenseData[0] === $name) {
  46953. return $identifier;
  46954. }
  46955. }
  46956. foreach ($this->exceptions as $identifier => $licenseData) {
  46957. if ($licenseData[0] === $name) {
  46958. return $identifier;
  46959. }
  46960. }
  46961. }
  46962. public function isOsiApprovedByIdentifier($identifier)
  46963. {
  46964. return $this->licenses[$identifier][1];
  46965. }
  46966. public function validate($license)
  46967. {
  46968. if (is_array($license)) {
  46969. $count = count($license);
  46970. if ($count !== count(array_filter($license, 'is_string'))) {
  46971. throw new \InvalidArgumentException('Array of strings expected.');
  46972. }
  46973. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  46974. }
  46975. if (!is_string($license)) {
  46976. throw new \InvalidArgumentException(sprintf(
  46977. 'Array or String expected, %s given.',
  46978. gettype($license)
  46979. ));
  46980. }
  46981. return $this->isValidLicenseString($license);
  46982. }
  46983. public static function getResourcesDir()
  46984. {
  46985. return dirname(__DIR__) . '/res';
  46986. }
  46987. private function loadLicenses()
  46988. {
  46989. if (null === $this->licenses) {
  46990. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  46991. $this->licenses = json_decode($json, true);
  46992. }
  46993. }
  46994. private function loadExceptions()
  46995. {
  46996. if (null === $this->exceptions) {
  46997. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  46998. $this->exceptions = json_decode($json, true);
  46999. }
  47000. }
  47001. private function getLicensesExpression()
  47002. {
  47003. if (null === $this->licensesExpression) {
  47004. $licenses = array_map('preg_quote', array_keys($this->licenses));
  47005. rsort($licenses);
  47006. $licenses = implode('|', $licenses);
  47007. $this->licensesExpression = $licenses;
  47008. }
  47009. return $this->licensesExpression;
  47010. }
  47011. private function getExceptionsExpression()
  47012. {
  47013. if (null === $this->exceptionsExpression) {
  47014. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  47015. rsort($exceptions);
  47016. $exceptions = implode('|', $exceptions);
  47017. $this->exceptionsExpression = $exceptions;
  47018. }
  47019. return $this->exceptionsExpression;
  47020. }
  47021. private function isValidLicenseString($license)
  47022. {
  47023. if (isset($this->licenses[$license])) {
  47024. return true;
  47025. }
  47026. $licenses = $this->getLicensesExpression();
  47027. $exceptions = $this->getExceptionsExpression();
  47028. $regex = <<<REGEX
  47029. {
  47030. (?(DEFINE)
  47031. # idstring: 1*( ALPHA / DIGIT / - / . )
  47032. (?<idstring>[\pL\pN.-]{1,})
  47033. # license-id: taken from list
  47034. (?<licenseid>${licenses})
  47035. # license-exception-id: taken from list
  47036. (?<licenseexceptionid>${exceptions})
  47037. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  47038. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  47039. # simple-expresssion: license-id / license-id+ / license-ref
  47040. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  47041. # compound-expression: 1*(
  47042. # simple-expression /
  47043. # simple-expression WITH license-exception-id /
  47044. # compound-expression AND compound-expression /
  47045. # compound-expression OR compound-expression
  47046. # ) / ( compound-expression ) )
  47047. (?<compound_head>
  47048. (?&simple_expression) ( \s+ (?:with|WITH) \s+ (?&licenseexceptionid))?
  47049. | \( \s* (?&compound_expression) \s* \)
  47050. )
  47051. (?<compound_expression>
  47052. (?&compound_head) (?: \s+ (?:and|AND|or|OR) \s+ (?&compound_expression))?
  47053. )
  47054. # license-expression: 1*1(simple-expression / compound-expression)
  47055. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  47056. ) # end of define
  47057. ^(NONE | NOASSERTION | (?&license_expression))$
  47058. }x
  47059. REGEX;
  47060. $match = preg_match($regex, $license);
  47061. if (0 === $match) {
  47062. return false;
  47063. }
  47064. if (false === $match) {
  47065. throw new \RuntimeException('Regex failed to compile/run.');
  47066. }
  47067. return true;
  47068. }
  47069. }
  47070. Copyright (C) 2015 Composer
  47071. Permission is hereby granted, free of charge, to any person obtaining a copy of
  47072. this software and associated documentation files (the "Software"), to deal in
  47073. the Software without restriction, including without limitation the rights to
  47074. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  47075. of the Software, and to permit persons to whom the Software is furnished to do
  47076. so, subject to the following conditions:
  47077. The above copyright notice and this permission notice shall be included in all
  47078. copies or substantial portions of the Software.
  47079. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47080. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47081. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47082. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47083. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47084. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47085. SOFTWARE.
  47086. <?php
  47087. namespace Composer\Semver;
  47088. use Composer\Semver\Constraint\Constraint;
  47089. class Comparator
  47090. {
  47091. public static function greaterThan($version1, $version2)
  47092. {
  47093. return self::compare($version1, '>', $version2);
  47094. }
  47095. public static function greaterThanOrEqualTo($version1, $version2)
  47096. {
  47097. return self::compare($version1, '>=', $version2);
  47098. }
  47099. public static function lessThan($version1, $version2)
  47100. {
  47101. return self::compare($version1, '<', $version2);
  47102. }
  47103. public static function lessThanOrEqualTo($version1, $version2)
  47104. {
  47105. return self::compare($version1, '<=', $version2);
  47106. }
  47107. public static function equalTo($version1, $version2)
  47108. {
  47109. return self::compare($version1, '==', $version2);
  47110. }
  47111. public static function notEqualTo($version1, $version2)
  47112. {
  47113. return self::compare($version1, '!=', $version2);
  47114. }
  47115. public static function compare($version1, $operator, $version2)
  47116. {
  47117. $constraint = new Constraint($operator, $version2);
  47118. return $constraint->matches(new Constraint('==', $version1));
  47119. }
  47120. }
  47121. <?php
  47122. namespace Composer\Semver\Constraint;
  47123. 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);
  47124. abstract class AbstractConstraint implements ConstraintInterface
  47125. {
  47126. protected $prettyString;
  47127. public function matches(ConstraintInterface $provider)
  47128. {
  47129. if ($provider instanceof $this) {
  47130. return $this->matchSpecific($provider);
  47131. }
  47132. return $provider->matches($this);
  47133. }
  47134. public function setPrettyString($prettyString)
  47135. {
  47136. $this->prettyString = $prettyString;
  47137. }
  47138. public function getPrettyString()
  47139. {
  47140. if ($this->prettyString) {
  47141. return $this->prettyString;
  47142. }
  47143. return $this->__toString();
  47144. }
  47145. }
  47146. <?php
  47147. namespace Composer\Semver\Constraint;
  47148. class Constraint implements ConstraintInterface
  47149. {
  47150. const OP_EQ = 0;
  47151. const OP_LT = 1;
  47152. const OP_LE = 2;
  47153. const OP_GT = 3;
  47154. const OP_GE = 4;
  47155. const OP_NE = 5;
  47156. private static $transOpStr = array(
  47157. '=' => self::OP_EQ,
  47158. '==' => self::OP_EQ,
  47159. '<' => self::OP_LT,
  47160. '<=' => self::OP_LE,
  47161. '>' => self::OP_GT,
  47162. '>=' => self::OP_GE,
  47163. '<>' => self::OP_NE,
  47164. '!=' => self::OP_NE,
  47165. );
  47166. private static $transOpInt = array(
  47167. self::OP_EQ => '==',
  47168. self::OP_LT => '<',
  47169. self::OP_LE => '<=',
  47170. self::OP_GT => '>',
  47171. self::OP_GE => '>=',
  47172. self::OP_NE => '!=',
  47173. );
  47174. protected $operator;
  47175. protected $version;
  47176. protected $prettyString;
  47177. public function matches(ConstraintInterface $provider)
  47178. {
  47179. if ($provider instanceof $this) {
  47180. return $this->matchSpecific($provider);
  47181. }
  47182. return $provider->matches($this);
  47183. }
  47184. public function setPrettyString($prettyString)
  47185. {
  47186. $this->prettyString = $prettyString;
  47187. }
  47188. public function getPrettyString()
  47189. {
  47190. if ($this->prettyString) {
  47191. return $this->prettyString;
  47192. }
  47193. return $this->__toString();
  47194. }
  47195. public static function getSupportedOperators()
  47196. {
  47197. return array_keys(self::$transOpStr);
  47198. }
  47199. public function __construct($operator, $version)
  47200. {
  47201. if (!isset(self::$transOpStr[$operator])) {
  47202. throw new \InvalidArgumentException(sprintf(
  47203. 'Invalid operator "%s" given, expected one of: %s',
  47204. $operator,
  47205. implode(', ', self::getSupportedOperators())
  47206. ));
  47207. }
  47208. $this->operator = self::$transOpStr[$operator];
  47209. $this->version = $version;
  47210. }
  47211. public function versionCompare($a, $b, $operator, $compareBranches = false)
  47212. {
  47213. if (!isset(self::$transOpStr[$operator])) {
  47214. throw new \InvalidArgumentException(sprintf(
  47215. 'Invalid operator "%s" given, expected one of: %s',
  47216. $operator,
  47217. implode(', ', self::getSupportedOperators())
  47218. ));
  47219. }
  47220. $aIsBranch = 'dev-' === substr($a, 0, 4);
  47221. $bIsBranch = 'dev-' === substr($b, 0, 4);
  47222. if ($aIsBranch && $bIsBranch) {
  47223. return $operator === '==' && $a === $b;
  47224. }
  47225. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  47226. return false;
  47227. }
  47228. return version_compare($a, $b, $operator);
  47229. }
  47230. public function matchSpecific(Constraint $provider, $compareBranches = false)
  47231. {
  47232. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  47233. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  47234. $isEqualOp = self::OP_EQ === $this->operator;
  47235. $isNonEqualOp = self::OP_NE === $this->operator;
  47236. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  47237. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  47238. if ($isNonEqualOp || $isProviderNonEqualOp) {
  47239. return !$isEqualOp && !$isProviderEqualOp
  47240. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  47241. }
  47242. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  47243. return true;
  47244. }
  47245. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  47246. if ($provider->version === $this->version
  47247. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  47248. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  47249. return false;
  47250. }
  47251. return true;
  47252. }
  47253. return false;
  47254. }
  47255. public function __toString()
  47256. {
  47257. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  47258. }
  47259. }
  47260. <?php
  47261. namespace Composer\Semver\Constraint;
  47262. interface ConstraintInterface
  47263. {
  47264. public function matches(ConstraintInterface $provider);
  47265. public function getPrettyString();
  47266. public function __toString();
  47267. }
  47268. <?php
  47269. namespace Composer\Semver\Constraint;
  47270. class EmptyConstraint implements ConstraintInterface
  47271. {
  47272. protected $prettyString;
  47273. public function matches(ConstraintInterface $provider)
  47274. {
  47275. return true;
  47276. }
  47277. public function setPrettyString($prettyString)
  47278. {
  47279. $this->prettyString = $prettyString;
  47280. }
  47281. public function getPrettyString()
  47282. {
  47283. if ($this->prettyString) {
  47284. return $this->prettyString;
  47285. }
  47286. return $this->__toString();
  47287. }
  47288. public function __toString()
  47289. {
  47290. return '[]';
  47291. }
  47292. }
  47293. <?php
  47294. namespace Composer\Semver\Constraint;
  47295. class MultiConstraint implements ConstraintInterface
  47296. {
  47297. protected $constraints;
  47298. protected $prettyString;
  47299. protected $conjunctive;
  47300. public function __construct(array $constraints, $conjunctive = true)
  47301. {
  47302. $this->constraints = $constraints;
  47303. $this->conjunctive = $conjunctive;
  47304. }
  47305. public function getConstraints()
  47306. {
  47307. return $this->constraints;
  47308. }
  47309. public function isConjunctive()
  47310. {
  47311. return $this->conjunctive;
  47312. }
  47313. public function isDisjunctive()
  47314. {
  47315. return !$this->conjunctive;
  47316. }
  47317. public function matches(ConstraintInterface $provider)
  47318. {
  47319. if (false === $this->conjunctive) {
  47320. foreach ($this->constraints as $constraint) {
  47321. if ($constraint->matches($provider)) {
  47322. return true;
  47323. }
  47324. }
  47325. return false;
  47326. }
  47327. foreach ($this->constraints as $constraint) {
  47328. if (!$constraint->matches($provider)) {
  47329. return false;
  47330. }
  47331. }
  47332. return true;
  47333. }
  47334. public function setPrettyString($prettyString)
  47335. {
  47336. $this->prettyString = $prettyString;
  47337. }
  47338. public function getPrettyString()
  47339. {
  47340. if ($this->prettyString) {
  47341. return $this->prettyString;
  47342. }
  47343. return $this->__toString();
  47344. }
  47345. public function __toString()
  47346. {
  47347. $constraints = array();
  47348. foreach ($this->constraints as $constraint) {
  47349. $constraints[] = (string) $constraint;
  47350. }
  47351. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  47352. }
  47353. }
  47354. <?php
  47355. namespace Composer\Semver;
  47356. use Composer\Semver\Constraint\Constraint;
  47357. class Semver
  47358. {
  47359. const SORT_ASC = 1;
  47360. const SORT_DESC = -1;
  47361. private static $versionParser;
  47362. public static function satisfies($version, $constraints)
  47363. {
  47364. if (null === self::$versionParser) {
  47365. self::$versionParser = new VersionParser();
  47366. }
  47367. $versionParser = self::$versionParser;
  47368. $provider = new Constraint('==', $versionParser->normalize($version));
  47369. $constraints = $versionParser->parseConstraints($constraints);
  47370. return $constraints->matches($provider);
  47371. }
  47372. public static function satisfiedBy(array $versions, $constraints)
  47373. {
  47374. $versions = array_filter($versions, function ($version) use ($constraints) {
  47375. return Semver::satisfies($version, $constraints);
  47376. });
  47377. return array_values($versions);
  47378. }
  47379. public static function sort(array $versions)
  47380. {
  47381. return self::usort($versions, self::SORT_ASC);
  47382. }
  47383. public static function rsort(array $versions)
  47384. {
  47385. return self::usort($versions, self::SORT_DESC);
  47386. }
  47387. private static function usort(array $versions, $direction)
  47388. {
  47389. if (null === self::$versionParser) {
  47390. self::$versionParser = new VersionParser();
  47391. }
  47392. $versionParser = self::$versionParser;
  47393. $normalized = array();
  47394. foreach ($versions as $key => $version) {
  47395. $normalized[] = array($versionParser->normalize($version), $key);
  47396. }
  47397. usort($normalized, function (array $left, array $right) use ($direction) {
  47398. if ($left[0] === $right[0]) {
  47399. return 0;
  47400. }
  47401. if (Comparator::lessThan($left[0], $right[0])) {
  47402. return -$direction;
  47403. }
  47404. return $direction;
  47405. });
  47406. $sorted = array();
  47407. foreach ($normalized as $item) {
  47408. $sorted[] = $versions[$item[1]];
  47409. }
  47410. return $sorted;
  47411. }
  47412. }
  47413. <?php
  47414. namespace Composer\Semver;
  47415. use Composer\Semver\Constraint\ConstraintInterface;
  47416. use Composer\Semver\Constraint\EmptyConstraint;
  47417. use Composer\Semver\Constraint\MultiConstraint;
  47418. use Composer\Semver\Constraint\Constraint;
  47419. class VersionParser
  47420. {
  47421. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  47422. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  47423. public static function parseStability($version)
  47424. {
  47425. $version = preg_replace('{#.+$}i', '', $version);
  47426. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  47427. return 'dev';
  47428. }
  47429. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  47430. if (!empty($match[3])) {
  47431. return 'dev';
  47432. }
  47433. if (!empty($match[1])) {
  47434. if ('beta' === $match[1] || 'b' === $match[1]) {
  47435. return 'beta';
  47436. }
  47437. if ('alpha' === $match[1] || 'a' === $match[1]) {
  47438. return 'alpha';
  47439. }
  47440. if ('rc' === $match[1]) {
  47441. return 'RC';
  47442. }
  47443. }
  47444. return 'stable';
  47445. }
  47446. public static function normalizeStability($stability)
  47447. {
  47448. $stability = strtolower($stability);
  47449. return $stability === 'rc' ? 'RC' : $stability;
  47450. }
  47451. public function normalize($version, $fullVersion = null)
  47452. {
  47453. $version = trim($version);
  47454. if (null === $fullVersion) {
  47455. $fullVersion = $version;
  47456. }
  47457. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  47458. $version = $match[1];
  47459. }
  47460. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  47461. return '9999999-dev';
  47462. }
  47463. if ('dev-' === strtolower(substr($version, 0, 4))) {
  47464. return 'dev-' . substr($version, 4);
  47465. }
  47466. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  47467. $version = $match[1];
  47468. }
  47469. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  47470. $version = $matches[1]
  47471. . (!empty($matches[2]) ? $matches[2] : '.0')
  47472. . (!empty($matches[3]) ? $matches[3] : '.0')
  47473. . (!empty($matches[4]) ? $matches[4] : '.0');
  47474. $index = 5;
  47475. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  47476. $version = preg_replace('{\D}', '.', $matches[1]);
  47477. $index = 2;
  47478. }
  47479. if (isset($index)) {
  47480. if (!empty($matches[$index])) {
  47481. if ('stable' === $matches[$index]) {
  47482. return $version;
  47483. }
  47484. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  47485. }
  47486. if (!empty($matches[$index + 2])) {
  47487. $version .= '-dev';
  47488. }
  47489. return $version;
  47490. }
  47491. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  47492. try {
  47493. return $this->normalizeBranch($match[1]);
  47494. } catch (\Exception $e) {
  47495. }
  47496. }
  47497. $extraMessage = '';
  47498. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  47499. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  47500. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  47501. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  47502. }
  47503. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  47504. }
  47505. public function parseNumericAliasPrefix($branch)
  47506. {
  47507. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  47508. return $matches['version'] . '.';
  47509. }
  47510. return false;
  47511. }
  47512. public function normalizeBranch($name)
  47513. {
  47514. $name = trim($name);
  47515. if (in_array($name, array('master', 'trunk', 'default'))) {
  47516. return $this->normalize($name);
  47517. }
  47518. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  47519. $version = '';
  47520. for ($i = 1; $i < 5; ++$i) {
  47521. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  47522. }
  47523. return str_replace('x', '9999999', $version) . '-dev';
  47524. }
  47525. return 'dev-' . $name;
  47526. }
  47527. public function parseConstraints($constraints)
  47528. {
  47529. $prettyConstraint = $constraints;
  47530. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  47531. $constraints = empty($match[1]) ? '*' : $match[1];
  47532. }
  47533. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  47534. $constraints = $match[1];
  47535. }
  47536. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  47537. $orGroups = array();
  47538. foreach ($orConstraints as $constraints) {
  47539. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  47540. if (count($andConstraints) > 1) {
  47541. $constraintObjects = array();
  47542. foreach ($andConstraints as $constraint) {
  47543. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  47544. $constraintObjects[] = $parsedConstraint;
  47545. }
  47546. }
  47547. } else {
  47548. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  47549. }
  47550. if (1 === count($constraintObjects)) {
  47551. $constraint = $constraintObjects[0];
  47552. } else {
  47553. $constraint = new MultiConstraint($constraintObjects);
  47554. }
  47555. $orGroups[] = $constraint;
  47556. }
  47557. if (1 === count($orGroups)) {
  47558. $constraint = $orGroups[0];
  47559. } elseif (2 === count($orGroups)
  47560. && $orGroups[0] instanceof MultiConstraint
  47561. && $orGroups[1] instanceof MultiConstraint
  47562. && 2 === count($orGroups[0]->getConstraints())
  47563. && 2 === count($orGroups[1]->getConstraints())
  47564. && ($a = (string) $orGroups[0])
  47565. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  47566. && ($b = (string) $orGroups[1])
  47567. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  47568. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  47569. ) {
  47570. $constraint = new MultiConstraint(array(
  47571. new Constraint('>=', substr($a, 4, $posA - 5)),
  47572. new Constraint('<', substr($b, $posB + 2, -1)),
  47573. ));
  47574. } else {
  47575. $constraint = new MultiConstraint($orGroups, false);
  47576. }
  47577. $constraint->setPrettyString($prettyConstraint);
  47578. return $constraint;
  47579. }
  47580. private function parseConstraint($constraint)
  47581. {
  47582. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  47583. $constraint = $match[1];
  47584. if ($match[2] !== 'stable') {
  47585. $stabilityModifier = $match[2];
  47586. }
  47587. }
  47588. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  47589. return array(new EmptyConstraint());
  47590. }
  47591. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  47592. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  47593. if (substr($constraint, 0, 2) === '~>') {
  47594. throw new \UnexpectedValueException(
  47595. 'Could not parse version constraint ' . $constraint . ': ' .
  47596. 'Invalid operator "~>", you probably meant to use the "~" operator'
  47597. );
  47598. }
  47599. if (isset($matches[4]) && '' !== $matches[4]) {
  47600. $position = 4;
  47601. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  47602. $position = 3;
  47603. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  47604. $position = 2;
  47605. } else {
  47606. $position = 1;
  47607. }
  47608. $stabilitySuffix = '';
  47609. if (!empty($matches[5])) {
  47610. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  47611. }
  47612. if (!empty($matches[7])) {
  47613. $stabilitySuffix .= '-dev';
  47614. }
  47615. if (!$stabilitySuffix) {
  47616. $stabilitySuffix = '-dev';
  47617. }
  47618. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  47619. $lowerBound = new Constraint('>=', $lowVersion);
  47620. $highPosition = max(1, $position - 1);
  47621. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  47622. $upperBound = new Constraint('<', $highVersion);
  47623. return array(
  47624. $lowerBound,
  47625. $upperBound,
  47626. );
  47627. }
  47628. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  47629. if ('0' !== $matches[1] || '' === $matches[2]) {
  47630. $position = 1;
  47631. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  47632. $position = 2;
  47633. } else {
  47634. $position = 3;
  47635. }
  47636. $stabilitySuffix = '';
  47637. if (empty($matches[5]) && empty($matches[7])) {
  47638. $stabilitySuffix .= '-dev';
  47639. }
  47640. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  47641. $lowerBound = new Constraint('>=', $lowVersion);
  47642. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  47643. $upperBound = new Constraint('<', $highVersion);
  47644. return array(
  47645. $lowerBound,
  47646. $upperBound,
  47647. );
  47648. }
  47649. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  47650. if (isset($matches[3]) && '' !== $matches[3]) {
  47651. $position = 3;
  47652. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  47653. $position = 2;
  47654. } else {
  47655. $position = 1;
  47656. }
  47657. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  47658. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  47659. if ($lowVersion === '0.0.0.0-dev') {
  47660. return array(new Constraint('<', $highVersion));
  47661. }
  47662. return array(
  47663. new Constraint('>=', $lowVersion),
  47664. new Constraint('<', $highVersion),
  47665. );
  47666. }
  47667. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  47668. $lowStabilitySuffix = '';
  47669. if (empty($matches[6]) && empty($matches[8])) {
  47670. $lowStabilitySuffix = '-dev';
  47671. }
  47672. $lowVersion = $this->normalize($matches['from']);
  47673. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  47674. $empty = function ($x) {
  47675. return ($x === 0 || $x === '0') ? false : empty($x);
  47676. };
  47677. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  47678. $highVersion = $this->normalize($matches['to']);
  47679. $upperBound = new Constraint('<=', $highVersion);
  47680. } else {
  47681. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  47682. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  47683. $upperBound = new Constraint('<', $highVersion);
  47684. }
  47685. return array(
  47686. $lowerBound,
  47687. $upperBound,
  47688. );
  47689. }
  47690. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  47691. try {
  47692. $version = $this->normalize($matches[2]);
  47693. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  47694. $version .= '-' . $stabilityModifier;
  47695. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  47696. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  47697. if (substr($matches[2], 0, 4) !== 'dev-') {
  47698. $version .= '-dev';
  47699. }
  47700. }
  47701. }
  47702. return array(new Constraint($matches[1] ?: '=', $version));
  47703. } catch (\Exception $e) {
  47704. }
  47705. }
  47706. $message = 'Could not parse version constraint ' . $constraint;
  47707. if (isset($e)) {
  47708. $message .= ': ' . $e->getMessage();
  47709. }
  47710. throw new \UnexpectedValueException($message);
  47711. }
  47712. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  47713. {
  47714. for ($i = 4; $i > 0; --$i) {
  47715. if ($i > $position) {
  47716. $matches[$i] = $pad;
  47717. } elseif ($i === $position && $increment) {
  47718. $matches[$i] += $increment;
  47719. if ($matches[$i] < 0) {
  47720. $matches[$i] = $pad;
  47721. --$position;
  47722. if ($i === 1) {
  47723. return;
  47724. }
  47725. }
  47726. }
  47727. }
  47728. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  47729. }
  47730. private function expandStability($stability)
  47731. {
  47732. $stability = strtolower($stability);
  47733. switch ($stability) {
  47734. case 'a':
  47735. return 'alpha';
  47736. case 'b':
  47737. return 'beta';
  47738. case 'p':
  47739. case 'pl':
  47740. return 'patch';
  47741. case 'rc':
  47742. return 'RC';
  47743. default:
  47744. return $stability;
  47745. }
  47746. }
  47747. }
  47748. Copyright (C) 2016 Composer
  47749. Permission is hereby granted, free of charge, to any person obtaining a copy of
  47750. this software and associated documentation files (the "Software"), to deal in
  47751. the Software without restriction, including without limitation the rights to
  47752. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  47753. of the Software, and to permit persons to whom the Software is furnished to do
  47754. so, subject to the following conditions:
  47755. The above copyright notice and this permission notice shall be included in all
  47756. copies or substantial portions of the Software.
  47757. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47758. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47759. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47760. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47761. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47762. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47763. SOFTWARE.
  47764. <?php
  47765. namespace Composer\CaBundle;
  47766. use Psr\Log\LoggerInterface;
  47767. use Symfony\Component\Process\PhpProcess;
  47768. class CaBundle
  47769. {
  47770. private static $caPath;
  47771. private static $caFileValidity = array();
  47772. private static $useOpensslParse;
  47773. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  47774. {
  47775. if (self::$caPath !== null) {
  47776. return self::$caPath;
  47777. }
  47778. $envCertFile = getenv('SSL_CERT_FILE');
  47779. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  47780. return self::$caPath = $envCertFile;
  47781. }
  47782. $envCertDir = getenv('SSL_CERT_DIR');
  47783. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  47784. return self::$caPath = $envCertDir;
  47785. }
  47786. $configured = ini_get('openssl.cafile');
  47787. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  47788. return self::$caPath = $configured;
  47789. }
  47790. $configured = ini_get('openssl.capath');
  47791. if ($configured && is_dir($configured) && is_readable($configured)) {
  47792. return self::$caPath = $configured;
  47793. }
  47794. $caBundlePaths = array(
  47795. '/etc/pki/tls/certs/ca-bundle.crt',
  47796. '/etc/ssl/certs/ca-certificates.crt',
  47797. '/etc/ssl/ca-bundle.pem',
  47798. '/usr/local/share/certs/ca-root-nss.crt',
  47799. '/usr/ssl/certs/ca-bundle.crt',
  47800. '/opt/local/share/curl/curl-ca-bundle.crt',
  47801. '/usr/local/share/curl/curl-ca-bundle.crt',
  47802. '/usr/share/ssl/certs/ca-bundle.crt',
  47803. '/etc/ssl/cert.pem',
  47804. '/usr/local/etc/ssl/cert.pem',
  47805. '/usr/local/etc/openssl/cert.pem',
  47806. );
  47807. foreach ($caBundlePaths as $caBundle) {
  47808. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  47809. return self::$caPath = $caBundle;
  47810. }
  47811. }
  47812. foreach ($caBundlePaths as $caBundle) {
  47813. $caBundle = dirname($caBundle);
  47814. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  47815. return self::$caPath = $caBundle;
  47816. }
  47817. }
  47818. return self::$caPath = static::getBundledCaBundlePath();
  47819. }
  47820. public static function getBundledCaBundlePath()
  47821. {
  47822. return __DIR__.'/../res/cacert.pem';
  47823. }
  47824. public static function validateCaFile($filename, LoggerInterface $logger = null)
  47825. {
  47826. static $warned = false;
  47827. if (isset(self::$caFileValidity[$filename])) {
  47828. return self::$caFileValidity[$filename];
  47829. }
  47830. $contents = file_get_contents($filename);
  47831. if (!static::isOpensslParseSafe()) {
  47832. if (!$warned && $logger) {
  47833. $logger->warning(sprintf(
  47834. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  47835. PHP_VERSION
  47836. ));
  47837. $warned = true;
  47838. }
  47839. $isValid = !empty($contents);
  47840. } else {
  47841. $isValid = (bool) openssl_x509_parse($contents);
  47842. }
  47843. if ($logger) {
  47844. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  47845. }
  47846. return self::$caFileValidity[$filename] = $isValid;
  47847. }
  47848. public static function isOpensslParseSafe()
  47849. {
  47850. if (null !== self::$useOpensslParse) {
  47851. return self::$useOpensslParse;
  47852. }
  47853. if (PHP_VERSION_ID >= 50600) {
  47854. return self::$useOpensslParse = true;
  47855. }
  47856. if (
  47857. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  47858. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  47859. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  47860. ) {
  47861. return self::$useOpensslParse = true;
  47862. }
  47863. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  47864. return self::$useOpensslParse = false;
  47865. }
  47866. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  47867. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  47868. if (preg_match($regex, PHP_VERSION, $m)) {
  47869. return ((int) $m[1]) >= $fixedVersion;
  47870. }
  47871. return false;
  47872. };
  47873. if (
  47874. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  47875. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  47876. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  47877. ) {
  47878. return self::$useOpensslParse = true;
  47879. }
  47880. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  47881. return self::$useOpensslParse = false;
  47882. }
  47883. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  47884. $script = <<<'EOT'
  47885. error_reporting(-1);
  47886. $info = openssl_x509_parse(base64_decode('%s'));
  47887. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  47888. EOT;
  47889. $script = '<'."?php\n".sprintf($script, $cert);
  47890. try {
  47891. $process = new PhpProcess($script);
  47892. $process->mustRun();
  47893. } catch (\Exception $e) {
  47894. return self::$useOpensslParse = false;
  47895. }
  47896. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  47897. $errorOutput = trim($process->getErrorOutput());
  47898. if (
  47899. count($output) === 3
  47900. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  47901. && $output[1] === 'string(27) "[email protected]"'
  47902. && $output[2] === 'int(-1)'
  47903. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  47904. ) {
  47905. return self::$useOpensslParse = true;
  47906. }
  47907. return self::$useOpensslParse = false;
  47908. }
  47909. public static function reset()
  47910. {
  47911. self::$caFileValidity = array();
  47912. self::$caPath = null;
  47913. self::$useOpensslParse = null;
  47914. }
  47915. }
  47916. Copyright (c) 2012 PHP Framework Interoperability Group
  47917. Permission is hereby granted, free of charge, to any person obtaining a copy
  47918. of this software and associated documentation files (the "Software"), to deal
  47919. in the Software without restriction, including without limitation the rights
  47920. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47921. copies of the Software, and to permit persons to whom the Software is
  47922. furnished to do so, subject to the following conditions:
  47923. The above copyright notice and this permission notice shall be included in
  47924. all copies or substantial portions of the Software.
  47925. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47926. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47927. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47928. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47929. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47930. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  47931. THE SOFTWARE.
  47932. <?php
  47933. namespace Psr\Log;
  47934. abstract class AbstractLogger implements LoggerInterface
  47935. {
  47936. public function emergency($message, array $context = array())
  47937. {
  47938. $this->log(LogLevel::EMERGENCY, $message, $context);
  47939. }
  47940. public function alert($message, array $context = array())
  47941. {
  47942. $this->log(LogLevel::ALERT, $message, $context);
  47943. }
  47944. public function critical($message, array $context = array())
  47945. {
  47946. $this->log(LogLevel::CRITICAL, $message, $context);
  47947. }
  47948. public function error($message, array $context = array())
  47949. {
  47950. $this->log(LogLevel::ERROR, $message, $context);
  47951. }
  47952. public function warning($message, array $context = array())
  47953. {
  47954. $this->log(LogLevel::WARNING, $message, $context);
  47955. }
  47956. public function notice($message, array $context = array())
  47957. {
  47958. $this->log(LogLevel::NOTICE, $message, $context);
  47959. }
  47960. public function info($message, array $context = array())
  47961. {
  47962. $this->log(LogLevel::INFO, $message, $context);
  47963. }
  47964. public function debug($message, array $context = array())
  47965. {
  47966. $this->log(LogLevel::DEBUG, $message, $context);
  47967. }
  47968. }
  47969. <?php
  47970. namespace Psr\Log;
  47971. class InvalidArgumentException extends \InvalidArgumentException
  47972. {
  47973. }
  47974. <?php
  47975. namespace Psr\Log;
  47976. class LogLevel
  47977. {
  47978. const EMERGENCY = 'emergency';
  47979. const ALERT = 'alert';
  47980. const CRITICAL = 'critical';
  47981. const ERROR = 'error';
  47982. const WARNING = 'warning';
  47983. const NOTICE = 'notice';
  47984. const INFO = 'info';
  47985. const DEBUG = 'debug';
  47986. }
  47987. <?php
  47988. namespace Psr\Log;
  47989. interface LoggerAwareInterface
  47990. {
  47991. public function setLogger(LoggerInterface $logger);
  47992. }
  47993. <?php
  47994. namespace Psr\Log;
  47995. trait LoggerAwareTrait
  47996. {
  47997. protected $logger;
  47998. public function setLogger(LoggerInterface $logger)
  47999. {
  48000. $this->logger = $logger;
  48001. }
  48002. }
  48003. <?php
  48004. namespace Psr\Log;
  48005. interface LoggerInterface
  48006. {
  48007. public function emergency($message, array $context = array());
  48008. public function alert($message, array $context = array());
  48009. public function critical($message, array $context = array());
  48010. public function error($message, array $context = array());
  48011. public function warning($message, array $context = array());
  48012. public function notice($message, array $context = array());
  48013. public function info($message, array $context = array());
  48014. public function debug($message, array $context = array());
  48015. public function log($level, $message, array $context = array());
  48016. }
  48017. <?php
  48018. namespace Psr\Log;
  48019. trait LoggerTrait
  48020. {
  48021. public function emergency($message, array $context = array())
  48022. {
  48023. $this->log(LogLevel::EMERGENCY, $message, $context);
  48024. }
  48025. public function alert($message, array $context = array())
  48026. {
  48027. $this->log(LogLevel::ALERT, $message, $context);
  48028. }
  48029. public function critical($message, array $context = array())
  48030. {
  48031. $this->log(LogLevel::CRITICAL, $message, $context);
  48032. }
  48033. public function error($message, array $context = array())
  48034. {
  48035. $this->log(LogLevel::ERROR, $message, $context);
  48036. }
  48037. public function warning($message, array $context = array())
  48038. {
  48039. $this->log(LogLevel::WARNING, $message, $context);
  48040. }
  48041. public function notice($message, array $context = array())
  48042. {
  48043. $this->log(LogLevel::NOTICE, $message, $context);
  48044. }
  48045. public function info($message, array $context = array())
  48046. {
  48047. $this->log(LogLevel::INFO, $message, $context);
  48048. }
  48049. public function debug($message, array $context = array())
  48050. {
  48051. $this->log(LogLevel::DEBUG, $message, $context);
  48052. }
  48053. abstract public function log($level, $message, array $context = array());
  48054. }
  48055. <?php
  48056. namespace Psr\Log;
  48057. class NullLogger extends AbstractLogger
  48058. {
  48059. public function log($level, $message, array $context = array())
  48060. {
  48061. }
  48062. }
  48063. <?php
  48064. namespace Psr\Log\Test;
  48065. use Psr\Log\LoggerInterface;
  48066. use Psr\Log\LogLevel;
  48067. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  48068. {
  48069. abstract public function getLogger();
  48070. abstract public function getLogs();
  48071. public function testImplements()
  48072. {
  48073. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  48074. }
  48075. public function testLogsAtAllLevels($level, $message)
  48076. {
  48077. $logger = $this->getLogger();
  48078. $logger->{$level}($message, array('user' => 'Bob'));
  48079. $logger->log($level, $message, array('user' => 'Bob'));
  48080. $expected = array(
  48081. $level.' message of level '.$level.' with context: Bob',
  48082. $level.' message of level '.$level.' with context: Bob',
  48083. );
  48084. $this->assertEquals($expected, $this->getLogs());
  48085. }
  48086. public function provideLevelsAndMessages()
  48087. {
  48088. return array(
  48089. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  48090. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  48091. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  48092. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  48093. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  48094. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  48095. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  48096. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  48097. );
  48098. }
  48099. public function testThrowsOnInvalidLevel()
  48100. {
  48101. $logger = $this->getLogger();
  48102. $logger->log('invalid level', 'Foo');
  48103. }
  48104. public function testContextReplacement()
  48105. {
  48106. $logger = $this->getLogger();
  48107. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  48108. $expected = array('info {Message {nothing} Bob Bar a}');
  48109. $this->assertEquals($expected, $this->getLogs());
  48110. }
  48111. public function testObjectCastToString()
  48112. {
  48113. if (method_exists($this, 'createPartialMock')) {
  48114. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  48115. } else {
  48116. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  48117. }
  48118. $dummy->expects($this->once())
  48119. ->method('__toString')
  48120. ->will($this->returnValue('DUMMY'));
  48121. $this->getLogger()->warning($dummy);
  48122. $expected = array('warning DUMMY');
  48123. $this->assertEquals($expected, $this->getLogs());
  48124. }
  48125. public function testContextCanContainAnything()
  48126. {
  48127. $context = array(
  48128. 'bool' => true,
  48129. 'null' => null,
  48130. 'string' => 'Foo',
  48131. 'int' => 0,
  48132. 'float' => 0.5,
  48133. 'nested' => array('with object' => new DummyTest),
  48134. 'object' => new \DateTime,
  48135. 'resource' => fopen('php://memory', 'r'),
  48136. );
  48137. $this->getLogger()->warning('Crazy context data', $context);
  48138. $expected = array('warning Crazy context data');
  48139. $this->assertEquals($expected, $this->getLogs());
  48140. }
  48141. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  48142. {
  48143. $logger = $this->getLogger();
  48144. $logger->warning('Random message', array('exception' => 'oops'));
  48145. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  48146. $expected = array(
  48147. 'warning Random message',
  48148. 'critical Uncaught Exception!'
  48149. );
  48150. $this->assertEquals($expected, $this->getLogs());
  48151. }
  48152. }
  48153. class DummyTest
  48154. {
  48155. public function __toString()
  48156. {
  48157. }
  48158. }
  48159. <?php
  48160. require_once __DIR__ . '/composer/autoload_real.php';
  48161. return ComposerAutoloaderInitComposerPhar1495001873::getLoader();
  48162. <?php
  48163. $vendorDir = dirname(dirname(__FILE__));
  48164. $baseDir = dirname($vendorDir);
  48165. return array(
  48166. );
  48167. <?php
  48168. $vendorDir = dirname(dirname(__FILE__));
  48169. $baseDir = dirname($vendorDir);
  48170. return array(
  48171. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  48172. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  48173. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  48174. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  48175. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  48176. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  48177. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  48178. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  48179. 'Seld\\CliPrompt\\' => array($vendorDir . '/seld/cli-prompt/src'),
  48180. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  48181. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  48182. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  48183. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  48184. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  48185. 'Composer\\' => array($baseDir . '/src/Composer'),
  48186. );
  48187. <?php
  48188. $vendorDir = dirname(dirname(__FILE__));
  48189. $baseDir = dirname($vendorDir);
  48190. return array(
  48191. );
  48192. <?php
  48193. $vendorDir = dirname(dirname(__FILE__));
  48194. $baseDir = dirname($vendorDir);
  48195. return array(
  48196. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  48197. );
  48198. <?php
  48199. class ComposerAutoloaderInitComposerPhar1495001873
  48200. {
  48201. private static $loader;
  48202. public static function loadClassLoader($class)
  48203. {
  48204. if ('Composer\Autoload\ClassLoader' === $class) {
  48205. require __DIR__ . '/ClassLoader.php';
  48206. }
  48207. }
  48208. public static function getLoader()
  48209. {
  48210. if (null !== self::$loader) {
  48211. return self::$loader;
  48212. }
  48213. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1495001873', 'loadClassLoader'), true, true);
  48214. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  48215. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1495001873', 'loadClassLoader'));
  48216. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  48217. if ($useStaticLoader) {
  48218. require_once __DIR__ . '/autoload_static.php';
  48219. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1495001873::getInitializer($loader));
  48220. } else {
  48221. $map = require __DIR__ . '/autoload_namespaces.php';
  48222. foreach ($map as $namespace => $path) {
  48223. $loader->set($namespace, $path);
  48224. }
  48225. $map = require __DIR__ . '/autoload_psr4.php';
  48226. foreach ($map as $namespace => $path) {
  48227. $loader->setPsr4($namespace, $path);
  48228. }
  48229. $classMap = require __DIR__ . '/autoload_classmap.php';
  48230. if ($classMap) {
  48231. $loader->addClassMap($classMap);
  48232. }
  48233. }
  48234. $loader->register(true);
  48235. if ($useStaticLoader) {
  48236. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1495001873::$files;
  48237. } else {
  48238. $includeFiles = require __DIR__ . '/autoload_files.php';
  48239. }
  48240. foreach ($includeFiles as $fileIdentifier => $file) {
  48241. composerRequireComposerPhar1495001873($fileIdentifier, $file);
  48242. }
  48243. return $loader;
  48244. }
  48245. }
  48246. function composerRequireComposerPhar1495001873($fileIdentifier, $file)
  48247. {
  48248. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  48249. require $file;
  48250. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  48251. }
  48252. }
  48253. <?php
  48254. namespace Composer\Autoload;
  48255. class ComposerStaticInitComposerPhar1495001873
  48256. {
  48257. public static $files = array (
  48258. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  48259. );
  48260. public static $prefixLengthsPsr4 = array (
  48261. 'S' =>
  48262. array (
  48263. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  48264. 'Symfony\\Component\\Process\\' => 26,
  48265. 'Symfony\\Component\\Finder\\' => 25,
  48266. 'Symfony\\Component\\Filesystem\\' => 29,
  48267. 'Symfony\\Component\\Debug\\' => 24,
  48268. 'Symfony\\Component\\Console\\' => 26,
  48269. 'Seld\\PharUtils\\' => 15,
  48270. 'Seld\\JsonLint\\' => 14,
  48271. 'Seld\\CliPrompt\\' => 15,
  48272. ),
  48273. 'P' =>
  48274. array (
  48275. 'Psr\\Log\\' => 8,
  48276. ),
  48277. 'J' =>
  48278. array (
  48279. 'JsonSchema\\' => 11,
  48280. ),
  48281. 'C' =>
  48282. array (
  48283. 'Composer\\Spdx\\' => 14,
  48284. 'Composer\\Semver\\' => 16,
  48285. 'Composer\\CaBundle\\' => 18,
  48286. 'Composer\\' => 9,
  48287. ),
  48288. );
  48289. public static $prefixDirsPsr4 = array (
  48290. 'Symfony\\Polyfill\\Mbstring\\' =>
  48291. array (
  48292. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  48293. ),
  48294. 'Symfony\\Component\\Process\\' =>
  48295. array (
  48296. 0 => __DIR__ . '/..' . '/symfony/process',
  48297. ),
  48298. 'Symfony\\Component\\Finder\\' =>
  48299. array (
  48300. 0 => __DIR__ . '/..' . '/symfony/finder',
  48301. ),
  48302. 'Symfony\\Component\\Filesystem\\' =>
  48303. array (
  48304. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  48305. ),
  48306. 'Symfony\\Component\\Debug\\' =>
  48307. array (
  48308. 0 => __DIR__ . '/..' . '/symfony/debug',
  48309. ),
  48310. 'Symfony\\Component\\Console\\' =>
  48311. array (
  48312. 0 => __DIR__ . '/..' . '/symfony/console',
  48313. ),
  48314. 'Seld\\PharUtils\\' =>
  48315. array (
  48316. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  48317. ),
  48318. 'Seld\\JsonLint\\' =>
  48319. array (
  48320. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  48321. ),
  48322. 'Seld\\CliPrompt\\' =>
  48323. array (
  48324. 0 => __DIR__ . '/..' . '/seld/cli-prompt/src',
  48325. ),
  48326. 'Psr\\Log\\' =>
  48327. array (
  48328. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  48329. ),
  48330. 'JsonSchema\\' =>
  48331. array (
  48332. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  48333. ),
  48334. 'Composer\\Spdx\\' =>
  48335. array (
  48336. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  48337. ),
  48338. 'Composer\\Semver\\' =>
  48339. array (
  48340. 0 => __DIR__ . '/..' . '/composer/semver/src',
  48341. ),
  48342. 'Composer\\CaBundle\\' =>
  48343. array (
  48344. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  48345. ),
  48346. 'Composer\\' =>
  48347. array (
  48348. 0 => __DIR__ . '/../..' . '/src/Composer',
  48349. ),
  48350. );
  48351. public static function getInitializer(ClassLoader $loader)
  48352. {
  48353. return \Closure::bind(function () use ($loader) {
  48354. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1495001873::$prefixLengthsPsr4;
  48355. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1495001873::$prefixDirsPsr4;
  48356. }, null, ClassLoader::class);
  48357. }
  48358. }
  48359. <?php
  48360. namespace Composer\Autoload;
  48361. class ClassLoader
  48362. {
  48363. private $prefixLengthsPsr4 = array();
  48364. private $prefixDirsPsr4 = array();
  48365. private $fallbackDirsPsr4 = array();
  48366. private $prefixesPsr0 = array();
  48367. private $fallbackDirsPsr0 = array();
  48368. private $useIncludePath = false;
  48369. private $classMap = array();
  48370. private $classMapAuthoritative = false;
  48371. private $missingClasses = array();
  48372. private $apcuPrefix;
  48373. public function getPrefixes()
  48374. {
  48375. if (!empty($this->prefixesPsr0)) {
  48376. return call_user_func_array('array_merge', $this->prefixesPsr0);
  48377. }
  48378. return array();
  48379. }
  48380. public function getPrefixesPsr4()
  48381. {
  48382. return $this->prefixDirsPsr4;
  48383. }
  48384. public function getFallbackDirs()
  48385. {
  48386. return $this->fallbackDirsPsr0;
  48387. }
  48388. public function getFallbackDirsPsr4()
  48389. {
  48390. return $this->fallbackDirsPsr4;
  48391. }
  48392. public function getClassMap()
  48393. {
  48394. return $this->classMap;
  48395. }
  48396. public function addClassMap(array $classMap)
  48397. {
  48398. if ($this->classMap) {
  48399. $this->classMap = array_merge($this->classMap, $classMap);
  48400. } else {
  48401. $this->classMap = $classMap;
  48402. }
  48403. }
  48404. public function add($prefix, $paths, $prepend = false)
  48405. {
  48406. if (!$prefix) {
  48407. if ($prepend) {
  48408. $this->fallbackDirsPsr0 = array_merge(
  48409. (array) $paths,
  48410. $this->fallbackDirsPsr0
  48411. );
  48412. } else {
  48413. $this->fallbackDirsPsr0 = array_merge(
  48414. $this->fallbackDirsPsr0,
  48415. (array) $paths
  48416. );
  48417. }
  48418. return;
  48419. }
  48420. $first = $prefix[0];
  48421. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  48422. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  48423. return;
  48424. }
  48425. if ($prepend) {
  48426. $this->prefixesPsr0[$first][$prefix] = array_merge(
  48427. (array) $paths,
  48428. $this->prefixesPsr0[$first][$prefix]
  48429. );
  48430. } else {
  48431. $this->prefixesPsr0[$first][$prefix] = array_merge(
  48432. $this->prefixesPsr0[$first][$prefix],
  48433. (array) $paths
  48434. );
  48435. }
  48436. }
  48437. public function addPsr4($prefix, $paths, $prepend = false)
  48438. {
  48439. if (!$prefix) {
  48440. if ($prepend) {
  48441. $this->fallbackDirsPsr4 = array_merge(
  48442. (array) $paths,
  48443. $this->fallbackDirsPsr4
  48444. );
  48445. } else {
  48446. $this->fallbackDirsPsr4 = array_merge(
  48447. $this->fallbackDirsPsr4,
  48448. (array) $paths
  48449. );
  48450. }
  48451. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  48452. $length = strlen($prefix);
  48453. if ('\\' !== $prefix[$length - 1]) {
  48454. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  48455. }
  48456. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  48457. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  48458. } elseif ($prepend) {
  48459. $this->prefixDirsPsr4[$prefix] = array_merge(
  48460. (array) $paths,
  48461. $this->prefixDirsPsr4[$prefix]
  48462. );
  48463. } else {
  48464. $this->prefixDirsPsr4[$prefix] = array_merge(
  48465. $this->prefixDirsPsr4[$prefix],
  48466. (array) $paths
  48467. );
  48468. }
  48469. }
  48470. public function set($prefix, $paths)
  48471. {
  48472. if (!$prefix) {
  48473. $this->fallbackDirsPsr0 = (array) $paths;
  48474. } else {
  48475. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  48476. }
  48477. }
  48478. public function setPsr4($prefix, $paths)
  48479. {
  48480. if (!$prefix) {
  48481. $this->fallbackDirsPsr4 = (array) $paths;
  48482. } else {
  48483. $length = strlen($prefix);
  48484. if ('\\' !== $prefix[$length - 1]) {
  48485. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  48486. }
  48487. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  48488. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  48489. }
  48490. }
  48491. public function setUseIncludePath($useIncludePath)
  48492. {
  48493. $this->useIncludePath = $useIncludePath;
  48494. }
  48495. public function getUseIncludePath()
  48496. {
  48497. return $this->useIncludePath;
  48498. }
  48499. public function setClassMapAuthoritative($classMapAuthoritative)
  48500. {
  48501. $this->classMapAuthoritative = $classMapAuthoritative;
  48502. }
  48503. public function isClassMapAuthoritative()
  48504. {
  48505. return $this->classMapAuthoritative;
  48506. }
  48507. public function setApcuPrefix($apcuPrefix)
  48508. {
  48509. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  48510. }
  48511. public function getApcuPrefix()
  48512. {
  48513. return $this->apcuPrefix;
  48514. }
  48515. public function register($prepend = false)
  48516. {
  48517. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  48518. }
  48519. public function unregister()
  48520. {
  48521. spl_autoload_unregister(array($this, 'loadClass'));
  48522. }
  48523. public function loadClass($class)
  48524. {
  48525. if ($file = $this->findFile($class)) {
  48526. includeFile($file);
  48527. return true;
  48528. }
  48529. }
  48530. public function findFile($class)
  48531. {
  48532. if (isset($this->classMap[$class])) {
  48533. return $this->classMap[$class];
  48534. }
  48535. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  48536. return false;
  48537. }
  48538. if (null !== $this->apcuPrefix) {
  48539. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  48540. if ($hit) {
  48541. return $file;
  48542. }
  48543. }
  48544. $file = $this->findFileWithExtension($class, '.php');
  48545. if (false === $file && defined('HHVM_VERSION')) {
  48546. $file = $this->findFileWithExtension($class, '.hh');
  48547. }
  48548. if (null !== $this->apcuPrefix) {
  48549. apcu_add($this->apcuPrefix.$class, $file);
  48550. }
  48551. if (false === $file) {
  48552. $this->missingClasses[$class] = true;
  48553. }
  48554. return $file;
  48555. }
  48556. private function findFileWithExtension($class, $ext)
  48557. {
  48558. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  48559. $first = $class[0];
  48560. if (isset($this->prefixLengthsPsr4[$first])) {
  48561. $subPath = $class;
  48562. while (false !== $lastPos = strrpos($subPath, '\\')) {
  48563. $subPath = substr($subPath, 0, $lastPos);
  48564. $search = $subPath.'\\';
  48565. if (isset($this->prefixDirsPsr4[$search])) {
  48566. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  48567. $length = $this->prefixLengthsPsr4[$first][$search];
  48568. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
  48569. return $file;
  48570. }
  48571. }
  48572. }
  48573. }
  48574. }
  48575. foreach ($this->fallbackDirsPsr4 as $dir) {
  48576. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  48577. return $file;
  48578. }
  48579. }
  48580. if (false !== $pos = strrpos($class, '\\')) {
  48581. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  48582. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  48583. } else {
  48584. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  48585. }
  48586. if (isset($this->prefixesPsr0[$first])) {
  48587. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  48588. if (0 === strpos($class, $prefix)) {
  48589. foreach ($dirs as $dir) {
  48590. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  48591. return $file;
  48592. }
  48593. }
  48594. }
  48595. }
  48596. }
  48597. foreach ($this->fallbackDirsPsr0 as $dir) {
  48598. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  48599. return $file;
  48600. }
  48601. }
  48602. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  48603. return $file;
  48604. }
  48605. return false;
  48606. }
  48607. }
  48608. function includeFile($file)
  48609. {
  48610. include $file;
  48611. }
  48612. ##
  48613. ## Bundle of CA Root Certificates
  48614. ##
  48615. ## Certificate data from Mozilla as of: Wed Jan 18 04:12:05 2017 GMT
  48616. ##
  48617. ## This is a bundle of X.509 certificates of public Certificate Authorities
  48618. ## (CA). These were automatically extracted from Mozilla's root certificates
  48619. ## file (certdata.txt). This file can be found in the mozilla source tree:
  48620. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  48621. ##
  48622. ## It contains the certificates in PEM format and therefore
  48623. ## can be directly used with curl / libcurl / php_curl, or with
  48624. ## an Apache+mod_ssl webserver for SSL client authentication.
  48625. ## Just configure this file as the SSLCACertificateFile.
  48626. ##
  48627. ## Conversion done with mk-ca-bundle.pl version 1.27.
  48628. ## SHA256: dffa79e6aa993f558e82884abf7bb54bf440ab66ee91d82a27a627f6f2a4ace4
  48629. ##
  48630. GlobalSign Root CA
  48631. ==================
  48632. -----BEGIN CERTIFICATE-----
  48633. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  48634. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  48635. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  48636. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  48637. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  48638. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  48639. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  48640. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  48641. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  48642. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  48643. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  48644. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  48645. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  48646. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  48647. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  48648. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  48649. -----END CERTIFICATE-----
  48650. GlobalSign Root CA - R2
  48651. =======================
  48652. -----BEGIN CERTIFICATE-----
  48653. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  48654. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  48655. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  48656. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  48657. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  48658. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  48659. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  48660. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  48661. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  48662. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  48663. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  48664. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  48665. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  48666. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  48667. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  48668. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  48669. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  48670. -----END CERTIFICATE-----
  48671. Verisign Class 3 Public Primary Certification Authority - G3
  48672. ============================================================
  48673. -----BEGIN CERTIFICATE-----
  48674. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  48675. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  48676. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  48677. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  48678. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  48679. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  48680. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  48681. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  48682. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  48683. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  48684. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  48685. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  48686. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  48687. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  48688. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  48689. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  48690. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  48691. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  48692. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  48693. -----END CERTIFICATE-----
  48694. Entrust.net Premium 2048 Secure Server CA
  48695. =========================================
  48696. -----BEGIN CERTIFICATE-----
  48697. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  48698. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  48699. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  48700. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  48701. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  48702. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  48703. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  48704. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  48705. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  48706. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  48707. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  48708. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  48709. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  48710. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  48711. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  48712. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  48713. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  48714. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  48715. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  48716. -----END CERTIFICATE-----
  48717. Baltimore CyberTrust Root
  48718. =========================
  48719. -----BEGIN CERTIFICATE-----
  48720. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  48721. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  48722. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  48723. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  48724. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  48725. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  48726. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  48727. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  48728. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  48729. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  48730. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  48731. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  48732. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  48733. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  48734. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  48735. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  48736. -----END CERTIFICATE-----
  48737. AddTrust Low-Value Services Root
  48738. ================================
  48739. -----BEGIN CERTIFICATE-----
  48740. MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  48741. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU
  48742. cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw
  48743. CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO
  48744. ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB
  48745. AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6
  48746. 54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr
  48747. oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1
  48748. Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui
  48749. GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w
  48750. HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD
  48751. AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT
  48752. RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw
  48753. HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt
  48754. ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph
  48755. iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY
  48756. eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr
  48757. mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj
  48758. ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk=
  48759. -----END CERTIFICATE-----
  48760. AddTrust External Root
  48761. ======================
  48762. -----BEGIN CERTIFICATE-----
  48763. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  48764. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  48765. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  48766. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  48767. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  48768. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  48769. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  48770. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  48771. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  48772. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  48773. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  48774. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  48775. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  48776. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  48777. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  48778. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  48779. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  48780. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  48781. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  48782. -----END CERTIFICATE-----
  48783. AddTrust Public Services Root
  48784. =============================
  48785. -----BEGIN CERTIFICATE-----
  48786. MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  48787. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU
  48788. cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ
  48789. BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l
  48790. dHdvcmsxIDAeBgNVBAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEF
  48791. AAOCAQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV6tsfSlbu
  48792. nyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nXGCwwfQ56HmIexkvA/X1i
  48793. d9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnPdzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSG
  48794. Aa2Il+tmzV7R/9x98oTaunet3IAIx6eH1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAw
  48795. HM+A+WD+eeSI8t0A65RF62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0G
  48796. A1UdDgQWBBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  48797. /zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDELMAkGA1UEBhMCU0Ux
  48798. FDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29yazEgMB4G
  48799. A1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4
  48800. JNojVhaTdt02KLmuG7jD8WS6IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL
  48801. +YPoRNWyQSW/iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao
  48802. GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh4SINhwBk/ox9
  48803. Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQmXiLsks3/QppEIW1cxeMiHV9H
  48804. EufOX1362KqxMy3ZdvJOOjMMK7MtkAY=
  48805. -----END CERTIFICATE-----
  48806. AddTrust Qualified Certificates Root
  48807. ====================================
  48808. -----BEGIN CERTIFICATE-----
  48809. MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  48810. QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU
  48811. cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx
  48812. CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ
  48813. IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG
  48814. 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx
  48815. 64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3
  48816. KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o
  48817. L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR
  48818. wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU
  48819. MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/
  48820. BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE
  48821. BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y
  48822. azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD
  48823. ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG
  48824. GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X
  48825. dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze
  48826. RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB
  48827. iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE=
  48828. -----END CERTIFICATE-----
  48829. Entrust Root Certification Authority
  48830. ====================================
  48831. -----BEGIN CERTIFICATE-----
  48832. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  48833. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  48834. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  48835. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  48836. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  48837. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  48838. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  48839. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  48840. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  48841. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  48842. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  48843. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  48844. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  48845. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  48846. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  48847. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  48848. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  48849. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  48850. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  48851. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  48852. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  48853. -----END CERTIFICATE-----
  48854. GeoTrust Global CA
  48855. ==================
  48856. -----BEGIN CERTIFICATE-----
  48857. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  48858. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  48859. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  48860. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  48861. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  48862. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  48863. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  48864. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  48865. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  48866. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  48867. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  48868. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  48869. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  48870. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  48871. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  48872. Mw==
  48873. -----END CERTIFICATE-----
  48874. GeoTrust Global CA 2
  48875. ====================
  48876. -----BEGIN CERTIFICATE-----
  48877. MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  48878. R2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwHhcNMDQwMzA0MDUw
  48879. MDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  48880. LjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  48881. ggEKAoIBAQDvPE1APRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/
  48882. NTL8Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hLTytCOb1k
  48883. LUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL5mkWRxHCJ1kDs6ZgwiFA
  48884. Vvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7S4wMcoKK+xfNAGw6EzywhIdLFnopsk/b
  48885. HdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQF
  48886. MAMBAf8wHQYDVR0OBBYEFHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNH
  48887. K266ZUapEBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6tdEPx7
  48888. srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv/NgdRN3ggX+d6Yvh
  48889. ZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywNA0ZF66D0f0hExghAzN4bcLUprbqL
  48890. OzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkC
  48891. x1YAzUm5s2x7UwQa4qjJqhIFI8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqF
  48892. H4z1Ir+rzoPz4iIprn2DQKi6bA==
  48893. -----END CERTIFICATE-----
  48894. GeoTrust Universal CA
  48895. =====================
  48896. -----BEGIN CERTIFICATE-----
  48897. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  48898. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  48899. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  48900. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  48901. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  48902. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  48903. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  48904. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  48905. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  48906. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  48907. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  48908. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  48909. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  48910. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  48911. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  48912. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  48913. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  48914. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  48915. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  48916. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  48917. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  48918. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  48919. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  48920. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  48921. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  48922. -----END CERTIFICATE-----
  48923. GeoTrust Universal CA 2
  48924. =======================
  48925. -----BEGIN CERTIFICATE-----
  48926. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  48927. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  48928. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  48929. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  48930. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  48931. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  48932. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  48933. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  48934. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  48935. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  48936. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  48937. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  48938. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  48939. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  48940. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  48941. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  48942. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  48943. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  48944. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  48945. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  48946. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  48947. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  48948. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  48949. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  48950. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  48951. -----END CERTIFICATE-----
  48952. Visa eCommerce Root
  48953. ===================
  48954. -----BEGIN CERTIFICATE-----
  48955. MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
  48956. EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
  48957. QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
  48958. WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
  48959. VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
  48960. bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
  48961. F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
  48962. RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
  48963. TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
  48964. /k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
  48965. GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
  48966. MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
  48967. CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
  48968. YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
  48969. zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
  48970. YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
  48971. 398znM/jra6O1I7mT1GvFpLgXPYHDw==
  48972. -----END CERTIFICATE-----
  48973. Certum Root CA
  48974. ==============
  48975. -----BEGIN CERTIFICATE-----
  48976. MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
  48977. ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
  48978. Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
  48979. by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
  48980. wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
  48981. kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
  48982. 89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
  48983. Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
  48984. NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
  48985. hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
  48986. GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
  48987. GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
  48988. 0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
  48989. qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
  48990. -----END CERTIFICATE-----
  48991. Comodo AAA Services root
  48992. ========================
  48993. -----BEGIN CERTIFICATE-----
  48994. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  48995. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  48996. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  48997. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  48998. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  48999. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  49000. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  49001. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  49002. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  49003. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  49004. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  49005. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  49006. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  49007. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  49008. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  49009. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  49010. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  49011. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  49012. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  49013. -----END CERTIFICATE-----
  49014. Comodo Secure Services root
  49015. ===========================
  49016. -----BEGIN CERTIFICATE-----
  49017. MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  49018. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  49019. TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw
  49020. MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu
  49021. Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi
  49022. BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
  49023. ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP
  49024. 9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc
  49025. rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC
  49026. oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V
  49027. p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E
  49028. FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  49029. gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj
  49030. YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm
  49031. aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm
  49032. 4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj
  49033. Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL
  49034. DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw
  49035. pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H
  49036. RR3B7Hzs/Sk=
  49037. -----END CERTIFICATE-----
  49038. Comodo Trusted Services root
  49039. ============================
  49040. -----BEGIN CERTIFICATE-----
  49041. MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  49042. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  49043. TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw
  49044. MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1h
  49045. bmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUw
  49046. IwYDVQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOC
  49047. AQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWWfnJSoBVC21ndZHoa0Lh7
  49048. 3TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMtTGo87IvDktJTdyR0nAducPy9C1t2ul/y
  49049. /9c3S0pgePfw+spwtOpZqqPOSC+pw7ILfhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6
  49050. juljatEPmsbS9Is6FARW1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsS
  49051. ivnkBbA7kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0GA1Ud
  49052. DgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  49053. /zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21vZG9jYS5jb20vVHJ1c3RlZENlcnRp
  49054. ZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRodHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENl
  49055. cnRpZmljYXRlU2VydmljZXMuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8Ntw
  49056. uleGFTQQuS9/HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32
  49057. pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxISjBc/lDb+XbDA
  49058. BHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+xqFx7D+gIIxmOom0jtTYsU0l
  49059. R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O
  49060. 9y5Xt5hwXsjEeLBi
  49061. -----END CERTIFICATE-----
  49062. QuoVadis Root CA
  49063. ================
  49064. -----BEGIN CERTIFICATE-----
  49065. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  49066. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  49067. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  49068. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  49069. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  49070. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  49071. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  49072. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  49073. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  49074. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  49075. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  49076. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  49077. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  49078. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  49079. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  49080. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  49081. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  49082. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  49083. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  49084. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  49085. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  49086. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  49087. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  49088. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  49089. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  49090. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  49091. 5nrQNiOKSnQ2+Q==
  49092. -----END CERTIFICATE-----
  49093. QuoVadis Root CA 2
  49094. ==================
  49095. -----BEGIN CERTIFICATE-----
  49096. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  49097. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  49098. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  49099. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  49100. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  49101. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  49102. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  49103. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  49104. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  49105. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  49106. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  49107. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  49108. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  49109. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  49110. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  49111. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  49112. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  49113. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  49114. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  49115. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  49116. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  49117. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  49118. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  49119. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  49120. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  49121. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  49122. -----END CERTIFICATE-----
  49123. QuoVadis Root CA 3
  49124. ==================
  49125. -----BEGIN CERTIFICATE-----
  49126. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  49127. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  49128. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  49129. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  49130. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  49131. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  49132. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  49133. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  49134. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  49135. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  49136. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  49137. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  49138. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  49139. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  49140. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  49141. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  49142. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  49143. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  49144. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  49145. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  49146. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  49147. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  49148. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  49149. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  49150. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  49151. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  49152. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  49153. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  49154. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  49155. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  49156. -----END CERTIFICATE-----
  49157. Security Communication Root CA
  49158. ==============================
  49159. -----BEGIN CERTIFICATE-----
  49160. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  49161. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  49162. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  49163. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  49164. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  49165. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  49166. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  49167. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  49168. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  49169. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  49170. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  49171. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  49172. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  49173. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  49174. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  49175. FL39vmwLAw==
  49176. -----END CERTIFICATE-----
  49177. Sonera Class 2 Root CA
  49178. ======================
  49179. -----BEGIN CERTIFICATE-----
  49180. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  49181. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  49182. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  49183. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  49184. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  49185. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  49186. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  49187. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  49188. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  49189. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  49190. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  49191. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  49192. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  49193. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  49194. llpwrN9M
  49195. -----END CERTIFICATE-----
  49196. UTN USERFirst Hardware Root CA
  49197. ==============================
  49198. -----BEGIN CERTIFICATE-----
  49199. MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE
  49200. BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
  49201. IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd
  49202. BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx
  49203. OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0
  49204. eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVz
  49205. ZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwggEiMA0GCSqGSIb3
  49206. DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlI
  49207. wrthdBKWHTxqctU8EGc6Oe0rE81m65UJM6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFd
  49208. tqdt++BxF2uiiPsA3/4aMXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8
  49209. i4fDidNdoI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqIDsjf
  49210. Pe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9KsyoUhbAgMBAAGjgbkw
  49211. gbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKFyXyYbKJhDlV0HN9WF
  49212. lp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNF
  49213. UkZpcnN0LUhhcmR3YXJlLmNybDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUF
  49214. BwMGBggrBgEFBQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
  49215. //bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28GpgoiskliCE7/yMgUsogW
  49216. XecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gECJChicsZUN/KHAG8HQQZexB2
  49217. lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kn
  49218. iCrVWFCVH/A7HFe7fRQ5YiuayZSSKqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67
  49219. nfhmqA==
  49220. -----END CERTIFICATE-----
  49221. Camerfirma Chambers of Commerce Root
  49222. ====================================
  49223. -----BEGIN CERTIFICATE-----
  49224. MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  49225. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  49226. ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
  49227. NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
  49228. cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
  49229. MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
  49230. AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
  49231. xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
  49232. NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
  49233. DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
  49234. d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
  49235. EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
  49236. cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
  49237. AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
  49238. bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
  49239. VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
  49240. aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
  49241. fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
  49242. L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
  49243. UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
  49244. ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
  49245. erfutGWaIZDgqtCYvDi1czyL+Nw=
  49246. -----END CERTIFICATE-----
  49247. Camerfirma Global Chambersign Root
  49248. ==================================
  49249. -----BEGIN CERTIFICATE-----
  49250. MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  49251. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  49252. ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
  49253. NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
  49254. YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
  49255. MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
  49256. ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
  49257. 1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
  49258. by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
  49259. 6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
  49260. 8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
  49261. BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
  49262. aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
  49263. Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
  49264. aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
  49265. ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
  49266. bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
  49267. PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
  49268. gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
  49269. PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
  49270. IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
  49271. t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
  49272. -----END CERTIFICATE-----
  49273. XRamp Global CA Root
  49274. ====================
  49275. -----BEGIN CERTIFICATE-----
  49276. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  49277. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  49278. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  49279. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  49280. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  49281. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  49282. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  49283. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  49284. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  49285. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  49286. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  49287. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  49288. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  49289. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  49290. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  49291. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  49292. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  49293. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  49294. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  49295. -----END CERTIFICATE-----
  49296. Go Daddy Class 2 CA
  49297. ===================
  49298. -----BEGIN CERTIFICATE-----
  49299. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  49300. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  49301. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  49302. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  49303. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  49304. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  49305. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  49306. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  49307. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  49308. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  49309. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  49310. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  49311. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  49312. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  49313. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  49314. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  49315. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  49316. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  49317. vZ8=
  49318. -----END CERTIFICATE-----
  49319. Starfield Class 2 CA
  49320. ====================
  49321. -----BEGIN CERTIFICATE-----
  49322. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  49323. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  49324. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  49325. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  49326. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  49327. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  49328. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  49329. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  49330. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  49331. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  49332. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  49333. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  49334. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  49335. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  49336. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  49337. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  49338. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  49339. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  49340. QBFGmh95DmK/D5fs4C8fF5Q=
  49341. -----END CERTIFICATE-----
  49342. StartCom Certification Authority
  49343. ================================
  49344. -----BEGIN CERTIFICATE-----
  49345. MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  49346. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  49347. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  49348. NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  49349. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  49350. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  49351. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  49352. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  49353. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  49354. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  49355. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  49356. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  49357. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  49358. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  49359. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  49360. 37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
  49361. FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
  49362. Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
  49363. YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
  49364. AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
  49365. Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
  49366. U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
  49367. LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
  49368. cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
  49369. cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
  49370. dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
  49371. AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
  49372. 3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
  49373. vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
  49374. fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
  49375. fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
  49376. EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
  49377. yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
  49378. 1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
  49379. lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
  49380. g14=
  49381. -----END CERTIFICATE-----
  49382. Taiwan GRCA
  49383. ===========
  49384. -----BEGIN CERTIFICATE-----
  49385. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  49386. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  49387. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  49388. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  49389. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  49390. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  49391. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  49392. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  49393. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  49394. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  49395. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  49396. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  49397. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  49398. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  49399. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  49400. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  49401. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  49402. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  49403. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  49404. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  49405. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  49406. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  49407. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  49408. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  49409. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  49410. -----END CERTIFICATE-----
  49411. Swisscom Root CA 1
  49412. ==================
  49413. -----BEGIN CERTIFICATE-----
  49414. MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQG
  49415. EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
  49416. dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4
  49417. MTgyMjA2MjBaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
  49418. aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIIC
  49419. IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9m2BtRsiM
  49420. MW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdihFvkcxC7mlSpnzNApbjyF
  49421. NDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/TilftKaNXXsLmREDA/7n29uj/x2lzZAe
  49422. AR81sH8A25Bvxn570e56eqeqDFdvpG3FEzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkC
  49423. b6dJtDZd0KTeByy2dbcokdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn
  49424. 7uHbHaBuHYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNFvJbN
  49425. cA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo19AOeCMgkckkKmUp
  49426. WyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjCL3UcPX7ape8eYIVpQtPM+GP+HkM5
  49427. haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJWbjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNY
  49428. MUJDLXT5xp6mig/p/r+D5kNXJLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
  49429. HQYDVR0hBBYwFDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j
  49430. BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzcK6FptWfUjNP9
  49431. MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzfky9NfEBWMXrrpA9gzXrzvsMn
  49432. jgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7IkVh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQ
  49433. MbFamIp1TpBcahQq4FJHgmDmHtqBsfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4H
  49434. VtA4oJVwIHaM190e3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtl
  49435. vrsRls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ipmXeascCl
  49436. OS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HHb6D0jqTsNFFbjCYDcKF3
  49437. 1QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksfrK/7DZBaZmBwXarNeNQk7shBoJMBkpxq
  49438. nvy5JMWzFYJ+vq6VK+uxwNrjAWALXmmshFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCy
  49439. x/yP2FS1k2Kdzs9Z+z0YzirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMW
  49440. NY6E0F/6MBr1mmz0DlP5OlvRHA==
  49441. -----END CERTIFICATE-----
  49442. DigiCert Assured ID Root CA
  49443. ===========================
  49444. -----BEGIN CERTIFICATE-----
  49445. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  49446. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  49447. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  49448. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  49449. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  49450. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  49451. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  49452. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  49453. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  49454. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  49455. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  49456. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  49457. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  49458. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  49459. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  49460. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  49461. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  49462. -----END CERTIFICATE-----
  49463. DigiCert Global Root CA
  49464. =======================
  49465. -----BEGIN CERTIFICATE-----
  49466. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  49467. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  49468. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  49469. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  49470. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  49471. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  49472. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  49473. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  49474. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  49475. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  49476. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  49477. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  49478. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  49479. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  49480. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  49481. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  49482. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  49483. -----END CERTIFICATE-----
  49484. DigiCert High Assurance EV Root CA
  49485. ==================================
  49486. -----BEGIN CERTIFICATE-----
  49487. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  49488. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  49489. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  49490. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  49491. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  49492. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  49493. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  49494. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  49495. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  49496. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  49497. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  49498. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  49499. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  49500. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  49501. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  49502. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  49503. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  49504. -----END CERTIFICATE-----
  49505. Certplus Class 2 Primary CA
  49506. ===========================
  49507. -----BEGIN CERTIFICATE-----
  49508. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  49509. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  49510. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  49511. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  49512. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  49513. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  49514. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  49515. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  49516. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  49517. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  49518. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  49519. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  49520. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  49521. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  49522. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  49523. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  49524. l7+ijrRU
  49525. -----END CERTIFICATE-----
  49526. DST Root CA X3
  49527. ==============
  49528. -----BEGIN CERTIFICATE-----
  49529. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  49530. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  49531. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  49532. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  49533. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  49534. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  49535. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  49536. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  49537. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  49538. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  49539. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  49540. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  49541. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  49542. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  49543. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  49544. -----END CERTIFICATE-----
  49545. DST ACES CA X6
  49546. ==============
  49547. -----BEGIN CERTIFICATE-----
  49548. MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
  49549. EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
  49550. MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
  49551. MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
  49552. CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
  49553. AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
  49554. DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
  49555. pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
  49556. GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
  49557. MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
  49558. EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
  49559. Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
  49560. dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
  49561. CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
  49562. 5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
  49563. Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
  49564. nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
  49565. vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
  49566. oKfN5XozNmr6mis=
  49567. -----END CERTIFICATE-----
  49568. SwissSign Gold CA - G2
  49569. ======================
  49570. -----BEGIN CERTIFICATE-----
  49571. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  49572. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  49573. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  49574. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  49575. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  49576. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  49577. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  49578. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  49579. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  49580. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  49581. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  49582. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  49583. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  49584. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  49585. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  49586. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  49587. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  49588. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  49589. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  49590. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  49591. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  49592. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  49593. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  49594. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  49595. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  49596. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  49597. -----END CERTIFICATE-----
  49598. SwissSign Silver CA - G2
  49599. ========================
  49600. -----BEGIN CERTIFICATE-----
  49601. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  49602. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  49603. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  49604. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  49605. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  49606. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  49607. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  49608. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  49609. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  49610. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  49611. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  49612. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  49613. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  49614. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  49615. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  49616. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  49617. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  49618. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  49619. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  49620. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  49621. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  49622. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  49623. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  49624. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  49625. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  49626. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  49627. -----END CERTIFICATE-----
  49628. GeoTrust Primary Certification Authority
  49629. ========================================
  49630. -----BEGIN CERTIFICATE-----
  49631. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  49632. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  49633. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  49634. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  49635. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  49636. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  49637. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  49638. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  49639. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  49640. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  49641. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  49642. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  49643. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  49644. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  49645. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  49646. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  49647. -----END CERTIFICATE-----
  49648. thawte Primary Root CA
  49649. ======================
  49650. -----BEGIN CERTIFICATE-----
  49651. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  49652. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  49653. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  49654. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  49655. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  49656. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  49657. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  49658. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  49659. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  49660. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  49661. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  49662. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  49663. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  49664. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  49665. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  49666. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  49667. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  49668. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  49669. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  49670. -----END CERTIFICATE-----
  49671. VeriSign Class 3 Public Primary Certification Authority - G5
  49672. ============================================================
  49673. -----BEGIN CERTIFICATE-----
  49674. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  49675. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  49676. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  49677. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  49678. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  49679. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  49680. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  49681. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  49682. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  49683. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  49684. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  49685. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  49686. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  49687. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  49688. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  49689. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  49690. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  49691. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  49692. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  49693. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  49694. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  49695. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  49696. -----END CERTIFICATE-----
  49697. SecureTrust CA
  49698. ==============
  49699. -----BEGIN CERTIFICATE-----
  49700. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  49701. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  49702. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  49703. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  49704. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  49705. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  49706. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  49707. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  49708. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  49709. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  49710. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  49711. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  49712. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  49713. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  49714. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  49715. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  49716. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  49717. -----END CERTIFICATE-----
  49718. Secure Global CA
  49719. ================
  49720. -----BEGIN CERTIFICATE-----
  49721. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  49722. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  49723. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  49724. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  49725. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  49726. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  49727. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  49728. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  49729. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  49730. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  49731. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  49732. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  49733. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  49734. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  49735. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  49736. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  49737. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  49738. -----END CERTIFICATE-----
  49739. COMODO Certification Authority
  49740. ==============================
  49741. -----BEGIN CERTIFICATE-----
  49742. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  49743. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  49744. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  49745. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  49746. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  49747. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  49748. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  49749. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  49750. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  49751. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  49752. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  49753. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  49754. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  49755. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  49756. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  49757. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  49758. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  49759. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  49760. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  49761. -----END CERTIFICATE-----
  49762. Network Solutions Certificate Authority
  49763. =======================================
  49764. -----BEGIN CERTIFICATE-----
  49765. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  49766. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  49767. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  49768. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  49769. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  49770. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  49771. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  49772. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  49773. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  49774. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  49775. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  49776. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  49777. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  49778. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  49779. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  49780. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  49781. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  49782. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  49783. -----END CERTIFICATE-----
  49784. WellsSecure Public Root Certificate Authority
  49785. =============================================
  49786. -----BEGIN CERTIFICATE-----
  49787. MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM
  49788. F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw
  49789. NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
  49790. MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dl
  49791. bGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYD
  49792. VQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  49793. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+rWxxTkqxtnt3CxC5FlAM1
  49794. iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjUDk/41itMpBb570OYj7OeUt9tkTmPOL13
  49795. i0Nj67eT/DBMHAGTthP796EfvyXhdDcsHqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8
  49796. bJVhHlfXBIEyg1J55oNjz7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiB
  49797. K0HmOFafSZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/SlwxlAgMB
  49798. AAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwu
  49799. cGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBQm
  49800. lRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0jBIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGB
  49801. i6SBiDCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRww
  49802. GgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg
  49803. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEBALkVsUSRzCPI
  49804. K0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0
  49805. bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj
  49806. qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es
  49807. E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ
  49808. tylv2G0xffX8oRAHh84vWdw+WNs=
  49809. -----END CERTIFICATE-----
  49810. COMODO ECC Certification Authority
  49811. ==================================
  49812. -----BEGIN CERTIFICATE-----
  49813. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  49814. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  49815. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  49816. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  49817. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  49818. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  49819. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  49820. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  49821. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  49822. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  49823. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  49824. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  49825. -----END CERTIFICATE-----
  49826. Security Communication EV RootCA1
  49827. =================================
  49828. -----BEGIN CERTIFICATE-----
  49829. MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  49830. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
  49831. dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
  49832. BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
  49833. Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  49834. AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
  49835. /VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
  49836. WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
  49837. ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
  49838. bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
  49839. 9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
  49840. SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
  49841. iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
  49842. Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
  49843. mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
  49844. T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
  49845. -----END CERTIFICATE-----
  49846. OISTE WISeKey Global Root GA CA
  49847. ===============================
  49848. -----BEGIN CERTIFICATE-----
  49849. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  49850. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  49851. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  49852. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  49853. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  49854. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  49855. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  49856. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  49857. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  49858. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  49859. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  49860. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  49861. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  49862. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  49863. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  49864. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  49865. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  49866. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  49867. -----END CERTIFICATE-----
  49868. Microsec e-Szigno Root CA
  49869. =========================
  49870. -----BEGIN CERTIFICATE-----
  49871. MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE
  49872. BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL
  49873. EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0
  49874. MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz
  49875. dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT
  49876. GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
  49877. AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG
  49878. d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N
  49879. oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc
  49880. QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ
  49881. PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb
  49882. MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG
  49883. IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD
  49884. VR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIBAQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3
  49885. LmUtc3ppZ25vLmh1L1NaU1ovMIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0A
  49886. dAB2AOEAbgB5ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn
  49887. AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABTAHoAbwBsAGcA
  49888. 4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABhACAAcwB6AGUAcgBpAG4AdAAg
  49889. AGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABoAHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMA
  49890. egBpAGcAbgBvAC4AaAB1AC8AUwBaAFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6
  49891. Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NO
  49892. PU1pY3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxPPU1pY3Jv
  49893. c2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdDtiaW5h
  49894. cnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuBEGluZm9AZS1zemlnbm8uaHWkdzB1MSMw
  49895. IQYDVQQDDBpNaWNyb3NlYyBlLVN6aWduw7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhT
  49896. WjEWMBQGA1UEChMNTWljcm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhV
  49897. MIGsBgNVHSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJIVTER
  49898. MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp
  49899. Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal
  49900. HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT
  49901. nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE
  49902. aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a
  49903. 86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK
  49904. yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB
  49905. S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU=
  49906. -----END CERTIFICATE-----
  49907. Certigna
  49908. ========
  49909. -----BEGIN CERTIFICATE-----
  49910. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  49911. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  49912. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  49913. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  49914. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  49915. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  49916. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  49917. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  49918. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  49919. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  49920. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  49921. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  49922. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  49923. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  49924. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  49925. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  49926. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  49927. -----END CERTIFICATE-----
  49928. Deutsche Telekom Root CA 2
  49929. ==========================
  49930. -----BEGIN CERTIFICATE-----
  49931. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  49932. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  49933. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  49934. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  49935. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  49936. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  49937. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  49938. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  49939. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  49940. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  49941. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  49942. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  49943. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  49944. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  49945. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  49946. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  49947. Cm26OWMohpLzGITY+9HPBVZkVw==
  49948. -----END CERTIFICATE-----
  49949. Cybertrust Global Root
  49950. ======================
  49951. -----BEGIN CERTIFICATE-----
  49952. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  49953. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  49954. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  49955. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  49956. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  49957. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  49958. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  49959. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  49960. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  49961. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  49962. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  49963. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  49964. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  49965. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  49966. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  49967. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  49968. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  49969. -----END CERTIFICATE-----
  49970. ePKI Root Certification Authority
  49971. =================================
  49972. -----BEGIN CERTIFICATE-----
  49973. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  49974. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  49975. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  49976. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  49977. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  49978. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  49979. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  49980. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  49981. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  49982. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  49983. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  49984. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  49985. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  49986. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  49987. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  49988. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  49989. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  49990. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  49991. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  49992. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  49993. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  49994. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  49995. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  49996. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  49997. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  49998. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  49999. -----END CERTIFICATE-----
  50000. 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
  50001. =============================================================================================================================
  50002. -----BEGIN CERTIFICATE-----
  50003. MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
  50004. DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
  50005. aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
  50006. b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
  50007. BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
  50008. S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
  50009. MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
  50010. IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
  50011. n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
  50012. IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
  50013. dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
  50014. cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
  50015. AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
  50016. Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
  50017. xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
  50018. 6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
  50019. hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
  50020. BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  50021. MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
  50022. N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
  50023. y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
  50024. LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
  50025. dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
  50026. -----END CERTIFICATE-----
  50027. certSIGN ROOT CA
  50028. ================
  50029. -----BEGIN CERTIFICATE-----
  50030. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  50031. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  50032. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  50033. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  50034. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  50035. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  50036. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  50037. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  50038. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  50039. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  50040. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  50041. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  50042. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  50043. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  50044. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  50045. -----END CERTIFICATE-----
  50046. CNNIC ROOT
  50047. ==========
  50048. -----BEGIN CERTIFICATE-----
  50049. MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJDTjEOMAwGA1UE
  50050. ChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2MDcwOTE0WhcNMjcwNDE2MDcw
  50051. OTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1Qw
  50052. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzD
  50053. o+/hn7E7SIX1mlwhIhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tiz
  50054. VHa6dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZOV/kbZKKT
  50055. VrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrCGHn2emU1z5DrvTOTn1Or
  50056. czvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gNv7Sg2Ca+I19zN38m5pIEo3/PIKe38zrK
  50057. y5nLAgMBAAGjczBxMBEGCWCGSAGG+EIBAQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscC
  50058. wQ7vptU7ETAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991S
  50059. lgrHAsEO76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnKOOK5
  50060. Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvHugDnuL8BV8F3RTIM
  50061. O/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7HgviyJA/qIYM/PmLXoXLT1tLYhFHxUV8
  50062. BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2
  50063. G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m
  50064. mxE=
  50065. -----END CERTIFICATE-----
  50066. ApplicationCA - Japanese Government
  50067. ===================================
  50068. -----BEGIN CERTIFICATE-----
  50069. MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT
  50070. SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw
  50071. MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl
  50072. cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  50073. CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4
  50074. fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN
  50075. wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE
  50076. jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu
  50077. nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU
  50078. WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV
  50079. BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD
  50080. vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs
  50081. o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g
  50082. /DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD
  50083. io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW
  50084. dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL
  50085. rosot4LKGAfmt1t06SAZf7IbiVQ=
  50086. -----END CERTIFICATE-----
  50087. GeoTrust Primary Certification Authority - G3
  50088. =============================================
  50089. -----BEGIN CERTIFICATE-----
  50090. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  50091. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  50092. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  50093. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  50094. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  50095. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  50096. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  50097. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  50098. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  50099. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  50100. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  50101. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  50102. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  50103. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  50104. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  50105. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  50106. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  50107. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  50108. -----END CERTIFICATE-----
  50109. thawte Primary Root CA - G2
  50110. ===========================
  50111. -----BEGIN CERTIFICATE-----
  50112. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  50113. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  50114. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  50115. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  50116. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  50117. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  50118. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  50119. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  50120. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  50121. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  50122. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  50123. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  50124. -----END CERTIFICATE-----
  50125. thawte Primary Root CA - G3
  50126. ===========================
  50127. -----BEGIN CERTIFICATE-----
  50128. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  50129. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  50130. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  50131. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  50132. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  50133. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  50134. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  50135. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  50136. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  50137. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  50138. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  50139. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  50140. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  50141. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  50142. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  50143. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  50144. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  50145. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  50146. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  50147. -----END CERTIFICATE-----
  50148. GeoTrust Primary Certification Authority - G2
  50149. =============================================
  50150. -----BEGIN CERTIFICATE-----
  50151. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  50152. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  50153. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  50154. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  50155. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  50156. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  50157. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  50158. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  50159. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  50160. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  50161. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  50162. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  50163. npaqBA+K
  50164. -----END CERTIFICATE-----
  50165. VeriSign Universal Root Certification Authority
  50166. ===============================================
  50167. -----BEGIN CERTIFICATE-----
  50168. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  50169. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  50170. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  50171. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  50172. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  50173. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  50174. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  50175. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  50176. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  50177. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  50178. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  50179. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  50180. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  50181. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  50182. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  50183. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  50184. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  50185. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  50186. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  50187. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  50188. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  50189. mJO37M2CYfE45k+XmCpajQ==
  50190. -----END CERTIFICATE-----
  50191. VeriSign Class 3 Public Primary Certification Authority - G4
  50192. ============================================================
  50193. -----BEGIN CERTIFICATE-----
  50194. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  50195. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  50196. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  50197. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  50198. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  50199. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  50200. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  50201. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  50202. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  50203. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  50204. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  50205. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  50206. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  50207. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  50208. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  50209. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  50210. -----END CERTIFICATE-----
  50211. NetLock Arany (Class Gold) Főtanúsítvány
  50212. ========================================
  50213. -----BEGIN CERTIFICATE-----
  50214. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  50215. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  50216. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  50217. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  50218. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  50219. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  50220. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  50221. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  50222. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  50223. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  50224. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  50225. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  50226. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  50227. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  50228. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  50229. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  50230. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  50231. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  50232. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  50233. -----END CERTIFICATE-----
  50234. Staat der Nederlanden Root CA - G2
  50235. ==================================
  50236. -----BEGIN CERTIFICATE-----
  50237. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  50238. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  50239. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  50240. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  50241. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  50242. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  50243. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  50244. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  50245. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  50246. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  50247. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  50248. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  50249. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  50250. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  50251. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  50252. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  50253. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  50254. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  50255. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  50256. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  50257. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  50258. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  50259. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  50260. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  50261. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  50262. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  50263. 66+KAQ==
  50264. -----END CERTIFICATE-----
  50265. Hongkong Post Root CA 1
  50266. =======================
  50267. -----BEGIN CERTIFICATE-----
  50268. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  50269. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  50270. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  50271. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  50272. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  50273. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  50274. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  50275. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  50276. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  50277. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  50278. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  50279. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  50280. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  50281. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  50282. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  50283. -----END CERTIFICATE-----
  50284. SecureSign RootCA11
  50285. ===================
  50286. -----BEGIN CERTIFICATE-----
  50287. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  50288. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  50289. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  50290. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  50291. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  50292. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  50293. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  50294. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  50295. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  50296. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  50297. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  50298. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  50299. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  50300. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  50301. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  50302. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  50303. -----END CERTIFICATE-----
  50304. ACEDICOM Root
  50305. =============
  50306. -----BEGIN CERTIFICATE-----
  50307. MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
  50308. T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
  50309. MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
  50310. A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
  50311. AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
  50312. WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
  50313. YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
  50314. MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
  50315. m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
  50316. HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
  50317. xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
  50318. 3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
  50319. 2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
  50320. TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
  50321. 4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
  50322. 9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
  50323. bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
  50324. aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
  50325. eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
  50326. zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
  50327. ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
  50328. KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
  50329. nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
  50330. I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
  50331. MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
  50332. tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
  50333. -----END CERTIFICATE-----
  50334. Microsec e-Szigno Root CA 2009
  50335. ==============================
  50336. -----BEGIN CERTIFICATE-----
  50337. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  50338. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  50339. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  50340. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  50341. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  50342. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  50343. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  50344. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  50345. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  50346. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  50347. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  50348. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  50349. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  50350. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  50351. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  50352. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  50353. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  50354. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  50355. LXpUq3DDfSJlgnCW
  50356. -----END CERTIFICATE-----
  50357. GlobalSign Root CA - R3
  50358. =======================
  50359. -----BEGIN CERTIFICATE-----
  50360. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  50361. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  50362. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  50363. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  50364. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  50365. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  50366. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  50367. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  50368. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  50369. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  50370. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  50371. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  50372. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  50373. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  50374. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  50375. kpeDMdmztcpHWD9f
  50376. -----END CERTIFICATE-----
  50377. Autoridad de Certificacion Firmaprofesional CIF A62634068
  50378. =========================================================
  50379. -----BEGIN CERTIFICATE-----
  50380. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  50381. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  50382. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  50383. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  50384. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  50385. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  50386. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  50387. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  50388. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  50389. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  50390. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  50391. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  50392. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  50393. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  50394. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  50395. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  50396. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  50397. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  50398. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  50399. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  50400. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  50401. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  50402. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  50403. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  50404. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  50405. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  50406. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  50407. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  50408. -----END CERTIFICATE-----
  50409. Izenpe.com
  50410. ==========
  50411. -----BEGIN CERTIFICATE-----
  50412. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  50413. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  50414. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  50415. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  50416. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  50417. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  50418. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  50419. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  50420. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  50421. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  50422. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  50423. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  50424. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  50425. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  50426. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  50427. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  50428. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  50429. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  50430. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  50431. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  50432. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  50433. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  50434. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  50435. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  50436. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  50437. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  50438. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  50439. -----END CERTIFICATE-----
  50440. Chambers of Commerce Root - 2008
  50441. ================================
  50442. -----BEGIN CERTIFICATE-----
  50443. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  50444. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  50445. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  50446. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  50447. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  50448. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  50449. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  50450. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  50451. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  50452. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  50453. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  50454. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  50455. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  50456. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  50457. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  50458. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  50459. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  50460. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  50461. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  50462. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  50463. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  50464. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  50465. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  50466. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  50467. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  50468. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  50469. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  50470. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  50471. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  50472. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  50473. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  50474. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  50475. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  50476. -----END CERTIFICATE-----
  50477. Global Chambersign Root - 2008
  50478. ==============================
  50479. -----BEGIN CERTIFICATE-----
  50480. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  50481. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  50482. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  50483. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  50484. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  50485. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  50486. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  50487. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  50488. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  50489. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  50490. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  50491. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  50492. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  50493. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  50494. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  50495. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  50496. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  50497. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  50498. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  50499. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  50500. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  50501. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  50502. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  50503. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  50504. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  50505. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  50506. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  50507. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  50508. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  50509. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  50510. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  50511. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  50512. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  50513. -----END CERTIFICATE-----
  50514. Go Daddy Root Certificate Authority - G2
  50515. ========================================
  50516. -----BEGIN CERTIFICATE-----
  50517. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  50518. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  50519. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  50520. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  50521. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  50522. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  50523. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  50524. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  50525. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  50526. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  50527. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  50528. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  50529. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  50530. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  50531. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  50532. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  50533. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  50534. -----END CERTIFICATE-----
  50535. Starfield Root Certificate Authority - G2
  50536. =========================================
  50537. -----BEGIN CERTIFICATE-----
  50538. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  50539. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  50540. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  50541. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  50542. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  50543. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  50544. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  50545. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  50546. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  50547. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  50548. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  50549. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  50550. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  50551. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  50552. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  50553. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  50554. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  50555. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  50556. -----END CERTIFICATE-----
  50557. Starfield Services Root Certificate Authority - G2
  50558. ==================================================
  50559. -----BEGIN CERTIFICATE-----
  50560. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  50561. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  50562. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  50563. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  50564. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  50565. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  50566. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  50567. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  50568. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  50569. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  50570. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  50571. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  50572. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  50573. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  50574. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  50575. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  50576. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  50577. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  50578. -----END CERTIFICATE-----
  50579. AffirmTrust Commercial
  50580. ======================
  50581. -----BEGIN CERTIFICATE-----
  50582. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  50583. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  50584. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  50585. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  50586. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  50587. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  50588. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  50589. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  50590. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  50591. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  50592. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  50593. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  50594. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  50595. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  50596. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  50597. -----END CERTIFICATE-----
  50598. AffirmTrust Networking
  50599. ======================
  50600. -----BEGIN CERTIFICATE-----
  50601. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  50602. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  50603. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  50604. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  50605. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  50606. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  50607. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  50608. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  50609. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  50610. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  50611. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  50612. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  50613. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  50614. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  50615. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  50616. -----END CERTIFICATE-----
  50617. AffirmTrust Premium
  50618. ===================
  50619. -----BEGIN CERTIFICATE-----
  50620. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  50621. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  50622. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  50623. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  50624. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  50625. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  50626. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  50627. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  50628. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  50629. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  50630. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  50631. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  50632. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  50633. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  50634. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  50635. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  50636. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  50637. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  50638. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  50639. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  50640. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  50641. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  50642. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  50643. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  50644. -----END CERTIFICATE-----
  50645. AffirmTrust Premium ECC
  50646. =======================
  50647. -----BEGIN CERTIFICATE-----
  50648. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  50649. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  50650. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  50651. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  50652. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  50653. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  50654. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  50655. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  50656. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  50657. eQ==
  50658. -----END CERTIFICATE-----
  50659. Certum Trusted Network CA
  50660. =========================
  50661. -----BEGIN CERTIFICATE-----
  50662. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  50663. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  50664. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  50665. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  50666. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  50667. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  50668. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  50669. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  50670. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  50671. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  50672. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  50673. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  50674. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  50675. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  50676. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  50677. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  50678. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  50679. -----END CERTIFICATE-----
  50680. Certinomis - Autorité Racine
  50681. ============================
  50682. -----BEGIN CERTIFICATE-----
  50683. MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  50684. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
  50685. LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
  50686. A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
  50687. JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
  50688. ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
  50689. wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
  50690. Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
  50691. 2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
  50692. jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
  50693. c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
  50694. lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
  50695. xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
  50696. 530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
  50697. 4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  50698. A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
  50699. KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
  50700. WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
  50701. R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
  50702. nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
  50703. CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
  50704. JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
  50705. qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
  50706. WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
  50707. wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
  50708. vgt2Fl43N+bYdJeimUV5
  50709. -----END CERTIFICATE-----
  50710. TWCA Root Certification Authority
  50711. =================================
  50712. -----BEGIN CERTIFICATE-----
  50713. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  50714. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  50715. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  50716. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  50717. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  50718. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  50719. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  50720. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  50721. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  50722. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  50723. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  50724. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  50725. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  50726. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  50727. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  50728. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  50729. -----END CERTIFICATE-----
  50730. Security Communication RootCA2
  50731. ==============================
  50732. -----BEGIN CERTIFICATE-----
  50733. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  50734. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  50735. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  50736. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  50737. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  50738. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  50739. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  50740. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  50741. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  50742. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  50743. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  50744. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  50745. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  50746. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  50747. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  50748. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  50749. -----END CERTIFICATE-----
  50750. EC-ACC
  50751. ======
  50752. -----BEGIN CERTIFICATE-----
  50753. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  50754. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  50755. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  50756. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  50757. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  50758. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  50759. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  50760. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  50761. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  50762. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  50763. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  50764. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  50765. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  50766. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  50767. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  50768. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  50769. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  50770. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  50771. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  50772. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  50773. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  50774. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  50775. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  50776. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  50777. 5EI=
  50778. -----END CERTIFICATE-----
  50779. Hellenic Academic and Research Institutions RootCA 2011
  50780. =======================================================
  50781. -----BEGIN CERTIFICATE-----
  50782. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  50783. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  50784. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  50785. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  50786. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  50787. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  50788. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  50789. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  50790. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  50791. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  50792. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  50793. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  50794. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  50795. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  50796. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  50797. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  50798. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  50799. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  50800. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  50801. -----END CERTIFICATE-----
  50802. Actalis Authentication Root CA
  50803. ==============================
  50804. -----BEGIN CERTIFICATE-----
  50805. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  50806. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  50807. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  50808. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  50809. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  50810. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  50811. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  50812. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  50813. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  50814. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  50815. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  50816. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  50817. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  50818. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  50819. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  50820. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  50821. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  50822. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  50823. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  50824. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  50825. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  50826. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  50827. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  50828. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  50829. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  50830. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  50831. -----END CERTIFICATE-----
  50832. Trustis FPS Root CA
  50833. ===================
  50834. -----BEGIN CERTIFICATE-----
  50835. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  50836. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  50837. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  50838. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  50839. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  50840. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  50841. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  50842. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  50843. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  50844. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  50845. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  50846. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  50847. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  50848. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  50849. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  50850. iB6XzCGcKQENZetX2fNXlrtIzYE=
  50851. -----END CERTIFICATE-----
  50852. StartCom Certification Authority
  50853. ================================
  50854. -----BEGIN CERTIFICATE-----
  50855. MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  50856. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  50857. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  50858. NjM3WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  50859. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  50860. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  50861. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  50862. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  50863. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  50864. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  50865. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  50866. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  50867. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  50868. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  50869. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  50870. 37uMdBNSSwIDAQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD
  50871. VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFulF2mHMMo0aEPQ
  50872. Qa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCCATgwLgYIKwYBBQUHAgEWImh0
  50873. dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cu
  50874. c3RhcnRzc2wuY29tL2ludGVybWVkaWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENv
  50875. bW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0
  50876. aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0aWZpY2F0
  50877. aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93d3cuc3RhcnRzc2wuY29t
  50878. L3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBG
  50879. cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5
  50880. fPGFf59Jb2vKXfuM/gTFwWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWm
  50881. N3PH/UvSTa0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst0OcN
  50882. Org+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNcpRJvkrKTlMeIFw6T
  50883. tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX
  50884. e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA
  50885. 2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs
  50886. HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE
  50887. JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib
  50888. D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8=
  50889. -----END CERTIFICATE-----
  50890. StartCom Certification Authority G2
  50891. ===================================
  50892. -----BEGIN CERTIFICATE-----
  50893. MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  50894. U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
  50895. RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE
  50896. ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  50897. dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O
  50898. o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG
  50899. 4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi
  50900. Aez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/Q0kGi4xDuFby2X8hQxfqp0iVAXV16iul
  50901. Q5XqFYSdCI0mblWbq9zSOdIxHWDirMxWRST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbs
  50902. O+wmETRIjfaAKxojAuuKHDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8H
  50903. vKTlXcxNnw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM0D4L
  50904. nMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/iUUjXuG+v+E5+M5iS
  50905. FGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9Ha90OrInwMEePnWjFqmveiJdnxMa
  50906. z6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHgTuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8E
  50907. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJ
  50908. KoZIhvcNAQELBQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K
  50909. 2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfXUfEpY9Z1zRbk
  50910. J4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl6/2o1PXWT6RbdejF0mCy2wl+
  50911. JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG
  50912. /+gyRr61M3Z3qAFdlsHB1b6uJcDJHgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTc
  50913. nIhT76IxW1hPkWLIwpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/Xld
  50914. blhYXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc
  50915. l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm
  50916. 7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm
  50917. obp573PYtlNXLfbQ4ddI
  50918. -----END CERTIFICATE-----
  50919. Buypass Class 2 Root CA
  50920. =======================
  50921. -----BEGIN CERTIFICATE-----
  50922. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  50923. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  50924. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  50925. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  50926. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  50927. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  50928. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  50929. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  50930. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  50931. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  50932. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  50933. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  50934. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  50935. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  50936. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  50937. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  50938. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  50939. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  50940. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  50941. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  50942. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  50943. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  50944. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  50945. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  50946. rJgWVqA=
  50947. -----END CERTIFICATE-----
  50948. Buypass Class 3 Root CA
  50949. =======================
  50950. -----BEGIN CERTIFICATE-----
  50951. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  50952. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  50953. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  50954. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  50955. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  50956. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  50957. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  50958. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  50959. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  50960. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  50961. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  50962. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  50963. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  50964. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  50965. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  50966. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  50967. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  50968. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  50969. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  50970. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  50971. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  50972. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  50973. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  50974. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  50975. Cp/HuZc=
  50976. -----END CERTIFICATE-----
  50977. T-TeleSec GlobalRoot Class 3
  50978. ============================
  50979. -----BEGIN CERTIFICATE-----
  50980. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  50981. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  50982. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  50983. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  50984. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  50985. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  50986. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  50987. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  50988. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  50989. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  50990. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  50991. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  50992. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  50993. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  50994. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  50995. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  50996. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  50997. -----END CERTIFICATE-----
  50998. EE Certification Centre Root CA
  50999. ===============================
  51000. -----BEGIN CERTIFICATE-----
  51001. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  51002. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  51003. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  51004. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  51005. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  51006. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  51007. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  51008. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  51009. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  51010. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  51011. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  51012. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  51013. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  51014. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  51015. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  51016. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  51017. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  51018. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  51019. dcGWxZ0=
  51020. -----END CERTIFICATE-----
  51021. TURKTRUST Certificate Services Provider Root 2007
  51022. =================================================
  51023. -----BEGIN CERTIFICATE-----
  51024. MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
  51025. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
  51026. MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
  51027. QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X
  51028. DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl
  51029. a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN
  51030. BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  51031. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw
  51032. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N
  51033. YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv
  51034. KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya
  51035. KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT
  51036. rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC
  51037. AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP
  51038. BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s
  51039. Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I
  51040. aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO
  51041. Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb
  51042. BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK
  51043. poRq0Tl9
  51044. -----END CERTIFICATE-----
  51045. D-TRUST Root Class 3 CA 2 2009
  51046. ==============================
  51047. -----BEGIN CERTIFICATE-----
  51048. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  51049. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  51050. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  51051. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  51052. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  51053. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  51054. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  51055. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  51056. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  51057. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  51058. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  51059. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  51060. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  51061. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  51062. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  51063. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  51064. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  51065. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  51066. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  51067. -----END CERTIFICATE-----
  51068. D-TRUST Root Class 3 CA 2 EV 2009
  51069. =================================
  51070. -----BEGIN CERTIFICATE-----
  51071. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  51072. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  51073. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  51074. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  51075. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  51076. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  51077. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  51078. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  51079. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  51080. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  51081. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  51082. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  51083. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  51084. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  51085. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  51086. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  51087. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  51088. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  51089. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  51090. w9y4AyHqnxbxLFS1
  51091. -----END CERTIFICATE-----
  51092. PSCProcert
  51093. ==========
  51094. -----BEGIN CERTIFICATE-----
  51095. MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1dG9yaWRhZCBk
  51096. ZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9sYW5vMQswCQYDVQQGEwJWRTEQ
  51097. MA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlzdHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lz
  51098. dGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBl
  51099. cmludGVuZGVuY2lhIGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUw
  51100. IwYJKoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEwMFoXDTIw
  51101. MTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHByb2NlcnQubmV0LnZlMQ8w
  51102. DQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGExKjAoBgNVBAsTIVByb3ZlZWRvciBkZSBD
  51103. ZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZp
  51104. Y2FjaW9uIEVsZWN0cm9uaWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIw
  51105. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo97BVC
  51106. wfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74BCXfgI8Qhd19L3uA
  51107. 3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38GieU89RLAu9MLmV+QfI4tL3czkkoh
  51108. RqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmO
  51109. EO8GqQKJ/+MMbpfg353bIdD0PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG2
  51110. 0qCZyFSTXai20b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH
  51111. 0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/6mnbVSKVUyqU
  51112. td+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1mv6JpIzi4mWCZDlZTOpx+FIyw
  51113. Bm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvp
  51114. r2uKGcfLFFb14dq12fy/czja+eevbqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/
  51115. AgEBMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAz
  51116. Ni0wMB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFDgBStuyId
  51117. xuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRp
  51118. ZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQH
  51119. EwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5h
  51120. Y2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5k
  51121. ZW5jaWEgZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG
  51122. 9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQDAgEGME0GA1UdEQRG
  51123. MESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0wMDAwMDKgGwYFYIZeAgKgEgwQUklG
  51124. LUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEagRKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52
  51125. ZS9sY3IvQ0VSVElGSUNBRE8tUkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNy
  51126. YWl6LnN1c2NlcnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v
  51127. Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsGAQUFBwIBFh5o
  51128. dHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcNAQELBQADggIBACtZ6yKZu4Sq
  51129. T96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmN
  51130. g7+mvTV+LFwxNG9s2/NkAZiqlCxB3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4q
  51131. uxtxj7mkoP3YldmvWb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1
  51132. n8GhHVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHmpHmJWhSn
  51133. FFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXzsOfIt+FTvZLm8wyWuevo
  51134. 5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bEqCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq
  51135. 3TNWOByyrYDT13K9mmyZY+gAu0F2BbdbmRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5
  51136. poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y
  51137. eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km
  51138. -----END CERTIFICATE-----
  51139. China Internet Network Information Center EV Certificates Root
  51140. ==============================================================
  51141. -----BEGIN CERTIFICATE-----
  51142. MIID9zCCAt+gAwIBAgIESJ8AATANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMCQ04xMjAwBgNV
  51143. BAoMKUNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyMUcwRQYDVQQDDD5D
  51144. aGluYSBJbnRlcm5ldCBOZXR3b3JrIEluZm9ybWF0aW9uIENlbnRlciBFViBDZXJ0aWZpY2F0ZXMg
  51145. Um9vdDAeFw0xMDA4MzEwNzExMjVaFw0zMDA4MzEwNzExMjVaMIGKMQswCQYDVQQGEwJDTjEyMDAG
  51146. A1UECgwpQ2hpbmEgSW50ZXJuZXQgTmV0d29yayBJbmZvcm1hdGlvbiBDZW50ZXIxRzBFBgNVBAMM
  51147. PkNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyIEVWIENlcnRpZmljYXRl
  51148. cyBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm35z7r07eKpkQ0H1UN+U8i6y
  51149. jUqORlTSIRLIOTJCBumD1Z9S7eVnAztUwYyZmczpwA//DdmEEbK40ctb3B75aDFk4Zv6dOtouSCV
  51150. 98YPjUesWgbdYavi7NifFy2cyjw1l1VxzUOFsUcW9SxTgHbP0wBkvUCZ3czY28Sf1hNfQYOL+Q2H
  51151. klY0bBoQCxfVWhyXWIQ8hBouXJE0bhlffxdpxWXvayHG1VA6v2G5BY3vbzQ6sm8UY78WO5upKv23
  51152. KzhmBsUs4qpnHkWnjQRmQvaPK++IIGmPMowUc9orhpFjIpryp9vOiYurXccUwVswah+xt54ugQEC
  51153. 7c+WXmPbqOY4twIDAQABo2MwYTAfBgNVHSMEGDAWgBR8cks5x8DbYqVPm6oYNJKiyoOCWTAPBgNV
  51154. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUfHJLOcfA22KlT5uqGDSSosqD
  51155. glkwDQYJKoZIhvcNAQEFBQADggEBACrDx0M3j92tpLIM7twUbY8opJhJywyA6vPtI2Z1fcXTIWd5
  51156. 0XPFtQO3WKwMVC/GVhMPMdoG52U7HW8228gd+f2ABsqjPWYWqJ1MFn3AlUa1UeTiH9fqBk1jjZaM
  51157. 7+czV0I664zBechNdn3e9rG3geCg+aF4RhcaVpjwTj2rHO3sOdwHSPdj/gauwqRcalsyiMXHM4Ws
  51158. ZkJHwlgkmeHlPuV1LI5D1l08eB6olYIpUNHRFrrvwb562bTYzB5MRuF3sTGrvSrIzo9uoV1/A3U0
  51159. 5K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATywy39FCqQmbkHzJ8=
  51160. -----END CERTIFICATE-----
  51161. Swisscom Root CA 2
  51162. ==================
  51163. -----BEGIN CERTIFICATE-----
  51164. MIIF2TCCA8GgAwIBAgIQHp4o6Ejy5e/DfEoeWhhntjANBgkqhkiG9w0BAQsFADBkMQswCQYDVQQG
  51165. EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
  51166. dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMjAeFw0xMTA2MjQwODM4MTRaFw0zMTA2
  51167. MjUwNzM4MTRaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
  51168. aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAyMIIC
  51169. IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlUJOhJ1R5tMJ6HJaI2nbeHCOFvErjw0DzpPM
  51170. LgAIe6szjPTpQOYXTKueuEcUMncy3SgM3hhLX3af+Dk7/E6J2HzFZ++r0rk0X2s682Q2zsKwzxNo
  51171. ysjL67XiPS4h3+os1OD5cJZM/2pYmLcX5BtS5X4HAB1f2uY+lQS3aYg5oUFgJWFLlTloYhyxCwWJ
  51172. wDaCFCE/rtuh/bxvHGCGtlOUSbkrRsVPACu/obvLP+DHVxxX6NZp+MEkUp2IVd3Chy50I9AU/SpH
  51173. Wrumnf2U5NGKpV+GY3aFy6//SSj8gO1MedK75MDvAe5QQQg1I3ArqRa0jG6F6bYRzzHdUyYb3y1a
  51174. SgJA/MTAtukxGggo5WDDH8SQjhBiYEQN7Aq+VRhxLKX0srwVYv8c474d2h5Xszx+zYIdkeNL6yxS
  51175. NLCK/RJOlrDrcH+eOfdmQrGrrFLadkBXeyq96G4DsguAhYidDMfCd7Camlf0uPoTXGiTOmekl9Ab
  51176. mbeGMktg2M7v0Ax/lZ9vh0+Hio5fCHyqW/xavqGRn1V9TrALacywlKinh/LTSlDcX3KwFnUey7QY
  51177. Ypqwpzmqm59m2I2mbJYV4+by+PGDYmy7Velhk6M99bFXi08jsJvllGov34zflVEpYKELKeRcVVi3
  51178. qPyZ7iVNTA6z00yPhOgpD/0QVAKFyPnlw4vP5w8CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
  51179. HQYDVR0hBBYwFDASBgdghXQBUwIBBgdghXQBUwIBMBIGA1UdEwEB/wQIMAYBAf8CAQcwHQYDVR0O
  51180. BBYEFE0mICKJS9PVpAqhb97iEoHF8TwuMB8GA1UdIwQYMBaAFE0mICKJS9PVpAqhb97iEoHF8Twu
  51181. MA0GCSqGSIb3DQEBCwUAA4ICAQAyCrKkG8t9voJXiblqf/P0wS4RfbgZPnm3qKhyN2abGu2sEzsO
  51182. v2LwnN+ee6FTSA5BesogpxcbtnjsQJHzQq0Qw1zv/2BZf82Fo4s9SBwlAjxnffUy6S8w5X2lejjQ
  51183. 82YqZh6NM4OKb3xuqFp1mrjX2lhIREeoTPpMSQpKwhI3qEAMw8jh0FcNlzKVxzqfl9NX+Ave5XLz
  51184. o9v/tdhZsnPdTSpxsrpJ9csc1fV5yJmz/MFMdOO0vSk3FQQoHt5FRnDsr7p4DooqzgB53MBfGWcs
  51185. a0vvaGgLQ+OswWIJ76bdZWGgr4RVSJFSHMYlkSrQwSIjYVmvRRGFHQEkNI/Ps/8XciATwoCqISxx
  51186. OQ7Qj1zB09GOInJGTB2Wrk9xseEFKZZZ9LuedT3PDTcNYtsmjGOpI99nBjx8Oto0QuFmtEYE3saW
  51187. mA9LSHokMnWRn6z3aOkquVVlzl1h0ydw2Df+n7mvoC5Wt6NlUe07qxS/TFED6F+KBZvuim6c779o
  51188. +sjaC+NCydAXFJy3SuCvkychVSa1ZC+N8f+mQAWFBVzKBxlcCxMoTFh/wqXvRdpg065lYZ1Tg3TC
  51189. rvJcwhbtkj6EPnNgiLx29CzP0H1907he0ZESEOnN3col49XtmS++dYFLJPlFRpTJKSFTnCZFqhMX
  51190. 5OfNeOI5wSsSnqaeG8XmDtkx2Q==
  51191. -----END CERTIFICATE-----
  51192. Swisscom Root EV CA 2
  51193. =====================
  51194. -----BEGIN CERTIFICATE-----
  51195. MIIF4DCCA8igAwIBAgIRAPL6ZOJ0Y9ON/RAdBB92ylgwDQYJKoZIhvcNAQELBQAwZzELMAkGA1UE
  51196. BhMCY2gxETAPBgNVBAoTCFN3aXNzY29tMSUwIwYDVQQLExxEaWdpdGFsIENlcnRpZmljYXRlIFNl
  51197. cnZpY2VzMR4wHAYDVQQDExVTd2lzc2NvbSBSb290IEVWIENBIDIwHhcNMTEwNjI0MDk0NTA4WhcN
  51198. MzEwNjI1MDg0NTA4WjBnMQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsT
  51199. HERpZ2l0YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxHjAcBgNVBAMTFVN3aXNzY29tIFJvb3QgRVYg
  51200. Q0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMT3HS9X6lds93BdY7BxUglgRCgz
  51201. o3pOCvrY6myLURYaVa5UJsTMRQdBTxB5f3HSek4/OE6zAMaVylvNwSqD1ycfMQ4jFrclyxy0uYAy
  51202. Xhqdk/HoPGAsp15XGVhRXrwsVgu42O+LgrQ8uMIkqBPHoCE2G3pXKSinLr9xJZDzRINpUKTk4Rti
  51203. GZQJo/PDvO/0vezbE53PnUgJUmfANykRHvvSEaeFGHR55E+FFOtSN+KxRdjMDUN/rhPSays/p8Li
  51204. qG12W0OfvrSdsyaGOx9/5fLoZigWJdBLlzin5M8J0TbDC77aO0RYjb7xnglrPvMyxyuHxuxenPaH
  51205. Za0zKcQvidm5y8kDnftslFGXEBuGCxobP/YCfnvUxVFkKJ3106yDgYjTdLRZncHrYTNaRdHLOdAG
  51206. alNgHa/2+2m8atwBz735j9m9W8E6X47aD0upm50qKGsaCnw8qyIL5XctcfaCNYGu+HuB5ur+rPQa
  51207. m3Rc6I8k9l2dRsQs0h4rIWqDJ2dVSqTjyDKXZpBy2uPUZC5f46Fq9mDU5zXNysRojddxyNMkM3Ox
  51208. bPlq4SjbX8Y96L5V5jcb7STZDxmPX2MYWFCBUWVv8p9+agTnNCRxunZLWB4ZvRVgRaoMEkABnRDi
  51209. xzgHcgplwLa7JSnaFp6LNYth7eVxV4O1PHGf40+/fh6Bn0GXAgMBAAGjgYYwgYMwDgYDVR0PAQH/
  51210. BAQDAgGGMB0GA1UdIQQWMBQwEgYHYIV0AVMCAgYHYIV0AVMCAjASBgNVHRMBAf8ECDAGAQH/AgED
  51211. MB0GA1UdDgQWBBRF2aWBbj2ITY1x0kbBbkUe88SAnTAfBgNVHSMEGDAWgBRF2aWBbj2ITY1x0kbB
  51212. bkUe88SAnTANBgkqhkiG9w0BAQsFAAOCAgEAlDpzBp9SSzBc1P6xXCX5145v9Ydkn+0UjrgEjihL
  51213. j6p7jjm02Vj2e6E1CqGdivdj5eu9OYLU43otb98TPLr+flaYC/NUn81ETm484T4VvwYmneTwkLbU
  51214. wp4wLh/vx3rEUMfqe9pQy3omywC0Wqu1kx+AiYQElY2NfwmTv9SoqORjbdlk5LgpWgi/UOGED1V7
  51215. XwgiG/W9mR4U9s70WBCCswo9GcG/W6uqmdjyMb3lOGbcWAXH7WMaLgqXfIeTK7KK4/HsGOV1timH
  51216. 59yLGn602MnTihdsfSlEvoqq9X46Lmgxk7lq2prg2+kupYTNHAq4Sgj5nPFhJpiTt3tm7JFe3VE/
  51217. 23MPrQRYCd0EApUKPtN236YQHoA96M2kZNEzx5LH4k5E4wnJTsJdhw4Snr8PyQUQ3nqjsTzyP6Wq
  51218. J3mtMX0f/fwZacXduT98zca0wjAefm6S139hdlqP65VNvBFuIXxZN5nQBrz5Bm0yFqXZaajh3DyA
  51219. HmBR3NdUIR7KYndP+tiPsys6DXhyyWhBWkdKwqPrGtcKqzwyVcgKEZzfdNbwQBUdyLmPtTbFr/gi
  51220. uMod89a2GQ+fYWVq6nTIfI/DT11lgh/ZDYnadXL77/FHZxOzyNEZiCcmmpl5fx7kLD977vHeTYuW
  51221. l8PVP3wbI+2ksx0WckNLIOFZfsLorSa/ovc=
  51222. -----END CERTIFICATE-----
  51223. CA Disig Root R1
  51224. ================
  51225. -----BEGIN CERTIFICATE-----
  51226. MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw
  51227. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  51228. ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx
  51229. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  51230. c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy
  51231. 3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8
  51232. u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2
  51233. m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk
  51234. CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa
  51235. YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6
  51236. vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL
  51237. LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX
  51238. ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is
  51239. XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV
  51240. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ
  51241. 04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR
  51242. xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B
  51243. LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM
  51244. CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb
  51245. VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85
  51246. YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS
  51247. ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix
  51248. lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N
  51249. UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ
  51250. a7+h89n07eLw4+1knj0vllJPgFOL
  51251. -----END CERTIFICATE-----
  51252. CA Disig Root R2
  51253. ================
  51254. -----BEGIN CERTIFICATE-----
  51255. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  51256. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  51257. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  51258. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  51259. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  51260. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  51261. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  51262. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  51263. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  51264. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  51265. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  51266. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  51267. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  51268. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  51269. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  51270. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  51271. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  51272. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  51273. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  51274. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  51275. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  51276. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  51277. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  51278. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  51279. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  51280. -----END CERTIFICATE-----
  51281. ACCVRAIZ1
  51282. =========
  51283. -----BEGIN CERTIFICATE-----
  51284. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  51285. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  51286. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  51287. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  51288. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  51289. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  51290. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  51291. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  51292. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  51293. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  51294. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  51295. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  51296. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  51297. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  51298. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  51299. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  51300. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  51301. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  51302. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  51303. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  51304. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  51305. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  51306. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  51307. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  51308. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  51309. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  51310. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  51311. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  51312. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  51313. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  51314. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  51315. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  51316. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  51317. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  51318. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  51319. EfbRD0tVNEYqi4Y7
  51320. -----END CERTIFICATE-----
  51321. TWCA Global Root CA
  51322. ===================
  51323. -----BEGIN CERTIFICATE-----
  51324. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  51325. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  51326. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  51327. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  51328. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  51329. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  51330. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  51331. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  51332. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  51333. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  51334. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  51335. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  51336. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  51337. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  51338. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  51339. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  51340. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  51341. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  51342. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  51343. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  51344. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  51345. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  51346. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  51347. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  51348. -----END CERTIFICATE-----
  51349. TeliaSonera Root CA v1
  51350. ======================
  51351. -----BEGIN CERTIFICATE-----
  51352. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  51353. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  51354. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  51355. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  51356. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  51357. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  51358. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  51359. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  51360. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  51361. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  51362. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  51363. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  51364. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  51365. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  51366. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  51367. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  51368. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  51369. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  51370. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  51371. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  51372. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  51373. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  51374. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  51375. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  51376. -----END CERTIFICATE-----
  51377. E-Tugra Certification Authority
  51378. ===============================
  51379. -----BEGIN CERTIFICATE-----
  51380. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  51381. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  51382. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  51383. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  51384. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  51385. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  51386. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  51387. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  51388. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  51389. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  51390. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  51391. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  51392. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  51393. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  51394. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  51395. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  51396. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  51397. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  51398. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  51399. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  51400. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  51401. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  51402. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  51403. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  51404. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  51405. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  51406. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  51407. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  51408. C7TbO6Orb1wdtn7os4I07QZcJA==
  51409. -----END CERTIFICATE-----
  51410. T-TeleSec GlobalRoot Class 2
  51411. ============================
  51412. -----BEGIN CERTIFICATE-----
  51413. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  51414. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  51415. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  51416. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  51417. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  51418. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  51419. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  51420. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  51421. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  51422. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  51423. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  51424. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  51425. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  51426. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  51427. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  51428. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  51429. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  51430. -----END CERTIFICATE-----
  51431. Atos TrustedRoot 2011
  51432. =====================
  51433. -----BEGIN CERTIFICATE-----
  51434. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  51435. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  51436. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  51437. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  51438. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  51439. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  51440. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  51441. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  51442. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  51443. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  51444. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  51445. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  51446. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  51447. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  51448. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  51449. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  51450. -----END CERTIFICATE-----
  51451. QuoVadis Root CA 1 G3
  51452. =====================
  51453. -----BEGIN CERTIFICATE-----
  51454. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  51455. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  51456. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  51457. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  51458. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  51459. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  51460. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  51461. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  51462. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  51463. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  51464. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  51465. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  51466. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  51467. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  51468. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  51469. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  51470. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  51471. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  51472. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  51473. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  51474. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  51475. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  51476. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  51477. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  51478. hMJKzRwuJIczYOXD
  51479. -----END CERTIFICATE-----
  51480. QuoVadis Root CA 2 G3
  51481. =====================
  51482. -----BEGIN CERTIFICATE-----
  51483. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  51484. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  51485. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  51486. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  51487. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  51488. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  51489. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  51490. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  51491. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  51492. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  51493. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  51494. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  51495. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  51496. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  51497. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  51498. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  51499. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  51500. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  51501. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  51502. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  51503. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  51504. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  51505. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  51506. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  51507. O3jtZsSOeWmD3n+M
  51508. -----END CERTIFICATE-----
  51509. QuoVadis Root CA 3 G3
  51510. =====================
  51511. -----BEGIN CERTIFICATE-----
  51512. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  51513. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  51514. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  51515. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  51516. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  51517. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  51518. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  51519. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  51520. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  51521. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  51522. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  51523. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  51524. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  51525. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  51526. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  51527. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  51528. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  51529. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  51530. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  51531. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  51532. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  51533. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  51534. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  51535. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  51536. PpxxVJkES/1Y+Zj0
  51537. -----END CERTIFICATE-----
  51538. DigiCert Assured ID Root G2
  51539. ===========================
  51540. -----BEGIN CERTIFICATE-----
  51541. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  51542. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  51543. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  51544. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  51545. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  51546. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  51547. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  51548. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  51549. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  51550. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  51551. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  51552. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  51553. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  51554. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  51555. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  51556. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  51557. IhNzbM8m9Yop5w==
  51558. -----END CERTIFICATE-----
  51559. DigiCert Assured ID Root G3
  51560. ===========================
  51561. -----BEGIN CERTIFICATE-----
  51562. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  51563. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  51564. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  51565. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  51566. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  51567. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  51568. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  51569. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  51570. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  51571. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  51572. 1vUhZscv6pZjamVFkpUBtA==
  51573. -----END CERTIFICATE-----
  51574. DigiCert Global Root G2
  51575. =======================
  51576. -----BEGIN CERTIFICATE-----
  51577. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  51578. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  51579. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  51580. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  51581. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  51582. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  51583. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  51584. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  51585. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  51586. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  51587. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  51588. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  51589. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  51590. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  51591. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  51592. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  51593. MrY=
  51594. -----END CERTIFICATE-----
  51595. DigiCert Global Root G3
  51596. =======================
  51597. -----BEGIN CERTIFICATE-----
  51598. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  51599. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  51600. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  51601. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  51602. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  51603. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  51604. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  51605. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  51606. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  51607. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  51608. VOKa5Vt8sycX
  51609. -----END CERTIFICATE-----
  51610. DigiCert Trusted Root G4
  51611. ========================
  51612. -----BEGIN CERTIFICATE-----
  51613. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  51614. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  51615. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  51616. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  51617. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  51618. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  51619. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  51620. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  51621. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  51622. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  51623. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  51624. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  51625. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  51626. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  51627. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  51628. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  51629. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  51630. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  51631. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  51632. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  51633. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  51634. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  51635. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  51636. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  51637. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  51638. 82Z+
  51639. -----END CERTIFICATE-----
  51640. WoSign
  51641. ======
  51642. -----BEGIN CERTIFICATE-----
  51643. MIIFdjCCA16gAwIBAgIQXmjWEXGUY1BWAGjzPsnFkTANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQG
  51644. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxKjAoBgNVBAMTIUNlcnRpZmljYXRpb24g
  51645. QXV0aG9yaXR5IG9mIFdvU2lnbjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMFUxCzAJ
  51646. BgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEqMCgGA1UEAxMhQ2VydGlmaWNh
  51647. dGlvbiBBdXRob3JpdHkgb2YgV29TaWduMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
  51648. vcqNrLiRFVaXe2tcesLea9mhsMMQI/qnobLMMfo+2aYpbxY94Gv4uEBf2zmoAHqLoE1UfcIiePyO
  51649. CbiohdfMlZdLdNiefvAA5A6JrkkoRBoQmTIPJYhTpA2zDxIIFgsDcSccf+Hb0v1naMQFXQoOXXDX
  51650. 2JegvFNBmpGN9J42Znp+VsGQX+axaCA2pIwkLCxHC1l2ZjC1vt7tj/id07sBMOby8w7gLJKA84X5
  51651. KIq0VC6a7fd2/BVoFutKbOsuEo/Uz/4Mx1wdC34FMr5esAkqQtXJTpCzWQ27en7N1QhatH/YHGkR
  51652. +ScPewavVIMYe+HdVHpRaG53/Ma/UkpmRqGyZxq7o093oL5d//xWC0Nyd5DKnvnyOfUNqfTq1+ez
  51653. EC8wQjchzDBwyYaYD8xYTYO7feUapTeNtqwylwA6Y3EkHp43xP901DfA4v6IRmAR3Qg/UDaruHqk
  51654. lWJqbrDKaiFaafPz+x1wOZXzp26mgYmhiMU7ccqjUu6Du/2gd/Tkb+dC221KmYo0SLwX3OSACCK2
  51655. 8jHAPwQ+658geda4BmRkAjHXqc1S+4RFaQkAKtxVi8QGRkvASh0JWzko/amrzgD5LkhLJuYwTKVY
  51656. yrREgk/nkR4zw7CT/xH8gdLKH3Ep3XZPkiWvHYG3Dy+MwwbMLyejSuQOmbp8HkUff6oZRZb9/D0C
  51657. AwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFOFmzw7R
  51658. 8bNLtwYgFP6HEtX2/vs+MA0GCSqGSIb3DQEBBQUAA4ICAQCoy3JAsnbBfnv8rWTjMnvMPLZdRtP1
  51659. LOJwXcgu2AZ9mNELIaCJWSQBnfmvCX0KI4I01fx8cpm5o9dU9OpScA7F9dY74ToJMuYhOZO9sxXq
  51660. T2r09Ys/L3yNWC7F4TmgPsc9SnOeQHrAK2GpZ8nzJLmzbVUsWh2eJXLOC62qx1ViC777Y7NhRCOj
  51661. y+EaDveaBk3e1CNOIZZbOVtXHS9dCF4Jef98l7VNg64N1uajeeAz0JmWAjCnPv/So0M/BVoG6kQC
  51662. 2nz4SNAzqfkHx5Xh9T71XXG68pWpdIhhWeO/yloTunK0jF02h+mmxTwTv97QRCbut+wucPrXnbes
  51663. 5cVAWubXbHssw1abR80LzvobtCHXt2a49CUwi1wNuepnsvRtrtWhnk/Yn+knArAdBtaP4/tIEp9/
  51664. EaEQPkxROpaw0RPxx9gmrjrKkcRpnd8BKWRRb2jaFOwIQZeQjdCygPLPwj2/kWjFgGcexGATVdVh
  51665. mVd8upUPYUk6ynW8yQqTP2cOEvIo4jEbwFcW3wh8GcF+Dx+FHgo2fFt+J7x6v+Db9NpSvd4MVHAx
  51666. kUOVyLzwPt0JfjBkUO1/AaQzZ01oT74V77D2AhGiGxMlOtzCWfHjXEa7ZywCRuoeSKbmW9m1vFGi
  51667. kpbbqsY3Iqb+zCB0oy2pLmvLwIIRIbWTee5Ehr7XHuQe+w==
  51668. -----END CERTIFICATE-----
  51669. WoSign China
  51670. ============
  51671. -----BEGIN CERTIFICATE-----
  51672. MIIFWDCCA0CgAwIBAgIQUHBrzdgT/BtOOzNy0hFIjTANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQG
  51673. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMMEkNBIOayg+mAmuagueiv
  51674. geS5pjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMEYxCzAJBgNVBAYTAkNOMRowGAYD
  51675. VQQKExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAwwSQ0Eg5rKD6YCa5qC56K+B5LmmMIICIjAN
  51676. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0EkhHiX8h8EqwqzbdoYGTufQdDTc7WU1/FDWiD+k
  51677. 8H/rD195L4mx/bxjWDeTmzj4t1up+thxx7S8gJeNbEvxUNUqKaqoGXqW5pWOdO2XCld19AXbbQs5
  51678. uQF/qvbW2mzmBeCkTVL829B0txGMe41P/4eDrv8FAxNXUDf+jJZSEExfv5RxadmWPgxDT74wwJ85
  51679. dE8GRV2j1lY5aAfMh09Qd5Nx2UQIsYo06Yms25tO4dnkUkWMLhQfkWsZHWgpLFbE4h4TV2TwYeO5
  51680. Ed+w4VegG63XX9Gv2ystP9Bojg/qnw+LNVgbExz03jWhCl3W6t8Sb8D7aQdGctyB9gQjF+BNdeFy
  51681. b7Ao65vh4YOhn0pdr8yb+gIgthhid5E7o9Vlrdx8kHccREGkSovrlXLp9glk3Kgtn3R46MGiCWOc
  51682. 76DbT52VqyBPt7D3h1ymoOQ3OMdc4zUPLK2jgKLsLl3Az+2LBcLmc272idX10kaO6m1jGx6KyX2m
  51683. +Jzr5dVjhU1zZmkR/sgO9MHHZklTfuQZa/HpelmjbX7FF+Ynxu8b22/8DU0GAbQOXDBGVWCvOGU6
  51684. yke6rCzMRh+yRpY/8+0mBe53oWprfi1tWFxK1I5nuPHa1UaKJ/kR8slC/k7e3x9cxKSGhxYzoacX
  51685. GKUN5AXlK8IrC6KVkLn9YDxOiT7nnO4fuwECAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1Ud
  51686. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFOBNv9ybQV0T6GTwp+kVpOGBwboxMA0GCSqGSIb3DQEBCwUA
  51687. A4ICAQBqinA4WbbaixjIvirTthnVZil6Xc1bL3McJk6jfW+rtylNpumlEYOnOXOvEESS5iVdT2H6
  51688. yAa+Tkvv/vMx/sZ8cApBWNromUuWyXi8mHwCKe0JgOYKOoICKuLJL8hWGSbueBwj/feTZU7n85iY
  51689. r83d2Z5AiDEoOqsuC7CsDCT6eiaY8xJhEPRdF/d+4niXVOKM6Cm6jBAyvd0zaziGfjk9DgNyp115
  51690. j0WKWa5bIW4xRtVZjc8VX90xJc/bYNaBRHIpAlf2ltTW/+op2znFuCyKGo3Oy+dCMYYFaA6eFN0A
  51691. kLppRQjbbpCBhqcqBT/mhDn4t/lXX0ykeVoQDF7Va/81XwVRHmyjdanPUIPTfPRm94KNPQx96N97
  51692. qA4bLJyuQHCH2u2nFoJavjVsIE4iYdm8UXrNemHcSxH5/mc0zy4EZmFcV5cjjPOGG0jfKq+nwf/Y
  51693. jj4Du9gqsPoUJbJRa4ZDhS4HIxaAjUz7tGM7zMN07RujHv41D198HRaG9Q7DlfEvr10lO1Hm13ZB
  51694. ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv
  51695. T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO
  51696. kI26oQ==
  51697. -----END CERTIFICATE-----
  51698. COMODO RSA Certification Authority
  51699. ==================================
  51700. -----BEGIN CERTIFICATE-----
  51701. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  51702. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  51703. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  51704. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  51705. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  51706. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  51707. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  51708. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  51709. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  51710. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  51711. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  51712. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  51713. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  51714. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  51715. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  51716. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  51717. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  51718. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  51719. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  51720. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  51721. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  51722. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  51723. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  51724. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  51725. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  51726. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  51727. LaZRfyHBNVOFBkpdn627G190
  51728. -----END CERTIFICATE-----
  51729. USERTrust RSA Certification Authority
  51730. =====================================
  51731. -----BEGIN CERTIFICATE-----
  51732. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  51733. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  51734. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  51735. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  51736. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  51737. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  51738. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  51739. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  51740. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  51741. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  51742. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  51743. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  51744. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  51745. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  51746. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  51747. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  51748. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  51749. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  51750. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  51751. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  51752. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  51753. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  51754. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  51755. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  51756. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  51757. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  51758. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  51759. -----END CERTIFICATE-----
  51760. USERTrust ECC Certification Authority
  51761. =====================================
  51762. -----BEGIN CERTIFICATE-----
  51763. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  51764. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  51765. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  51766. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  51767. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  51768. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  51769. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  51770. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  51771. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  51772. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  51773. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  51774. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  51775. -----END CERTIFICATE-----
  51776. GlobalSign ECC Root CA - R4
  51777. ===========================
  51778. -----BEGIN CERTIFICATE-----
  51779. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  51780. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  51781. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  51782. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  51783. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  51784. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  51785. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  51786. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  51787. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  51788. -----END CERTIFICATE-----
  51789. GlobalSign ECC Root CA - R5
  51790. ===========================
  51791. -----BEGIN CERTIFICATE-----
  51792. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  51793. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  51794. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  51795. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  51796. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  51797. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  51798. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  51799. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  51800. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  51801. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  51802. -----END CERTIFICATE-----
  51803. Staat der Nederlanden Root CA - G3
  51804. ==================================
  51805. -----BEGIN CERTIFICATE-----
  51806. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  51807. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  51808. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  51809. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  51810. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  51811. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  51812. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  51813. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  51814. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  51815. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  51816. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  51817. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  51818. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  51819. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  51820. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  51821. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  51822. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  51823. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  51824. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  51825. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  51826. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  51827. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  51828. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  51829. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  51830. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  51831. -----END CERTIFICATE-----
  51832. Staat der Nederlanden EV Root CA
  51833. ================================
  51834. -----BEGIN CERTIFICATE-----
  51835. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  51836. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  51837. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  51838. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  51839. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  51840. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  51841. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  51842. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  51843. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  51844. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  51845. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  51846. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  51847. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  51848. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  51849. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  51850. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  51851. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  51852. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  51853. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  51854. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  51855. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  51856. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  51857. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  51858. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  51859. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  51860. -----END CERTIFICATE-----
  51861. IdenTrust Commercial Root CA 1
  51862. ==============================
  51863. -----BEGIN CERTIFICATE-----
  51864. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  51865. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  51866. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  51867. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  51868. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  51869. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  51870. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  51871. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  51872. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  51873. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  51874. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  51875. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  51876. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  51877. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  51878. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  51879. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  51880. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  51881. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  51882. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  51883. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  51884. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  51885. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  51886. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  51887. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  51888. cGzM7vRX+Bi6hG6H
  51889. -----END CERTIFICATE-----
  51890. IdenTrust Public Sector Root CA 1
  51891. =================================
  51892. -----BEGIN CERTIFICATE-----
  51893. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  51894. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  51895. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  51896. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  51897. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  51898. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  51899. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  51900. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  51901. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  51902. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  51903. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  51904. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  51905. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  51906. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  51907. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  51908. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  51909. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  51910. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  51911. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  51912. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  51913. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  51914. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  51915. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  51916. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  51917. 3Wl9af0AVqW3rLatt8o+Ae+c
  51918. -----END CERTIFICATE-----
  51919. Entrust Root Certification Authority - G2
  51920. =========================================
  51921. -----BEGIN CERTIFICATE-----
  51922. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  51923. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  51924. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  51925. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  51926. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  51927. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  51928. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  51929. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  51930. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  51931. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  51932. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  51933. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  51934. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  51935. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  51936. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  51937. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  51938. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  51939. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  51940. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  51941. e4pIb4tF9g==
  51942. -----END CERTIFICATE-----
  51943. Entrust Root Certification Authority - EC1
  51944. ==========================================
  51945. -----BEGIN CERTIFICATE-----
  51946. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  51947. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  51948. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  51949. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  51950. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  51951. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  51952. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  51953. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  51954. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  51955. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  51956. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  51957. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  51958. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  51959. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  51960. -----END CERTIFICATE-----
  51961. CFCA EV ROOT
  51962. ============
  51963. -----BEGIN CERTIFICATE-----
  51964. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  51965. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  51966. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  51967. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  51968. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  51969. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  51970. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  51971. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  51972. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  51973. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  51974. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  51975. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  51976. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  51977. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  51978. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  51979. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  51980. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  51981. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  51982. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  51983. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  51984. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  51985. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  51986. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  51987. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  51988. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  51989. -----END CERTIFICATE-----
  51990. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5
  51991. ====================================================
  51992. -----BEGIN CERTIFICATE-----
  51993. MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UEBhMCVFIxDzAN
  51994. BgNVBAcMBkFua2FyYTFNMEsGA1UECgxEVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  51995. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4xQjBABgNVBAMMOVTDnFJLVFJVU1Qg
  51996. RWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSBINTAeFw0xMzA0MzAw
  51997. ODA3MDFaFw0yMzA0MjgwODA3MDFaMIGxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0w
  51998. SwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnE
  51999. n2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBFbGVrdHJvbmlrIFNlcnRp
  52000. ZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg1MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52001. CgKCAQEApCUZ4WWe60ghUEoI5RHwWrom/4NZzkQqL/7hzmAD/I0Dpe3/a6i6zDQGn1k19uwsu537
  52002. jVJp45wnEFPzpALFp/kRGml1bsMdi9GYjZOHp3GXDSHHmflS0yxjXVW86B8BSLlg/kJK9siArs1m
  52003. ep5Fimh34khon6La8eHBEJ/rPCmBp+EyCNSgBbGM+42WAA4+Jd9ThiI7/PS98wl+d+yG6w8z5UNP
  52004. 9FR1bSmZLmZaQ9/LXMrI5Tjxfjs1nQ/0xVqhzPMggCTTV+wVunUlm+hkS7M0hO8EuPbJbKoCPrZV
  52005. 4jI3X/xml1/N1p7HIL9Nxqw/dV8c7TKcfGkAaZHjIxhT6QIDAQABo0IwQDAdBgNVHQ4EFgQUVpkH
  52006. HtOsDGlktAxQR95DLL4gwPswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI
  52007. hvcNAQELBQADggEBAJ5FdnsXSDLyOIspve6WSk6BGLFRRyDN0GSxDsnZAdkJzsiZ3GglE9Rc8qPo
  52008. BP5yCccLqh0lVX6Wmle3usURehnmp349hQ71+S4pL+f5bFgWV1Al9j4uPqrtd3GqqpmWRgqujuwq
  52009. URawXs3qZwQcWDD1YIq9pr1N5Za0/EKJAWv2cMhQOQwt1WbZyNKzMrcbGW3LM/nfpeYVhDfwwvJl
  52010. lpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CFYv4HAqGEVka+lgqaE9chTLd8
  52011. B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW+qtB4Uu2NQvAmxU=
  52012. -----END CERTIFICATE-----
  52013. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6
  52014. ====================================================
  52015. -----BEGIN CERTIFICATE-----
  52016. MIIEJjCCAw6gAwIBAgIGfaHyZeyKMA0GCSqGSIb3DQEBCwUAMIGxMQswCQYDVQQGEwJUUjEPMA0G
  52017. A1UEBwwGQW5rYXJhMU0wSwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls
  52018. acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBF
  52019. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg2MB4XDTEzMTIxODA5
  52020. MDQxMFoXDTIzMTIxNjA5MDQxMFowgbExCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExTTBL
  52021. BgNVBAoMRFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBCaWxpxZ9pbSBHw7x2ZW5sacSf
  52022. aSBIaXptZXRsZXJpIEEuxZ4uMUIwQAYDVQQDDDlUw5xSS1RSVVNUIEVsZWt0cm9uaWsgU2VydGlm
  52023. aWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLEgSDYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  52024. AoIBAQCdsGjW6L0UlqMACprx9MfMkU1xeHe59yEmFXNRFpQJRwXiM/VomjX/3EsvMsew7eKC5W/a
  52025. 2uqsxgbPJQ1BgfbBOCK9+bGlprMBvD9QFyv26WZV1DOzXPhDIHiTVRZwGTLmiddk671IUP320EED
  52026. wnS3/faAz1vFq6TWlRKb55cTMgPp1KtDWxbtMyJkKbbSk60vbNg9tvYdDjTu0n2pVQ8g9P0pu5Fb
  52027. HH3GQjhtQiht1AH7zYiXSX6484P4tZgvsycLSF5W506jM7NE1qXyGJTtHB6plVxiSvgNZ1GpryHV
  52028. +DKdeboaX+UEVU0TRv/yz3THGmNtwx8XEsMeED5gCLMxAgMBAAGjQjBAMB0GA1UdDgQWBBTdVRcT
  52029. 9qzoSCHK77Wv0QAy7Z6MtTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG
  52030. 9w0BAQsFAAOCAQEAb1gNl0OqFlQ+v6nfkkU/hQu7VtMMUszIv3ZnXuaqs6fvuay0EBQNdH49ba3R
  52031. fdCaqaXKGDsCQC4qnFAUi/5XfldcEQlLNkVS9z2sFP1E34uXI9TDwe7UU5X+LEr+DXCqu4svLcsy
  52032. o4LyVN/Y8t3XSHLuSqMplsNEzm61kod2pLv0kmzOLBQJZo6NrRa1xxsJYTvjIKIDgI6tflEATseW
  52033. hvtDmHd9KMeP2Cpu54Rvl0EpABZeTeIT6lnAY2c6RPuY/ATTMHKm9ocJV612ph1jmv3XZch4gyt1
  52034. O6VbuA1df74jrlZVlFjvH4GMKrLN5ptjnhi85WsGtAuYSyher4hYyw==
  52035. -----END CERTIFICATE-----
  52036. Certinomis - Root CA
  52037. ====================
  52038. -----BEGIN CERTIFICATE-----
  52039. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  52040. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  52041. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  52042. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  52043. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  52044. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  52045. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  52046. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  52047. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  52048. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  52049. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  52050. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  52051. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  52052. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  52053. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  52054. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  52055. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  52056. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  52057. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  52058. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  52059. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  52060. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  52061. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  52062. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  52063. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  52064. hkIGuUE=
  52065. -----END CERTIFICATE-----
  52066. OISTE WISeKey Global Root GB CA
  52067. ===============================
  52068. -----BEGIN CERTIFICATE-----
  52069. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  52070. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  52071. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  52072. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  52073. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  52074. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  52075. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  52076. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  52077. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  52078. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  52079. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  52080. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  52081. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  52082. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  52083. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  52084. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  52085. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  52086. -----END CERTIFICATE-----
  52087. Certification Authority of WoSign G2
  52088. ====================================
  52089. -----BEGIN CERTIFICATE-----
  52090. MIIDfDCCAmSgAwIBAgIQayXaioidfLwPBbOxemFFRDANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQG
  52091. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxLTArBgNVBAMTJENlcnRpZmljYXRpb24g
  52092. QXV0aG9yaXR5IG9mIFdvU2lnbiBHMjAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMFgx
  52093. CzAJBgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEtMCsGA1UEAxMkQ2VydGlm
  52094. aWNhdGlvbiBBdXRob3JpdHkgb2YgV29TaWduIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52095. CgKCAQEAvsXEoCKASU+/2YcRxlPhuw+9YH+v9oIOH9ywjj2X4FA8jzrvZjtFB5sg+OPXJYY1kBai
  52096. XW8wGQiHC38Gsp1ij96vkqVg1CuAmlI/9ZqD6TRay9nVYlzmDuDfBpgOgHzKtB0TiGsOqCR3A9Du
  52097. W/PKaZE1OVbFbeP3PU9ekzgkyhjpJMuSA93MHD0JcOQg5PGurLtzaaNjOg9FD6FKmsLRY6zLEPg9
  52098. 5k4ot+vElbGs/V6r+kHLXZ1L3PR8du9nfwB6jdKgGlxNIuG12t12s9R23164i5jIFFTMaxeSt+BK
  52099. v0mUYQs4kI9dJGwlezt52eJ+na2fmKEG/HgUYFf47oB3sQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  52100. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU+mCp62XF3RYUCE4MD42b4Pdkr2cwDQYJKoZI
  52101. hvcNAQELBQADggEBAFfDejaCnI2Y4qtAqkePx6db7XznPWZaOzG73/MWM5H8fHulwqZm46qwtyeY
  52102. P0nXYGdnPzZPSsvxFPpahygc7Y9BMsaV+X3avXtbwrAh449G3CE4Q3RM+zD4F3LBMvzIkRfEzFg3
  52103. TgvMWvchNSiDbGAtROtSjFA9tWwS1/oJu2yySrHFieT801LYYRf+epSEj3m2M1m6D8QL4nCgS3gu
  52104. +sif/a+RZQp4OBXllxcU3fngLDT4ONCEIgDAFFEYKwLcMFrw6AF8NTojrwjkr6qOKEJJLvD1mTS+
  52105. 7Q9LGOHSJDy7XUe3IfKN0QqZjuNuPq1w4I+5ysxugTH2e5x6eeRncRg=
  52106. -----END CERTIFICATE-----
  52107. CA WoSign ECC Root
  52108. ==================
  52109. -----BEGIN CERTIFICATE-----
  52110. MIICCTCCAY+gAwIBAgIQaEpYcIBr8I8C+vbe6LCQkDAKBggqhkjOPQQDAzBGMQswCQYDVQQGEwJD
  52111. TjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMTEkNBIFdvU2lnbiBFQ0MgUm9v
  52112. dDAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMEYxCzAJBgNVBAYTAkNOMRowGAYDVQQK
  52113. ExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAxMSQ0EgV29TaWduIEVDQyBSb290MHYwEAYHKoZI
  52114. zj0CAQYFK4EEACIDYgAE4f2OuEMkq5Z7hcK6C62N4DrjJLnSsb6IOsq/Srj57ywvr1FQPEd1bPiU
  52115. t5v8KB7FVMxjnRZLU8HnIKvNrCXSf4/CwVqCXjCLelTOA7WRf6qU0NGKSMyCBSah1VES1ns2o0Iw
  52116. QDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqv3VWqP2h4syhf3R
  52117. MluARZPzA7gwCgYIKoZIzj0EAwMDaAAwZQIxAOSkhLCB1T2wdKyUpOgOPQB0TKGXa/kNUTyh2Tv0
  52118. Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYu
  52119. a/GRspBl9JrmkO5K
  52120. -----END CERTIFICATE-----
  52121. SZAFIR ROOT CA2
  52122. ===============
  52123. -----BEGIN CERTIFICATE-----
  52124. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  52125. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  52126. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  52127. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  52128. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  52129. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  52130. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  52131. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  52132. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  52133. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  52134. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  52135. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  52136. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  52137. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  52138. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  52139. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  52140. -----END CERTIFICATE-----
  52141. Certum Trusted Network CA 2
  52142. ===========================
  52143. -----BEGIN CERTIFICATE-----
  52144. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  52145. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  52146. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  52147. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  52148. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  52149. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  52150. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  52151. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  52152. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  52153. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  52154. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  52155. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  52156. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  52157. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  52158. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  52159. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52160. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  52161. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  52162. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  52163. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  52164. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  52165. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  52166. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  52167. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  52168. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  52169. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  52170. zAYspsbiDrW5viSP
  52171. -----END CERTIFICATE-----
  52172. Hellenic Academic and Research Institutions RootCA 2015
  52173. =======================================================
  52174. -----BEGIN CERTIFICATE-----
  52175. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  52176. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  52177. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  52178. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  52179. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  52180. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  52181. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  52182. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  52183. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  52184. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  52185. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  52186. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  52187. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  52188. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  52189. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  52190. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  52191. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52192. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  52193. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  52194. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  52195. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  52196. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  52197. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  52198. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  52199. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  52200. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  52201. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  52202. p/UsQu0yrbYhnr68
  52203. -----END CERTIFICATE-----
  52204. Hellenic Academic and Research Institutions ECC RootCA 2015
  52205. ===========================================================
  52206. -----BEGIN CERTIFICATE-----
  52207. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  52208. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  52209. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  52210. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  52211. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  52212. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  52213. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  52214. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  52215. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  52216. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  52217. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  52218. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  52219. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  52220. -----END CERTIFICATE-----
  52221. Certplus Root CA G1
  52222. ===================
  52223. -----BEGIN CERTIFICATE-----
  52224. MIIFazCCA1OgAwIBAgISESBVg+QtPlRWhS2DN7cs3EYRMA0GCSqGSIb3DQEBDQUAMD4xCzAJBgNV
  52225. BAYTAkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTAe
  52226. Fw0xNDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhD
  52227. ZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTCCAiIwDQYJKoZIhvcNAQEBBQAD
  52228. ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN
  52229. r49aiZFluVj8tANfkT8tEBXgfs+8/H9DZ6itXjYj2JizTfNDnjl8KvzsiNWI7nC9hRYt6kuJPKNx
  52230. Qv4c/dMcLRC4hlTqQ7jbxofaqK6AJc96Jh2qkbBIb6613p7Y1/oA/caP0FG7Yn2ksYyy/yARujVj
  52231. BYZHYEMzkPZHogNPlk2dT8Hq6pyi/jQu3rfKG3akt62f6ajUeD94/vI4CTYd0hYCyOwqaK/1jpTv
  52232. LRN6HkJKHRUxrgwEV/xhc/MxVoYxgKDEEW4wduOU8F8ExKyHcomYxZ3MVwia9Az8fXoFOvpHgDm2
  52233. z4QTd28n6v+WZxcIbekN1iNQMLAVdBM+5S//Ds3EC0pd8NgAM0lm66EYfFkuPSi5YXHLtaW6uOrc
  52234. 4nBvCGrch2c0798wct3zyT8j/zXhviEpIDCB5BmlIOklynMxdCm+4kLV87ImZsdo/Rmz5yCTmehd
  52235. 4F6H50boJZwKKSTUzViGUkAksnsPmBIgJPaQbEfIDbsYIC7Z/fyL8inqh3SV4EJQeIQEQWGw9CEj
  52236. jy3LKCHyamz0GqbFFLQ3ZU+V/YDI+HLlJWvEYLF7bY5KinPOWftwenMGE9nTdDckQQoRb5fc5+R+
  52237. ob0V8rqHDz1oihYHAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0G
  52238. A1UdDgQWBBSowcCbkahDFXxdBie0KlHYlwuBsTAfBgNVHSMEGDAWgBSowcCbkahDFXxdBie0KlHY
  52239. lwuBsTANBgkqhkiG9w0BAQ0FAAOCAgEAnFZvAX7RvUz1isbwJh/k4DgYzDLDKTudQSk0YcbX8ACh
  52240. 66Ryj5QXvBMsdbRX7gp8CXrc1cqh0DQT+Hern+X+2B50ioUHj3/MeXrKls3N/U/7/SMNkPX0XtPG
  52241. YX2eEeAC7gkE2Qfdpoq3DIMku4NQkv5gdRE+2J2winq14J2by5BSS7CTKtQ+FjPlnsZlFT5kOwQ/
  52242. 2wyPX1wdaR+v8+khjPPvl/aatxm2hHSco1S1cE5j2FddUyGbQJJD+tZ3VTNPZNX70Cxqjm0lpu+F
  52243. 6ALEUz65noe8zDUa3qHpimOHZR4RKttjd5cUvpoUmRGywO6wT/gUITJDT5+rosuoD6o7BlXGEilX
  52244. CNQ314cnrUlZp5GrRHpejXDbl85IULFzk/bwg2D5zfHhMf1bfHEhYxQUqq/F3pN+aLHsIqKqkHWe
  52245. tUNy6mSjhEv9DKgma3GX7lZjZuhCVPnHHd/Qj1vfyDBviP4NxDMcU6ij/UgQ8uQKTuEVV/xuZDDC
  52246. VRHc6qnNSlSsKWNEz0pAoNZoWRsz+e86i9sgktxChL8Bq4fA1SCC28a5g4VCXA9DO2pJNdWY9BW/
  52247. +mGBDAkgGNLQFwzLSABQ6XaCjGTXOqAHVcweMcDvOrRl++O/QmueD6i9a5jc2NvLi6Td11n0bt3+
  52248. qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo=
  52249. -----END CERTIFICATE-----
  52250. Certplus Root CA G2
  52251. ===================
  52252. -----BEGIN CERTIFICATE-----
  52253. MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT
  52254. AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x
  52255. NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0
  52256. cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  52257. BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN
  52258. Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD
  52259. AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud
  52260. IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV
  52261. HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl
  52262. vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw==
  52263. -----END CERTIFICATE-----
  52264. OpenTrust Root CA G1
  52265. ====================
  52266. -----BEGIN CERTIFICATE-----
  52267. MIIFbzCCA1egAwIBAgISESCzkFU5fX82bWTCp59rY45nMA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV
  52268. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcx
  52269. MB4XDTE0MDUyNjA4NDU1MFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  52270. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzEwggIiMA0GCSqGSIb3DQEB
  52271. AQUAA4ICDwAwggIKAoICAQD4eUbalsUwXopxAy1wpLuwxQjczeY1wICkES3d5oeuXT2R0odsN7fa
  52272. Yp6bwiTXj/HbpqbfRm9RpnHLPhsxZ2L3EVs0J9V5ToybWL0iEA1cJwzdMOWo010hOHQX/uMftk87
  52273. ay3bfWAfjH1MBcLrARYVmBSO0ZB3Ij/swjm4eTrwSSTilZHcYTSSjFR077F9jAHiOH3BX2pfJLKO
  52274. YheteSCtqx234LSWSE9mQxAGFiQD4eCcjsZGT44ameGPuY4zbGneWK2gDqdkVBFpRGZPTBKnjix9
  52275. xNRbxQA0MMHZmf4yzgeEtE7NCv82TWLxp2NX5Ntqp66/K7nJ5rInieV+mhxNaMbBGN4zK1FGSxyO
  52276. 9z0M+Yo0FMT7MzUj8czxKselu7Cizv5Ta01BG2Yospb6p64KTrk5M0ScdMGTHPjgniQlQ/GbI4Kq
  52277. 3ywgsNw2TgOzfALU5nsaqocTvz6hdLubDuHAk5/XpGbKuxs74zD0M1mKB3IDVedzagMxbm+WG+Oi
  52278. n6+Sx+31QrclTDsTBM8clq8cIqPQqwWyTBIjUtz9GVsnnB47ev1CI9sjgBPwvFEVVJSmdz7QdFG9
  52279. URQIOTfLHzSpMJ1ShC5VkLG631UAC9hWLbFJSXKAqWLXwPYYEQRVzXR7z2FwefR7LFxckvzluFqr
  52280. TJOVoSfupb7PcSNCupt2LQIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  52281. /zAdBgNVHQ4EFgQUl0YhVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px
  52282. N3DlCPaTKbYwDQYJKoZIhvcNAQELBQADggIBAB3dAmB84DWn5ph76kTOZ0BP8pNuZtQ5iSas000E
  52283. PLuHIT839HEl2ku6q5aCgZG27dmxpGWX4m9kWaSW7mDKHyP7Rbr/jyTwyqkxf3kfgLMtMrpkZ2Cv
  52284. uVnN35pJ06iCsfmYlIrM4LvgBBuZYLFGZdwIorJGnkSI6pN+VxbSFXJfLkur1J1juONI5f6ELlgK
  52285. n0Md/rcYkoZDSw6cMoYsYPXpSOqV7XAp8dUv/TW0V8/bhUiZucJvbI/NeJWsZCj9VrDDb8O+WVLh
  52286. X4SPgPL0DTatdrOjteFkdjpY3H1PXlZs5VVZV6Xf8YpmMIzUUmI4d7S+KNfKNsSbBfD4Fdvb8e80
  52287. nR14SohWZ25g/4/Ii+GOvUKpMwpZQhISKvqxnUOOBZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm
  52288. GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/
  52289. bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o
  52290. 4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA
  52291. OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx
  52292. -----END CERTIFICATE-----
  52293. OpenTrust Root CA G2
  52294. ====================
  52295. -----BEGIN CERTIFICATE-----
  52296. MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV
  52297. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy
  52298. MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  52299. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzIwggIiMA0GCSqGSIb3DQEB
  52300. AQUAA4ICDwAwggIKAoICAQDMtlelM5QQgTJT32F+D3Y5z1zCU3UdSXqWON2ic2rxb95eolq5cSG+
  52301. Ntmh/LzubKh8NBpxGuga2F8ORAbtp+Dz0mEL4DKiltE48MLaARf85KxP6O6JHnSrT78eCbY2albz
  52302. 4e6WiWYkBuTNQjpK3eCasMSCRbP+yatcfD7J6xcvDH1urqWPyKwlCm/61UWY0jUJ9gNDlP7ZvyCV
  52303. eYCYitmJNbtRG6Q3ffyZO6v/v6wNj0OxmXsWEH4db0fEFY8ElggGQgT4hNYdvJGmQr5J1WqIP7wt
  52304. UdGejeBSzFfdNTVY27SPJIjki9/ca1TSgSuyzpJLHB9G+h3Ykst2Z7UJmQnlrBcUVXDGPKBWCgOz
  52305. 3GIZ38i1MH/1PCZ1Eb3XG7OHngevZXHloM8apwkQHZOJZlvoPGIytbU6bumFAYueQ4xncyhZW+vj
  52306. 3CzMpSZyYhK05pyDRPZRpOLAeiRXyg6lPzq1O4vldu5w5pLeFlwoW5cZJ5L+epJUzpM5ChaHvGOz
  52307. 9bGTXOBut9Dq+WIyiET7vycotjCVXRIouZW+j1MY5aIYFuJWpLIsEPUdN6b4t/bQWVyJ98LVtZR0
  52308. 0dX+G7bw5tYee9I8y6jj9RjzIR9u701oBnstXW5DiabA+aC/gh7PU3+06yzbXfZqfUAkBXKJOAGT
  52309. y3HCOV0GEfZvePg3DTmEJwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  52310. /zAdBgNVHQ4EFgQUajn6QiL35okATV59M4PLuG53hq8wHwYDVR0jBBgwFoAUajn6QiL35okATV59
  52311. M4PLuG53hq8wDQYJKoZIhvcNAQENBQADggIBAJjLq0A85TMCl38th6aP1F5Kr7ge57tx+4BkJamz
  52312. Gj5oXScmp7oq4fBXgwpkTx4idBvpkF/wrM//T2h6OKQQbA2xx6R3gBi2oihEdqc0nXGEL8pZ0keI
  52313. mUEiyTCYYW49qKgFbdEfwFFEVn8nNQLdXpgKQuswv42hm1GqO+qTRmTFAHneIWv2V6CG1wZy7HBG
  52314. S4tz3aAhdT7cHcCP009zHIXZ/n9iyJVvttN7jLpTwm+bREx50B1ws9efAvSyB7DH5fitIw6mVskp
  52315. EndI2S9G/Tvw/HRwkqWOOAgfZDC2t0v7NqwQjqBSM2OdAzVWxWm9xiNaJ5T2pBL4LTM8oValX9YZ
  52316. 6e18CL13zSdkzJTaTkZQh+D5wVOAHrut+0dSixv9ovneDiK3PTNZbNTe9ZUGMg1RGUFcPk8G97kr
  52317. gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo
  52318. SmVGFvyqv1ROTVu+OEO3KMqLM6oaJbolXCkvW0pujOotnCr2BXbgd5eAiN1nE28daCSLT7d0geX0
  52319. YJ96Vdc+N9oWaz53rK4YcJUIeSkDiv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm
  52320. u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK
  52321. -----END CERTIFICATE-----
  52322. OpenTrust Root CA G3
  52323. ====================
  52324. -----BEGIN CERTIFICATE-----
  52325. MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT
  52326. AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X
  52327. DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w
  52328. ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA
  52329. IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B
  52330. ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB
  52331. /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf
  52332. BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM
  52333. BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta
  52334. 3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB
  52335. -----END CERTIFICATE-----
  52336. ISRG Root X1
  52337. ============
  52338. -----BEGIN CERTIFICATE-----
  52339. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  52340. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  52341. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  52342. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  52343. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  52344. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  52345. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  52346. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  52347. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  52348. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  52349. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  52350. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  52351. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  52352. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  52353. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  52354. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  52355. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  52356. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  52357. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  52358. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  52359. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  52360. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  52361. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  52362. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  52363. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  52364. -----END CERTIFICATE-----
  52365. AC RAIZ FNMT-RCM
  52366. ================
  52367. -----BEGIN CERTIFICATE-----
  52368. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  52369. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  52370. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  52371. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  52372. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  52373. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  52374. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  52375. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  52376. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  52377. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  52378. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  52379. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  52380. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  52381. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  52382. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  52383. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  52384. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  52385. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  52386. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  52387. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  52388. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  52389. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  52390. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  52391. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  52392. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  52393. -----END CERTIFICATE-----
  52394. Amazon Root CA 1
  52395. ================
  52396. -----BEGIN CERTIFICATE-----
  52397. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  52398. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  52399. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  52400. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52401. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  52402. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  52403. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  52404. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  52405. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  52406. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  52407. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  52408. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  52409. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  52410. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  52411. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  52412. -----END CERTIFICATE-----
  52413. Amazon Root CA 2
  52414. ================
  52415. -----BEGIN CERTIFICATE-----
  52416. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  52417. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  52418. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  52419. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  52420. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  52421. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  52422. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  52423. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  52424. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  52425. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  52426. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  52427. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  52428. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  52429. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  52430. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  52431. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  52432. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  52433. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  52434. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  52435. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  52436. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  52437. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  52438. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  52439. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  52440. -----END CERTIFICATE-----
  52441. Amazon Root CA 3
  52442. ================
  52443. -----BEGIN CERTIFICATE-----
  52444. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  52445. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  52446. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  52447. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  52448. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  52449. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  52450. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  52451. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  52452. -----END CERTIFICATE-----
  52453. Amazon Root CA 4
  52454. ================
  52455. -----BEGIN CERTIFICATE-----
  52456. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  52457. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  52458. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  52459. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  52460. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  52461. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  52462. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  52463. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  52464. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  52465. -----END CERTIFICATE-----
  52466. LuxTrust Global Root 2
  52467. ======================
  52468. -----BEGIN CERTIFICATE-----
  52469. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  52470. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  52471. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  52472. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  52473. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  52474. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  52475. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  52476. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  52477. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  52478. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  52479. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  52480. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  52481. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  52482. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  52483. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  52484. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  52485. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  52486. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  52487. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  52488. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  52489. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  52490. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  52491. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  52492. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  52493. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  52494. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  52495. -----END CERTIFICATE-----
  52496. <?php
  52497. if (PHP_SAPI !== 'cli') {
  52498. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  52499. }
  52500. require __DIR__.'/../src/bootstrap.php';
  52501. use Composer\Factory;
  52502. use Composer\XdebugHandler;
  52503. use Composer\Console\Application;
  52504. error_reporting(-1);
  52505. // Create output for XdebugHandler and Application
  52506. $output = Factory::createOutput();
  52507. $xdebug = new XdebugHandler($output);
  52508. $xdebug->check();
  52509. unset($xdebug);
  52510. if (function_exists('ini_set')) {
  52511. @ini_set('display_errors', 1);
  52512. $memoryInBytes = function ($value) {
  52513. $unit = strtolower(substr($value, -1, 1));
  52514. $value = (int) $value;
  52515. switch($unit) {
  52516. case 'g':
  52517. $value *= 1024;
  52518. // no break (cumulative multiplier)
  52519. case 'm':
  52520. $value *= 1024;
  52521. // no break (cumulative multiplier)
  52522. case 'k':
  52523. $value *= 1024;
  52524. }
  52525. return $value;
  52526. };
  52527. $memoryLimit = trim(ini_get('memory_limit'));
  52528. // Increase memory_limit if it is lower than 1.5GB
  52529. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  52530. @ini_set('memory_limit', '1536M');
  52531. }
  52532. unset($memoryInBytes, $memoryLimit);
  52533. }
  52534. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  52535. // run the command application
  52536. $application = new Application();
  52537. $application->run(null, $output);
  52538. Copyright (c) Nils Adermann, Jordi Boggiano
  52539. Permission is hereby granted, free of charge, to any person obtaining a copy
  52540. of this software and associated documentation files (the "Software"), to deal
  52541. in the Software without restriction, including without limitation the rights
  52542. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  52543. copies of the Software, and to permit persons to whom the Software is furnished
  52544. to do so, subject to the following conditions:
  52545. The above copyright notice and this permission notice shall be included in all
  52546. copies or substantial portions of the Software.
  52547. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52548. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52549. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52550. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52551. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52552. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  52553. THE SOFTWARE.
  52554. Ïg7 ‰2«Óõ#°÷‡#rI ?å]���GBMB